strapi-plugin-comments 3.2.0 → 3.2.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/_chunks/{index-DV3FvCxv.js → index-B19IlxIY.js} +36 -36
- package/dist/_chunks/{index-5LPolIUr.js → index-B9qwk6Sf.js} +1 -1
- package/dist/_chunks/{index-BHaPiDDi.js → index-BLBuBesY.js} +1 -1
- package/dist/_chunks/{index-rxGUTZN1.mjs → index-Bos1nB7H.mjs} +5716 -5680
- package/dist/_chunks/{index-D1CAoT0G.mjs → index-BvWdv1a2.mjs} +1 -1
- package/dist/_chunks/{index-CaQhYHpU.js → index-CD-Ke6qY.js} +1 -1
- package/dist/_chunks/{index-DCg7dWuW.mjs → index-CrjZ1-we.mjs} +2 -2
- package/dist/_chunks/{index-Bu69cWq9.mjs → index-xIUKJDL-.mjs} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/hooks/useSanitizedHTML.d.ts +1 -0
- package/dist/server/index.js +16 -16
- package/dist/server/index.mjs +375 -328
- package/dist/server/src/index.d.ts +3 -0
- package/dist/server/src/services/admin/admin.service.d.ts +1 -0
- package/dist/server/src/services/client.service.d.ts +1 -0
- package/dist/server/src/services/common.service.d.ts +1 -0
- package/dist/server/src/services/index.d.ts +3 -0
- package/package.json +2 -4
- package/dist/assets/configuration.png +0 -0
- package/dist/assets/logo.png +0 -0
- package/dist/assets/marketplace.png +0 -0
- package/dist/assets/preview.png +0 -0
package/dist/server/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const v=require("zod"),zm=require("no-profanity");require("fs");require("path");const vm={uid:/^(?<type>[a-z0-9-]+)\:{2}(?<api>[a-z0-9-]+)\.{1}(?<contentType>[a-z0-9-]+)$/i,relatedUid:/^(?<uid>[a-z0-9-]+\:{2}[a-z0-9-]+\.[a-z0-9-]+)\:{1}(?<id>[a-z0-9-]+)$/i,email:/\S+@\S+\.\S+/,sorting:/^(?<path>[a-z0-9-_\:\.]+)\:+(asc|desc)$/i},oa={ENABLED_COLLECTIONS:"enabledCollections",APPROVAL_FLOW:"approvalFlow",ENTRY_LABEL:"entryLabel",MODERATOR_ROLES:"moderatorRoles",BAD_WORDS:"badWords",AUTHOR_BLOCKED_PROPS:"blockedAuthorProps"};var Fi=(i=>(i.PENDING="PENDING",i.APPROVED="APPROVED",i.REJECTED="REJECTED",i))(Fi||{}),Zt=(i=>(i.BAD_LANGUAGE="BAD_LANGUAGE",i.DISCRIMINATION="DISCRIMINATION",i.OTHER="OTHER",i))(Zt||{});const
|
|
1
|
+
"use strict";const v=require("zod"),zm=require("no-profanity"),Cv=require("sanitize-html");require("fs");require("path");const Iv=i=>i&&i.__esModule?i:{default:i},Rv=Iv(Cv),vm={uid:/^(?<type>[a-z0-9-]+)\:{2}(?<api>[a-z0-9-]+)\.{1}(?<contentType>[a-z0-9-]+)$/i,relatedUid:/^(?<uid>[a-z0-9-]+\:{2}[a-z0-9-]+\.[a-z0-9-]+)\:{1}(?<id>[a-z0-9-]+)$/i,email:/\S+@\S+\.\S+/,sorting:/^(?<path>[a-z0-9-_\:\.]+)\:+(asc|desc)$/i},oa={ENABLED_COLLECTIONS:"enabledCollections",APPROVAL_FLOW:"approvalFlow",ENTRY_LABEL:"entryLabel",MODERATOR_ROLES:"moderatorRoles",BAD_WORDS:"badWords",AUTHOR_BLOCKED_PROPS:"blockedAuthorProps"};var Fi=(i=>(i.PENDING="PENDING",i.APPROVED="APPROVED",i.REJECTED="REJECTED",i))(Fi||{}),Zt=(i=>(i.BAD_LANGUAGE="BAD_LANGUAGE",i.DISCRIMINATION="DISCRIMINATION",i.OTHER="OTHER",i))(Zt||{});const xv="plugin::comments",Nv={collectionName:"plugin_comments_comments",info:{tableName:"plugin-comments-comments",singularName:"comment",pluralName:"comments",displayName:"Comment",description:"Comment content type",kind:"collectionType"},options:{draftAndPublish:!1},pluginOptions:{"content-manager":{visible:!1},"content-type-builder":{visible:!1}},attributes:{content:{type:"text",configurable:!1,required:!0},blocked:{type:"boolean",default:!1,configurable:!1},blockedThread:{type:"boolean",default:!1,configurable:!1},blockReason:{type:"string",configurable:!1},authorUser:{type:"relation",relation:"oneToOne",target:"plugin::users-permissions.user",configurable:!1},authorId:{type:"string",configurable:!1},authorName:{type:"string",configurable:!1},authorEmail:{type:"email",configurable:!1},authorAvatar:{type:"string",configurable:!1},isAdminComment:{type:"boolean",configurable:!1},removed:{type:"boolean",configurable:!1},approvalStatus:{type:"enumeration",enum:Object.values(Fi),configurable:!1},related:{type:"string",configurable:!1},reports:{type:"relation",relation:"oneToMany",target:"plugin::comments.comment-report",mappedBy:"related",configurable:!1},threadOf:{type:"relation",relation:"oneToOne",target:"plugin::comments.comment",configurable:!1}}},zv={schema:Nv},Lv={collectionName:"plugin_comments_reports",info:{tableName:"plugin-comments-reports",singularName:"comment-report",pluralName:"comment-reports",displayName:"Reports",description:"Reports content type",kind:"collectionType"},options:{draftAndPublish:!1},pluginOptions:{"content-manager":{visible:!1},"content-type-builder":{visible:!1}},attributes:{content:{type:"text",configurable:!1},reason:{type:"enumeration",enum:Object.values(Zt),default:Zt.OTHER,configurable:!1,required:!0},resolved:{type:"boolean",default:!1,configurable:!1},related:{type:"relation",relation:"manyToOne",target:"plugin::comments.comment",inversedBy:"reports",configurable:!1}}},Dv={schema:Lv},Pv={comment:zv,"comment-report":Dv},Fv={name:"comments",plugin:"comments",type:"json"},Uv=({strapi:i})=>{if(!Mv({strapi:i})){i.log.warn("[Comments Plugin] Custom fields disabled. Upgrade Strapi to use custom fields.");return}i.customFields.register(Fv)},Mv=({strapi:i})=>!!i.customFields,ft=(i,u)=>i.plugin("comments").service(u),Wv=i=>{Uv(i);const u=ft(i.strapi,"common");i.strapi.documents.use(async(o,h)=>{if(o.action==="delete"&&o.uid.startsWith("api::")){const{params:{locale:m,documentId:A},uid:S}=o,C=[S,A].join(":");await u.perRemove(C,m)}return h()})},lr=(i,u)=>i.plugin("comments").contentType(u)?.uid,il=i=>{const u="plugin::users-permissions.user",o=["media","relation"],{attributes:h}=i.contentType(u)??{attributes:{}};return(Object.keys(h)?.filter(A=>o.includes(h[A]?.type))).includes("avatar")?{populate:{avatar:!0}}:!0};function ym(i){return typeof i=="string"?i.split(":"):"createdAt:desc".split(":")}const Bv=i=>{const{gql:{auth:u=!1}={}}=i;return{"Query.findAllFlat":{auth:u},"Query.findAllInHierarchy":{auth:u},"Mutation.getCreateComment":{auth:u},"Mutation.getUpdateComment":{auth:u},"Mutation.getRemoveComment":{auth:u},"Mutation.getCreateAbuseReport":{auth:u}}},jv=(i,u)=>{const{nonNull:o}=u;return{type:o("Report"),args:{input:o("CreateReport")},async resolve(h,m,A){const{input:S}=m,{state:{user:C=void 0}={}}=A,{commentId:R,relation:N,...O}=S;try{return await ft(i,"client").reportAbuse({...O,commentId:R,relation:N},C)}catch(F){throw F}}}},$v=(i,u)=>{const{nonNull:o}=u;return{type:o("CommentSingle"),args:{input:o("CreateComment")},async resolve(h,m,A){const{input:S}=m,{state:{user:C=void 0}={}}=A,{relation:R,...N}=S;try{return await ft(i,"client").create({...N,relation:R},C)}catch(O){throw O}}}},kv=(i,u)=>{const{nonNull:o}=u;return{type:o("CommentSingle"),args:{input:o("RemoveComment")},async resolve(h,m,A){const{input:S}=m,{state:{user:C=void 0}={}}=A,{id:R,relation:N,author:O}=S;try{return await ft(i,"client").markAsRemoved({commentId:R,relation:N,authorId:O?.id},C)}catch(F){throw F}}}},Vv=(i,u)=>{const{nonNull:o}=u;return{type:o("CommentSingle"),args:{input:o("UpdateComment")},async resolve(h,m,A){const{input:S}=m,{state:{user:C=void 0}={}}=A,{id:R,relation:N,...O}=S;try{return await ft(i,"client").update({...O,relation:N,commentId:R},C)}catch(F){throw F}}}},Gv=(i,u)=>{const o={getCreateComment:$v,getUpdateComment:Vv,getRemoveComment:kv,getCreateAbuseReport:jv};return u.extendType({type:"Mutation",definition(h){for(const[m,A]of Object.entries(o)){const S=A(i,u);h.field(m,S)}}})};var Rr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Rf={exports:{}};/**
|
|
2
2
|
* @license
|
|
3
3
|
* Lodash <https://lodash.com/>
|
|
4
4
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
@@ -24,15 +24,15 @@ __p += '`),$&&(E+=`' +
|
|
|
24
24
|
function print() { __p += __j.call(arguments, '') }
|
|
25
25
|
`:`;
|
|
26
26
|
`)+E+`return __p
|
|
27
|
-
}`;var M=Gs(function(){return P(s,x+"return "+E).apply(o,c)});if(M.source=E,Ps(M))throw M;return M}function Vs(e){return he(e).toLowerCase()}function vf(e){return he(e).toUpperCase()}function Lg(e,t,n){if(e=he(e),e&&(n||t===o))return zl(e);if(!e||!(t=Ht(t)))return e;var r=en(e),a=en(t),s=Ll(r,a),c=Dl(r,a)+1;return Sr(r,s,c).join("")}function Dg(e,t,n){if(e=he(e),e&&(n||t===o))return e.slice(0,Fa(e)+1);if(!e||!(t=Ht(t)))return e;var r=en(e),a=Dl(r,en(t))+1;return Sr(r,0,a).join("")}function Pg(e,t,n){if(e=he(e),e&&(n||t===o))return e.replace(ri,"");if(!e||!(t=Ht(t)))return e;var r=en(e),a=Ll(r,en(t));return Sr(r,a).join("")}function Qr(e,t){var n=Qe,r=En;if(Ue(t)){var a="separator"in t?t.separator:a;n="length"in t?H(t.length):n,r="omission"in t?Ht(t.omission):r}e=he(e);var s=e.length;if(fi(e)){var c=en(e);s=c.length}if(n>=s)return e;var f=n-Fr(r);if(f<1)return r;var g=c?Sr(c,0,f).join(""):e.slice(0,f);if(a===o)return g+r;if(c&&(f+=g.length-f),or(a)){if(e.slice(f).search(a)){var w,b=g;for(a.global||(a=Ua(a.source,he(oi.exec(a))+"g")),a.lastIndex=0;w=a.exec(b);)var E=w.index;g=g.slice(0,E===o?f:E)}}else if(e.indexOf(Ht(a),f)!=f){var T=g.lastIndexOf(a);T>-1&&(g=g.slice(0,T))}return g+r}function ie(e){return e=he(e),e&&Vf.test(e)?e.replace(ni,Oh):e}var Fg=qr(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Wn=cs("toUpperCase");function yf(e,t,n){return e=he(e),t=n?o:t,t===o?at(e)?Rh(e):Rl(e):e.match(t)||[]}var Gs=ne(function(e,t){try{return zt(e,o,t)}catch(n){return Ps(n)?n:new D(n)}}),qs=Kn(function(e,t){return kt(t,function(n){n=bn(n),Nn(e,n,vt(e[n],e))}),e});function _f(e){var t=e==null?0:e.length,n=K();return e=t?Ce(e,function(r){if(typeof r[1]!="function")throw new tn(S);return[n(r[0]),r[1]]}):[],ne(function(r){for(var a=-1;++a<t;){var s=e[a];if(zt(s[0],this,r))return zt(s[1],this,r)}})}function Li(e){return oc(Pt(e,F))}function Hs(e){return function(){return e}}function Ug(e,t){return e==null||e!==e?t:e}var Mg=yc(),bf=yc(!0);function lt(e){return e}function Ys(e){return gu(typeof e=="function"?e:Pt(e,F))}function Wg(e){return es(Pt(e,F))}function Bg(e,t){return vu(e,Pt(t,F))}var jg=ne(function(e,t){return function(n){return _i(n,e,t)}}),$g=ne(function(e,t){return function(n){return _i(e,n,t)}});function Qs(e,t,n){var r=rt(t),a=so(t,r);n==null&&!(Ue(t)&&(a.length||!r.length))&&(n=t,t=e,e=this,a=so(t,rt(t)));var s=!(Ue(n)&&"chain"in n)||!!n.chain,c=ln(e);return kt(a,function(f){var g=t[f];e[f]=g,c&&(e.prototype[f]=function(){var w=this.__chain__;if(s||w){var b=e(this.__wrapped__),E=b.__actions__=Tt(this.__actions__);return E.push({func:g,args:arguments,thisArg:e}),b.__chain__=w,b}return g.apply(e,Vt([this.value()],arguments))})}),e}function kg(){return et._===this&&(et._=Yn),this}function Js(){}function wf(e){return e=H(e),ne(function(t){return ts(t,e)})}var Vg=fs(Ce),Gg=fs(Ho),Af=fs(Oa);function Xs(e){return ys(e)?Ra(bn(e)):tp(e)}function qg(e){return function(t){return e==null?o:Vr(e,t)}}var Hg=bc(),Yg=bc(!0);function Zs(){return[]}function Ks(){return!1}function Qg(){return{}}function Jg(){return""}function el(){return!0}function Ef(e,t){if(e=H(e),e<1||e>Kt)return[];var n=Mt,r=Pe(e,Mt);t=K(t),e-=Mt;for(var a=La(r,t);++n<e;)t(n);return a}function Xg(e){return ee(e)?Ce(e,bn):Qt(e)?[e]:Tt(Ts(he(e)))}function Zg(e){var t=++zh;return he(e)+t}var Kg=Iu(function(e,t){return e+t},0),em=hs("ceil"),tm=Iu(function(e,t){return e/t},1),nm=hs("floor");function rm(e){return e&&e.length?_n(e,lt,dt):o}function im(e,t){return e&&e.length?_n(e,K(t,2),dt):o}function om(e){return xl(e,lt)}function um(e,t){return xl(e,K(t,2))}function am(e){return e&&e.length?_n(e,lt,mu):o}function sm(e,t){return e&&e.length?_n(e,K(t,2),mu):o}var lm=Iu(function(e,t){return e*t},1),cm=hs("round"),fm=Iu(function(e,t){return e-t},0);function hm(e){return e&&e.length?za(e,lt):0}function pm(e,t){return e&&e.length?za(e,K(t,2)):0}return d.after=Fd,d.ary=Wu,d.assign=So,d.assignIn=Ku,d.assignInWith=ar,d.assignWith=To,d.at=Oo,d.before=qc,d.bind=vt,d.bindAll=qs,d.bindKey=Bu,d.castArray=Gd,d.chain=Bc,d.chunk=Cp,d.compact=Ip,d.concat=Rp,d.cond=_f,d.conforms=Li,d.constant=Hs,d.countBy=md,d.create=ea,d.curry=Hc,d.curryRight=Yc,d.debounce=ju,d.defaults=Ri,d.defaultsDeep=tg,d.defer=Ud,d.delay=xs,d.difference=xp,d.differenceBy=Np,d.differenceWith=zp,d.drop=Lp,d.dropRight=Dp,d.dropRightWhile=Pp,d.dropWhile=Fp,d.fill=Up,d.filter=yd,d.flatMap=$c,d.flatMapDeep=bd,d.flatMapDepth=wd,d.flatten=It,d.flattenDeep=$e,d.flattenDepth=Mp,d.flip=Md,d.flow=Mg,d.flowRight=bf,d.fromPairs=Wp,d.functions=uf,d.functionsIn=xi,d.groupBy=Ad,d.initial=jp,d.intersection=Os,d.intersectionBy=$p,d.intersectionWith=tr,d.invert=sf,d.invertBy=lf,d.invokeMap=Sd,d.iteratee=Ys,d.keyBy=Td,d.keys=rt,d.keysIn=xt,d.map=Uu,d.mapKeys=ag,d.mapValues=Ws,d.matches=Wg,d.matchesProperty=Bg,d.memoize=Eo,d.merge=Bs,d.mergeWith=js,d.method=jg,d.methodOf=$g,d.mixin=Qs,d.negate=$u,d.nthArg=wf,d.omit=_t,d.omitBy=sg,d.once=Ns,d.orderBy=Od,d.over=Vg,d.overArgs=zs,d.overEvery=Gg,d.overSome=Af,d.partial=Ls,d.partialRight=Qc,d.partition=Cd,d.pick=cf,d.pickBy=Ni,d.property=Xs,d.propertyOf=qg,d.pull=kp,d.pullAll=Pc,d.pullAllBy=Vp,d.pullAllWith=Gp,d.pullAt=qp,d.range=Hg,d.rangeRight=Yg,d.rearg=Wd,d.reject=xd,d.remove=Hp,d.rest=Bd,d.reverse=Pu,d.sampleSize=zd,d.set=ff,d.setWith=lg,d.shuffle=Ld,d.slice=wo,d.sortBy=Gc,d.sortedUniq=Fc,d.sortedUniqBy=nr,d.split=mf,d.spread=jd,d.tail=ae,d.take=Uc,d.takeRight=an,d.takeRightWhile=Mc,d.takeWhile=Zp,d.tap=sd,d.throttle=$d,d.thru=Ao,d.toArray=rf,d.toPairs=hf,d.toPairsIn=pf,d.toPath=Xg,d.toPlainObject=Ms,d.transform=cg,d.unary=kd,d.union=me,d.unionBy=Kp,d.unionWith=ed,d.uniq=td,d.uniqBy=nd,d.uniqWith=rd,d.unset=fg,d.unzip=Cs,d.unzipWith=Wc,d.update=hg,d.updateWith=pg,d.values=zi,d.valuesIn=dg,d.without=id,d.words=yf,d.wrap=Vd,d.xor=od,d.xorBy=Is,d.xorWith=ud,d.zip=Rs,d.zipObject=nt,d.zipObjectDeep=Ft,d.zipWith=ad,d.entries=hf,d.entriesIn=pf,d.extend=Ku,d.extendWith=ar,Qs(d,d),d.add=Kg,d.attempt=Gs,d.camelCase=yg,d.capitalize=df,d.ceil=em,d.clamp=gg,d.clone=qd,d.cloneDeep=Yd,d.cloneDeepWith=Qd,d.cloneWith=Hd,d.conformsTo=Jd,d.deburr=gf,d.defaultTo=Ug,d.divide=tm,d.endsWith=_g,d.eq=we,d.escape=bg,d.escapeRegExp=wg,d.every=vd,d.find=_d,d.findIndex=zc,d.findKey=ng,d.findLast=jc,d.findLastIndex=un,d.findLastKey=rg,d.floor=nm,d.forEach=kc,d.forEachRight=Vc,d.forIn=ig,d.forInRight=og,d.forOwn=ta,d.forOwnRight=Co,d.get=Mn,d.gt=ku,d.gte=Ds,d.has=af,d.hasIn=Io,d.head=Lc,d.identity=lt,d.includes=Ed,d.indexOf=Bp,d.inRange=mg,d.invoke=ug,d.isArguments=Or,d.isArray=ee,d.isArrayBuffer=xe,d.isArrayLike=yt,d.isArrayLikeObject=ke,d.isBoolean=sn,d.isBuffer=wn,d.isDate=Xd,d.isElement=Ii,d.isEmpty=Vu,d.isEqual=Gu,d.isEqualWith=ve,d.isError=Ps,d.isFinite=Jc,d.isFunction=ln,d.isInteger=Xc,d.isLength=qu,d.isMap=rr,d.isMatch=Hu,d.isMatchWith=Zc,d.isNaN=Yu,d.isNative=Kc,d.isNil=Qu,d.isNull=ef,d.isNumber=Fs,d.isObject=Ue,d.isObjectLike=Ne,d.isPlainObject=ir,d.isRegExp=or,d.isSafeInteger=Ju,d.isSet=tf,d.isString=Xu,d.isSymbol=Qt,d.isTypedArray=ur,d.isUndefined=Zu,d.isWeakMap=Us,d.isWeakSet=Zd,d.join=Dc,d.kebabCase=Ag,d.last=Rt,d.lastIndexOf=Fe,d.lowerCase=Eg,d.lowerFirst=Sg,d.lt=nf,d.lte=Kd,d.max=rm,d.maxBy=im,d.mean=om,d.meanBy=um,d.min=am,d.minBy=sm,d.stubArray=Zs,d.stubFalse=Ks,d.stubObject=Qg,d.stubString=Jg,d.stubTrue=el,d.multiply=lm,d.nth=Be,d.noConflict=kg,d.noop=Js,d.now=Mu,d.pad=Tg,d.padEnd=Og,d.padStart=Cg,d.parseInt=Ig,d.random=vg,d.reduce=Id,d.reduceRight=Rd,d.repeat=Rg,d.replace=na,d.result=$s,d.round=cm,d.runInContext=p,d.sample=Nd,d.size=Dd,d.snakeCase=ks,d.some=Pd,d.sortedIndex=Yp,d.sortedIndexBy=Fu,d.sortedIndexOf=Yt,d.sortedLastIndex=Qp,d.sortedLastIndexBy=Jp,d.sortedLastIndexOf=Xp,d.startCase=xg,d.startsWith=Ng,d.subtract=fm,d.sum=hm,d.sumBy=pm,d.template=zg,d.times=Ef,d.toFinite=Te,d.toInteger=H,d.toLength=of,d.toLower=Vs,d.toNumber=cn,d.toSafeInteger=eg,d.toString=he,d.toUpper=vf,d.trim=Lg,d.trimEnd=Dg,d.trimStart=Pg,d.truncate=Qr,d.unescape=ie,d.uniqueId=Zg,d.upperCase=Fg,d.upperFirst=Wn,d.each=kc,d.eachRight=Vc,d.first=Lc,Qs(d,function(){var e={};return zn(d,function(t,n){ge.call(d.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),d.VERSION=h,kt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){d[e].placeholder=d}),kt(["drop","take"],function(e,t){se.prototype[e]=function(n){n=n===o?1:Je(H(n),0);var r=this.__filtered__&&!t?new se(this):this.clone();return r.__filtered__?r.__takeCount__=Pe(n,r.__takeCount__):r.__views__.push({size:Pe(n,Mt),type:e+(r.__dir__<0?"Right":"")}),r},se.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),kt(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n==fr||n==Wi;se.prototype[e]=function(a){var s=this.clone();return s.__iteratees__.push({iteratee:K(a,3),type:n}),s.__filtered__=s.__filtered__||r,s}}),kt(["head","last"],function(e,t){var n="take"+(t?"Right":"");se.prototype[e]=function(){return this[n](1).value()[0]}}),kt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");se.prototype[e]=function(){return this.__filtered__?new se(this):this[n](1)}}),se.prototype.compact=function(){return this.filter(lt)},se.prototype.find=function(e){return this.filter(e).head()},se.prototype.findLast=function(e){return this.reverse().find(e)},se.prototype.invokeMap=ne(function(e,t){return typeof e=="function"?new se(this):this.map(function(n){return _i(n,e,t)})}),se.prototype.reject=function(e){return this.filter($u(K(e)))},se.prototype.slice=function(e,t){e=H(e);var n=this;return n.__filtered__&&(e>0||t<0)?new se(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==o&&(t=H(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},se.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},se.prototype.toArray=function(){return this.take(Mt)},zn(se.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),a=d[r?"take"+(t=="last"?"Right":""):t],s=r||/^find/.test(t);a&&(d.prototype[t]=function(){var c=this.__wrapped__,f=r?[1]:arguments,g=c instanceof se,w=f[0],b=g||ee(c),E=function(B){var $=a.apply(d,Vt([B],f));return r&&T?$[0]:$};b&&n&&typeof w=="function"&&w.length!=1&&(g=b=!1);var T=this.__chain__,x=!!this.__actions__.length,z=s&&!T,M=g&&!x;if(!s&&b){c=M?c:new se(this);var L=e.apply(c,f);return L.__actions__.push({func:Ao,args:[E],thisArg:o}),new rn(L,T)}return z&&M?e.apply(this,f):(L=this.thru(E),z?r?L.value()[0]:L.value():L)})}),kt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Jo[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);d.prototype[e]=function(){var a=arguments;if(r&&!this.__chain__){var s=this.value();return t.apply(ee(s)?s:[],a)}return this[n](function(c){return t.apply(ee(c)?c:[],a)})}}),zn(se.prototype,function(e,t){var n=d[t];if(n){var r=n.name+"";ge.call(We,r)||(We[r]=[]),We[r].push({name:t,func:n})}}),We[go(o,X).name]=[{name:"wrapper",func:o}],se.prototype.clone=Ql,se.prototype.reverse=Mh,se.prototype.value=Wh,d.prototype.at=ld,d.prototype.chain=cd,d.prototype.commit=fd,d.prototype.next=hd,d.prototype.plant=dd,d.prototype.reverse=gd,d.prototype.toJSON=d.prototype.valueOf=d.prototype.value=Ci,d.prototype.first=d.prototype.head,eo&&(d.prototype[eo]=pd),d},mn=xh();Pr?((Pr.exports=mn)._=mn,wa._=mn):et._=mn}).call(Rr)})(Rf,Rf.exports);var ze=Rf.exports;const ua=i=>{const{sort:u,fields:o,omit:h,filters:m={},populate:A={},relation:S,pagination:C}=i,R=(m.$or||[]).filter(U=>!Object.keys(U).includes("removed")),N=m.$or?.some(U=>U.removed);let O={reports:{where:{resolved:!1}},...A},F={threadOf:{populate:{authorUser:{populate:!0,avatar:{populate:!0}},...A}}};if("author"in A){const{author:U,...Q}=A;O={reports:{where:{resolved:!1}},...Q,authorUser:U},F={threadOf:{populate:{authorUser:U,...Q}}}}return R.length&&!N?{...i,filters:{...ze.omit(m,"$or"),$and:[...m.$and||[],{$or:R},{$or:[{removed:{$null:!0}},{removed:!1}]}],related:S},populate:{...O,...F},pagination:C,sort:u,fields:o,omit:h}:{...i,filters:{...m,$or:[...R,{removed:{$null:!0}},{removed:!1}],related:S},populate:{...O,...F},pagination:C,sort:u,fields:o,omit:h}},kv=(i,u)=>{const{nonNull:o,stringArg:h}=u,{service:m}=i.plugin("graphql"),{args:A}=m("internals"),S=i.contentType(lr(i,"comment"));return{type:"ResponseFindAll",args:{relation:o(h()),filters:ft(i,"gql").buildContentTypeFilters(S),pagination:A.PaginationArg,sort:A.SortArg},async resolve(C,R){const{relation:N,filters:O,sort:F,pagination:U}=R;return await ft(i,"common").findAllFlat(ua({relation:N,filters:ft(i,"gql").graphQLFiltersToStrapiQuery(O,S),sort:F,pagination:U?{...U,withCount:!ze.isEmpty(U)}:void 0}),void 0)}}},Vv=(i,u)=>{const{nonNull:o,list:h,stringArg:m}=u,{service:A}=i.plugin("graphql"),{args:S}=A("internals"),{naming:{getFiltersInputTypeName:C}}=A("utils"),R=i.contentType(lr(i,"comment"));return{type:o(h("CommentNested")),args:{relation:o(m()),sort:S.SortArg,filters:C(R)},async resolve(N,O){const{relation:F,filters:U,sort:Q}=O;return await ft(i,"common").findAllInHierarchy({...ua({relation:F,filters:ft(i,"gql").graphQLFiltersToStrapiQuery(U,R),sort:Q}),dropBlockedThreads:!0})}}},Cr={ENABLED_COLLECTIONS:"enabledCollections",APPROVAL_FLOW:"approvalFlow",ENTRY_LABEL:"entryLabel",MODERATOR_ROLES:"moderatorRoles",BAD_WORDS:"badWords",AUTHOR_BLOCKED_PROPS:"blockedAuthorProps"},ul={GENERIC:"GENERIC",STRAPI:"STRAPI"},Gv={relatedUid:/^(?<uid>[a-z0-9-]+\:{2}[a-z0-9-]+\.[a-z0-9-]+)\:{1}(?<id>[a-z0-9-]+)$/i},qv=(i,u)=>{const{nonNull:o,intArg:h,arg:m}=u,{service:A}=i.plugin("graphql"),{args:S}=A("internals"),{naming:{getFiltersInputTypeName:C}}=A("utils"),R=i.contentType(lr(i,"comment"));return{type:"ResponseFindAllPerAuthor",args:{authorId:o(h()),authorType:m({type:"CommentAuthorType"}),filters:C(R),pagination:S.PaginationArg,sort:S.SortArg},async resolve(N,O){const{authorId:F,authorType:U,filters:Q,sort:j,pagination:J}=O,te=U!==ul.GENERIC;return await ft(i,"common").findAllPerAuthor(ua({filters:ft(i,"gql").graphQLFiltersToStrapiQuery(Q,R),sort:j,pagination:J?{...J,withCount:!ze.isEmpty(J)}:void 0,authorId:F}),te)}}},Hv=(i,u)=>{const o={findAllFlat:kv,findAllInHierarchy:Vv,findAllPerAuthor:qv};return u.extendType({type:"Query",definition(h){for(const[m,A]of Object.entries(o)){const S=A(i,u);h.field(m,S)}}})},Yv=i=>i.objectType({name:"CommentSingle",definition(u){u.id("id"),u.string("documentId"),u.nonNull.string("content"),u.boolean("blocked"),u.boolean("blockedThread"),u.boolean("removed"),u.string("approvalStatus"),u.field("threadOf",{type:"CommentSingle"}),u.field("author",{type:"CommentAuthor"}),u.string("createdAt"),u.string("updatedAt")}}),Qv=i=>i.objectType({name:"CommentAuthor",definition(u){u.id("id"),u.nonNull.string("name"),u.nonNull.string("email"),u.string("avatar")}}),Jv=i=>i.enumType({name:"CommentAuthorType",description:"User type which was the author of comment - Strapi built-in or generic",members:Object.values(ul)}),Xv=i=>i.objectType({name:"CommentNested",definition(u){u.id("id"),u.string("documentId"),u.nonNull.string("content"),u.boolean("blocked"),u.boolean("blockedThread"),u.string("approvalStatus"),u.boolean("removed"),u.field("threadOf",{type:"CommentSingle"}),u.list.field("children",{type:"CommentNested"}),u.field("author",{type:"CommentAuthor"}),u.string("createdAt"),u.string("updatedAt")}}),Zv=i=>i.inputObjectType({name:"CreateComment",definition(u){u.nonNull.string("content"),u.nonNull.string("relation"),u.id("threadOf"),u.field("author",{type:"CreateCommentAuthor"})}}),Kv=i=>i.inputObjectType({name:"CreateCommentAuthor",definition(u){u.nonNull.id("id"),u.nonNull.string("name"),u.string("email"),u.string("avatar")}}),e0=i=>i.inputObjectType({name:"CreateReport",definition(u){u.id("commentId"),u.nonNull.string("relation"),u.nonNull.string("content"),u.field("reason",{type:"ReportReason"})}});function He(i,u){if(!!!i)throw new Error(u)}function Qm(i){return typeof i=="object"&&i!==null}function t0(i,u){if(!!!i)throw new Error("Unexpected invariant triggered.")}const n0=/\r\n|[\n\r]/g;function _m(i,u){let o=0,h=1;for(const m of i.body.matchAll(n0)){if(typeof m.index=="number"||t0(!1),m.index>=u)break;o=m.index+m[0].length,h+=1}return{line:h,column:u+1-o}}function r0(i){return Jm(i.source,_m(i.source,i.start))}function Jm(i,u){const o=i.locationOffset.column-1,h="".padStart(o)+i.body,m=u.line-1,A=i.locationOffset.line-1,S=u.line+A,C=u.line===1?o:0,R=u.column+C,N=`${i.name}:${S}:${R}
|
|
27
|
+
}`;var M=Gs(function(){return P(s,x+"return "+E).apply(o,c)});if(M.source=E,Ps(M))throw M;return M}function Vs(e){return he(e).toLowerCase()}function vf(e){return he(e).toUpperCase()}function Lg(e,t,n){if(e=he(e),e&&(n||t===o))return zl(e);if(!e||!(t=Ht(t)))return e;var r=en(e),a=en(t),s=Ll(r,a),c=Dl(r,a)+1;return Sr(r,s,c).join("")}function Dg(e,t,n){if(e=he(e),e&&(n||t===o))return e.slice(0,Fa(e)+1);if(!e||!(t=Ht(t)))return e;var r=en(e),a=Dl(r,en(t))+1;return Sr(r,0,a).join("")}function Pg(e,t,n){if(e=he(e),e&&(n||t===o))return e.replace(ri,"");if(!e||!(t=Ht(t)))return e;var r=en(e),a=Ll(r,en(t));return Sr(r,a).join("")}function Qr(e,t){var n=Qe,r=En;if(Ue(t)){var a="separator"in t?t.separator:a;n="length"in t?H(t.length):n,r="omission"in t?Ht(t.omission):r}e=he(e);var s=e.length;if(fi(e)){var c=en(e);s=c.length}if(n>=s)return e;var f=n-Fr(r);if(f<1)return r;var g=c?Sr(c,0,f).join(""):e.slice(0,f);if(a===o)return g+r;if(c&&(f+=g.length-f),or(a)){if(e.slice(f).search(a)){var w,b=g;for(a.global||(a=Ua(a.source,he(oi.exec(a))+"g")),a.lastIndex=0;w=a.exec(b);)var E=w.index;g=g.slice(0,E===o?f:E)}}else if(e.indexOf(Ht(a),f)!=f){var T=g.lastIndexOf(a);T>-1&&(g=g.slice(0,T))}return g+r}function ie(e){return e=he(e),e&&Vf.test(e)?e.replace(ni,Oh):e}var Fg=qr(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Wn=cs("toUpperCase");function yf(e,t,n){return e=he(e),t=n?o:t,t===o?at(e)?Rh(e):Rl(e):e.match(t)||[]}var Gs=ne(function(e,t){try{return zt(e,o,t)}catch(n){return Ps(n)?n:new D(n)}}),qs=Kn(function(e,t){return kt(t,function(n){n=bn(n),Nn(e,n,vt(e[n],e))}),e});function _f(e){var t=e==null?0:e.length,n=K();return e=t?Ce(e,function(r){if(typeof r[1]!="function")throw new tn(S);return[n(r[0]),r[1]]}):[],ne(function(r){for(var a=-1;++a<t;){var s=e[a];if(zt(s[0],this,r))return zt(s[1],this,r)}})}function Li(e){return oc(Pt(e,F))}function Hs(e){return function(){return e}}function Ug(e,t){return e==null||e!==e?t:e}var Mg=yc(),bf=yc(!0);function lt(e){return e}function Ys(e){return gu(typeof e=="function"?e:Pt(e,F))}function Wg(e){return es(Pt(e,F))}function Bg(e,t){return vu(e,Pt(t,F))}var jg=ne(function(e,t){return function(n){return _i(n,e,t)}}),$g=ne(function(e,t){return function(n){return _i(e,n,t)}});function Qs(e,t,n){var r=rt(t),a=so(t,r);n==null&&!(Ue(t)&&(a.length||!r.length))&&(n=t,t=e,e=this,a=so(t,rt(t)));var s=!(Ue(n)&&"chain"in n)||!!n.chain,c=ln(e);return kt(a,function(f){var g=t[f];e[f]=g,c&&(e.prototype[f]=function(){var w=this.__chain__;if(s||w){var b=e(this.__wrapped__),E=b.__actions__=Tt(this.__actions__);return E.push({func:g,args:arguments,thisArg:e}),b.__chain__=w,b}return g.apply(e,Vt([this.value()],arguments))})}),e}function kg(){return et._===this&&(et._=Yn),this}function Js(){}function wf(e){return e=H(e),ne(function(t){return ts(t,e)})}var Vg=fs(Ce),Gg=fs(Ho),Af=fs(Oa);function Xs(e){return ys(e)?Ra(bn(e)):tp(e)}function qg(e){return function(t){return e==null?o:Vr(e,t)}}var Hg=bc(),Yg=bc(!0);function Zs(){return[]}function Ks(){return!1}function Qg(){return{}}function Jg(){return""}function el(){return!0}function Ef(e,t){if(e=H(e),e<1||e>Kt)return[];var n=Mt,r=Pe(e,Mt);t=K(t),e-=Mt;for(var a=La(r,t);++n<e;)t(n);return a}function Xg(e){return ee(e)?Ce(e,bn):Qt(e)?[e]:Tt(Ts(he(e)))}function Zg(e){var t=++zh;return he(e)+t}var Kg=Iu(function(e,t){return e+t},0),em=hs("ceil"),tm=Iu(function(e,t){return e/t},1),nm=hs("floor");function rm(e){return e&&e.length?_n(e,lt,dt):o}function im(e,t){return e&&e.length?_n(e,K(t,2),dt):o}function om(e){return xl(e,lt)}function um(e,t){return xl(e,K(t,2))}function am(e){return e&&e.length?_n(e,lt,mu):o}function sm(e,t){return e&&e.length?_n(e,K(t,2),mu):o}var lm=Iu(function(e,t){return e*t},1),cm=hs("round"),fm=Iu(function(e,t){return e-t},0);function hm(e){return e&&e.length?za(e,lt):0}function pm(e,t){return e&&e.length?za(e,K(t,2)):0}return d.after=Fd,d.ary=Wu,d.assign=So,d.assignIn=Ku,d.assignInWith=ar,d.assignWith=To,d.at=Oo,d.before=qc,d.bind=vt,d.bindAll=qs,d.bindKey=Bu,d.castArray=Gd,d.chain=Bc,d.chunk=Cp,d.compact=Ip,d.concat=Rp,d.cond=_f,d.conforms=Li,d.constant=Hs,d.countBy=md,d.create=ea,d.curry=Hc,d.curryRight=Yc,d.debounce=ju,d.defaults=Ri,d.defaultsDeep=tg,d.defer=Ud,d.delay=xs,d.difference=xp,d.differenceBy=Np,d.differenceWith=zp,d.drop=Lp,d.dropRight=Dp,d.dropRightWhile=Pp,d.dropWhile=Fp,d.fill=Up,d.filter=yd,d.flatMap=$c,d.flatMapDeep=bd,d.flatMapDepth=wd,d.flatten=It,d.flattenDeep=$e,d.flattenDepth=Mp,d.flip=Md,d.flow=Mg,d.flowRight=bf,d.fromPairs=Wp,d.functions=uf,d.functionsIn=xi,d.groupBy=Ad,d.initial=jp,d.intersection=Os,d.intersectionBy=$p,d.intersectionWith=tr,d.invert=sf,d.invertBy=lf,d.invokeMap=Sd,d.iteratee=Ys,d.keyBy=Td,d.keys=rt,d.keysIn=xt,d.map=Uu,d.mapKeys=ag,d.mapValues=Ws,d.matches=Wg,d.matchesProperty=Bg,d.memoize=Eo,d.merge=Bs,d.mergeWith=js,d.method=jg,d.methodOf=$g,d.mixin=Qs,d.negate=$u,d.nthArg=wf,d.omit=_t,d.omitBy=sg,d.once=Ns,d.orderBy=Od,d.over=Vg,d.overArgs=zs,d.overEvery=Gg,d.overSome=Af,d.partial=Ls,d.partialRight=Qc,d.partition=Cd,d.pick=cf,d.pickBy=Ni,d.property=Xs,d.propertyOf=qg,d.pull=kp,d.pullAll=Pc,d.pullAllBy=Vp,d.pullAllWith=Gp,d.pullAt=qp,d.range=Hg,d.rangeRight=Yg,d.rearg=Wd,d.reject=xd,d.remove=Hp,d.rest=Bd,d.reverse=Pu,d.sampleSize=zd,d.set=ff,d.setWith=lg,d.shuffle=Ld,d.slice=wo,d.sortBy=Gc,d.sortedUniq=Fc,d.sortedUniqBy=nr,d.split=mf,d.spread=jd,d.tail=ae,d.take=Uc,d.takeRight=an,d.takeRightWhile=Mc,d.takeWhile=Zp,d.tap=sd,d.throttle=$d,d.thru=Ao,d.toArray=rf,d.toPairs=hf,d.toPairsIn=pf,d.toPath=Xg,d.toPlainObject=Ms,d.transform=cg,d.unary=kd,d.union=me,d.unionBy=Kp,d.unionWith=ed,d.uniq=td,d.uniqBy=nd,d.uniqWith=rd,d.unset=fg,d.unzip=Cs,d.unzipWith=Wc,d.update=hg,d.updateWith=pg,d.values=zi,d.valuesIn=dg,d.without=id,d.words=yf,d.wrap=Vd,d.xor=od,d.xorBy=Is,d.xorWith=ud,d.zip=Rs,d.zipObject=nt,d.zipObjectDeep=Ft,d.zipWith=ad,d.entries=hf,d.entriesIn=pf,d.extend=Ku,d.extendWith=ar,Qs(d,d),d.add=Kg,d.attempt=Gs,d.camelCase=yg,d.capitalize=df,d.ceil=em,d.clamp=gg,d.clone=qd,d.cloneDeep=Yd,d.cloneDeepWith=Qd,d.cloneWith=Hd,d.conformsTo=Jd,d.deburr=gf,d.defaultTo=Ug,d.divide=tm,d.endsWith=_g,d.eq=we,d.escape=bg,d.escapeRegExp=wg,d.every=vd,d.find=_d,d.findIndex=zc,d.findKey=ng,d.findLast=jc,d.findLastIndex=un,d.findLastKey=rg,d.floor=nm,d.forEach=kc,d.forEachRight=Vc,d.forIn=ig,d.forInRight=og,d.forOwn=ta,d.forOwnRight=Co,d.get=Mn,d.gt=ku,d.gte=Ds,d.has=af,d.hasIn=Io,d.head=Lc,d.identity=lt,d.includes=Ed,d.indexOf=Bp,d.inRange=mg,d.invoke=ug,d.isArguments=Or,d.isArray=ee,d.isArrayBuffer=xe,d.isArrayLike=yt,d.isArrayLikeObject=ke,d.isBoolean=sn,d.isBuffer=wn,d.isDate=Xd,d.isElement=Ii,d.isEmpty=Vu,d.isEqual=Gu,d.isEqualWith=ve,d.isError=Ps,d.isFinite=Jc,d.isFunction=ln,d.isInteger=Xc,d.isLength=qu,d.isMap=rr,d.isMatch=Hu,d.isMatchWith=Zc,d.isNaN=Yu,d.isNative=Kc,d.isNil=Qu,d.isNull=ef,d.isNumber=Fs,d.isObject=Ue,d.isObjectLike=Ne,d.isPlainObject=ir,d.isRegExp=or,d.isSafeInteger=Ju,d.isSet=tf,d.isString=Xu,d.isSymbol=Qt,d.isTypedArray=ur,d.isUndefined=Zu,d.isWeakMap=Us,d.isWeakSet=Zd,d.join=Dc,d.kebabCase=Ag,d.last=Rt,d.lastIndexOf=Fe,d.lowerCase=Eg,d.lowerFirst=Sg,d.lt=nf,d.lte=Kd,d.max=rm,d.maxBy=im,d.mean=om,d.meanBy=um,d.min=am,d.minBy=sm,d.stubArray=Zs,d.stubFalse=Ks,d.stubObject=Qg,d.stubString=Jg,d.stubTrue=el,d.multiply=lm,d.nth=Be,d.noConflict=kg,d.noop=Js,d.now=Mu,d.pad=Tg,d.padEnd=Og,d.padStart=Cg,d.parseInt=Ig,d.random=vg,d.reduce=Id,d.reduceRight=Rd,d.repeat=Rg,d.replace=na,d.result=$s,d.round=cm,d.runInContext=p,d.sample=Nd,d.size=Dd,d.snakeCase=ks,d.some=Pd,d.sortedIndex=Yp,d.sortedIndexBy=Fu,d.sortedIndexOf=Yt,d.sortedLastIndex=Qp,d.sortedLastIndexBy=Jp,d.sortedLastIndexOf=Xp,d.startCase=xg,d.startsWith=Ng,d.subtract=fm,d.sum=hm,d.sumBy=pm,d.template=zg,d.times=Ef,d.toFinite=Te,d.toInteger=H,d.toLength=of,d.toLower=Vs,d.toNumber=cn,d.toSafeInteger=eg,d.toString=he,d.toUpper=vf,d.trim=Lg,d.trimEnd=Dg,d.trimStart=Pg,d.truncate=Qr,d.unescape=ie,d.uniqueId=Zg,d.upperCase=Fg,d.upperFirst=Wn,d.each=kc,d.eachRight=Vc,d.first=Lc,Qs(d,function(){var e={};return zn(d,function(t,n){ge.call(d.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),d.VERSION=h,kt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){d[e].placeholder=d}),kt(["drop","take"],function(e,t){se.prototype[e]=function(n){n=n===o?1:Je(H(n),0);var r=this.__filtered__&&!t?new se(this):this.clone();return r.__filtered__?r.__takeCount__=Pe(n,r.__takeCount__):r.__views__.push({size:Pe(n,Mt),type:e+(r.__dir__<0?"Right":"")}),r},se.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),kt(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n==fr||n==Wi;se.prototype[e]=function(a){var s=this.clone();return s.__iteratees__.push({iteratee:K(a,3),type:n}),s.__filtered__=s.__filtered__||r,s}}),kt(["head","last"],function(e,t){var n="take"+(t?"Right":"");se.prototype[e]=function(){return this[n](1).value()[0]}}),kt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");se.prototype[e]=function(){return this.__filtered__?new se(this):this[n](1)}}),se.prototype.compact=function(){return this.filter(lt)},se.prototype.find=function(e){return this.filter(e).head()},se.prototype.findLast=function(e){return this.reverse().find(e)},se.prototype.invokeMap=ne(function(e,t){return typeof e=="function"?new se(this):this.map(function(n){return _i(n,e,t)})}),se.prototype.reject=function(e){return this.filter($u(K(e)))},se.prototype.slice=function(e,t){e=H(e);var n=this;return n.__filtered__&&(e>0||t<0)?new se(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==o&&(t=H(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},se.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},se.prototype.toArray=function(){return this.take(Mt)},zn(se.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),a=d[r?"take"+(t=="last"?"Right":""):t],s=r||/^find/.test(t);a&&(d.prototype[t]=function(){var c=this.__wrapped__,f=r?[1]:arguments,g=c instanceof se,w=f[0],b=g||ee(c),E=function(B){var $=a.apply(d,Vt([B],f));return r&&T?$[0]:$};b&&n&&typeof w=="function"&&w.length!=1&&(g=b=!1);var T=this.__chain__,x=!!this.__actions__.length,z=s&&!T,M=g&&!x;if(!s&&b){c=M?c:new se(this);var L=e.apply(c,f);return L.__actions__.push({func:Ao,args:[E],thisArg:o}),new rn(L,T)}return z&&M?e.apply(this,f):(L=this.thru(E),z?r?L.value()[0]:L.value():L)})}),kt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Jo[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);d.prototype[e]=function(){var a=arguments;if(r&&!this.__chain__){var s=this.value();return t.apply(ee(s)?s:[],a)}return this[n](function(c){return t.apply(ee(c)?c:[],a)})}}),zn(se.prototype,function(e,t){var n=d[t];if(n){var r=n.name+"";ge.call(We,r)||(We[r]=[]),We[r].push({name:t,func:n})}}),We[go(o,X).name]=[{name:"wrapper",func:o}],se.prototype.clone=Ql,se.prototype.reverse=Mh,se.prototype.value=Wh,d.prototype.at=ld,d.prototype.chain=cd,d.prototype.commit=fd,d.prototype.next=hd,d.prototype.plant=dd,d.prototype.reverse=gd,d.prototype.toJSON=d.prototype.valueOf=d.prototype.value=Ci,d.prototype.first=d.prototype.head,eo&&(d.prototype[eo]=pd),d},mn=xh();Pr?((Pr.exports=mn)._=mn,wa._=mn):et._=mn}).call(Rr)})(Rf,Rf.exports);var ze=Rf.exports;const ua=i=>{const{sort:u,fields:o,omit:h,filters:m={},populate:A={},relation:S,pagination:C}=i,R=(m.$or||[]).filter(U=>!Object.keys(U).includes("removed")),N=m.$or?.some(U=>U.removed);let O={reports:{where:{resolved:!1}},...A},F={threadOf:{populate:{authorUser:{populate:!0,avatar:{populate:!0}},...A}}};if("author"in A){const{author:U,...Q}=A;O={reports:{where:{resolved:!1}},...Q,authorUser:U},F={threadOf:{populate:{authorUser:U,...Q}}}}return R.length&&!N?{...i,filters:{...ze.omit(m,"$or"),$and:[...m.$and||[],{$or:R},{$or:[{removed:{$null:!0}},{removed:!1}]}],related:S},populate:{...O,...F},pagination:C,sort:u,fields:o,omit:h}:{...i,filters:{...m,$or:[...R,{removed:{$null:!0}},{removed:!1}],related:S},populate:{...O,...F},pagination:C,sort:u,fields:o,omit:h}},qv=(i,u)=>{const{nonNull:o,stringArg:h}=u,{service:m}=i.plugin("graphql"),{args:A}=m("internals"),S=i.contentType(lr(i,"comment"));return{type:"ResponseFindAll",args:{relation:o(h()),filters:ft(i,"gql").buildContentTypeFilters(S),pagination:A.PaginationArg,sort:A.SortArg},async resolve(C,R){const{relation:N,filters:O,sort:F,pagination:U}=R;return await ft(i,"common").findAllFlat(ua({relation:N,filters:ft(i,"gql").graphQLFiltersToStrapiQuery(O,S),sort:F,pagination:U?{...U,withCount:!ze.isEmpty(U)}:void 0}),void 0)}}},Hv=(i,u)=>{const{nonNull:o,list:h,stringArg:m}=u,{service:A}=i.plugin("graphql"),{args:S}=A("internals"),{naming:{getFiltersInputTypeName:C}}=A("utils"),R=i.contentType(lr(i,"comment"));return{type:o(h("CommentNested")),args:{relation:o(m()),sort:S.SortArg,filters:C(R)},async resolve(N,O){const{relation:F,filters:U,sort:Q}=O;return await ft(i,"common").findAllInHierarchy({...ua({relation:F,filters:ft(i,"gql").graphQLFiltersToStrapiQuery(U,R),sort:Q}),dropBlockedThreads:!0})}}},Cr={ENABLED_COLLECTIONS:"enabledCollections",APPROVAL_FLOW:"approvalFlow",ENTRY_LABEL:"entryLabel",MODERATOR_ROLES:"moderatorRoles",BAD_WORDS:"badWords",AUTHOR_BLOCKED_PROPS:"blockedAuthorProps"},ul={GENERIC:"GENERIC",STRAPI:"STRAPI"},Yv={relatedUid:/^(?<uid>[a-z0-9-]+\:{2}[a-z0-9-]+\.[a-z0-9-]+)\:{1}(?<id>[a-z0-9-]+)$/i},Qv=(i,u)=>{const{nonNull:o,intArg:h,arg:m}=u,{service:A}=i.plugin("graphql"),{args:S}=A("internals"),{naming:{getFiltersInputTypeName:C}}=A("utils"),R=i.contentType(lr(i,"comment"));return{type:"ResponseFindAllPerAuthor",args:{authorId:o(h()),authorType:m({type:"CommentAuthorType"}),filters:C(R),pagination:S.PaginationArg,sort:S.SortArg},async resolve(N,O){const{authorId:F,authorType:U,filters:Q,sort:j,pagination:J}=O,te=U!==ul.GENERIC;return await ft(i,"common").findAllPerAuthor(ua({filters:ft(i,"gql").graphQLFiltersToStrapiQuery(Q,R),sort:j,pagination:J?{...J,withCount:!ze.isEmpty(J)}:void 0,authorId:F}),te)}}},Jv=(i,u)=>{const o={findAllFlat:qv,findAllInHierarchy:Hv,findAllPerAuthor:Qv};return u.extendType({type:"Query",definition(h){for(const[m,A]of Object.entries(o)){const S=A(i,u);h.field(m,S)}}})},Xv=i=>i.objectType({name:"CommentSingle",definition(u){u.id("id"),u.string("documentId"),u.nonNull.string("content"),u.boolean("blocked"),u.boolean("blockedThread"),u.boolean("removed"),u.string("approvalStatus"),u.field("threadOf",{type:"CommentSingle"}),u.field("author",{type:"CommentAuthor"}),u.string("createdAt"),u.string("updatedAt")}}),Zv=i=>i.objectType({name:"CommentAuthor",definition(u){u.id("id"),u.nonNull.string("name"),u.nonNull.string("email"),u.string("avatar")}}),Kv=i=>i.enumType({name:"CommentAuthorType",description:"User type which was the author of comment - Strapi built-in or generic",members:Object.values(ul)}),e0=i=>i.objectType({name:"CommentNested",definition(u){u.id("id"),u.string("documentId"),u.nonNull.string("content"),u.boolean("blocked"),u.boolean("blockedThread"),u.string("approvalStatus"),u.boolean("removed"),u.field("threadOf",{type:"CommentSingle"}),u.list.field("children",{type:"CommentNested"}),u.field("author",{type:"CommentAuthor"}),u.string("createdAt"),u.string("updatedAt")}}),t0=i=>i.inputObjectType({name:"CreateComment",definition(u){u.nonNull.string("content"),u.nonNull.string("relation"),u.id("threadOf"),u.field("author",{type:"CreateCommentAuthor"})}}),n0=i=>i.inputObjectType({name:"CreateCommentAuthor",definition(u){u.nonNull.id("id"),u.nonNull.string("name"),u.string("email"),u.string("avatar")}}),r0=i=>i.inputObjectType({name:"CreateReport",definition(u){u.id("commentId"),u.nonNull.string("relation"),u.nonNull.string("content"),u.field("reason",{type:"ReportReason"})}});function He(i,u){if(!!!i)throw new Error(u)}function Qm(i){return typeof i=="object"&&i!==null}function i0(i,u){if(!!!i)throw new Error("Unexpected invariant triggered.")}const o0=/\r\n|[\n\r]/g;function _m(i,u){let o=0,h=1;for(const m of i.body.matchAll(o0)){if(typeof m.index=="number"||i0(!1),m.index>=u)break;o=m.index+m[0].length,h+=1}return{line:h,column:u+1-o}}function u0(i){return Jm(i.source,_m(i.source,i.start))}function Jm(i,u){const o=i.locationOffset.column-1,h="".padStart(o)+i.body,m=u.line-1,A=i.locationOffset.line-1,S=u.line+A,C=u.line===1?o:0,R=u.column+C,N=`${i.name}:${S}:${R}
|
|
28
28
|
`,O=h.split(/\r\n|[\n\r]/g),F=O[m];if(F.length>120){const U=Math.floor(R/80),Q=R%80,j=[];for(let J=0;J<F.length;J+=80)j.push(F.slice(J,J+80));return N+Lm([[`${S} |`,j[0]],...j.slice(1,U+1).map(J=>["|",J]),["|","^".padStart(Q)],["|",j[U+1]]])}return N+Lm([[`${S-1} |`,O[m-1]],[`${S} |`,F],["|","^".padStart(R)],[`${S+1} |`,O[m+1]]])}function Lm(i){const u=i.filter(([h,m])=>m!==void 0),o=Math.max(...u.map(([h])=>h.length));return u.map(([h,m])=>h.padStart(o)+(m?" "+m:"")).join(`
|
|
29
|
-
`)}function
|
|
29
|
+
`)}function a0(i){const u=i[0];return u==null||"kind"in u||"length"in u?{nodes:u,source:i[1],positions:i[2],path:i[3],originalError:i[4],extensions:i[5]}:u}class Bn extends Error{constructor(u,...o){var h,m,A;const{nodes:S,source:C,positions:R,path:N,originalError:O,extensions:F}=a0(o);super(u),this.name="GraphQLError",this.path=N??void 0,this.originalError=O??void 0,this.nodes=Dm(Array.isArray(S)?S:S?[S]:void 0);const U=Dm((h=this.nodes)===null||h===void 0?void 0:h.map(j=>j.loc).filter(j=>j!=null));this.source=C??(U==null||(m=U[0])===null||m===void 0?void 0:m.source),this.positions=R??U?.map(j=>j.start),this.locations=R&&C?R.map(j=>_m(C,j)):U?.map(j=>_m(j.source,j.start));const Q=Qm(O?.extensions)?O?.extensions:void 0;this.extensions=(A=F??Q)!==null&&A!==void 0?A:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),O!=null&&O.stack?Object.defineProperty(this,"stack",{value:O.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,Bn):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let u=this.message;if(this.nodes)for(const o of this.nodes)o.loc&&(u+=`
|
|
30
30
|
|
|
31
|
-
`+
|
|
31
|
+
`+u0(o.loc));else if(this.source&&this.locations)for(const o of this.locations)u+=`
|
|
32
32
|
|
|
33
|
-
`+Jm(this.source,o);return u}toJSON(){const u={message:this.message};return this.locations!=null&&(u.locations=this.locations),this.path!=null&&(u.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(u.extensions=this.extensions),u}}function Dm(i){return i===void 0||i.length===0?void 0:i}const Xm={Name:[],Document:["definitions"],OperationDefinition:["description","name","variableDefinitions","directives","selectionSet"],VariableDefinition:["description","variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["description","name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"],TypeCoordinate:["name"],MemberCoordinate:["name","memberName"],ArgumentCoordinate:["name","fieldName","argumentName"],DirectiveCoordinate:["name"],DirectiveArgumentCoordinate:["name","argumentName"]},
|
|
33
|
+
`+Jm(this.source,o);return u}toJSON(){const u={message:this.message};return this.locations!=null&&(u.locations=this.locations),this.path!=null&&(u.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(u.extensions=this.extensions),u}}function Dm(i){return i===void 0||i.length===0?void 0:i}const Xm={Name:[],Document:["definitions"],OperationDefinition:["description","name","variableDefinitions","directives","selectionSet"],VariableDefinition:["description","variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["description","name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"],TypeCoordinate:["name"],MemberCoordinate:["name","memberName"],ArgumentCoordinate:["name","fieldName","argumentName"],DirectiveCoordinate:["name"],DirectiveArgumentCoordinate:["name","argumentName"]},s0=new Set(Object.keys(Xm));function Pm(i){const u=i?.kind;return typeof u=="string"&&s0.has(u)}var Fm;(function(i){i.QUERY="query",i.MUTATION="mutation",i.SUBSCRIPTION="subscription"})(Fm||(Fm={}));var Xt;(function(i){i.NAME="Name",i.DOCUMENT="Document",i.OPERATION_DEFINITION="OperationDefinition",i.VARIABLE_DEFINITION="VariableDefinition",i.SELECTION_SET="SelectionSet",i.FIELD="Field",i.ARGUMENT="Argument",i.FRAGMENT_SPREAD="FragmentSpread",i.INLINE_FRAGMENT="InlineFragment",i.FRAGMENT_DEFINITION="FragmentDefinition",i.VARIABLE="Variable",i.INT="IntValue",i.FLOAT="FloatValue",i.STRING="StringValue",i.BOOLEAN="BooleanValue",i.NULL="NullValue",i.ENUM="EnumValue",i.LIST="ListValue",i.OBJECT="ObjectValue",i.OBJECT_FIELD="ObjectField",i.DIRECTIVE="Directive",i.NAMED_TYPE="NamedType",i.LIST_TYPE="ListType",i.NON_NULL_TYPE="NonNullType",i.SCHEMA_DEFINITION="SchemaDefinition",i.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",i.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",i.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",i.FIELD_DEFINITION="FieldDefinition",i.INPUT_VALUE_DEFINITION="InputValueDefinition",i.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",i.UNION_TYPE_DEFINITION="UnionTypeDefinition",i.ENUM_TYPE_DEFINITION="EnumTypeDefinition",i.ENUM_VALUE_DEFINITION="EnumValueDefinition",i.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",i.DIRECTIVE_DEFINITION="DirectiveDefinition",i.SCHEMA_EXTENSION="SchemaExtension",i.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",i.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",i.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",i.UNION_TYPE_EXTENSION="UnionTypeExtension",i.ENUM_TYPE_EXTENSION="EnumTypeExtension",i.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension",i.TYPE_COORDINATE="TypeCoordinate",i.MEMBER_COORDINATE="MemberCoordinate",i.ARGUMENT_COORDINATE="ArgumentCoordinate",i.DIRECTIVE_COORDINATE="DirectiveCoordinate",i.DIRECTIVE_ARGUMENT_COORDINATE="DirectiveArgumentCoordinate"})(Xt||(Xt={}));function Um(i){return i===9||i===32}function l0(i){return i>=48&&i<=57}function Zm(i){return i>=97&&i<=122||i>=65&&i<=90}function c0(i){return Zm(i)||i===95}function f0(i){return Zm(i)||l0(i)||i===95}function h0(i,u){const o=i.replace(/"""/g,'\\"""'),h=o.split(/\r\n|[\n\r]/g),m=h.length===1,A=h.length>1&&h.slice(1).every(Q=>Q.length===0||Um(Q.charCodeAt(0))),S=o.endsWith('\\"""'),C=i.endsWith('"')&&!S,R=i.endsWith("\\"),N=C||R,O=!m||i.length>70||N||A||S;let F="";const U=m&&Um(i.charCodeAt(0));return(O&&!U||A)&&(F+=`
|
|
34
34
|
`),F+=o,(O||N)&&(F+=`
|
|
35
|
-
`),'"""'+F+'"""'}const
|
|
35
|
+
`),'"""'+F+'"""'}const p0=10,Km=2;function jn(i){return Df(i,[])}function Df(i,u){switch(typeof i){case"string":return JSON.stringify(i);case"function":return i.name?`[function ${i.name}]`:"[function]";case"object":return d0(i,u);default:return String(i)}}function d0(i,u){if(i===null)return"null";if(u.includes(i))return"[Circular]";const o=[...u,i];if(g0(i)){const h=i.toJSON();if(h!==i)return typeof h=="string"?h:Df(h,o)}else if(Array.isArray(i))return v0(i,o);return m0(i,o)}function g0(i){return typeof i.toJSON=="function"}function m0(i,u){const o=Object.entries(i);return o.length===0?"{}":u.length>Km?"["+y0(i)+"]":"{ "+o.map(([m,A])=>m+": "+Df(A,u)).join(", ")+" }"}function v0(i,u){if(i.length===0)return"[]";if(u.length>Km)return"[Array]";const o=Math.min(p0,i.length),h=i.length-o,m=[];for(let A=0;A<o;++A)m.push(Df(i[A],u));return h===1?m.push("... 1 more item"):h>1&&m.push(`... ${h} more items`),"["+m.join(", ")+"]"}function y0(i){const u=Object.prototype.toString.call(i).replace(/^\[object /,"").replace(/]$/,"");if(u==="Object"&&typeof i.constructor=="function"){const o=i.constructor.name;if(typeof o=="string"&&o!=="")return o}return u}const _0=globalThis.process&&process.env.NODE_ENV==="production",Ui=_0?function(u,o){return u instanceof o}:function(u,o){if(u instanceof o)return!0;if(typeof u=="object"&&u!==null){var h;const m=o.prototype[Symbol.toStringTag],A=Symbol.toStringTag in u?u[Symbol.toStringTag]:(h=u.constructor)===null||h===void 0?void 0:h.name;if(m===A){const S=jn(u);throw new Error(`Cannot use ${m} "${S}" from another module or realm.
|
|
36
36
|
|
|
37
37
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
38
38
|
directory. If different versions of "graphql" are the dependencies of other
|
|
@@ -43,18 +43,18 @@ https://yarnpkg.com/en/docs/selective-version-resolutions
|
|
|
43
43
|
Duplicate "graphql" modules cannot be used at the same time since different
|
|
44
44
|
versions may have different capabilities and behavior. The data from one
|
|
45
45
|
version used in the function from another could produce confusing and
|
|
46
|
-
spurious results.`)}}return!1},
|
|
46
|
+
spurious results.`)}}return!1},b0=5;function w0(i,u){const[o,h]=u?[i,u]:[void 0,i];let m=" Did you mean ";o&&(m+=o+" ");const A=h.map(R=>`"${R}"`);switch(A.length){case 0:return"";case 1:return m+A[0]+"?";case 2:return m+A[0]+" or "+A[1]+"?"}const S=A.slice(0,b0),C=S.pop();return m+S.join(", ")+", or "+C+"?"}function Mm(i){return i}function A0(i,u){const o=Object.create(null);for(const h of i)o[u(h)]=h;return o}function Im(i,u,o){const h=Object.create(null);for(const m of i)h[u(m)]=o(m);return h}function Pf(i,u){const o=Object.create(null);for(const h of Object.keys(i))o[h]=u(i[h],h);return o}function E0(i,u){let o=0,h=0;for(;o<i.length&&h<u.length;){let m=i.charCodeAt(o),A=u.charCodeAt(h);if(Sf(m)&&Sf(A)){let S=0;do++o,S=S*10+m-bm,m=i.charCodeAt(o);while(Sf(m)&&S>0);let C=0;do++h,C=C*10+A-bm,A=u.charCodeAt(h);while(Sf(A)&&C>0);if(S<C)return-1;if(S>C)return 1}else{if(m<A)return-1;if(m>A)return 1;++o,++h}}return i.length-u.length}const bm=48,S0=57;function Sf(i){return!isNaN(i)&&bm<=i&&i<=S0}function T0(i,u){const o=Object.create(null),h=new O0(i),m=Math.floor(i.length*.4)+1;for(const A of u){const S=h.measure(A,m);S!==void 0&&(o[A]=S)}return Object.keys(o).sort((A,S)=>{const C=o[A]-o[S];return C!==0?C:E0(A,S)})}class O0{constructor(u){this._input=u,this._inputLowerCase=u.toLowerCase(),this._inputArray=Wm(this._inputLowerCase),this._rows=[new Array(u.length+1).fill(0),new Array(u.length+1).fill(0),new Array(u.length+1).fill(0)]}measure(u,o){if(this._input===u)return 0;const h=u.toLowerCase();if(this._inputLowerCase===h)return 1;let m=Wm(h),A=this._inputArray;if(m.length<A.length){const O=m;m=A,A=O}const S=m.length,C=A.length;if(S-C>o)return;const R=this._rows;for(let O=0;O<=C;O++)R[0][O]=O;for(let O=1;O<=S;O++){const F=R[(O-1)%3],U=R[O%3];let Q=U[0]=O;for(let j=1;j<=C;j++){const J=m[O-1]===A[j-1]?0:1;let te=Math.min(F[j]+1,U[j-1]+1,F[j-1]+J);if(O>1&&j>1&&m[O-1]===A[j-2]&&m[O-2]===A[j-1]){const X=R[(O-2)%3][j-2];te=Math.min(te,X+1)}te<Q&&(Q=te),U[j]=te}if(Q>o)return}const N=R[S%3][C];return N<=o?N:void 0}}function Wm(i){const u=i.length,o=new Array(u);for(let h=0;h<u;++h)o[h]=i.charCodeAt(h);return o}function xr(i){if(i==null)return Object.create(null);if(Object.getPrototypeOf(i)===null)return i;const u=Object.create(null);for(const[o,h]of Object.entries(i))u[o]=h;return u}function C0(i){return`"${i.replace(I0,R0)}"`}const I0=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function R0(i){return x0[i.charCodeAt(0)]}const x0=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],N0=Object.freeze({});function z0(i,u,o=Xm){const h=new Map;for(const X of Object.values(Xt))h.set(X,L0(u,X));let m,A=Array.isArray(i),S=[i],C=-1,R=[],N=i,O,F;const U=[],Q=[];do{C++;const X=C===S.length,ye=X&&R.length!==0;if(X){if(O=Q.length===0?void 0:U[U.length-1],N=F,F=Q.pop(),ye)if(A){N=N.slice();let Le=0;for(const[Ve,Ye]of R){const Me=Ve-Le;Ye===null?(N.splice(Me,1),Le++):N[Me]=Ye}}else{N={...N};for(const[Le,Ve]of R)N[Le]=Ve}C=m.index,S=m.keys,R=m.edits,A=m.inArray,m=m.prev}else if(F){if(O=A?C:S[C],N=F[O],N==null)continue;U.push(O)}let _e;if(!Array.isArray(N)){var j,J;Pm(N)||He(!1,`Invalid AST Node: ${jn(N)}.`);const Le=X?(j=h.get(N.kind))===null||j===void 0?void 0:j.leave:(J=h.get(N.kind))===null||J===void 0?void 0:J.enter;if(_e=Le?.call(u,N,O,F,U,Q),_e===N0)break;if(_e===!1){if(!X){U.pop();continue}}else if(_e!==void 0&&(R.push([O,_e]),!X))if(Pm(_e))N=_e;else{U.pop();continue}}if(_e===void 0&&ye&&R.push([O,N]),X)U.pop();else{var te;m={inArray:A,index:C,keys:S,edits:R,prev:m},A=Array.isArray(N),S=A?N:(te=o[N.kind])!==null&&te!==void 0?te:[],C=-1,R=[],F&&Q.push(F),F=N}}while(m!==void 0);return R.length!==0?R[R.length-1][1]:i}function L0(i,u){const o=i[u];return typeof o=="object"?o:typeof o=="function"?{enter:o,leave:void 0}:{enter:i.enter,leave:i.leave}}function Bm(i){return z0(i,P0)}const D0=80,P0={Name:{leave:i=>i.value},Variable:{leave:i=>"$"+i.name},Document:{leave:i=>k(i.definitions,`
|
|
47
47
|
|
|
48
48
|
`)},OperationDefinition:{leave(i){const u=dm(i.variableDefinitions)?ue(`(
|
|
49
49
|
`,k(i.variableDefinitions,`
|
|
50
50
|
`),`
|
|
51
51
|
)`):ue("(",k(i.variableDefinitions,", "),")"),o=ue("",i.description,`
|
|
52
52
|
`)+k([i.operation,k([i.name,u]),k(i.directives," ")]," ");return(o==="query"?"":o+" ")+i.selectionSet}},VariableDefinition:{leave:({variable:i,type:u,defaultValue:o,directives:h,description:m})=>ue("",m,`
|
|
53
|
-
`)+i+": "+u+ue(" = ",o)+ue(" ",k(h," "))},SelectionSet:{leave:({selections:i})=>sr(i)},Field:{leave({alias:i,name:u,arguments:o,directives:h,selectionSet:m}){const A=ue("",i,": ")+u;let S=A+ue("(",k(o,", "),")");return S.length>
|
|
53
|
+
`)+i+": "+u+ue(" = ",o)+ue(" ",k(h," "))},SelectionSet:{leave:({selections:i})=>sr(i)},Field:{leave({alias:i,name:u,arguments:o,directives:h,selectionSet:m}){const A=ue("",i,": ")+u;let S=A+ue("(",k(o,", "),")");return S.length>D0&&(S=A+ue(`(
|
|
54
54
|
`,If(k(o,`
|
|
55
55
|
`)),`
|
|
56
56
|
)`)),k([S,k(h," "),m]," ")}},Argument:{leave:({name:i,value:u})=>i+": "+u},FragmentSpread:{leave:({name:i,directives:u})=>"..."+i+ue(" ",k(u," "))},InlineFragment:{leave:({typeCondition:i,directives:u,selectionSet:o})=>k(["...",ue("on ",i),k(u," "),o]," ")},FragmentDefinition:{leave:({name:i,typeCondition:u,variableDefinitions:o,directives:h,selectionSet:m,description:A})=>ue("",A,`
|
|
57
|
-
`)+`fragment ${i}${ue("(",k(o,", "),")")} on ${u} ${ue("",k(h," ")," ")}`+m},IntValue:{leave:({value:i})=>i},FloatValue:{leave:({value:i})=>i},StringValue:{leave:({value:i,block:u})=>u?
|
|
57
|
+
`)+`fragment ${i}${ue("(",k(o,", "),")")} on ${u} ${ue("",k(h," ")," ")}`+m},IntValue:{leave:({value:i})=>i},FloatValue:{leave:({value:i})=>i},StringValue:{leave:({value:i,block:u})=>u?h0(i):C0(i)},BooleanValue:{leave:({value:i})=>i?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:i})=>i},ListValue:{leave:({values:i})=>"["+k(i,", ")+"]"},ObjectValue:{leave:({fields:i})=>"{"+k(i,", ")+"}"},ObjectField:{leave:({name:i,value:u})=>i+": "+u},Directive:{leave:({name:i,arguments:u})=>"@"+i+ue("(",k(u,", "),")")},NamedType:{leave:({name:i})=>i},ListType:{leave:({type:i})=>"["+i+"]"},NonNullType:{leave:({type:i})=>i+"!"},SchemaDefinition:{leave:({description:i,directives:u,operationTypes:o})=>ue("",i,`
|
|
58
58
|
`)+k(["schema",k(u," "),sr(o)]," ")},OperationTypeDefinition:{leave:({operation:i,type:u})=>i+": "+u},ScalarTypeDefinition:{leave:({description:i,name:u,directives:o})=>ue("",i,`
|
|
59
59
|
`)+k(["scalar",u,k(o," ")]," ")},ObjectTypeDefinition:{leave:({description:i,name:u,interfaces:o,directives:h,fields:m})=>ue("",i,`
|
|
60
60
|
`)+k(["type",u,ue("implements ",k(o," & ")),k(h," "),sr(m)]," ")},FieldDefinition:{leave:({description:i,name:u,arguments:o,type:h,directives:m})=>ue("",i,`
|
|
@@ -76,10 +76,10 @@ spurious results.`)}}return!1},v0=5;function y0(i,u){const[o,h]=u?[i,u]:[void 0,
|
|
|
76
76
|
`)),`
|
|
77
77
|
}`)}function ue(i,u,o=""){return u!=null&&u!==""?i+u+o:""}function If(i){return ue(" ",i.replace(/\n/g,`
|
|
78
78
|
`))}function dm(i){var u;return(u=i?.some(o=>o.includes(`
|
|
79
|
-
`)))!==null&&u!==void 0?u:!1}function wm(i,u){switch(i.kind){case Xt.NULL:return null;case Xt.INT:return parseInt(i.value,10);case Xt.FLOAT:return parseFloat(i.value);case Xt.STRING:case Xt.ENUM:case Xt.BOOLEAN:return i.value;case Xt.LIST:return i.values.map(o=>wm(o,u));case Xt.OBJECT:return Im(i.fields,o=>o.name.value,o=>wm(o.value,u));case Xt.VARIABLE:return u?.[i.name.value]}}function cr(i){if(i!=null||He(!1,"Must provide name."),typeof i=="string"||He(!1,"Expected name to be a string."),i.length===0)throw new Bn("Expected name to be a non-empty string.");for(let u=1;u<i.length;++u)if(!s0(i.charCodeAt(u)))throw new Bn(`Names must only contain [_a-zA-Z0-9] but "${i}" does not.`);if(!a0(i.charCodeAt(0)))throw new Bn(`Names must start with [_a-zA-Z] but "${i}" does not.`);return i}function L0(i){if(i==="true"||i==="false"||i==="null")throw new Bn(`Enum values cannot be named: ${i}`);return cr(i)}function ll(i){return D0(i)||P0(i)||F0(i)||U0(i)||M0(i)||W0(i)||B0(i)||Rm(i)}function D0(i){return Ui(i,nv)}function P0(i){return Ui(i,V0)}function F0(i){return Ui(i,H0)}function U0(i){return Ui(i,Y0)}function M0(i){return Ui(i,J0)}function W0(i){return Ui(i,X0)}function B0(i){return Ui(i,j0)}function Rm(i){return Ui(i,$0)}class j0{constructor(u){ll(u)||He(!1,`Expected ${jn(u)} to be a GraphQL type.`),this.ofType=u}get[Symbol.toStringTag](){return"GraphQLList"}toString(){return"["+String(this.ofType)+"]"}toJSON(){return this.toString()}}class $0{constructor(u){k0(u)||He(!1,`Expected ${jn(u)} to be a GraphQL nullable type.`),this.ofType=u}get[Symbol.toStringTag](){return"GraphQLNonNull"}toString(){return String(this.ofType)+"!"}toJSON(){return this.toString()}}function k0(i){return ll(i)&&!Rm(i)}function ev(i){return typeof i=="function"?i():i}function tv(i){return typeof i=="function"?i():i}class nv{constructor(u){var o,h,m,A;const S=(o=u.parseValue)!==null&&o!==void 0?o:Mm;this.name=cr(u.name),this.description=u.description,this.specifiedByURL=u.specifiedByURL,this.serialize=(h=u.serialize)!==null&&h!==void 0?h:Mm,this.parseValue=S,this.parseLiteral=(m=u.parseLiteral)!==null&&m!==void 0?m:(C,R)=>S(wm(C,R)),this.extensions=xr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(A=u.extensionASTNodes)!==null&&A!==void 0?A:[],u.specifiedByURL==null||typeof u.specifiedByURL=="string"||He(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${jn(u.specifiedByURL)}.`),u.serialize==null||typeof u.serialize=="function"||He(!1,`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`),u.parseLiteral&&(typeof u.parseValue=="function"&&typeof u.parseLiteral=="function"||He(!1,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`))}get[Symbol.toStringTag](){return"GraphQLScalarType"}toConfig(){return{name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class V0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.isTypeOf=u.isTypeOf,this.extensions=xr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._fields=()=>iv(u),this._interfaces=()=>rv(u),u.isTypeOf==null||typeof u.isTypeOf=="function"||He(!1,`${this.name} must provide "isTypeOf" as a function, but got: ${jn(u.isTypeOf)}.`)}get[Symbol.toStringTag](){return"GraphQLObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:ov(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function rv(i){var u;const o=ev((u=i.interfaces)!==null&&u!==void 0?u:[]);return Array.isArray(o)||He(!1,`${i.name} interfaces must be an Array or a function which returns an Array.`),o}function iv(i){const u=tv(i.fields);return aa(u)||He(!1,`${i.name} fields must be an object with field names as keys or a function which returns such an object.`),Pf(u,(o,h)=>{var m;aa(o)||He(!1,`${i.name}.${h} field config must be an object.`),o.resolve==null||typeof o.resolve=="function"||He(!1,`${i.name}.${h} field resolver must be a function if provided, but got: ${jn(o.resolve)}.`);const A=(m=o.args)!==null&&m!==void 0?m:{};return aa(A)||He(!1,`${i.name}.${h} args must be an object with argument names as keys.`),{name:cr(h),description:o.description,type:o.type,args:G0(A),resolve:o.resolve,subscribe:o.subscribe,deprecationReason:o.deprecationReason,extensions:xr(o.extensions),astNode:o.astNode}})}function G0(i){return Object.entries(i).map(([u,o])=>({name:cr(u),description:o.description,type:o.type,defaultValue:o.defaultValue,deprecationReason:o.deprecationReason,extensions:xr(o.extensions),astNode:o.astNode}))}function aa(i){return Qm(i)&&!Array.isArray(i)}function ov(i){return Pf(i,u=>({description:u.description,type:u.type,args:q0(u.args),resolve:u.resolve,subscribe:u.subscribe,deprecationReason:u.deprecationReason,extensions:u.extensions,astNode:u.astNode}))}function q0(i){return Im(i,u=>u.name,u=>({description:u.description,type:u.type,defaultValue:u.defaultValue,deprecationReason:u.deprecationReason,extensions:u.extensions,astNode:u.astNode}))}class H0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.resolveType=u.resolveType,this.extensions=xr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._fields=iv.bind(void 0,u),this._interfaces=rv.bind(void 0,u),u.resolveType==null||typeof u.resolveType=="function"||He(!1,`${this.name} must provide "resolveType" as a function, but got: ${jn(u.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLInterfaceType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:ov(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class Y0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.resolveType=u.resolveType,this.extensions=xr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._types=Q0.bind(void 0,u),u.resolveType==null||typeof u.resolveType=="function"||He(!1,`${this.name} must provide "resolveType" as a function, but got: ${jn(u.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLUnionType"}getTypes(){return typeof this._types=="function"&&(this._types=this._types()),this._types}toConfig(){return{name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Q0(i){const u=ev(i.types);return Array.isArray(u)||He(!1,`Must provide Array of types or a function which returns such an array for Union ${i.name}.`),u}class J0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.extensions=xr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._values=typeof u.values=="function"?u.values:jm(this.name,u.values),this._valueLookup=null,this._nameLookup=null}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){return typeof this._values=="function"&&(this._values=jm(this.name,this._values())),this._values}getValue(u){return this._nameLookup===null&&(this._nameLookup=_0(this.getValues(),o=>o.name)),this._nameLookup[u]}serialize(u){this._valueLookup===null&&(this._valueLookup=new Map(this.getValues().map(h=>[h.value,h])));const o=this._valueLookup.get(u);if(o===void 0)throw new Bn(`Enum "${this.name}" cannot represent value: ${jn(u)}`);return o.name}parseValue(u){if(typeof u!="string"){const h=jn(u);throw new Bn(`Enum "${this.name}" cannot represent non-string value: ${h}.`+Tf(this,h))}const o=this.getValue(u);if(o==null)throw new Bn(`Value "${u}" does not exist in "${this.name}" enum.`+Tf(this,u));return o.value}parseLiteral(u,o){if(u.kind!==Xt.ENUM){const m=Bm(u);throw new Bn(`Enum "${this.name}" cannot represent non-enum value: ${m}.`+Tf(this,m),{nodes:u})}const h=this.getValue(u.value);if(h==null){const m=Bm(u);throw new Bn(`Value "${m}" does not exist in "${this.name}" enum.`+Tf(this,m),{nodes:u})}return h.value}toConfig(){const u=Im(this.getValues(),o=>o.name,o=>({description:o.description,value:o.value,deprecationReason:o.deprecationReason,extensions:o.extensions,astNode:o.astNode}));return{name:this.name,description:this.description,values:u,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Tf(i,u){const o=i.getValues().map(m=>m.name),h=A0(u,o);return y0("the enum value",h)}function jm(i,u){return aa(u)||He(!1,`${i} values must be an object with value names as keys.`),Object.entries(u).map(([o,h])=>(aa(h)||He(!1,`${i}.${o} must refer to an object with a "value" key representing an internal value but got: ${jn(h)}.`),{name:L0(o),description:h.description,value:h.value!==void 0?h.value:o,deprecationReason:h.deprecationReason,extensions:xr(h.extensions),astNode:h.astNode}))}class X0{constructor(u){var o,h;this.name=cr(u.name),this.description=u.description,this.extensions=xr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this.isOneOf=(h=u.isOneOf)!==null&&h!==void 0?h:!1,this._fields=Z0.bind(void 0,u)}get[Symbol.toStringTag](){return"GraphQLInputObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}toConfig(){const u=Pf(this.getFields(),o=>({description:o.description,type:o.type,defaultValue:o.defaultValue,deprecationReason:o.deprecationReason,extensions:o.extensions,astNode:o.astNode}));return{name:this.name,description:this.description,fields:u,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,isOneOf:this.isOneOf}}toString(){return this.name}toJSON(){return this.toString()}}function Z0(i){const u=tv(i.fields);return aa(u)||He(!1,`${i.name} fields must be an object with field names as keys or a function which returns such an object.`),Pf(u,(o,h)=>(!("resolve"in o)||He(!1,`${i.name}.${h} field has a resolve property, but Input Types cannot define resolvers.`),{name:cr(h),description:o.description,type:o.type,defaultValue:o.defaultValue,deprecationReason:o.deprecationReason,extensions:xr(o.extensions),astNode:o.astNode}))}function Mi(i){const u=K0(i);if(u)throw u;return i}function K0(i){if(typeof i=="string"||He(!1,"Expected name to be a string."),i.startsWith("__"))return new Bn(`Name "${i}" must not begin with "__", which is reserved by GraphQL introspection.`);try{cr(i)}catch(u){return u}}const ey=i=>i.scalarType({name:"ID",asNexusMethod:"id",description:"id as string or integer",serialize:u=>u,parseValue(u){const o=parseInt(u);return ze.isNumber(o)?o:u},parseLiteral(u){return u.kind===Xt.INT||u.kind===Xt.STRING?u.value:null}}),ty=i=>i.inputObjectType({name:"IdentifyCommentAuthor",definition(u){u.nonNull.id("id")}}),ny=i=>i.inputObjectType({name:"RemoveComment",definition(u){u.id("id"),u.nonNull.string("relation"),u.field("author",{type:"IdentifyCommentAuthor"})}}),ry=i=>i.objectType({name:"Report",definition(u){u.id("id"),u.nonNull.string("content"),u.field("reason",{type:"ReportReason"}),u.field("related",{type:"CommentSingle"}),u.string("createdAt"),u.string("updatedAt")}}),iy=(i,{reportReasons:u})=>i.enumType({name:"ReportReason",description:"Reason of abuse report",members:Object.values(u)}),oy=i=>i.objectType({name:"ResponseFindAll",definition(u){u.nonNull.list.field("data",{type:"CommentSingle"}),u.field("meta",{type:"ResponseMeta"})}}),uy=i=>i.objectType({name:"ResponseFindAllPerAuthor",definition(u){u.nonNull.list.field("data",{type:"CommentSingle"}),u.field("meta",{type:"ResponseMeta"})}}),ay=i=>i.objectType({name:"ResponseMeta",definition(u){u.field("pagination",{type:"ResponsePagination"})}}),sy=i=>i.objectType({name:"ResponsePagination",definition(u){u.int("page"),u.int("pageSize"),u.int("pageCount"),u.int("total"),u.int("start"),u.int("limit")}}),ly=i=>i.inputObjectType({name:"UpdateComment",definition(u){u.id("id"),u.nonNull.string("content"),u.nonNull.string("relation"),u.field("author",{type:"IdentifyCommentAuthor"})}}),cy=[Yv,Qv,Jv,Xv,Zv,Kv,e0,ey,ty,ny,iy,oy,uy,ay,sy,ly,ry],fy=(i,u)=>cy.map(o=>o(u,i)),uv=i=>i.plugin("graphql").service("extension"),hy=i=>{const u=uv(i);u.shadowCRUD(lr(i,"comment")).disable(),u.shadowCRUD(lr(i,"comment")).disableQueries(),u.shadowCRUD(lr(i,"comment")).disableMutations(),u.shadowCRUD(lr(i,"comment-report")).disable(),u.shadowCRUD(lr(i,"comment-report")).disableQueries(),u.shadowCRUD(lr(i,"comment-report")).disableMutations()},py=async({strapi:i})=>{i.plugin("graphql")&&(hy(i),(await ft(i,"common").getConfig(oa.ENABLED_COLLECTIONS,[])).length&&await dy(i))},dy=async i=>{const u=uv(i),o=await ft(i,"common").getConfig();u.use(({strapi:h,nexus:m})=>{const A=fy(o,m),S=Hv(h,m),C=$v(h,m),R=Uv(o);return{types:[A,S,C],resolversConfig:R}})},ra={comments:{read:"comments-read",moderate:"comments-moderate"},reports:{read:"reports-read",review:"reports-review"},settings:{read:"settings-read",change:"settings-change"}},gy=async({strapi:i})=>{if(i.plugin("graphql")&&await py({strapi:i}),Object.keys(i.plugins).indexOf("users-permissions")===-1)throw new Error("In order to make the comments plugin work the users-permissions plugin is required");const u=[{section:"plugins",displayName:"Comments: Read",uid:ra.comments.read,pluginName:"comments"},{section:"plugins",displayName:"Comments: Moderate",uid:ra.comments.moderate,pluginName:"comments"},{section:"plugins",displayName:"Reports: Read",uid:ra.reports.read,pluginName:"comments"},{section:"plugins",displayName:"Reports: Moderate",uid:ra.reports.review,pluginName:"comments"},{section:"plugins",displayName:"Settings: Read",uid:ra.settings.read,pluginName:"comments"},{section:"plugins",displayName:"Settings: Change",uid:ra.settings.change,pluginName:"comments"}];await i.admin.services.permission.actionProvider.registerMany(u)},my={isValidationEnabled:!0,enabledCollections:[],moderatorRoles:[],approvalFlow:[],entryLabel:{"*":["Title","title","Name","name","Subject","subject"]},reportReasons:{BAD_LANGUAGE:Zt.BAD_LANGUAGE,DISCRIMINATION:Zt.DISCRIMINATION,OTHER:Zt.OTHER},blockedAuthorProps:[]},vy=v.z.object({[Zt.BAD_LANGUAGE]:v.z.literal(Zt.BAD_LANGUAGE),[Zt.OTHER]:v.z.literal(Zt.OTHER),[Zt.DISCRIMINATION]:v.z.literal(Zt.DISCRIMINATION)}),Am=v.z.object({isValidationEnabled:v.z.boolean().optional(),reportReasons:vy.optional(),isGQLPluginEnabled:v.z.boolean().optional(),[Cr.ENABLED_COLLECTIONS]:v.z.array(v.z.string()),[Cr.MODERATOR_ROLES]:v.z.array(v.z.string()),[Cr.APPROVAL_FLOW]:v.z.array(v.z.string()),[Cr.ENTRY_LABEL]:v.z.record(v.z.array(v.z.string())),[Cr.BAD_WORDS]:v.z.boolean().optional(),[Cr.AUTHOR_BLOCKED_PROPS]:v.z.array(v.z.string()),gql:v.z.object({auth:v.z.boolean().optional()}).optional(),client:v.z.object({url:v.z.string().nullable(),contactEmail:v.z.string().nullable()}).default({url:null,contactEmail:null})}),yy={default:Am.parse(my),validate:i=>Am.safeParse(i)},Y=({left:i,right:u})=>{if(u!==void 0&&i!==void 0)throw new Error(`Received both left and right values at runtime when opening an Either
|
|
79
|
+
`)))!==null&&u!==void 0?u:!1}function wm(i,u){switch(i.kind){case Xt.NULL:return null;case Xt.INT:return parseInt(i.value,10);case Xt.FLOAT:return parseFloat(i.value);case Xt.STRING:case Xt.ENUM:case Xt.BOOLEAN:return i.value;case Xt.LIST:return i.values.map(o=>wm(o,u));case Xt.OBJECT:return Im(i.fields,o=>o.name.value,o=>wm(o.value,u));case Xt.VARIABLE:return u?.[i.name.value]}}function cr(i){if(i!=null||He(!1,"Must provide name."),typeof i=="string"||He(!1,"Expected name to be a string."),i.length===0)throw new Bn("Expected name to be a non-empty string.");for(let u=1;u<i.length;++u)if(!f0(i.charCodeAt(u)))throw new Bn(`Names must only contain [_a-zA-Z0-9] but "${i}" does not.`);if(!c0(i.charCodeAt(0)))throw new Bn(`Names must start with [_a-zA-Z] but "${i}" does not.`);return i}function F0(i){if(i==="true"||i==="false"||i==="null")throw new Bn(`Enum values cannot be named: ${i}`);return cr(i)}function ll(i){return U0(i)||M0(i)||W0(i)||B0(i)||j0(i)||$0(i)||k0(i)||Rm(i)}function U0(i){return Ui(i,nv)}function M0(i){return Ui(i,H0)}function W0(i){return Ui(i,J0)}function B0(i){return Ui(i,X0)}function j0(i){return Ui(i,K0)}function $0(i){return Ui(i,ey)}function k0(i){return Ui(i,V0)}function Rm(i){return Ui(i,G0)}class V0{constructor(u){ll(u)||He(!1,`Expected ${jn(u)} to be a GraphQL type.`),this.ofType=u}get[Symbol.toStringTag](){return"GraphQLList"}toString(){return"["+String(this.ofType)+"]"}toJSON(){return this.toString()}}class G0{constructor(u){q0(u)||He(!1,`Expected ${jn(u)} to be a GraphQL nullable type.`),this.ofType=u}get[Symbol.toStringTag](){return"GraphQLNonNull"}toString(){return String(this.ofType)+"!"}toJSON(){return this.toString()}}function q0(i){return ll(i)&&!Rm(i)}function ev(i){return typeof i=="function"?i():i}function tv(i){return typeof i=="function"?i():i}class nv{constructor(u){var o,h,m,A;const S=(o=u.parseValue)!==null&&o!==void 0?o:Mm;this.name=cr(u.name),this.description=u.description,this.specifiedByURL=u.specifiedByURL,this.serialize=(h=u.serialize)!==null&&h!==void 0?h:Mm,this.parseValue=S,this.parseLiteral=(m=u.parseLiteral)!==null&&m!==void 0?m:(C,R)=>S(wm(C,R)),this.extensions=xr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(A=u.extensionASTNodes)!==null&&A!==void 0?A:[],u.specifiedByURL==null||typeof u.specifiedByURL=="string"||He(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${jn(u.specifiedByURL)}.`),u.serialize==null||typeof u.serialize=="function"||He(!1,`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`),u.parseLiteral&&(typeof u.parseValue=="function"&&typeof u.parseLiteral=="function"||He(!1,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`))}get[Symbol.toStringTag](){return"GraphQLScalarType"}toConfig(){return{name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class H0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.isTypeOf=u.isTypeOf,this.extensions=xr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._fields=()=>iv(u),this._interfaces=()=>rv(u),u.isTypeOf==null||typeof u.isTypeOf=="function"||He(!1,`${this.name} must provide "isTypeOf" as a function, but got: ${jn(u.isTypeOf)}.`)}get[Symbol.toStringTag](){return"GraphQLObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:ov(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function rv(i){var u;const o=ev((u=i.interfaces)!==null&&u!==void 0?u:[]);return Array.isArray(o)||He(!1,`${i.name} interfaces must be an Array or a function which returns an Array.`),o}function iv(i){const u=tv(i.fields);return aa(u)||He(!1,`${i.name} fields must be an object with field names as keys or a function which returns such an object.`),Pf(u,(o,h)=>{var m;aa(o)||He(!1,`${i.name}.${h} field config must be an object.`),o.resolve==null||typeof o.resolve=="function"||He(!1,`${i.name}.${h} field resolver must be a function if provided, but got: ${jn(o.resolve)}.`);const A=(m=o.args)!==null&&m!==void 0?m:{};return aa(A)||He(!1,`${i.name}.${h} args must be an object with argument names as keys.`),{name:cr(h),description:o.description,type:o.type,args:Y0(A),resolve:o.resolve,subscribe:o.subscribe,deprecationReason:o.deprecationReason,extensions:xr(o.extensions),astNode:o.astNode}})}function Y0(i){return Object.entries(i).map(([u,o])=>({name:cr(u),description:o.description,type:o.type,defaultValue:o.defaultValue,deprecationReason:o.deprecationReason,extensions:xr(o.extensions),astNode:o.astNode}))}function aa(i){return Qm(i)&&!Array.isArray(i)}function ov(i){return Pf(i,u=>({description:u.description,type:u.type,args:Q0(u.args),resolve:u.resolve,subscribe:u.subscribe,deprecationReason:u.deprecationReason,extensions:u.extensions,astNode:u.astNode}))}function Q0(i){return Im(i,u=>u.name,u=>({description:u.description,type:u.type,defaultValue:u.defaultValue,deprecationReason:u.deprecationReason,extensions:u.extensions,astNode:u.astNode}))}class J0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.resolveType=u.resolveType,this.extensions=xr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._fields=iv.bind(void 0,u),this._interfaces=rv.bind(void 0,u),u.resolveType==null||typeof u.resolveType=="function"||He(!1,`${this.name} must provide "resolveType" as a function, but got: ${jn(u.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLInterfaceType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:ov(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class X0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.resolveType=u.resolveType,this.extensions=xr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._types=Z0.bind(void 0,u),u.resolveType==null||typeof u.resolveType=="function"||He(!1,`${this.name} must provide "resolveType" as a function, but got: ${jn(u.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLUnionType"}getTypes(){return typeof this._types=="function"&&(this._types=this._types()),this._types}toConfig(){return{name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Z0(i){const u=ev(i.types);return Array.isArray(u)||He(!1,`Must provide Array of types or a function which returns such an array for Union ${i.name}.`),u}class K0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.extensions=xr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._values=typeof u.values=="function"?u.values:jm(this.name,u.values),this._valueLookup=null,this._nameLookup=null}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){return typeof this._values=="function"&&(this._values=jm(this.name,this._values())),this._values}getValue(u){return this._nameLookup===null&&(this._nameLookup=A0(this.getValues(),o=>o.name)),this._nameLookup[u]}serialize(u){this._valueLookup===null&&(this._valueLookup=new Map(this.getValues().map(h=>[h.value,h])));const o=this._valueLookup.get(u);if(o===void 0)throw new Bn(`Enum "${this.name}" cannot represent value: ${jn(u)}`);return o.name}parseValue(u){if(typeof u!="string"){const h=jn(u);throw new Bn(`Enum "${this.name}" cannot represent non-string value: ${h}.`+Tf(this,h))}const o=this.getValue(u);if(o==null)throw new Bn(`Value "${u}" does not exist in "${this.name}" enum.`+Tf(this,u));return o.value}parseLiteral(u,o){if(u.kind!==Xt.ENUM){const m=Bm(u);throw new Bn(`Enum "${this.name}" cannot represent non-enum value: ${m}.`+Tf(this,m),{nodes:u})}const h=this.getValue(u.value);if(h==null){const m=Bm(u);throw new Bn(`Value "${m}" does not exist in "${this.name}" enum.`+Tf(this,m),{nodes:u})}return h.value}toConfig(){const u=Im(this.getValues(),o=>o.name,o=>({description:o.description,value:o.value,deprecationReason:o.deprecationReason,extensions:o.extensions,astNode:o.astNode}));return{name:this.name,description:this.description,values:u,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Tf(i,u){const o=i.getValues().map(m=>m.name),h=T0(u,o);return w0("the enum value",h)}function jm(i,u){return aa(u)||He(!1,`${i} values must be an object with value names as keys.`),Object.entries(u).map(([o,h])=>(aa(h)||He(!1,`${i}.${o} must refer to an object with a "value" key representing an internal value but got: ${jn(h)}.`),{name:F0(o),description:h.description,value:h.value!==void 0?h.value:o,deprecationReason:h.deprecationReason,extensions:xr(h.extensions),astNode:h.astNode}))}class ey{constructor(u){var o,h;this.name=cr(u.name),this.description=u.description,this.extensions=xr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this.isOneOf=(h=u.isOneOf)!==null&&h!==void 0?h:!1,this._fields=ty.bind(void 0,u)}get[Symbol.toStringTag](){return"GraphQLInputObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}toConfig(){const u=Pf(this.getFields(),o=>({description:o.description,type:o.type,defaultValue:o.defaultValue,deprecationReason:o.deprecationReason,extensions:o.extensions,astNode:o.astNode}));return{name:this.name,description:this.description,fields:u,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,isOneOf:this.isOneOf}}toString(){return this.name}toJSON(){return this.toString()}}function ty(i){const u=tv(i.fields);return aa(u)||He(!1,`${i.name} fields must be an object with field names as keys or a function which returns such an object.`),Pf(u,(o,h)=>(!("resolve"in o)||He(!1,`${i.name}.${h} field has a resolve property, but Input Types cannot define resolvers.`),{name:cr(h),description:o.description,type:o.type,defaultValue:o.defaultValue,deprecationReason:o.deprecationReason,extensions:xr(o.extensions),astNode:o.astNode}))}function Mi(i){const u=ny(i);if(u)throw u;return i}function ny(i){if(typeof i=="string"||He(!1,"Expected name to be a string."),i.startsWith("__"))return new Bn(`Name "${i}" must not begin with "__", which is reserved by GraphQL introspection.`);try{cr(i)}catch(u){return u}}const ry=i=>i.scalarType({name:"ID",asNexusMethod:"id",description:"id as string or integer",serialize:u=>u,parseValue(u){const o=parseInt(u);return ze.isNumber(o)?o:u},parseLiteral(u){return u.kind===Xt.INT||u.kind===Xt.STRING?u.value:null}}),iy=i=>i.inputObjectType({name:"IdentifyCommentAuthor",definition(u){u.nonNull.id("id")}}),oy=i=>i.inputObjectType({name:"RemoveComment",definition(u){u.id("id"),u.nonNull.string("relation"),u.field("author",{type:"IdentifyCommentAuthor"})}}),uy=i=>i.objectType({name:"Report",definition(u){u.id("id"),u.nonNull.string("content"),u.field("reason",{type:"ReportReason"}),u.field("related",{type:"CommentSingle"}),u.string("createdAt"),u.string("updatedAt")}}),ay=(i,{reportReasons:u})=>i.enumType({name:"ReportReason",description:"Reason of abuse report",members:Object.values(u)}),sy=i=>i.objectType({name:"ResponseFindAll",definition(u){u.nonNull.list.field("data",{type:"CommentSingle"}),u.field("meta",{type:"ResponseMeta"})}}),ly=i=>i.objectType({name:"ResponseFindAllPerAuthor",definition(u){u.nonNull.list.field("data",{type:"CommentSingle"}),u.field("meta",{type:"ResponseMeta"})}}),cy=i=>i.objectType({name:"ResponseMeta",definition(u){u.field("pagination",{type:"ResponsePagination"})}}),fy=i=>i.objectType({name:"ResponsePagination",definition(u){u.int("page"),u.int("pageSize"),u.int("pageCount"),u.int("total"),u.int("start"),u.int("limit")}}),hy=i=>i.inputObjectType({name:"UpdateComment",definition(u){u.id("id"),u.nonNull.string("content"),u.nonNull.string("relation"),u.field("author",{type:"IdentifyCommentAuthor"})}}),py=[Xv,Zv,Kv,e0,t0,n0,r0,ry,iy,oy,ay,sy,ly,cy,fy,hy,uy],dy=(i,u)=>py.map(o=>o(u,i)),uv=i=>i.plugin("graphql").service("extension"),gy=i=>{const u=uv(i);u.shadowCRUD(lr(i,"comment")).disable(),u.shadowCRUD(lr(i,"comment")).disableQueries(),u.shadowCRUD(lr(i,"comment")).disableMutations(),u.shadowCRUD(lr(i,"comment-report")).disable(),u.shadowCRUD(lr(i,"comment-report")).disableQueries(),u.shadowCRUD(lr(i,"comment-report")).disableMutations()},my=async({strapi:i})=>{i.plugin("graphql")&&(gy(i),(await ft(i,"common").getConfig(oa.ENABLED_COLLECTIONS,[])).length&&await vy(i))},vy=async i=>{const u=uv(i),o=await ft(i,"common").getConfig();u.use(({strapi:h,nexus:m})=>{const A=dy(o,m),S=Jv(h,m),C=Gv(h,m),R=Bv(o);return{types:[A,S,C],resolversConfig:R}})},ra={comments:{read:"comments-read",moderate:"comments-moderate"},reports:{read:"reports-read",review:"reports-review"},settings:{read:"settings-read",change:"settings-change"}},yy=async({strapi:i})=>{if(i.plugin("graphql")&&await my({strapi:i}),Object.keys(i.plugins).indexOf("users-permissions")===-1)throw new Error("In order to make the comments plugin work the users-permissions plugin is required");const u=[{section:"plugins",displayName:"Comments: Read",uid:ra.comments.read,pluginName:"comments"},{section:"plugins",displayName:"Comments: Moderate",uid:ra.comments.moderate,pluginName:"comments"},{section:"plugins",displayName:"Reports: Read",uid:ra.reports.read,pluginName:"comments"},{section:"plugins",displayName:"Reports: Moderate",uid:ra.reports.review,pluginName:"comments"},{section:"plugins",displayName:"Settings: Read",uid:ra.settings.read,pluginName:"comments"},{section:"plugins",displayName:"Settings: Change",uid:ra.settings.change,pluginName:"comments"}];await i.admin.services.permission.actionProvider.registerMany(u)},_y={isValidationEnabled:!0,enabledCollections:[],moderatorRoles:[],approvalFlow:[],entryLabel:{"*":["Title","title","Name","name","Subject","subject"]},reportReasons:{BAD_LANGUAGE:Zt.BAD_LANGUAGE,DISCRIMINATION:Zt.DISCRIMINATION,OTHER:Zt.OTHER},blockedAuthorProps:[]},by=v.z.object({[Zt.BAD_LANGUAGE]:v.z.literal(Zt.BAD_LANGUAGE),[Zt.OTHER]:v.z.literal(Zt.OTHER),[Zt.DISCRIMINATION]:v.z.literal(Zt.DISCRIMINATION)}),Am=v.z.object({isValidationEnabled:v.z.boolean().optional(),reportReasons:by.optional(),isGQLPluginEnabled:v.z.boolean().optional(),[Cr.ENABLED_COLLECTIONS]:v.z.array(v.z.string()),[Cr.MODERATOR_ROLES]:v.z.array(v.z.string()),[Cr.APPROVAL_FLOW]:v.z.array(v.z.string()),[Cr.ENTRY_LABEL]:v.z.record(v.z.array(v.z.string())),[Cr.BAD_WORDS]:v.z.boolean().optional(),[Cr.AUTHOR_BLOCKED_PROPS]:v.z.array(v.z.string()),gql:v.z.object({auth:v.z.boolean().optional()}).optional(),client:v.z.object({url:v.z.string().nullable(),contactEmail:v.z.string().nullable()}).default({url:null,contactEmail:null})}),wy={default:Am.parse(_y),validate:i=>Am.safeParse(i)},Y=({left:i,right:u})=>{if(u!==void 0&&i!==void 0)throw new Error(`Received both left and right values at runtime when opening an Either
|
|
80
80
|
Left: ${JSON.stringify(i)}
|
|
81
|
-
Right: ${JSON.stringify(u)}`);if(i!==void 0)return i;if(u!==void 0)return u;throw new Error("Received no left or right values at runtime when opening Either")},
|
|
82
|
-
`);return av(new An(400,u))}return ol(i.data)},Ff=i=>v.z.string().regex(vm.relatedUid,{message:'Field "relation" got incorrect format, use format like "api::<collection name>.<content type name>:<document id>"'}).refine(u=>i.some(o=>u.startsWith(o)),"Invalid relation or not enabled collections"),Ny=v.z.object({id:v.z.union([v.z.number(),v.z.string()]),name:v.z.string().min(1).max(100).optional(),email:v.z.string().email(),avatar:v.z.string().url().optional()});v.z.union([v.z.string(),v.z.number(),v.z.boolean()]);const cv=xy.merge(v.z.object({_q:v.z.string().optional()})),Jr=i=>Nt(sa({id:Zr.single}).safeParse(i)),zy=i=>Nt(cv.safeParse(i)),Ly=i=>Nt(cv.safeParse(i)),Dy=(i,u)=>{const o=sa({id:Zr.single}).merge(v.z.object({removed:v.z.string().optional().transform(h=>h==="true")})).safeParse({...u,id:i});return Nt(o)},Py=i=>Nt(sa({id:Zr.single,reportId:Zr.single}).safeParse(i)),Fy=i=>{const u=sa({id:Zr.single,reportIds:Zr.array}).safeParse(i);return Nt(u)},Uy=i=>{const u=sa({reportIds:Zr.array}).safeParse(i);return Nt(u)},My=v.z.object({id:v.z.union([v.z.string(),v.z.number()]),email:v.z.string().email(),lastname:v.z.string().nullable().optional(),username:v.z.string().nullable().optional(),firstname:v.z.string().nullable().optional()}),fv=v.z.object({id:v.z.union([v.z.string(),v.z.number()]),content:v.z.string(),author:My}),Wy=i=>Nt(fv.safeParse(i)),By=i=>Nt(fv.pick({content:!0,id:!0}).safeParse(i)),jy=i=>Nt(Am.safeParse(i)),hv=i=>v.z.object({relation:Ff(i),content:v.z.string().min(1),author:Ny.optional(),threadOf:v.z.union([v.z.string(),v.z.number()]).optional(),approvalStatus:v.z.nativeEnum(Fi).optional(),locale:v.z.string().optional()}),$y=(i,u,o)=>Nt(hv(i).safeParse({...o,relation:u})),ky=(i,u)=>Nt(hv(i).pick({content:!0,relation:!0,author:!0}).merge(sa({commentId:Zr.single})).safeParse(u)),Vy=i=>v.z.object({relation:Ff(i)}),Gy=v.z.object({pagination:v.z.object({pageSize:Xr.default(10),page:Xr.default(1),withCount:Em.optional().default(!1)}).optional()}),qy=v.z.record(v.z.union([v.z.union([v.z.boolean(),v.z.literal("true").transform(()=>!0),v.z.literal("false").transform(()=>!1),v.z.literal("*")]),v.z.record(v.z.any())])).optional(),xm=i=>{const u=Sm({id:!0,content:!0,authorId:!0,authorName:!0,authorEmail:!0,createdAt:!0,updatedAt:!0,removed:!0,blocked:!0,blockedThread:!0,approvalStatus:!0,isAdminComment:!0,threadOf:!0});return v.z.object({sort:lv.optional().nullable().default("createdAt:desc"),fields:v.z.string().array().optional(),omit:v.z.string().array().optional(),filters:u.merge(v.z.object({$and:u.array().min(1).optional(),$or:u.array().min(1).optional()})).optional(),isAdmin:v.z.boolean().optional().default(!1),populate:qy,limit:Xr.optional(),skip:Xr.optional(),locale:v.z.string().optional()}).merge(Vy(i)).merge(Gy)},Hy=(i,u,o)=>Nt(xm(i).safeParse({...o,relation:u})),Yy=(i,u,o)=>{const h=xm(i).pick({sort:!0,fields:!0,omit:!0,filters:!0,isAdmin:!0,populate:!0,limit:!0,skip:!0,relation:!0,locale:!0,pagination:!0}).merge(v.z.object({startingFromId:v.z.number().optional(),dropBlockedThreads:v.z.boolean().optional().default(!1)}));return Nt(h.safeParse({...o,relation:u}))},Qy=(i,u)=>{const o=xm([]).pick({sort:!0,fields:!0,omit:!0,isAdmin:!0,populate:!0,limit:!0,skip:!0,pagination:!0,filters:!0,locale:!0}).merge(v.z.object({type:v.z.union([v.z.literal(ul.GENERIC),v.z.literal("generic")]).optional(),authorId:v.z.union([v.z.string(),v.z.number()])}));return Nt(o.safeParse({...u,...i}))},Jy=i=>v.z.object({relation:Ff(i[Cr.ENABLED_COLLECTIONS]),commentId:Xr,content:v.z.string().min(1),reason:v.z.nativeEnum(i.reportReasons)}),Xy=(i,u)=>Nt(Jy(i).safeParse(u)),Zy=i=>v.z.object({relation:Ff(i),commentId:v.z.union([v.z.string(),v.z.number()]),authorId:v.z.union([v.z.string(),v.z.number()])}),Ky=(i,u)=>Nt(Zy(i).safeParse(u)),e_=({strapi:i})=>({getService(u){return ft(i,u)},async findAll(u){const o=zy(u.query);if(pe(o))return this.getService("admin").findAll(Y(o));throw ce(u,Y(o))},async findReports(u){const o=Ly(u.query);if(pe(o))return this.getService("admin").findReports(Y(o));throw ce(u,Y(o))},async findOne(u){const o=Dy(u.params.id,u.query);if(pe(o))return this.getService("admin").findOneAndThread(Y(o));throw ce(u,Y(o))},async blockComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").changeBlockedComment(Y(o).id,!0);throw ce(u,Y(o))},async unblockComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").changeBlockedComment(Y(o).id,!1);throw ce(u,Y(o))},async deleteComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").deleteComment(Y(o).id);throw ce(u,Y(o))},async blockCommentThread(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").blockCommentThread(Y(o).id,!0);throw ce(u,Y(o))},async unblockCommentThread(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").blockCommentThread(Y(o).id,!1);throw ce(u,Y(o))},async resolveAbuseReport(u){const o=Py(u.params);if(pe(o))return this.getService("admin").resolveAbuseReport(Y(o));throw ce(u,Y(o))},async resolveCommentMultipleAbuseReports(u){const o=Fy({...u.request.body,id:u.params.id});if(pe(o))return this.getService("admin").resolveCommentMultipleAbuseReports(Y(o));throw ce(u,Y(o))},async resolveAllAbuseReportsForComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").resolveAllAbuseReportsForComment(Y(o).id);throw ce(u,Y(o))},async resolveAllAbuseReportsForThread(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").resolveAllAbuseReportsForThread(Y(o).id);throw ce(u,Y(o))},async resolveMultipleAbuseReports(u){const o=Uy(u.request.body);if(pe(o))return this.getService("admin").resolveMultipleAbuseReports(Y(o));throw ce(u,Y(o))},async postComment(u){const o=Wy({id:u.params.id,content:u.request.body.content,author:u.request.body.author});if(pe(o))return this.getService("admin").postComment(Y(o));throw ce(u,Y(o))},async updateComment(u){const o=By({id:u.params.id,content:u.request.body.content});if(pe(o))return this.getService("admin").updateComment(Y(o));throw ce(u,Y(o))},async approveComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").approveComment(Y(o).id);throw ce(u,Y(o))},async rejectComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").rejectComment(Y(o).id);throw ce(u,Y(o))}}),Ir=async(i,u,o)=>Uf(i).getLocalConfig(u,o),nl=v.z.object({url:v.z.string(),name:v.z.string(),hash:v.z.string()}),pv=v.z.object({id:v.z.number(),...nl.shape,formats:v.z.object({thumbnail:nl.optional(),small:nl.optional(),medium:nl.optional(),large:nl.optional()}).optional()}).nullable().optional(),dv=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),blocked:v.z.boolean().nullable(),blockedThread:v.z.boolean().nullable(),blockReason:v.z.string().nullable(),isAdminComment:v.z.boolean().nullable(),removed:v.z.boolean().nullable(),approvalStatus:v.z.string().nullable(),related:v.z.string(),createdAt:v.z.string(),updatedAt:v.z.string().nullable(),publishedAt:v.z.string().nullable(),authorId:v.z.string().nullable(),authorName:v.z.string().nullable(),authorEmail:v.z.string().email().nullable(),authorAvatar:v.z.string().nullable(),authorUser:v.z.union([v.z.string(),v.z.object({id:v.z.number(),username:v.z.string(),email:v.z.string().email(),avatar:pv})]).optional().nullable(),locale:v.z.string().nullable()}),gv=v.z.object({page:v.z.number(),pageSize:v.z.number(),pageCount:v.z.number(),total:v.z.number()}),Pi=(i,u)=>o=>i?u.parseAsync(o):Promise.resolve(o),mv=(i,u)=>o=>i?u.parseAsync(o):Promise.resolve(o),t_=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable()}),$m=dv.merge(v.z.object({gotThread:v.z.boolean().nullable().optional(),threadFirstItemId:v.z.number().nullable().optional(),reports:v.z.array(t_).default([]),author:v.z.any().nullable().optional()})),al=$m.extend({threadOf:v.z.lazy(()=>v.z.union([v.z.number(),$m])).nullable().optional()}),n_=v.z.object({id:v.z.number(),uid:v.z.string(),documentId:v.z.string(),requireCommentsApproval:v.z.boolean().nullable().optional(),locale:v.z.string().nullable().optional()});al.omit({related:!0}).extend({related:n_.nullable().optional()});const r_=v.z.array(al),i_=v.z.object({pagination:gv,results:v.z.array(al)}),ia={findMany:r_,findWithCount:i_,findOne:al,create:al},o_=v.z.object({id:v.z.number(),documentId:v.z.string(),content:v.z.string(),blocked:v.z.boolean(),blockedThread:v.z.boolean(),blockReason:v.z.string().nullable(),authorId:v.z.string().nullable(),authorName:v.z.string().nullable(),authorEmail:v.z.string().nullable(),authorAvatar:v.z.string().nullable(),authorUser:v.z.union([v.z.string(),v.z.object({id:v.z.number(),username:v.z.string(),email:v.z.string().email(),avatar:pv})]).optional().nullable(),isAdminComment:v.z.boolean().nullable(),removed:v.z.boolean().nullable(),approvalStatus:v.z.string().nullable(),related:v.z.string(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string(),locale:v.z.string().nullable()}),vv=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable(),related:o_.nullable().optional()}),u_=v.z.object({results:v.z.array(vv),pagination:gv}),a_=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable()}),s_=v.z.array(v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable(),related:dv.nullable()})),Of={findMany:s_,findPage:u_,update:a_,create:vv},l_=i=>{const u=lr(i,"comment-report"),o=i.query(u);return{async findPage(h){const m=await Ir(i,"isValidationEnabled",!1);return o.findPage(h).then(Pi(m,Of.findPage))},async findMany(h){const m=await Ir(i,"isValidationEnabled",!1);return o.findMany(h).then(mv(m,Of.findMany))},async update(h){const m=await Ir(i,"isValidationEnabled",!1);return o.update(h).then(Pi(m,Of.update))},async updateMany(h){return o.updateMany(h)},async create(h){const m=await Ir(i,"isValidationEnabled",!1);return o.create(h).then(Pi(m,Of.create))}}},Di=ze.once(l_),c_=i=>{const u=lr(i,"comment");return{async findMany(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).findMany(o).then(mv(h,ia.findMany))},async findWithCount(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).findPage(o).then(Pi(h,ia.findWithCount))},async findOne(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).findOne(o).then(m=>m?Pi(h,ia.findOne)(m):null)},async update(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).update(o).then(Pi(h,ia.findOne))},async delete(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).delete(o).then(m=>m?Pi(h,ia.findOne)(m):null)},async deleteMany(o){return i.query(u).deleteMany(o)},updateMany(o){return i.query(u).updateMany(o)},async create(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).create(o).then(Pi(h,ia.create))}}},it=ze.once(c_),f_=i=>({getLocalConfig(u,o){return i.config.get([Cv,u].filter(Boolean).join("."),o)},async getStore(){return await i.store({type:"plugin",name:"comments"})},async getConfig(){return await(await this.getStore()).get({key:"config"})},async get(u){const o=await this.getConfig(),h={regex:Object.keys(vm).reduce((O,F)=>({...O,[F]:vm[F].toString()}),{})},m=!!i.plugin("graphql"),A=this.getLocalConfig("reportReasons");if(o)return ol({...o,...h,reportReasons:A,isGQLPluginEnabled:u?m:void 0});const S=this.getLocalConfig("entryLabel"),C=this.getLocalConfig("approvalFlow"),R=this.getLocalConfig("blockedAuthorProps"),N={entryLabel:S,approvalFlow:C,blockedAuthorProps:R,reportReasons:A,...h};if(u){const O=this.getLocalConfig("enabledCollections"),F=this.getLocalConfig("moderatorRoles");return ol({...N,enabledCollections:O,moderatorRoles:F,isGQLPluginEnabled:m})}return ol(N)},async update(u){return await(await this.getStore()).set({key:"config",value:{...u,reportReasons:{BAD_LANGUAGE:Zt.BAD_LANGUAGE,DISCRIMINATION:Zt.DISCRIMINATION,OTHER:Zt.OTHER}}}),this.get()},async restore(){return await(await this.getStore()).delete({key:"config"}),this.get()}}),Uf=ze.once(f_),h_=({strapi:i})=>({getService(u){return ft(i,u)},getStoreRepository(){return Uf(i)},async post(u){const o=await this.getStoreRepository().get(!0);if(pe(o)){const h=Y(o),m=$y(h.enabledCollections,u.params.relation,u.request.body);if(pe(m))return this.getService("client").create(m.right,u.state.user);throw ce(u,Y(m))}throw ce(u,Y(o))},async findAllFlat(u){const o=await this.getStoreRepository().get(!0);if(pe(o)){const h=Y(o),m=Hy(h.enabledCollections,u.params.relation,u.query);if(pe(m))return this.getService("common").findAllFlat(ua(m.right));throw ce(u,Y(m))}throw ce(u,Y(o))},async findAllInHierarchy(u){const o=await this.getStoreRepository().get(!0);if(pe(o)){const h=Y(o),m=Yy(h.enabledCollections,u.params.relation,u.query);if(pe(m))return this.getService("common").findAllInHierarchy(ua(m.right));throw ce(u,Y(m))}throw ce(u,Y(o))},async findAllPerAuthor(u){const o=Qy(u.params,u.query);if(pe(o))return this.getService("common").findAllPerAuthor(ua(o.right),u.params.type?![ul.GENERIC.toLowerCase(),ul.GENERIC].includes(u.params.type):!1);throw ce(u,Y(o))},async put(u){const{user:o}=u.state,h=await this.getStoreRepository().get(!0);if(pe(h)){const m=Y(h),A=ky(m.enabledCollections,{...u.params,content:u.request.body.content,author:u.request.body.author});if(pe(A))return await this.getService("client").update(A.right,o);throw ce(u,Y(A))}throw ce(u,Y(h))},async reportAbuse(u){const{state:o}=u,{user:h}=o,m=await this.getStoreRepository().get(!0);if(pe(m)){const A=Y(m),S=Xy(A,{...u.request.body,...u.params});if(pe(S))return await this.getService("client").reportAbuse(S.right,h);throw ce(u,Y(S))}throw ce(u,Y(m))},async removeComment(u){const{state:o}=u,{user:h}=o,m=await this.getStoreRepository().get(!0);if(pe(m)){const A=Y(m),S=Ky(A.enabledCollections,{...u.query,...u.params});if(pe(S))return await this.getService("client").markAsRemoved(S.right,h);throw ce(u,Y(S))}throw ce(u,Y(m))}}),p_=({strapi:i})=>{const u=ft(i,"settings");return{async get(o){try{return await u.getConfig()}catch(h){throw ce(o,h)}},async getForSettingsPage(o){try{return await u.getConfig(!0)}catch(h){throw ce(o,h)}},async update(o){const h=jy(o.request.body);if(pe(h))return await u.update(Y(h));throw ce(o,Y(h))},async restore(o){try{return await u.restore()}catch(h){throw ce(o,h)}},async restart(o){try{return u.restart(),o.send({message:"Restarted",status:200})}catch(h){throw ce(o,h)}}}},d_={admin:e_,client:h_,settings:p_},g_=[{method:"GET",path:"/moderate/all",handler:"admin.findAll",config:{policies:[]}},{method:"GET",path:"/moderate/reports",handler:"admin.findReports",config:{policies:[]}},{method:"GET",path:"/moderate/single/:id",handler:"admin.findOne",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/approve",handler:"admin.approveComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/reject",handler:"admin.rejectComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/block",handler:"admin.blockComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/unblock",handler:"admin.unblockComment",config:{policies:[]}},{method:"DELETE",path:"/moderate/single/:id/delete",handler:"admin.deleteComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/report/:reportId/resolve",handler:"admin.resolveAbuseReport",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/report/resolve",handler:"admin.resolveCommentMultipleAbuseReports",config:{policies:[]}},{method:"PUT",path:"/moderate/all/:id/report/resolve",handler:"admin.resolveAllAbuseReportsForComment",config:{policies:[]}},{method:"PUT",path:"/moderate/all/:id/report/resolve-thread",handler:"admin.resolveAllAbuseReportsForThread",config:{policies:[]}},{method:"PUT",path:"/moderate/multiple/report/resolve",handler:"admin.resolveMultipleAbuseReports",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/update",handler:"admin.updateComment",config:{policies:[]}},{method:"PUT",path:"/moderate/thread/:id/block",handler:"admin.blockCommentThread",config:{policies:[]}},{method:"PUT",path:"/moderate/thread/:id/unblock",handler:"admin.unblockCommentThread",config:{policies:[]}},{method:"POST",path:"/moderate/thread/:id/postComment",handler:"admin.postComment",config:{policies:[]}}],m_=[{method:"PUT",path:"/settings/config",handler:"settings.update",config:{policies:[]}},{method:"DELETE",path:"/settings/config",handler:"settings.restore",config:{policies:[]}},{method:"POST",path:"/settings/restart",handler:"settings.restart",config:{policies:[]}},{method:"GET",path:"/settings/config",handler:"settings.getForSettingsPage",config:{policies:[]}},{method:"GET",path:"/moderate/config",handler:"settings.get",config:{policies:[]}}],v_=[...g_,...m_],y_=[{method:"GET",path:"/:relation",handler:"client.findAllInHierarchy",config:{policies:[],description:"Find all comments related to configured Collection / Single Type and return them in a nested structure",tag:{plugin:"comments",name:"Comments",actionType:"find"}}},{method:"POST",path:"/:relation",handler:"client.post",config:{policies:[],description:"Post a comment against configured Collection / Single Type",tag:{plugin:"comments",name:"Comments",actionType:"create"}}},{method:"GET",path:"/:relation/flat",handler:"client.findAllFlat",config:{policies:[],description:"Find all comments related to configured Collection / Single Type and return them in a flat structure for further processing",tag:{plugin:"comments",name:"Comments",actionType:"find"}}},{method:"PUT",path:"/:relation/comment/:commentId",handler:"client.put",config:{policies:[],description:"Update comment related to configured Collection / Single Type if user is the author",tag:{plugin:"comments",name:"Comments",actionType:"update"}}},{method:"POST",path:"/:relation/comment/:commentId/report-abuse",handler:"client.reportAbuse",config:{policies:[],description:"Report an abuse against comment for configured Collection / Single Type",tag:{plugin:"comments",name:"Comments",actionType:"create"}}},{method:"DELETE",path:"/:relation/comment/:commentId",handler:"client.removeComment",config:{policies:[],description:"Remove comment related to configured Collection / Single Type if user is the author",tag:{plugin:"comments",name:"Comments",actionType:"delete"}}},{method:"GET",path:"/author/:authorId",handler:"client.findAllPerAuthor",config:{policies:[],description:"Find all comments created by Strapi user",tag:{plugin:"comments",name:"Comments",actionType:"find"}}},{method:"GET",path:"/author/:authorId/:type",handler:"client.findAllPerAuthor",config:{policies:[],description:"Find all comments created by specified type of user",tag:{plugin:"comments",name:"Comments",actionType:"find"}}}],__={"content-api":{type:"content-api",routes:y_},admin:{type:"admin",routes:v_}};class fn extends Error{constructor(u,o,h=void 0){super(),this.name="Strapi:Plugin:Comments",this.status=u||500,this.message=o||"Internal error",this.payload=h,Object.setPrototypeOf(this,fn.prototype)}toString(u=this){return`${u.name} - ${u.message}`}toJSON(){return this.payload?{...this.payload,name:this.name,message:this.message}:this}}const km=i=>i.split(Gv.relatedUid).filter(u=>u&&u.length>0),yv=i=>i&&{...i,reports:(i.reports||[]).filter(u=>!u.resolved)},Vm=(i,u,o=[])=>{const{authorUser:h,authorId:m,authorName:A,authorEmail:S,authorAvatar:C,...R}=i;let N={};if(h&&typeof h!="string"){const O=h;N=o.reduce((F,U)=>({...F,[U]:O[U]}),{id:O.id,name:O.username,email:O.email,avatar:O.avatar?.formats?.thumbnail.url||O.avatar?.url})}else m&&(N={id:m,name:A,email:S,avatar:C});return N=ze.isEmpty(N)?N:Object.fromEntries(Object.entries(N).filter(([O])=>!u.includes(O))),{...R,author:ze.isEmpty(N)?i.author||{}:N}},Cf=i=>{throw i?new fn(401,"Not authenticated"):new fn(403,"Not authorized")},b_=i=>{const{lastname:u,username:o,firstname:h}=i;return u&&h?`${h} ${u}`:o||h||""},w_=ze.once(i=>({findAll:{createParams(u,o,h,m,A){const[S,C]=ym(u),R={orderBy:u?{[S]:C}:void 0,where:A,page:o,pageSize:h};return m&&ze.set(R,"where.content.$contains",m),R},getPopulate(){return{authorUser:il(i),threadOf:{populate:{authorUser:il(i)}},reports:{where:{resolved:!1}}}}},findReports:{getDefaultWhere(){return{resolved:{$notNull:!0}}},createParams(u,o,h,m){const[A,S]=ym(u),C={orderBy:u?{[A]:S}:void 0,where:this.getDefaultWhere(),page:o,pageSize:h};return m&&ze.set(C,"where.content.$contains",m),C}},findOneAndThread:{getDefaultWhere(u){return u?{$or:[{removed:!1},{removed:{$notNull:!1}}]}:{}},getPopulate(){const u=il(i),o={reports:{where:{resolved:!1}}},h={populate:{threadOf:{populate:{...o}},...o}};return{populate:{...h.populate,authorUser:u,threadOf:{populate:{...h.populate.threadOf.populate,authorUser:u}}}}}}})),A_=({strapi:i})=>{const u=w_(i);return{getCommonService(){return ft(i,"common")},async findAll({_q:o,orderBy:h,page:m,pageSize:A,filters:S}){const C=u.findAll.createParams(h,m,A,o,S),R=u.findAll.getPopulate(),N=it(i),{pagination:O,results:F}=await N.findWithCount({...C,count:!0,populate:R}),U=await this.getCommonService().findRelatedEntitiesFor(F);return{pagination:O,result:F.map(Q=>this.getCommonService().sanitizeCommentEntity(Q,[],[])).map(Q=>this.getCommonService().mergeRelatedEntityTo(Q,U))}},async findReports({_q:o,orderBy:h,page:m,pageSize:A}){const S=u.findReports.createParams(h,m,A,o),C=il(i),{pagination:R,results:N}=await Di(i).findPage({...S,populate:{related:{populate:{authorUser:C}}}}),O=N.map(j=>typeof j.related=="object"?j.related.id:null).filter(Boolean),F=await it(i).findMany({where:{threadOf:O},populate:["threadOf"],limit:Number.MAX_SAFE_INTEGER}),U=Array.from(new Set(F.map(({threadOf:j})=>typeof j=="object"?j.id:null).filter(Boolean)));return{result:N.map(j=>{const J=U.includes(j.related.id),te=this.getCommonService(),X={...j,related:te.sanitizeCommentEntity({...j.related,gotThread:J},[])},ye=typeof C!="boolean"?C?.populate:{};return yv(te.sanitizeCommentEntity(X,[],[],ye))}),pagination:R}},async findOneAndThread({id:o,removed:h,...m}){const A=il(i),S=u.findOneAndThread.getDefaultWhere(h),C=u.findOneAndThread.getPopulate(),R=await it(i).findOne({...C,where:{id:o}});if(!R)throw new An(404,"Not found");const{relatedId:N,uid:O}=this.getCommonService().parseRelationString(R.related),F=await i.documents(O).findOne({documentId:N}).then(te=>{if(!te)throw new An(404,"Relation not found");return{...te,uid:O}}),U=R.threadOf&&typeof R.threadOf=="object"?R.threadOf.id:null,Q=await this.getCommonService().findAllInHierarchy({filters:{...S,...m,threadOf:U,related:R.related},...C,startingFromId:U,isAdmin:!0,limit:Number.MAX_SAFE_INTEGER},!1),j=typeof A!="boolean"?A?.populate:{},J=this.getCommonService().sanitizeCommentEntity({...R,threadOf:R.threadOf||null},[],[],j);return{entity:F,selected:J,level:Q}},async changeBlockedComment(o,h){const m=await this.getCommonService().findOne({id:o});return this.getCommonService().updateComment({id:o},{blocked:ze.isNil(h)?!m.blocked:h})},async deleteComment(o){return it(i).update({where:{id:o},data:{removed:!0}})},async blockCommentThread(o,h){const m=await this.getCommonService().findOne({id:o}),A=h||!m.blocked,S=await this.getCommonService().updateComment({id:o},{blocked:A,blockedThread:A});return await this.blockNestedThreads(o,A),this.getCommonService().sanitizeCommentEntity(S,[])},async approveComment(o){const h=await it(i).update({where:{id:o},data:{approvalStatus:Fi.APPROVED}});if(!h)throw new An(404,"Not found");return this.getCommonService().sanitizeCommentEntity(h,[])},async rejectComment(o){const h=await it(i).update({where:{id:o},data:{approvalStatus:Fi.REJECTED}});if(!h)throw new An(404,"Not found");return this.getCommonService().sanitizeCommentEntity(h,[])},async blockNestedThreads(o,h){return this.getCommonService().modifiedNestedNestedComments(o,"blockedThread",h)},async resolveAbuseReport({id:o,reportId:h}){return Di(i).update({where:{id:h,related:o},data:{resolved:!0}})},async resolveCommentMultipleAbuseReports({id:o,reportIds:h}){if((await Di(i).findMany({where:{id:h,related:o},populate:["related"]})).length===h.length)return Di(i).updateMany({where:{id:h},data:{resolved:!0}});throw new An(400,"At least one of selected reports got invalid comment entity relation. Try again.")},async resolveAllAbuseReportsForComment(o){if(!o)throw new An(400,"There is something wrong with comment Id. Try again.");return Di(i).updateMany({where:{related:o,resolved:!1},data:{resolved:!0}})},async resolveAllAbuseReportsForThread(o){if(!o)throw new An(400,"There is something wrong with comment Id. Try again.");const h=await it(i).findMany({where:{threadOf:o},select:["id"]});return Di(i).updateMany({where:{related:h.map(({id:m})=>m).concat([o]),resolved:!1},data:{resolved:!0}})},async resolveMultipleAbuseReports({reportIds:o}){return Di(i).updateMany({where:{id:{$in:o}},data:{resolved:!0}})},async postComment({id:o,author:h,content:m}){const A=await it(i).findOne({where:{id:o}});if(!A)throw new An(404,"Not found");return it(i).create({data:{content:m,threadOf:o,authorId:h.id,authorName:b_(h),authorEmail:h.email,related:A.related,isAdminComment:!0}})},async updateComment({id:o,content:h}){const m=await it(i).update({where:{id:o},data:{content:h}});if(!m)throw new An(404,"Not found");return this.getCommonService().sanitizeCommentEntity(m,[])}}},E_=async(i,u)=>{try{return ol(await i())}catch{return av(u)}},S_=({strapi:i})=>{const u=async(o,h)=>{if(h)return{authorUser:h.id};if(o)return{authorId:o.id,authorName:o.name,authorEmail:o.email,authorAvatar:o.avatar}};return{getCommonService(){return ft(i,"common")},async create({relation:o,content:h,threadOf:m,author:A,approvalStatus:S,locale:C},R){const{uid:N,relatedId:O}=this.getCommonService().parseRelationString(o),F=await i.documents(N).findOne({documentId:O,locale:C});if(!F)throw new fn(400,'Relation for field "related" does not exist. Check your payload please.');const Q=(await this.getCommonService().getConfig(oa.APPROVAL_FLOW,[])).includes(N)||F.requireCommentsApproval,j=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]),J=await E_(async()=>m?await this.getCommonService().findOne({id:m,related:o,locale:C||null}):null,new fn(400,"Thread does not exist"));if(_y(J))throw Y(J);const te=Y(J);if(!A&&!this.getCommonService().isValidUserContext(R))throw Cf(R);const[X,ye]=await Promise.all([this.getCommonService().checkBadWords(h),u(A,R)]),_e=!ze.isEmpty(ye)&&!(ye.authorId||ye.authorUser);if(ze.isEmpty(ye)||_e)throw new fn(400,`Not able to recognise author of a comment. Make sure you've provided "author" property in a payload or authenticated your request properly.`);if(Q&&S&&S!==Fi.PENDING)throw new fn(400,"Invalid approval status");const Ve={...await it(i).create({data:{...ye,threadOf:m,locale:C,content:X,related:o,approvalStatus:Q?Fi.PENDING:Fi.APPROVED},populate:{authorUser:{populate:["avatar"]}}}),threadOf:te},Ye=this.getCommonService().sanitizeCommentEntity(Ve,j);try{await this.sendResponseNotification(Ye)}catch(Me){console.error(Me)}return Ye},async update({commentId:o,content:h,author:m,relation:A},S){if(!m&&!this.getCommonService().isValidUserContext(S))throw Cf(S);const C=S?.id||m?.id;if(await this.getCommonService().checkBadWords(h)){const R=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]),N=await this.getCommonService().findOne({id:o,related:A});if(N&&N.author?.id?.toString()===C?.toString()){const O=await it(i).update({where:{id:o},data:{content:h},populate:{threadOf:!0,authorUser:{populate:["avatar"]}}});return this.getCommonService().sanitizeCommentEntity(O,R)}}},async reportAbuse({commentId:o,relation:h,...m},A){if(!this.getCommonService().isValidUserContext(A))throw Cf(A);try{const S=await this.getCommonService().findOne({id:o,related:h});if(S.isAdminComment)throw new fn(403,"You're not allowed to take an action on that entity. This in a admin comment.");if(S){const C=await Di(i).create({data:{...m,resolved:!1,related:o}});if(C){const R={...C,related:S};try{return await this.sendAbuseReportEmail(C.reason,C.content),R}catch{return R}}else throw new fn(500,"Report cannot be created")}throw new fn(403,"You're not allowed to take an action on that entity. Make sure that comment exist or you've authenticated your request properly.")}catch(S){throw S}},async markAsRemoved({commentId:o,relation:h,authorId:m},A){if(!m&&!this.getCommonService().isValidUserContext(A))throw Cf(A);const S=A?.id||m;if(!S)throw new fn(403,`You're not allowed to take an action on that entity. Make sure that you've provided proper "authorId" or authenticated your request properly.`);try{const C=A?.id?{authorUser:S}:{authorId:S};if(await this.getCommonService().findOne({id:o,related:h,...C})){const N=await it(i).update({where:{id:o,related:h},data:{removed:!0},populate:{threadOf:!0,authorUser:{populate:["avatar"]}}});await this.markAsRemovedNested(o,!0);const O=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]);return this.getCommonService().sanitizeCommentEntity(N,O)}else throw new fn(404,"Entity does not exist or you're not allowed to take an action on it")}catch{throw new fn(404,"Entity does not exist or you're not allowed to take an action on it")}},async sendAbuseReportEmail(o,h){const m="strapi-super-admin",A=await this.getCommonService().getConfig(oa.MODERATOR_ROLES,[m]);if(A.length>0){const S=await i.query("admin::user").findMany({where:{roles:{code:A}}}).then(C=>C.map(R=>R.email));if(S.length>0){const C=await i.query("admin::user").findOne({where:{roles:{code:m}}});i.plugin("email")&&await i.plugin("email").service("email").send({to:S,from:C.email,subject:"New abuse report on comment",text:`
|
|
81
|
+
Right: ${JSON.stringify(u)}`);if(i!==void 0)return i;if(u!==void 0)return u;throw new Error("Received no left or right values at runtime when opening Either")},Ay=i=>i.left!==void 0,pe=i=>i.right!==void 0,av=i=>({left:i}),ol=i=>({right:i});let An=class sv extends Error{constructor(u,o,h=void 0){super(),this.name="Strapi:Plugin:Comments",this.status=u||500,this.message=o||"Internal error",this.payload=h,Object.setPrototypeOf(this,sv.prototype)}toString(u=this){return`${u.name} - ${u.message}`}toJSON(){return this.payload?{...this.payload,name:this.name,message:this.message}:this}};const ce=(i,u)=>u instanceof An?i.throw(u.status,JSON.stringify(u)):u,Ey=v.z.union([v.z.object({$eq:v.z.string().min(1)}),v.z.object({$eqi:v.z.string().min(1)})]),Sy=v.z.union([v.z.object({$ne:v.z.string().min(1)}),v.z.object({$nei:v.z.string().min(1)})]),Ty=v.z.union([v.z.object({$gt:v.z.string().min(1)}),v.z.object({$gte:v.z.string().min(1)})]),Oy=v.z.union([v.z.object({$lt:v.z.string().min(1)}),v.z.object({$lte:v.z.string().min(1)})]),Cy=v.z.union([v.z.object({$startsWith:v.z.string().min(1)}),v.z.object({$startsWithi:v.z.string().min(1)})]),Iy=v.z.union([v.z.object({$endsWith:v.z.string().min(1)}),v.z.object({$endsWithi:v.z.string().min(1)})]),Ry=v.z.union([v.z.object({$contains:v.z.string().min(1)}),v.z.object({$containsi:v.z.string().min(1)})]),xy=v.z.union([v.z.object({$notContains:v.z.string().min(1)}),v.z.object({$notContainsi:v.z.string().min(1)})]),Xr=v.z.union([v.z.string(),v.z.number()]).transform(i=>Number(i)).pipe(v.z.number()),Em=v.z.union([v.z.string(),v.z.boolean()]).transform(i=>typeof i=="string"?["t","true"].includes(i):i).pipe(v.z.boolean()),Ny=v.z.object({_q:v.z.string().optional()}),lv=v.z.string().regex(/^(content|createdAt|updatedAt|id):(desc|asc|ASC|DESC)$/,"Invalid orderBy options"),zy=v.z.union([v.z.string(),v.z.number(),Ey,Sy,Ty,Oy,Cy,Iy,Ry,xy,v.z.object({$null:Em}),v.z.object({$notNull:Em})]),Sm=i=>v.z.object(Object.keys(i).reduce((u,o)=>({...u,[o]:zy.optional()}),{})),Zr={single:"single",array:"array"},sa=i=>{const u=Object.entries(i).reduce((o,[h,m])=>({...o,[h]:m===Zr.single?Xr:v.z.array(Xr)}),{});return v.z.object(u)},Ly=v.z.object({pageSize:Xr.default(10),page:Xr.default(1)}).merge(Ny).merge(v.z.object({orderBy:lv.optional().nullable()})).merge(v.z.object({filters:Sm({removed:!0,approvalStatus:!0}).merge(v.z.object({$or:v.z.array(Sm({blocked:!0,blockedThread:!0})).optional()})).optional()})),Nt=i=>{if(!i.success){const u=i.error.issues.map(o=>`Path: ${o.path.join(".")} Code: ${o.code} Message: ${o.message}`).join(`
|
|
82
|
+
`);return av(new An(400,u))}return ol(i.data)},Ff=i=>v.z.string().regex(vm.relatedUid,{message:'Field "relation" got incorrect format, use format like "api::<collection name>.<content type name>:<document id>"'}).refine(u=>i.some(o=>u.startsWith(o)),"Invalid relation or not enabled collections"),Dy=v.z.object({id:v.z.union([v.z.number(),v.z.string()]),name:v.z.string().min(1).max(100).optional(),email:v.z.string().email(),avatar:v.z.string().url().optional()});v.z.union([v.z.string(),v.z.number(),v.z.boolean()]);const cv=Ly.merge(v.z.object({_q:v.z.string().optional()})),Jr=i=>Nt(sa({id:Zr.single}).safeParse(i)),Py=i=>Nt(cv.safeParse(i)),Fy=i=>Nt(cv.safeParse(i)),Uy=(i,u)=>{const o=sa({id:Zr.single}).merge(v.z.object({removed:v.z.string().optional().transform(h=>h==="true")})).safeParse({...u,id:i});return Nt(o)},My=i=>Nt(sa({id:Zr.single,reportId:Zr.single}).safeParse(i)),Wy=i=>{const u=sa({id:Zr.single,reportIds:Zr.array}).safeParse(i);return Nt(u)},By=i=>{const u=sa({reportIds:Zr.array}).safeParse(i);return Nt(u)},jy=v.z.object({id:v.z.union([v.z.string(),v.z.number()]),email:v.z.string().email(),lastname:v.z.string().nullable().optional(),username:v.z.string().nullable().optional(),firstname:v.z.string().nullable().optional()}),fv=v.z.object({id:v.z.union([v.z.string(),v.z.number()]),content:v.z.string(),author:jy}),$y=i=>Nt(fv.safeParse(i)),ky=i=>Nt(fv.pick({content:!0,id:!0}).safeParse(i)),Vy=i=>Nt(Am.safeParse(i)),hv=i=>v.z.object({relation:Ff(i),content:v.z.string().min(1),author:Dy.optional(),threadOf:v.z.union([v.z.string(),v.z.number()]).optional(),approvalStatus:v.z.nativeEnum(Fi).optional(),locale:v.z.string().optional()}),Gy=(i,u,o)=>Nt(hv(i).safeParse({...o,relation:u})),qy=(i,u)=>Nt(hv(i).pick({content:!0,relation:!0,author:!0}).merge(sa({commentId:Zr.single})).safeParse(u)),Hy=i=>v.z.object({relation:Ff(i)}),Yy=v.z.object({pagination:v.z.object({pageSize:Xr.default(10),page:Xr.default(1),withCount:Em.optional().default(!1)}).optional()}),Qy=v.z.record(v.z.union([v.z.union([v.z.boolean(),v.z.literal("true").transform(()=>!0),v.z.literal("false").transform(()=>!1),v.z.literal("*")]),v.z.record(v.z.any())])).optional(),xm=i=>{const u=Sm({id:!0,content:!0,authorId:!0,authorName:!0,authorEmail:!0,createdAt:!0,updatedAt:!0,removed:!0,blocked:!0,blockedThread:!0,approvalStatus:!0,isAdminComment:!0,threadOf:!0});return v.z.object({sort:lv.optional().nullable().default("createdAt:desc"),fields:v.z.string().array().optional(),omit:v.z.string().array().optional(),filters:u.merge(v.z.object({$and:u.array().min(1).optional(),$or:u.array().min(1).optional()})).optional(),isAdmin:v.z.boolean().optional().default(!1),populate:Qy,limit:Xr.optional(),skip:Xr.optional(),locale:v.z.string().optional()}).merge(Hy(i)).merge(Yy)},Jy=(i,u,o)=>Nt(xm(i).safeParse({...o,relation:u})),Xy=(i,u,o)=>{const h=xm(i).pick({sort:!0,fields:!0,omit:!0,filters:!0,isAdmin:!0,populate:!0,limit:!0,skip:!0,relation:!0,locale:!0,pagination:!0}).merge(v.z.object({startingFromId:v.z.number().optional(),dropBlockedThreads:v.z.boolean().optional().default(!1)}));return Nt(h.safeParse({...o,relation:u}))},Zy=(i,u)=>{const o=xm([]).pick({sort:!0,fields:!0,omit:!0,isAdmin:!0,populate:!0,limit:!0,skip:!0,pagination:!0,filters:!0,locale:!0}).merge(v.z.object({type:v.z.union([v.z.literal(ul.GENERIC),v.z.literal("generic")]).optional(),authorId:v.z.union([v.z.string(),v.z.number()])}));return Nt(o.safeParse({...u,...i}))},Ky=i=>v.z.object({relation:Ff(i[Cr.ENABLED_COLLECTIONS]),commentId:Xr,content:v.z.string().min(1),reason:v.z.nativeEnum(i.reportReasons)}),e_=(i,u)=>Nt(Ky(i).safeParse(u)),t_=i=>v.z.object({relation:Ff(i),commentId:v.z.union([v.z.string(),v.z.number()]),authorId:v.z.union([v.z.string(),v.z.number()])}),n_=(i,u)=>Nt(t_(i).safeParse(u)),r_=({strapi:i})=>({getService(u){return ft(i,u)},async findAll(u){const o=Py(u.query);if(pe(o))return this.getService("admin").findAll(Y(o));throw ce(u,Y(o))},async findReports(u){const o=Fy(u.query);if(pe(o))return this.getService("admin").findReports(Y(o));throw ce(u,Y(o))},async findOne(u){const o=Uy(u.params.id,u.query);if(pe(o))return this.getService("admin").findOneAndThread(Y(o));throw ce(u,Y(o))},async blockComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").changeBlockedComment(Y(o).id,!0);throw ce(u,Y(o))},async unblockComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").changeBlockedComment(Y(o).id,!1);throw ce(u,Y(o))},async deleteComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").deleteComment(Y(o).id);throw ce(u,Y(o))},async blockCommentThread(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").blockCommentThread(Y(o).id,!0);throw ce(u,Y(o))},async unblockCommentThread(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").blockCommentThread(Y(o).id,!1);throw ce(u,Y(o))},async resolveAbuseReport(u){const o=My(u.params);if(pe(o))return this.getService("admin").resolveAbuseReport(Y(o));throw ce(u,Y(o))},async resolveCommentMultipleAbuseReports(u){const o=Wy({...u.request.body,id:u.params.id});if(pe(o))return this.getService("admin").resolveCommentMultipleAbuseReports(Y(o));throw ce(u,Y(o))},async resolveAllAbuseReportsForComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").resolveAllAbuseReportsForComment(Y(o).id);throw ce(u,Y(o))},async resolveAllAbuseReportsForThread(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").resolveAllAbuseReportsForThread(Y(o).id);throw ce(u,Y(o))},async resolveMultipleAbuseReports(u){const o=By(u.request.body);if(pe(o))return this.getService("admin").resolveMultipleAbuseReports(Y(o));throw ce(u,Y(o))},async postComment(u){const o=$y({id:u.params.id,content:u.request.body.content,author:u.request.body.author});if(pe(o))return this.getService("admin").postComment(Y(o));throw ce(u,Y(o))},async updateComment(u){const o=ky({id:u.params.id,content:u.request.body.content});if(pe(o))return this.getService("admin").updateComment(Y(o));throw ce(u,Y(o))},async approveComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").approveComment(Y(o).id);throw ce(u,Y(o))},async rejectComment(u){const o=Jr(u.params);if(pe(o))return this.getService("admin").rejectComment(Y(o).id);throw ce(u,Y(o))}}),Ir=async(i,u,o)=>Uf(i).getLocalConfig(u,o),nl=v.z.object({url:v.z.string(),name:v.z.string(),hash:v.z.string()}),pv=v.z.object({id:v.z.number(),...nl.shape,formats:v.z.object({thumbnail:nl.optional(),small:nl.optional(),medium:nl.optional(),large:nl.optional()}).optional()}).nullable().optional(),dv=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),blocked:v.z.boolean().nullable(),blockedThread:v.z.boolean().nullable(),blockReason:v.z.string().nullable(),isAdminComment:v.z.boolean().nullable(),removed:v.z.boolean().nullable(),approvalStatus:v.z.string().nullable(),related:v.z.string(),createdAt:v.z.string(),updatedAt:v.z.string().nullable(),publishedAt:v.z.string().nullable(),authorId:v.z.string().nullable(),authorName:v.z.string().nullable(),authorEmail:v.z.string().email().nullable(),authorAvatar:v.z.string().nullable(),authorUser:v.z.union([v.z.string(),v.z.object({id:v.z.number(),username:v.z.string(),email:v.z.string().email(),avatar:pv})]).optional().nullable(),locale:v.z.string().nullable()}),gv=v.z.object({page:v.z.number(),pageSize:v.z.number(),pageCount:v.z.number(),total:v.z.number()}),Pi=(i,u)=>o=>i?u.parseAsync(o):Promise.resolve(o),mv=(i,u)=>o=>i?u.parseAsync(o):Promise.resolve(o),i_=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable()}),$m=dv.merge(v.z.object({gotThread:v.z.boolean().nullable().optional(),threadFirstItemId:v.z.number().nullable().optional(),reports:v.z.array(i_).default([]),author:v.z.any().nullable().optional()})),al=$m.extend({threadOf:v.z.lazy(()=>v.z.union([v.z.number(),$m])).nullable().optional()}),o_=v.z.object({id:v.z.number(),uid:v.z.string(),documentId:v.z.string(),requireCommentsApproval:v.z.boolean().nullable().optional(),locale:v.z.string().nullable().optional()});al.omit({related:!0}).extend({related:o_.nullable().optional()});const u_=v.z.array(al),a_=v.z.object({pagination:gv,results:v.z.array(al)}),ia={findMany:u_,findWithCount:a_,findOne:al,create:al},s_=v.z.object({id:v.z.number(),documentId:v.z.string(),content:v.z.string(),blocked:v.z.boolean(),blockedThread:v.z.boolean(),blockReason:v.z.string().nullable(),authorId:v.z.string().nullable(),authorName:v.z.string().nullable(),authorEmail:v.z.string().nullable(),authorAvatar:v.z.string().nullable(),authorUser:v.z.union([v.z.string(),v.z.object({id:v.z.number(),username:v.z.string(),email:v.z.string().email(),avatar:pv})]).optional().nullable(),isAdminComment:v.z.boolean().nullable(),removed:v.z.boolean().nullable(),approvalStatus:v.z.string().nullable(),related:v.z.string(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string(),locale:v.z.string().nullable()}),vv=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable(),related:s_.nullable().optional()}),l_=v.z.object({results:v.z.array(vv),pagination:gv}),c_=v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable()}),f_=v.z.array(v.z.object({id:v.z.number(),documentId:v.z.string().nullable(),content:v.z.string(),reason:v.z.string(),resolved:v.z.boolean(),createdAt:v.z.string(),updatedAt:v.z.string(),publishedAt:v.z.string().nullable(),locale:v.z.string().nullable(),related:dv.nullable()})),Of={findMany:f_,findPage:l_,update:c_,create:vv},h_=i=>{const u=lr(i,"comment-report"),o=i.query(u);return{async findPage(h){const m=await Ir(i,"isValidationEnabled",!1);return o.findPage(h).then(Pi(m,Of.findPage))},async findMany(h){const m=await Ir(i,"isValidationEnabled",!1);return o.findMany(h).then(mv(m,Of.findMany))},async update(h){const m=await Ir(i,"isValidationEnabled",!1);return o.update(h).then(Pi(m,Of.update))},async updateMany(h){return o.updateMany(h)},async create(h){const m=await Ir(i,"isValidationEnabled",!1);return o.create(h).then(Pi(m,Of.create))}}},Di=ze.once(h_),p_=i=>{const u=lr(i,"comment");return{async findMany(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).findMany(o).then(mv(h,ia.findMany))},async findWithCount(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).findPage(o).then(Pi(h,ia.findWithCount))},async findOne(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).findOne(o).then(m=>m?Pi(h,ia.findOne)(m):null)},async update(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).update(o).then(Pi(h,ia.findOne))},async delete(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).delete(o).then(m=>m?Pi(h,ia.findOne)(m):null)},async deleteMany(o){return i.query(u).deleteMany(o)},updateMany(o){return i.query(u).updateMany(o)},async create(o){const h=await Ir(i,"isValidationEnabled",!1);return i.query(u).create(o).then(Pi(h,ia.create))}}},it=ze.once(p_),d_=i=>({getLocalConfig(u,o){return i.config.get([xv,u].filter(Boolean).join("."),o)},async getStore(){return await i.store({type:"plugin",name:"comments"})},async getConfig(){return await(await this.getStore()).get({key:"config"})},async get(u){const o=await this.getConfig(),h={regex:Object.keys(vm).reduce((O,F)=>({...O,[F]:vm[F].toString()}),{})},m=!!i.plugin("graphql"),A=this.getLocalConfig("reportReasons");if(o)return ol({...o,...h,reportReasons:A,isGQLPluginEnabled:u?m:void 0});const S=this.getLocalConfig("entryLabel"),C=this.getLocalConfig("approvalFlow"),R=this.getLocalConfig("blockedAuthorProps"),N={entryLabel:S,approvalFlow:C,blockedAuthorProps:R,reportReasons:A,...h};if(u){const O=this.getLocalConfig("enabledCollections"),F=this.getLocalConfig("moderatorRoles");return ol({...N,enabledCollections:O,moderatorRoles:F,isGQLPluginEnabled:m})}return ol(N)},async update(u){return await(await this.getStore()).set({key:"config",value:{...u,reportReasons:{BAD_LANGUAGE:Zt.BAD_LANGUAGE,DISCRIMINATION:Zt.DISCRIMINATION,OTHER:Zt.OTHER}}}),this.get()},async restore(){return await(await this.getStore()).delete({key:"config"}),this.get()}}),Uf=ze.once(d_),g_=({strapi:i})=>({getService(u){return ft(i,u)},getStoreRepository(){return Uf(i)},async post(u){const o=await this.getStoreRepository().get(!0);if(pe(o)){const h=Y(o),m=Gy(h.enabledCollections,u.params.relation,u.request.body);if(pe(m))return this.getService("client").create(m.right,u.state.user);throw ce(u,Y(m))}throw ce(u,Y(o))},async findAllFlat(u){const o=await this.getStoreRepository().get(!0);if(pe(o)){const h=Y(o),m=Jy(h.enabledCollections,u.params.relation,u.query);if(pe(m))return this.getService("common").findAllFlat(ua(m.right));throw ce(u,Y(m))}throw ce(u,Y(o))},async findAllInHierarchy(u){const o=await this.getStoreRepository().get(!0);if(pe(o)){const h=Y(o),m=Xy(h.enabledCollections,u.params.relation,u.query);if(pe(m))return this.getService("common").findAllInHierarchy(ua(m.right));throw ce(u,Y(m))}throw ce(u,Y(o))},async findAllPerAuthor(u){const o=Zy(u.params,u.query);if(pe(o))return this.getService("common").findAllPerAuthor(ua(o.right),u.params.type?![ul.GENERIC.toLowerCase(),ul.GENERIC].includes(u.params.type):!1);throw ce(u,Y(o))},async put(u){const{user:o}=u.state,h=await this.getStoreRepository().get(!0);if(pe(h)){const m=Y(h),A=qy(m.enabledCollections,{...u.params,content:u.request.body.content,author:u.request.body.author});if(pe(A))return await this.getService("client").update(A.right,o);throw ce(u,Y(A))}throw ce(u,Y(h))},async reportAbuse(u){const{state:o}=u,{user:h}=o,m=await this.getStoreRepository().get(!0);if(pe(m)){const A=Y(m),S=e_(A,{...u.request.body,...u.params});if(pe(S))return await this.getService("client").reportAbuse(S.right,h);throw ce(u,Y(S))}throw ce(u,Y(m))},async removeComment(u){const{state:o}=u,{user:h}=o,m=await this.getStoreRepository().get(!0);if(pe(m)){const A=Y(m),S=n_(A.enabledCollections,{...u.query,...u.params});if(pe(S))return await this.getService("client").markAsRemoved(S.right,h);throw ce(u,Y(S))}throw ce(u,Y(m))}}),m_=({strapi:i})=>{const u=ft(i,"settings");return{async get(o){try{return await u.getConfig()}catch(h){throw ce(o,h)}},async getForSettingsPage(o){try{return await u.getConfig(!0)}catch(h){throw ce(o,h)}},async update(o){const h=Vy(o.request.body);if(pe(h))return await u.update(Y(h));throw ce(o,Y(h))},async restore(o){try{return await u.restore()}catch(h){throw ce(o,h)}},async restart(o){try{return u.restart(),o.send({message:"Restarted",status:200})}catch(h){throw ce(o,h)}}}},v_={admin:r_,client:g_,settings:m_},y_=[{method:"GET",path:"/moderate/all",handler:"admin.findAll",config:{policies:[]}},{method:"GET",path:"/moderate/reports",handler:"admin.findReports",config:{policies:[]}},{method:"GET",path:"/moderate/single/:id",handler:"admin.findOne",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/approve",handler:"admin.approveComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/reject",handler:"admin.rejectComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/block",handler:"admin.blockComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/unblock",handler:"admin.unblockComment",config:{policies:[]}},{method:"DELETE",path:"/moderate/single/:id/delete",handler:"admin.deleteComment",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/report/:reportId/resolve",handler:"admin.resolveAbuseReport",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/report/resolve",handler:"admin.resolveCommentMultipleAbuseReports",config:{policies:[]}},{method:"PUT",path:"/moderate/all/:id/report/resolve",handler:"admin.resolveAllAbuseReportsForComment",config:{policies:[]}},{method:"PUT",path:"/moderate/all/:id/report/resolve-thread",handler:"admin.resolveAllAbuseReportsForThread",config:{policies:[]}},{method:"PUT",path:"/moderate/multiple/report/resolve",handler:"admin.resolveMultipleAbuseReports",config:{policies:[]}},{method:"PUT",path:"/moderate/single/:id/update",handler:"admin.updateComment",config:{policies:[]}},{method:"PUT",path:"/moderate/thread/:id/block",handler:"admin.blockCommentThread",config:{policies:[]}},{method:"PUT",path:"/moderate/thread/:id/unblock",handler:"admin.unblockCommentThread",config:{policies:[]}},{method:"POST",path:"/moderate/thread/:id/postComment",handler:"admin.postComment",config:{policies:[]}}],__=[{method:"PUT",path:"/settings/config",handler:"settings.update",config:{policies:[]}},{method:"DELETE",path:"/settings/config",handler:"settings.restore",config:{policies:[]}},{method:"POST",path:"/settings/restart",handler:"settings.restart",config:{policies:[]}},{method:"GET",path:"/settings/config",handler:"settings.getForSettingsPage",config:{policies:[]}},{method:"GET",path:"/moderate/config",handler:"settings.get",config:{policies:[]}}],b_=[...y_,...__],w_=[{method:"GET",path:"/:relation",handler:"client.findAllInHierarchy",config:{policies:[],description:"Find all comments related to configured Collection / Single Type and return them in a nested structure",tag:{plugin:"comments",name:"Comments",actionType:"find"}}},{method:"POST",path:"/:relation",handler:"client.post",config:{policies:[],description:"Post a comment against configured Collection / Single Type",tag:{plugin:"comments",name:"Comments",actionType:"create"}}},{method:"GET",path:"/:relation/flat",handler:"client.findAllFlat",config:{policies:[],description:"Find all comments related to configured Collection / Single Type and return them in a flat structure for further processing",tag:{plugin:"comments",name:"Comments",actionType:"find"}}},{method:"PUT",path:"/:relation/comment/:commentId",handler:"client.put",config:{policies:[],description:"Update comment related to configured Collection / Single Type if user is the author",tag:{plugin:"comments",name:"Comments",actionType:"update"}}},{method:"POST",path:"/:relation/comment/:commentId/report-abuse",handler:"client.reportAbuse",config:{policies:[],description:"Report an abuse against comment for configured Collection / Single Type",tag:{plugin:"comments",name:"Comments",actionType:"create"}}},{method:"DELETE",path:"/:relation/comment/:commentId",handler:"client.removeComment",config:{policies:[],description:"Remove comment related to configured Collection / Single Type if user is the author",tag:{plugin:"comments",name:"Comments",actionType:"delete"}}},{method:"GET",path:"/author/:authorId",handler:"client.findAllPerAuthor",config:{policies:[],description:"Find all comments created by Strapi user",tag:{plugin:"comments",name:"Comments",actionType:"find"}}},{method:"GET",path:"/author/:authorId/:type",handler:"client.findAllPerAuthor",config:{policies:[],description:"Find all comments created by specified type of user",tag:{plugin:"comments",name:"Comments",actionType:"find"}}}],A_={"content-api":{type:"content-api",routes:w_},admin:{type:"admin",routes:b_}};class fn extends Error{constructor(u,o,h=void 0){super(),this.name="Strapi:Plugin:Comments",this.status=u||500,this.message=o||"Internal error",this.payload=h,Object.setPrototypeOf(this,fn.prototype)}toString(u=this){return`${u.name} - ${u.message}`}toJSON(){return this.payload?{...this.payload,name:this.name,message:this.message}:this}}const km=i=>i.split(Yv.relatedUid).filter(u=>u&&u.length>0),yv=i=>i&&{...i,reports:(i.reports||[]).filter(u=>!u.resolved)},Vm=(i,u,o=[])=>{const{authorUser:h,authorId:m,authorName:A,authorEmail:S,authorAvatar:C,...R}=i;let N={};if(h&&typeof h!="string"){const O=h;N=o.reduce((F,U)=>({...F,[U]:O[U]}),{id:O.id,name:O.username,email:O.email,avatar:O.avatar?.formats?.thumbnail.url||O.avatar?.url})}else m&&(N={id:m,name:A,email:S,avatar:C});return N=ze.isEmpty(N)?N:Object.fromEntries(Object.entries(N).filter(([O])=>!u.includes(O))),{...R,author:ze.isEmpty(N)?i.author||{}:N}},Cf=i=>{throw i?new fn(401,"Not authenticated"):new fn(403,"Not authorized")},E_=i=>{const{lastname:u,username:o,firstname:h}=i;return u&&h?`${h} ${u}`:o||h||""},S_=ze.once(i=>({findAll:{createParams(u,o,h,m,A){const[S,C]=ym(u),R={orderBy:u?{[S]:C}:void 0,where:A,page:o,pageSize:h};return m&&ze.set(R,"where.content.$contains",m),R},getPopulate(){return{authorUser:il(i),threadOf:{populate:{authorUser:il(i)}},reports:{where:{resolved:!1}}}}},findReports:{getDefaultWhere(){return{resolved:{$notNull:!0}}},createParams(u,o,h,m){const[A,S]=ym(u),C={orderBy:u?{[A]:S}:void 0,where:this.getDefaultWhere(),page:o,pageSize:h};return m&&ze.set(C,"where.content.$contains",m),C}},findOneAndThread:{getDefaultWhere(u){return u?{$or:[{removed:!1},{removed:{$notNull:!1}}]}:{}},getPopulate(){const u=il(i),o={reports:{where:{resolved:!1}}},h={populate:{threadOf:{populate:{...o}},...o}};return{populate:{...h.populate,authorUser:u,threadOf:{populate:{...h.populate.threadOf.populate,authorUser:u}}}}}}})),T_=({strapi:i})=>{const u=S_(i);return{getCommonService(){return ft(i,"common")},async findAll({_q:o,orderBy:h,page:m,pageSize:A,filters:S}){const C=u.findAll.createParams(h,m,A,o,S),R=u.findAll.getPopulate(),N=it(i),{pagination:O,results:F}=await N.findWithCount({...C,count:!0,populate:R}),U=await this.getCommonService().findRelatedEntitiesFor(F);return{pagination:O,result:F.map(Q=>this.getCommonService().sanitizeCommentEntity(Q,[],[])).map(Q=>this.getCommonService().mergeRelatedEntityTo(Q,U))}},async findReports({_q:o,orderBy:h,page:m,pageSize:A}){const S=u.findReports.createParams(h,m,A,o),C=il(i),{pagination:R,results:N}=await Di(i).findPage({...S,populate:{related:{populate:{authorUser:C}}}}),O=N.map(j=>typeof j.related=="object"?j.related.id:null).filter(Boolean),F=await it(i).findMany({where:{threadOf:O},populate:["threadOf"],limit:Number.MAX_SAFE_INTEGER}),U=Array.from(new Set(F.map(({threadOf:j})=>typeof j=="object"?j.id:null).filter(Boolean)));return{result:N.map(j=>{const J=U.includes(j.related.id),te=this.getCommonService(),X={...j,related:te.sanitizeCommentEntity({...j.related,gotThread:J},[])},ye=typeof C!="boolean"?C?.populate:{};return yv(te.sanitizeCommentEntity(X,[],[],ye))}),pagination:R}},async findOneAndThread({id:o,removed:h,...m}){const A=il(i),S=u.findOneAndThread.getDefaultWhere(h),C=u.findOneAndThread.getPopulate(),R=await it(i).findOne({...C,where:{id:o}});if(!R)throw new An(404,"Not found");const{relatedId:N,uid:O}=this.getCommonService().parseRelationString(R.related),F=await i.documents(O).findOne({documentId:N}).then(te=>{if(!te)throw new An(404,"Relation not found");return{...te,uid:O}}),U=R.threadOf&&typeof R.threadOf=="object"?R.threadOf.id:null,Q=await this.getCommonService().findAllInHierarchy({filters:{...S,...m,threadOf:U,related:R.related},...C,startingFromId:U,isAdmin:!0,limit:Number.MAX_SAFE_INTEGER},!1),j=typeof A!="boolean"?A?.populate:{},J=this.getCommonService().sanitizeCommentEntity({...R,threadOf:R.threadOf||null},[],[],j);return{entity:F,selected:J,level:Q}},async changeBlockedComment(o,h){const m=await this.getCommonService().findOne({id:o});return this.getCommonService().updateComment({id:o},{blocked:ze.isNil(h)?!m.blocked:h})},async deleteComment(o){return it(i).update({where:{id:o},data:{removed:!0}})},async blockCommentThread(o,h){const m=await this.getCommonService().findOne({id:o}),A=h||!m.blocked,S=await this.getCommonService().updateComment({id:o},{blocked:A,blockedThread:A});return await this.blockNestedThreads(o,A),this.getCommonService().sanitizeCommentEntity(S,[])},async approveComment(o){const h=await it(i).update({where:{id:o},data:{approvalStatus:Fi.APPROVED}});if(!h)throw new An(404,"Not found");return this.getCommonService().sanitizeCommentEntity(h,[])},async rejectComment(o){const h=await it(i).update({where:{id:o},data:{approvalStatus:Fi.REJECTED}});if(!h)throw new An(404,"Not found");return this.getCommonService().sanitizeCommentEntity(h,[])},async blockNestedThreads(o,h){return this.getCommonService().modifiedNestedNestedComments(o,"blockedThread",h)},async resolveAbuseReport({id:o,reportId:h}){return Di(i).update({where:{id:h,related:o},data:{resolved:!0}})},async resolveCommentMultipleAbuseReports({id:o,reportIds:h}){if((await Di(i).findMany({where:{id:h,related:o},populate:["related"]})).length===h.length)return Di(i).updateMany({where:{id:h},data:{resolved:!0}});throw new An(400,"At least one of selected reports got invalid comment entity relation. Try again.")},async resolveAllAbuseReportsForComment(o){if(!o)throw new An(400,"There is something wrong with comment Id. Try again.");return Di(i).updateMany({where:{related:o,resolved:!1},data:{resolved:!0}})},async resolveAllAbuseReportsForThread(o){if(!o)throw new An(400,"There is something wrong with comment Id. Try again.");const h=await it(i).findMany({where:{threadOf:o},select:["id"]});return Di(i).updateMany({where:{related:h.map(({id:m})=>m).concat([o]),resolved:!1},data:{resolved:!0}})},async resolveMultipleAbuseReports({reportIds:o}){return Di(i).updateMany({where:{id:{$in:o}},data:{resolved:!0}})},async postComment({id:o,author:h,content:m}){const A=await it(i).findOne({where:{id:o}});if(!A)throw new An(404,"Not found");return it(i).create({data:{content:this.getCommonService().sanitizeCommentContent(m),threadOf:o,authorId:h.id,authorName:E_(h),authorEmail:h.email,related:A.related,isAdminComment:!0}})},async updateComment({id:o,content:h}){const m=await it(i).update({where:{id:o},data:{content:this.getCommonService().sanitizeCommentContent(h)}});if(!m)throw new An(404,"Not found");return this.getCommonService().sanitizeCommentEntity(m,[])}}},O_=async(i,u)=>{try{return ol(await i())}catch{return av(u)}},C_=({strapi:i})=>{const u=async(o,h)=>{if(h)return{authorUser:h.id};if(o)return{authorId:o.id,authorName:o.name,authorEmail:o.email,authorAvatar:o.avatar}};return{getCommonService(){return ft(i,"common")},async create({relation:o,content:h,threadOf:m,author:A,approvalStatus:S,locale:C},R){const{uid:N,relatedId:O}=this.getCommonService().parseRelationString(o),F=await i.documents(N).findOne({documentId:O,locale:C});if(!F)throw new fn(400,'Relation for field "related" does not exist. Check your payload please.');const Q=(await this.getCommonService().getConfig(oa.APPROVAL_FLOW,[])).includes(N)||F.requireCommentsApproval,j=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]),J=await O_(async()=>m?await this.getCommonService().findOne({id:m,related:o,locale:C||null}):null,new fn(400,"Thread does not exist"));if(Ay(J))throw Y(J);const te=Y(J);if(!A&&!this.getCommonService().isValidUserContext(R))throw Cf(R);const[X,ye]=await Promise.all([this.getCommonService().checkBadWords(h),u(A,R)]),_e=!ze.isEmpty(ye)&&!(ye.authorId||ye.authorUser);if(ze.isEmpty(ye)||_e)throw new fn(400,`Not able to recognise author of a comment. Make sure you've provided "author" property in a payload or authenticated your request properly.`);if(Q&&S&&S!==Fi.PENDING)throw new fn(400,"Invalid approval status");const Ve={...await it(i).create({data:{...ye,threadOf:m,locale:C,content:this.getCommonService().sanitizeCommentContent(X),related:o,approvalStatus:Q?Fi.PENDING:Fi.APPROVED},populate:{authorUser:{populate:["avatar"]}}}),threadOf:te},Ye=this.getCommonService().sanitizeCommentEntity(Ve,j);try{await this.sendResponseNotification(Ye)}catch(Me){console.error(Me)}return Ye},async update({commentId:o,content:h,author:m,relation:A},S){if(!m&&!this.getCommonService().isValidUserContext(S))throw Cf(S);const C=S?.id||m?.id;if(await this.getCommonService().checkBadWords(h)){const R=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]),N=await this.getCommonService().findOne({id:o,related:A});if(N&&N.author?.id?.toString()===C?.toString()){const O=await it(i).update({where:{id:o},data:{content:this.getCommonService().sanitizeCommentContent(h)},populate:{threadOf:!0,authorUser:{populate:["avatar"]}}});return this.getCommonService().sanitizeCommentEntity(O,R)}}},async reportAbuse({commentId:o,relation:h,...m},A){if(!this.getCommonService().isValidUserContext(A))throw Cf(A);try{const S=await this.getCommonService().findOne({id:o,related:h});if(S.isAdminComment)throw new fn(403,"You're not allowed to take an action on that entity. This in a admin comment.");if(S){const C=await Di(i).create({data:{...m,resolved:!1,related:o}});if(C){const R={...C,related:S};try{return await this.sendAbuseReportEmail(C.reason,C.content),R}catch{return R}}else throw new fn(500,"Report cannot be created")}throw new fn(403,"You're not allowed to take an action on that entity. Make sure that comment exist or you've authenticated your request properly.")}catch(S){throw S}},async markAsRemoved({commentId:o,relation:h,authorId:m},A){if(!m&&!this.getCommonService().isValidUserContext(A))throw Cf(A);const S=A?.id||m;if(!S)throw new fn(403,`You're not allowed to take an action on that entity. Make sure that you've provided proper "authorId" or authenticated your request properly.`);try{const C=A?.id?{authorUser:S}:{authorId:S};if(await this.getCommonService().findOne({id:o,related:h,...C})){const N=await it(i).update({where:{id:o,related:h},data:{removed:!0},populate:{threadOf:!0,authorUser:{populate:["avatar"]}}});await this.markAsRemovedNested(o,!0);const O=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]);return this.getCommonService().sanitizeCommentEntity(N,O)}else throw new fn(404,"Entity does not exist or you're not allowed to take an action on it")}catch{throw new fn(404,"Entity does not exist or you're not allowed to take an action on it")}},async sendAbuseReportEmail(o,h){const m="strapi-super-admin",A=await this.getCommonService().getConfig(oa.MODERATOR_ROLES,[m]);if(A.length>0){const S=await i.query("admin::user").findMany({where:{roles:{code:A}}}).then(C=>C.map(R=>R.email));if(S.length>0){const C=await i.query("admin::user").findOne({where:{roles:{code:m}}});i.plugin("email")&&await i.plugin("email").service("email").send({to:S,from:C.email,subject:"New abuse report on comment",text:`
|
|
83
83
|
There was a new abuse report on your app.
|
|
84
84
|
Reason: ${o}
|
|
85
85
|
Message: ${h}
|
|
@@ -93,7 +93,7 @@ spurious results.`)}}return!1},v0=5;function y0(i,u){const[o,h]=u?[i,u]:[void 0,
|
|
|
93
93
|
------
|
|
94
94
|
|
|
95
95
|
Visit ${C} and continue the discussion.
|
|
96
|
-
`})}catch(R){throw i.log.error(R),R}}}}}},
|
|
96
|
+
`})}catch(R){throw i.log.error(R),R}}}}}},I_=10,R_=["id"],x_=({strapi:i})=>({async getConfig(u,o,h=!1){const m=Uf(i),A=await m.getConfig();return u&&!h?ze.get(A,u,o):h?m.getLocalConfig(u,o):A},parseRelationString(u){const[o,h]=km(u);return{uid:o,relatedId:h}},isValidUserContext(u){return u?u.id!=null:!0},sanitizeCommentEntity(u,o,h=[],m={}){const A=Array.isArray(m)?m:Object.keys(m||{});return ze.omit({...Vm({...u,threadOf:ze.isObject(u.threadOf)?Vm(u.threadOf,o,A):u.threadOf},o,A)},h)},async findAllFlat({fields:u,limit:o,skip:h,sort:m,populate:A,omit:S=[],isAdmin:C=!1,pagination:R,filters:N={},locale:O},F){const U=S.filter(Qe=>!R_.includes(Qe)),Q=["id","related"].filter(Qe=>!U.includes(Qe)),j={authorUser:{populate:!0,avatar:{populate:!0}},...ze.isObject(A)?A:{}},J=C?[]:await this.getConfig(Cr.AUTHOR_BLOCKED_PROPS,[]),[te,X]=ym(m),ye={orderBy:{[te]:X},select:Array.isArray(u)?ze.uniq([...u,Q].flat()):u},_e={where:{...N,...O?{locale:O}:{}},populate:j,...ye,pageSize:R?.pageSize||o||I_,page:R?.page||(h?Math.floor(h/o):1)||1},{results:Le,pagination:Ve}=await it(i).findWithCount(_e),Ye=await Promise.all(Le.map(async Qe=>{const{results:En,pagination:{total:Sn}}=await it(i).findWithCount({where:{threadOf:Qe.id}});return{id:Qe.id,itemsInTread:Sn,firstThreadItemId:ze.first(En)?.id}})),Me=U.includes("related")?[]:F!==null?[F]:await this.findRelatedEntitiesFor([...Le]),hn=Me.filter(Qe=>Qe).length>0,$n=Le.map(Qe=>{const En=Ye.find(Ze=>Ze.id===Qe.id),Sn="threadOf"in N?ze.isString(N.threadOf)?ze.parseInt(N.threadOf):N.threadOf:null;let Kr={};ze.isObject(A?.authorUser)&&(Kr="populate"in A.authorUser?A.authorUser.populate:j.authorUser);const fr=typeof Sn=="number"?Sn:null;return this.sanitizeCommentEntity({...Qe,threadOf:fr||Qe.threadOf,gotThread:(En?.itemsInTread||0)>0,threadFirstItemId:En?.firstThreadItemId},J,U,Kr)});return{data:hn?$n.map(Qe=>this.mergeRelatedEntityTo(Qe,Me)):$n,pagination:Ve}},async getCommentsChildren({filters:u,populate:o,sort:h,fields:m,isAdmin:A=!1,omit:S=[],locale:C,limit:R},N,O,F=!1,U=!1){if(!N.gotThread)return{...N,threadOf:void 0,related:void 0,blockedThread:U||N.blockedThread,children:[]};const Q=await this.findAllFlat({filters:{...u,threadOf:{$eq:N.id.toString()}},populate:o,sort:h,fields:m,isAdmin:A,omit:S,locale:C,limit:Number.MAX_SAFE_INTEGER},O),j=N.blockedThread&&F?[]:await Promise.all(Q.data.map(J=>this.getCommentsChildren({filters:u,populate:o,sort:h,fields:m,isAdmin:A,omit:S,locale:C,limit:R},J,O,F)));return{...N,threadOf:void 0,related:void 0,blockedThread:U||N.blockedThread,children:j}},async findAllInHierarchy({filters:u,populate:o,sort:h,fields:m,startingFromId:A,dropBlockedThreads:S,isAdmin:C=!1,omit:R=[],locale:N,limit:O,pagination:F},U){const Q=await this.findAllFlat({filters:{threadOf:A?{$eq:A.toString()}:{$null:!0},...u},pagination:F,populate:o,sort:h,fields:m,isAdmin:C,omit:R,locale:N,limit:O},U);return await Promise.all(Q?.data.map(J=>this.getCommentsChildren({filters:u,populate:o,sort:h,fields:m,isAdmin:C,omit:R,locale:N,limit:O},J,U,S)))},async findOne(u){const o=await it(i).findOne({where:u,populate:{reports:!0,authorUser:{populate:["avatar"]}}});if(!o)throw new An(400,"Comment does not exist. Check your payload please.");const h=await this.getConfig(Cr.AUTHOR_BLOCKED_PROPS,[]),m=this.sanitizeCommentEntity(o,h);return yv(m)},async findMany(u){return it(i).findMany(u)},async updateComment(u,o){return it(i).update({where:u,data:o})},async findAllPerAuthor({filters:u={},populate:o={},pagination:h,sort:m,fields:A,isAdmin:S=!1,authorId:C},R=!1){{if(ze.isNil(C))return{data:[]};const N=R?{authorUser:{id:C}}:{authorId:C},O=await this.findAllFlat({filters:{...ze.omit(u,["related"]),...N},pagination:h,populate:o,sort:m,fields:A,isAdmin:S});return{...O,data:O.data.map(({author:F,...U})=>U)}}},async findRelatedEntitiesFor(u){const o=u.reduce((h,m)=>{const[A,S]=km(m.related);return{...h,[A]:{...h[A]||{},documentIds:[...h[A]?.documentIds||[],S],locale:[...h[A]?.locale||[],m.locale]}}},{});return Promise.all(Object.entries(o).map(async([h,{documentIds:m,locale:A}])=>Promise.all(m.map((S,C)=>i.documents(h).findOne({documentId:S.toString(),locale:ze.isNil(A[C])?void 0:A[C],status:"published"}))).then(S=>S.filter(C=>C).map(C=>({...C,uid:h}))))).then(h=>h.flat(2))},mergeRelatedEntityTo(u,o=[]){return{...u,related:o.find(h=>h.locale&&u.locale?u.related===`${h.uid}:${h.documentId}`&&u.locale===h.locale:u.related===`${h.uid}:${h.documentId}`)}},async modifiedNestedNestedComments(u,o,h,m=10){if(m===0)return!0;try{const A=await this.findMany({where:{threadOf:u}}),S=await it(i).updateMany({where:{id:A.map(C=>C.id)},data:{[o]:h}});return A.length===S.count&&S.count>0?(await Promise.all(A.map(R=>this.modifiedNestedNestedComments(R.id,o,h,m-1)))).length===S.count:!0}catch{return!1}},async checkBadWords(u){if(await this.getConfig(Cr.BAD_WORDS,!0)&&u&&zm.isProfane({testString:u}))throw new An(400,"Bad language used! Please polite your comment...",{content:{original:u,filtered:u&&zm.replaceProfanities({testString:u})}});return u},async perRemove(u,o){const h=await i.plugin("i18n")?.service("locales").getDefaultLocale()||null;return it(i).updateMany({where:{related:u,$or:[{locale:o},h===o?{locale:{$eq:null}}:null].filter(Boolean)},data:{removed:!0}})},sanitizeCommentContent(u){return Rv.default(u,{allowedTags:["p","br","hr","div","span","h1","h2","h3","h4","h5","h6","strong","i","em","del","blockquote","ul","ol","li","pre","code","a","img","table","thead","tbody","tr","th","td","video","audio","source"],allowedAttributes:{"*":["href","align","alt","center","width","height","type","controls","target"],img:["src","alt"],source:["src","type"],video:["src","controls","width","height"],audio:["src","controls"]},allowedSchemes:["http","https","mailto"]})},registerLifecycleHook(){},async runLifecycleHook(){}});var xf={exports:{}};/**
|
|
97
97
|
* @license
|
|
98
98
|
* Lodash <https://lodash.com/>
|
|
99
99
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
@@ -119,13 +119,13 @@ __p += '`),$&&(E+=`' +
|
|
|
119
119
|
function print() { __p += __j.call(arguments, '') }
|
|
120
120
|
`:`;
|
|
121
121
|
`)+E+`return __p
|
|
122
|
-
}`;var M=Ef(function(){return Or(f,x+"return "+E).apply(_,g)});if(M.source=E,Os(M))throw M;return M}function Rd(e){return me(e).toLowerCase()}function xd(e){return me(e).toUpperCase()}function Nd(e,t,n){if(e=me(e),e&&(n||t===_))return fr(e);if(!e||!(t=St(t)))return e;var r=De(e),a=De(t);return wr(r,Kt(r,a),Ro(r,a)+1).join("")}function zd(e,t,n){if(e=me(e),e&&(n||t===_))return e.slice(0,hr(e)+1);if(!e||!(t=St(t)))return e;var r=De(e);return wr(r,0,Ro(r,De(t))+1).join("")}function Ld(e,t,n){if(e=me(e),e&&(n||t===_))return e.replace(ya,"");if(!e||!(t=St(t)))return e;var r=De(e);return wr(r,Kt(r,De(t))).join("")}function Dd(e,t){var n=Vf,r=Gf;if(Fe(t)){var a="separator"in t?t.separator:a;n="length"in t?ae(t.length):n,r="omission"in t?St(t.omission):r}e=me(e);var s=e.length;if(Ge(e)){var c=De(e);s=c.length}if(n>=s)return e;var f=n-Ke(r);if(f<1)return r;var g=c?wr(c,0,f).join(""):e.slice(0,f);if(a===_)return g+r;if(c&&(f+=g.length-f),qs(a)){if(e.slice(f).search(a)){var w,b=g;for(a.global||(a=yt(a.source,me(wl.exec(a))+"g")),a.lastIndex=0;w=a.exec(b);)var E=w.index;g=g.slice(0,E===_?f:E)}}else if(e.indexOf(St(a),f)!=f){var T=g.lastIndexOf(a);T>-1&&(g=g.slice(0,T))}return g+r}function Pd(e){return e=me(e),e&&ga.test(e)?e.replace(gl,Rh):e}function Gc(e,t,n){return e=me(e),t=n?_:t,t===_?Nr(e)?cl(e):te(e):e.match(t)||[]}function Mu(e){var t=e==null?0:e.length,n=Z();return e=t?O(e,function(r){if(typeof r[1]!="function")throw new sn(At);return[n(r[0]),r[1]]}):[],le(function(r){for(var a=-1;++a<t;){var s=e[a];if(o(s[0],this,r))return o(s[1],this,r)}})}function Fd(e){return Uh(qt(e,Bt))}function Wu(e){return function(){return e}}function qc(e,t){return e==null||e!==e?t:e}function vt(e){return e}function Bu(e){return Xl(typeof e=="function"?e:qt(e,Bt))}function Hc(e){return Zl(qt(e,Bt))}function Yc(e,t){return Kl(e,qt(t,Bt))}function ju(e,t,n){var r=nt(t),a=ou(t,r);n!=null||Fe(t)&&(a.length||!r.length)||(n=t,t=e,e=this,a=ou(t,nt(t)));var s=!(Fe(n)&&"chain"in n&&!n.chain),c=tr(e);return m(a,function(f){var g=t[f];e[f]=g,c&&(e.prototype[f]=function(){var w=this.__chain__;if(s||w){var b=e(this.__wrapped__);return(b.__actions__=dt(this.__actions__)).push({func:g,args:arguments,thisArg:e}),b.__chain__=w,b}return g.apply(e,F([this.value()],arguments))})}),e}function Ud(){return at._===this&&(at._=qu),this}function xs(){}function Md(e){return e=ae(e),le(function(t){return ec(t,e)})}function Eo(e){return wu(e)?Me(Fn(e)):yn(e)}function $u(e){return function(t){return e==null?_:jr(e,t)}}function Ns(){return[]}function zs(){return!1}function Ls(){return{}}function Qc(){return""}function Wd(){return!0}function Bd(e,t){if(e=ae(e),e<1||e>Tn)return[];var n=On,r=H(e,On);t=Z(t),e-=On;for(var a=Sn(r,t);++n<e;)t(n);return a}function jd(e){return ie(e)?O(e,Fn):Yt(e)?[e]:dt(ff(me(e)))}function $d(e){var t=++Ps;return me(e)+t}function kd(e){return e&&e.length?_r(e,vt,$r):_}function Vd(e,t){return e&&e.length?_r(e,Z(t,2),$r):_}function Gd(e){return Ye(e,vt)}function qd(e,t){return Ye(e,Z(t,2))}function Hd(e){return e&&e.length?_r(e,vt,$a):_}function Yd(e,t){return e&&e.length?_r(e,Z(t,2),$a):_}function Qd(e){return e&&e.length?En(e,vt):0}function Jd(e,t){return e&&e.length?En(e,Z(t,2)):0}y=y==null?at:mn.defaults(at.Object(),y,mn.pick(at,zl));var we=y.Array,ku=y.Date,Ds=y.Error,Or=y.Function,ee=y.Math,xe=y.Object,yt=y.RegExp,ke=y.String,sn=y.TypeError,wn=we.prototype,Xd=Or.prototype,Ii=xe.prototype,Vu=y["__core-js_shared__"],Gu=Xd.toString,ve=Ii.hasOwnProperty,Ps=0,Jc=function(){var e=/[^.]+$/.exec(Vu&&Vu.keys&&Vu.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ln=Ii.toString,Xc=Gu.call(xe),qu=at._,Ue=yt("^"+Gu.call(ve).replace(ko,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ne=Pa?y.Buffer:_,rr=y.Symbol,Hu=y.Uint8Array,Zc=Ne?Ne.allocUnsafe:_,Yu=V(xe.getPrototypeOf,xe),Kc=xe.create,ef=Ii.propertyIsEnumerable,Qu=wn.splice,Fs=rr?rr.isConcatSpreadable:_,ir=rr?rr.iterator:_,or=rr?rr.toStringTag:_,Ju=function(){try{var e=Ar(xe,"defineProperty");return e({},"",{}),e}catch{}}(),tf=y.clearTimeout!==at.clearTimeout&&y.clearTimeout,Xu=ku&&ku.now!==at.Date.now&&ku.now,Qt=y.setTimeout!==at.setTimeout&&y.setTimeout,ur=ee.ceil,Zu=ee.floor,Us=xe.getOwnPropertySymbols,Zd=Ne?Ne.isBuffer:_,nf=y.isFinite,Kd=wn.join,rf=V(xe.keys,xe),Te=ee.max,H=ee.min,of=ku.now,cn=y.parseInt,Ms=ee.random,eg=wn.reverse,he=Ar(y,"DataView"),So=Ar(y,"Map"),Ku=Ar(y,"Promise"),ar=Ar(y,"Set"),To=Ar(y,"WeakMap"),Oo=Ar(xe,"create"),ea=To&&new To,Ri={},tg=Tr(he),ng=Tr(So),rg=Tr(Ku),ig=Tr(ar),og=Tr(To),ta=rr?rr.prototype:_,Co=ta?ta.valueOf:_,uf=ta?ta.toString:_,xi=function(){function e(){}return function(t){if(!Fe(t))return{};if(Kc)return Kc(t);e.prototype=t;var n=new e;return e.prototype=_,n}}();l.templateSettings={escape:li,evaluate:ml,interpolate:va,variable:"",imports:{_:l}},l.prototype=I.prototype,l.prototype.constructor=l,D.prototype=xi(I.prototype),D.prototype.constructor=D,P.prototype=xi(I.prototype),P.prototype.constructor=P,Ur.prototype.clear=tn,Ur.prototype.delete=Jo,Ur.prototype.get=Nh,Ur.prototype.has=hi,Ur.prototype.set=Xo,nn.prototype.clear=ge,nn.prototype.delete=zh,nn.prototype.get=Wl,nn.prototype.has=Zo,nn.prototype.set=Lh,Yn.prototype.clear=Dh,Yn.prototype.delete=Ko,Yn.prototype.get=yr,Yn.prototype.has=eu,Yn.prototype.set=Bl,In.prototype.add=In.prototype.push=jl,In.prototype.has=$l,Lt.prototype.clear=kl,Lt.prototype.delete=eo,Lt.prototype.get=Mr,Lt.prototype.has=tu,Lt.prototype.set=Ph;var Mn=_i(Rn),af=_i(Wa,!0),Io=Za(),sf=Za(!0),lf=ea?function(e,t){return ea.set(e,t),e}:vt,ug=Ju?function(e,t){return Ju(e,"toString",{configurable:!0,enumerable:!1,value:Wu(t),writable:!0})}:vt,rt=le,xt=tf||function(e){return at.clearTimeout(e)},ag=ar&&1/re(new ar([,-0]))[1]==Dr?function(e){return new ar(e)}:xs,Ws=ea?function(e){return ea.get(e)}:xs,Bs=Us?function(e){return e==null?[]:(e=xe(e),C(Us(e),function(t){return ef.call(e,t)}))}:Ns,js=Us?function(e){for(var t=[];e;)F(t,Bs(e)),e=Yu(e);return t}:Ns,_t=tt;(he&&_t(new he(new ArrayBuffer(1)))!=ai||So&&_t(new So)!=dn||Ku&&_t(Ku.resolve())!=Gi||ar&&_t(new ar)!=gn||To&&_t(new To)!=Yi)&&(_t=function(e){var t=tt(e),n=t==qn?e.constructor:_,r=n?Tr(n):"";if(r)switch(r){case tg:return ai;case ng:return dn;case rg:return Gi;case ig:return gn;case og:return Yi}return t});var sg=Vu?tr:zs,cf=ls(lf),Ni=Qt||function(e,t){return at.setTimeout(e,t)},$s=ls(ug),ff=Er(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(yl,function(n,r,a,s){t.push(a?s.replace(ch,"$1"):r||n)}),t}),lg=le(function(e,t){return $e(e)?Br(e,We(t,1,$e,!0)):[]}),hf=le(function(e,t){var n=Ot(t);return $e(n)&&(n=_),$e(e)?Br(e,We(t,1,$e,!0),Z(n,2)):[]}),pf=le(function(e,t){var n=Ot(t);return $e(n)&&(n=_),$e(e)?Br(e,We(t,1,$e,!0),_,n):[]}),cg=le(function(e){var t=O(e,cu);return t.length&&t[0]===e[0]?mi(t):[]}),fg=le(function(e){var t=Ot(e),n=O(e,cu);return t===Ot(n)?t=_:n.pop(),n.length&&n[0]===e[0]?mi(n,Z(t,2)):[]}),hg=le(function(e){var t=Ot(e),n=O(e,cu);return t=typeof t=="function"?t:_,t&&n.pop(),n.length&&n[0]===e[0]?mi(n,_,t):[]}),pg=le(mo),zi=Pn(function(e,t){var n=e==null?0:e.length,r=Ma(e,t);return nc(e,O(t,function(a){return gt(a,n)?+a:a}).sort(so)),r}),dg=le(function(e){return Dt(We(e,1,$e,!0))}),gg=le(function(e){var t=Ot(e);return $e(t)&&(t=_),Dt(We(e,1,$e,!0),Z(t,2))}),mg=le(function(e){var t=Ot(e);return t=typeof t=="function"?t:_,Dt(We(e,1,$e,!0),_,t)}),vg=le(function(e,t){return $e(e)?Br(e,t):[]}),yg=le(function(e){return kr(C(e,$e))}),df=le(function(e){var t=Ot(e);return $e(t)&&(t=_),kr(C(e,$e),Z(t,2))}),gf=le(function(e){var t=Ot(e);return t=typeof t=="function"?t:_,kr(C(e,$e),_,t)}),_g=le(vs),bg=le(function(e){var t=e.length,n=t>1?e[t-1]:_;return n=typeof n=="function"?(e.pop(),n):_,zu(e,n)}),wg=Pn(function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,a=function(s){return Ma(s,e)};return!(t>1||this.__actions__.length)&&r instanceof P&>(n)?(r=r.slice(n,+n+(t?1:0)),r.__actions__.push({func:vo,args:[a],thisArg:_}),new D(r,this.__chain__).thru(function(s){return t&&!s.length&&s.push(_),s})):this.thru(a)}),Ag=vi(function(e,t,n){ve.call(e,n)?++e[n]:Pe(e,n,1)}),Eg=hu(cs),Sg=hu(qr),Tg=vi(function(e,t,n){ve.call(e,n)?e[n].push(t):Pe(e,n,[t])}),Og=le(function(e,t,n){var r=-1,a=typeof t=="function",s=It(e)?we(e.length):[];return Mn(e,function(c){s[++r]=a?o(t,c,n):se(c,t,n)}),s}),Cg=vi(function(e,t,n){Pe(e,n,t)}),Ig=vi(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Rg=le(function(e,t){if(e==null)return[];var n=t.length;return n>1&&st(e,t[0],t[1])?t=[]:n>2&&st(t[0],t[1],t[2])&&(t=[t[0]]),br(e,We(t,1),[])}),na=Xu||function(){return at.Date.now()},ks=le(function(e,t,n){var r=jt;if(n.length){var a=q(n,ne(ks));r|=Vn}return Xn(e,r,t,n,a)}),mf=le(function(e,t,n){var r=jt|mr;if(n.length){var a=q(n,ne(mf));r|=Vn}return Xn(t,r,e,n,a)}),xg=le(function(e,t){return pi(e,1,t)}),Ng=le(function(e,t,n){return pi(e,an(t)||0,n)});Du.Cache=Yn;var zg=rt(function(e,t){t=t.length==1&&ie(t[0])?O(t[0],Ze(Z())):O(We(t,1),Ze(Z()));var n=t.length;return le(function(r){for(var a=-1,s=H(r.length,n);++a<s;)r[a]=t[a].call(this,r[a]);return o(e,this,r)})}),Vs=le(function(e,t){return Xn(e,Vn,_,t,q(t,ne(Vs)))}),vf=le(function(e,t){return Xn(e,$i,_,t,q(t,ne(vf)))}),Lg=Pn(function(e,t){return Xn(e,ni,_,_,_,t)}),Dg=co($r),Pg=co(function(e,t){return e>=t}),Qr=Ql(function(){return arguments}())?Ql:function(e){return Be(e)&&ve.call(e,"callee")&&!ef.call(e,"callee")},ie=we.isArray,Fg=Fl?Ze(Fl):Mh,Wn=Zd||zs,yf=Ul?Ze(Ul):Wh,Gs=Ml?Ze(Ml):jh,qs=Fr?Ze(Fr):$h,_f=en?Ze(en):Qn,Li=Fa?Ze(Fa):kh,Hs=co($a),Ug=co(function(e,t){return e<=t}),Mg=yi(function(e,t){if(Ai(t)||It(t))return Ln(t,nt(t),e),_;for(var n in t)ve.call(t,n)&&no(e,n,t[n])}),bf=yi(function(e,t){Ln(t,Ft(t),e)}),lt=yi(function(e,t,n,r){Ln(t,Ft(t),e,r)}),Ys=yi(function(e,t,n,r){Ln(t,nt(t),e,r)}),Wg=Pn(Ma),Bg=le(function(e,t){e=xe(e);var n=-1,r=t.length,a=r>2?t[2]:_;for(a&&st(t[0],t[1],a)&&(r=1);++n<r;)for(var s=t[n],c=Ft(s),f=-1,g=c.length;++f<g;){var w=c[f],b=e[w];(b===_||un(b,Ii[w])&&!ve.call(e,w))&&(e[w]=s[w])}return e}),jg=le(function(e){return e.push(_,ns),o(wf,_,e)}),$g=sc(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=ln.call(t)),e[t]=n},Wu(vt)),Qs=sc(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=ln.call(t)),ve.call(e,t)?e[t].push(n):e[t]=[n]},Z),kg=le(se),Js=yi(function(e,t,n){uu(e,t,n)}),wf=yi(function(e,t,n,r){uu(e,t,n,r)}),Vg=Pn(function(e,t){var n={};if(e==null)return n;var r=!1;t=O(t,function(s){return s=_n(s,e),r||(r=s.length>1),s}),Ln(e,os(e),n),r&&(n=qt(n,Bt|No|dr,ep));for(var a=t.length;a--;)Pt(n,t[a]);return n}),Gg=Pn(function(e,t){return e==null?{}:qh(e,t)}),Af=fo(nt),Xs=fo(Ft),qg=Dn(function(e,t,n){return t=t.toLowerCase(),e+(n?jc(t):t)}),Hg=Dn(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Yg=Dn(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Zs=ac("toLowerCase"),Ks=Dn(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Qg=Dn(function(e,t,n){return e+(n?" ":"")+el(t)}),Jg=Dn(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),el=ac("toUpperCase"),Ef=le(function(e,t){try{return o(e,_,t)}catch(n){return Os(n)?n:new Ds(n)}}),Xg=Pn(function(e,t){return m(t,function(n){n=Fn(n),Pe(e,n,ks(e[n],e))}),e}),Zg=Ka(),Kg=Ka(!0),em=le(function(e,t){return function(n){return se(n,e,t)}}),tm=le(function(e,t){return function(n){return se(e,n,t)}}),nm=gu(O),rm=gu(S),im=gu(j),om=mu(),um=mu(!0),am=du(function(e,t){return e+t},0),sm=vu("ceil"),lm=du(function(e,t){return e/t},1),cm=vu("floor"),fm=du(function(e,t){return e*t},1),hm=vu("round"),pm=du(function(e,t){return e-t},0);return l.after=As,l.ary=Es,l.assign=Mg,l.assignIn=bf,l.assignInWith=lt,l.assignWith=Ys,l.at=Wg,l.before=Ss,l.bind=ks,l.bindAll=Xg,l.bindKey=mf,l.castArray=Lp,l.chain=Oc,l.chunk=Un,l.compact=up,l.concat=ap,l.cond=Mu,l.conforms=Fd,l.constant=Wu,l.countBy=Ag,l.create=Kp,l.curry=_o,l.curryRight=Ts,l.debounce=bn,l.defaults=Bg,l.defaultsDeep=jg,l.defer=xg,l.delay=Ng,l.difference=lg,l.differenceBy=hf,l.differenceWith=pf,l.drop=Cu,l.dropRight=Ei,l.dropRightWhile=gc,l.dropWhile=mc,l.fill=sp,l.filter=bp,l.flatMap=_s,l.flatMapDeep=wp,l.flatMapDepth=Ap,l.flatten=Si,l.flattenDeep=lp,l.flattenDepth=vc,l.flip=Yr,l.flow=Zg,l.flowRight=Kg,l.fromPairs=yc,l.functions=id,l.functionsIn=od,l.groupBy=Tg,l.initial=Iu,l.intersection=cg,l.intersectionBy=fg,l.intersectionWith=hg,l.invert=$g,l.invertBy=Qs,l.invokeMap=Og,l.iteratee=Bu,l.keyBy=Cg,l.keys=nt,l.keysIn=Ft,l.map=Lu,l.mapKeys=ad,l.mapValues=Bc,l.matches=Hc,l.matchesProperty=Yc,l.memoize=Du,l.merge=Js,l.mergeWith=wf,l.method=em,l.methodOf=tm,l.mixin=ju,l.negate=bo,l.nthArg=Md,l.omit=Vg,l.omitBy=sd,l.once=Cp,l.orderBy=Ep,l.over=nm,l.overArgs=zg,l.overEvery=rm,l.overSome=im,l.partial=Vs,l.partialRight=vf,l.partition=Ig,l.pick=Gg,l.pickBy=Ao,l.property=Eo,l.propertyOf=$u,l.pull=pg,l.pullAll=mo,l.pullAllBy=wc,l.pullAllWith=hs,l.pullAt=zi,l.range=om,l.rangeRight=um,l.rearg=Lg,l.reject=Rc,l.remove=fp,l.rest=Ip,l.reverse=Ru,l.sampleSize=Op,l.set=cd,l.setWith=fd,l.shuffle=ws,l.slice=Zn,l.sortBy=Rg,l.sortedUniq=Kn,l.sortedUniqBy=ps,l.split=Od,l.spread=Rp,l.tail=ds,l.take=gs,l.takeRight=xu,l.takeRightWhile=Ti,l.takeWhile=K,l.tap=gp,l.throttle=xp,l.thru=vo,l.toArray=Fc,l.toPairs=Af,l.toPairsIn=Xs,l.toPath=jd,l.toPlainObject=Mc,l.transform=hd,l.unary=Np,l.union=dg,l.unionBy=gg,l.unionWith=mg,l.uniq=Nu,l.uniqBy=ms,l.uniqWith=Hr,l.unset=pd,l.unzip=vs,l.unzipWith=zu,l.update=dd,l.updateWith=gd,l.values=Ci,l.valuesIn=md,l.without=vg,l.words=Gc,l.wrap=zp,l.xor=yg,l.xorBy=df,l.xorWith=gf,l.zip=_g,l.zipObject=Tc,l.zipObjectDeep=mt,l.zipWith=bg,l.entries=Af,l.entriesIn=Xs,l.extend=bf,l.extendWith=lt,ju(l,l),l.add=am,l.attempt=Ef,l.camelCase=qg,l.capitalize=jc,l.ceil=sm,l.clamp=vd,l.clone=Dp,l.cloneDeep=Fp,l.cloneDeepWith=Up,l.cloneWith=Pp,l.conformsTo=zc,l.deburr=$c,l.defaultTo=qc,l.divide=lm,l.endsWith=bd,l.eq=un,l.escape=wd,l.escapeRegExp=kc,l.every=ys,l.find=Eg,l.findIndex=cs,l.findKey=ed,l.findLast=Sg,l.findLastIndex=qr,l.findLastKey=td,l.floor=cm,l.forEach=Oi,l.forEachRight=bs,l.forIn=nd,l.forInRight=rd,l.forOwn=Cs,l.forOwnRight=Wc,l.get=Is,l.gt=Dg,l.gte=Pg,l.has=ud,l.hasIn=Rs,l.head=go,l.identity=vt,l.includes=Ic,l.indexOf=_c,l.inRange=yd,l.invoke=kg,l.isArguments=Qr,l.isArray=ie,l.isArrayBuffer=Fg,l.isArrayLike=It,l.isArrayLikeObject=$e,l.isBoolean=Mp,l.isBuffer=Wn,l.isDate=yf,l.isElement=Wp,l.isEmpty=Lc,l.isEqual=Bp,l.isEqualWith=jp,l.isError=Os,l.isFinite=$p,l.isFunction=tr,l.isInteger=Dc,l.isLength=Rt,l.isMap=Gs,l.isMatch=kp,l.isMatchWith=Pc,l.isNaN=Vp,l.isNative=Gp,l.isNil=Hp,l.isNull=qp,l.isNumber=Pu,l.isObject=Fe,l.isObjectLike=Be,l.isPlainObject=wo,l.isRegExp=qs,l.isSafeInteger=Yp,l.isSet=_f,l.isString=Fu,l.isSymbol=Yt,l.isTypedArray=Li,l.isUndefined=Qp,l.isWeakMap=Jp,l.isWeakSet=Xp,l.join=fs,l.kebabCase=Hg,l.last=Ot,l.lastIndexOf=cp,l.lowerCase=Yg,l.lowerFirst=Zs,l.lt=Hs,l.lte=Ug,l.max=kd,l.maxBy=Vd,l.mean=Gd,l.meanBy=qd,l.min=Hd,l.minBy=Yd,l.stubArray=Ns,l.stubFalse=zs,l.stubObject=Ls,l.stubString=Qc,l.stubTrue=Wd,l.multiply=fm,l.nth=bc,l.noConflict=Ud,l.noop=xs,l.now=na,l.pad=Vc,l.padEnd=Ad,l.padStart=Ed,l.parseInt=Sd,l.random=_d,l.reduce=Sp,l.reduceRight=Tp,l.repeat=Td,l.replace=Uu,l.result=ld,l.round=hm,l.runInContext=p,l.sample=xc,l.size=Nc,l.snakeCase=Ks,l.some=yo,l.sortedIndex=Ac,l.sortedIndexBy=Ec,l.sortedIndexOf=hp,l.sortedLastIndex=Sc,l.sortedLastIndexBy=pp,l.sortedLastIndexOf=dp,l.startCase=Qg,l.startsWith=Cd,l.subtract=pm,l.sum=Qd,l.sumBy=Jd,l.template=Id,l.times=Bd,l.toFinite=nr,l.toInteger=ae,l.toLength=Uc,l.toLower=Rd,l.toNumber=an,l.toSafeInteger=Zp,l.toString=me,l.toUpper=xd,l.trim=Nd,l.trimEnd=zd,l.trimStart=Ld,l.truncate=Dd,l.unescape=Pd,l.uniqueId=$d,l.upperCase=Jg,l.upperFirst=el,l.each=Oi,l.eachRight=bs,l.first=go,ju(l,function(){var e={};return Rn(l,function(t,n){ve.call(l.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),l.VERSION=Bi,m(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){l[e].placeholder=l}),m(["drop","take"],function(e,t){P.prototype[e]=function(n){n=n===_?1:Te(ae(n),0);var r=this.__filtered__&&!t?new P(this):this.clone();return r.__filtered__?r.__takeCount__=H(n,r.__takeCount__):r.__views__.push({size:H(n,On),type:e+(r.__dir__<0?"Right":"")}),r},P.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),m(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n==ca||n==Qf;P.prototype[e]=function(a){var s=this.clone();return s.__iteratees__.push({iteratee:Z(a,3),type:n}),s.__filtered__=s.__filtered__||r,s}}),m(["head","last"],function(e,t){var n="take"+(t?"Right":"");P.prototype[e]=function(){return this[n](1).value()[0]}}),m(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");P.prototype[e]=function(){return this.__filtered__?new P(this):this[n](1)}}),P.prototype.compact=function(){return this.filter(vt)},P.prototype.find=function(e){return this.filter(e).head()},P.prototype.findLast=function(e){return this.reverse().find(e)},P.prototype.invokeMap=le(function(e,t){return typeof e=="function"?new P(this):this.map(function(n){return se(n,e,t)})}),P.prototype.reject=function(e){return this.filter(bo(Z(e)))},P.prototype.slice=function(e,t){e=ae(e);var n=this;return n.__filtered__&&(e>0||t<0)?new P(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==_&&(t=ae(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},P.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},P.prototype.toArray=function(){return this.take(On)},Rn(P.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),a=l[r?"take"+(t=="last"?"Right":""):t],s=r||/^find/.test(t);a&&(l.prototype[t]=function(){var c=this.__wrapped__,f=r?[1]:arguments,g=c instanceof P,w=f[0],b=g||ie(c),E=function(B){var $=a.apply(l,F([B],f));return r&&T?$[0]:$};b&&n&&typeof w=="function"&&w.length!=1&&(g=b=!1);var T=this.__chain__,x=!!this.__actions__.length,z=s&&!T,M=g&&!x;if(!s&&b){c=M?c:new P(this);var L=e.apply(c,f);return L.__actions__.push({func:vo,args:[E],thisArg:_}),new D(L,T)}return z&&M?e.apply(this,f):(L=this.thru(E),z?r?L.value()[0]:L.value():L)})}),m(["pop","push","shift","sort","splice","unshift"],function(e){var t=wn[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);l.prototype[e]=function(){var a=arguments;if(r&&!this.__chain__){var s=this.value();return t.apply(ie(s)?s:[],a)}return this[n](function(c){return t.apply(ie(c)?c:[],a)})}}),Rn(P.prototype,function(e,t){var n=l[t];if(n){var r=n.name+"";ve.call(Ri,r)||(Ri[r]=[]),Ri[r].push({name:t,func:n})}}),Ri[pu(_,mr).name]=[{name:"wrapper",func:_}],P.prototype.clone=fe,P.prototype.reverse=be,P.prototype.value=Ua,l.prototype.at=wg,l.prototype.chain=mp,l.prototype.commit=Cc,l.prototype.next=vp,l.prototype.plant=_p,l.prototype.reverse=er,l.prototype.toJSON=l.prototype.valueOf=l.prototype.value=Ct,l.prototype.first=l.prototype.head,ir&&(l.prototype[ir]=yp),l},mn=xh();Hn?((Hn.exports=mn)._=mn,Da._=mn):at._=mn}).call(Rr)})(xf,xf.exports);var I_=xf.exports,_v={};(function(i){i.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendAll:"assignInAll",extendAllWith:"assignInAllWith",extendWith:"assignInWith",first:"head",conforms:"conformsTo",matches:"isMatch",property:"get",__:"placeholder",F:"stubFalse",T:"stubTrue",all:"every",allPass:"overEvery",always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",dropLast:"dropRight",dropLastWhile:"dropRightWhile",equals:"isEqual",identical:"eq",indexBy:"keyBy",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",props:"at",symmetricDifference:"xor",symmetricDifferenceBy:"xorBy",symmetricDifferenceWith:"xorWith",takeLast:"takeRight",takeLastWhile:"takeRightWhile",unapply:"rest",unnest:"flatten",useWith:"overArgs",where:"conformsTo",whereEq:"isMatch",zipObj:"zipObject"},i.aryMethod={1:["assignAll","assignInAll","attempt","castArray","ceil","create","curry","curryRight","defaultsAll","defaultsDeepAll","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","mergeAll","methodOf","mixin","nthArg","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words","zipAll"],2:["add","after","ary","assign","assignAllWith","assignIn","assignInAllWith","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","conformsTo","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","defaultTo","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","meanBy","merge","mergeAllWith","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","propertyOf","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","findFrom","findIndexFrom","findLastFrom","findLastIndexFrom","getOr","includesFrom","indexOfFrom","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqualWith","isMatchWith","flatMapDepth","lastIndexOfFrom","mergeWith","orderBy","padChars","padCharsEnd","padCharsStart","pullAllBy","pullAllWith","rangeStep","rangeStepRight","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","update","xorBy","xorWith","zipWith"],4:["fill","setWith","updateWith"]},i.aryRearg={2:[1,0],3:[2,0,1],4:[3,2,0,1]},i.iterateeAry={dropRightWhile:1,dropWhile:1,every:1,filter:1,find:1,findFrom:1,findIndex:1,findIndexFrom:1,findKey:1,findLast:1,findLastFrom:1,findLastIndex:1,findLastIndexFrom:1,findLastKey:1,flatMap:1,flatMapDeep:1,flatMapDepth:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,transform:2},i.iterateeRearg={mapKeys:[1],reduceRight:[1,0]},i.methodRearg={assignInAllWith:[1,0],assignInWith:[1,2,0],assignAllWith:[1,0],assignWith:[1,2,0],differenceBy:[1,2,0],differenceWith:[1,2,0],getOr:[2,1,0],intersectionBy:[1,2,0],intersectionWith:[1,2,0],isEqualWith:[1,2,0],isMatchWith:[2,1,0],mergeAllWith:[1,0],mergeWith:[1,2,0],padChars:[2,1,0],padCharsEnd:[2,1,0],padCharsStart:[2,1,0],pullAllBy:[2,1,0],pullAllWith:[2,1,0],rangeStep:[1,2,0],rangeStepRight:[1,2,0],setWith:[3,1,2,0],sortedIndexBy:[2,1,0],sortedLastIndexBy:[2,1,0],unionBy:[1,2,0],unionWith:[1,2,0],updateWith:[3,1,2,0],xorBy:[1,2,0],xorWith:[1,2,0],zipWith:[1,2,0]},i.methodSpread={assignAll:{start:0},assignAllWith:{start:0},assignInAll:{start:0},assignInAllWith:{start:0},defaultsAll:{start:0},defaultsDeepAll:{start:0},invokeArgs:{start:2},invokeArgsMap:{start:2},mergeAll:{start:0},mergeAllWith:{start:0},partial:{start:1},partialRight:{start:1},without:{start:1},zipAll:{start:0}},i.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAllWith:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignAll:!0,assignAllWith:!0,assignIn:!0,assignInAll:!0,assignInAllWith:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsAll:!0,defaultsDeep:!0,defaultsDeepAll:!0,merge:!0,mergeAll:!0,mergeAllWith:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0,update:!0,updateWith:!0}},i.realToAlias=function(){var u=Object.prototype.hasOwnProperty,o=i.aliasToReal,h={};for(var m in o){var A=o[m];u.call(h,A)?h[A].push(m):h[A]=[m]}return h}(),i.remap={assignAll:"assign",assignAllWith:"assignWith",assignInAll:"assignIn",assignInAllWith:"assignInWith",curryN:"curry",curryRightN:"curryRight",defaultsAll:"defaults",defaultsDeepAll:"defaultsDeep",findFrom:"find",findIndexFrom:"findIndex",findLastFrom:"findLast",findLastIndexFrom:"findLastIndex",getOr:"get",includesFrom:"includes",indexOfFrom:"indexOf",invokeArgs:"invoke",invokeArgsMap:"invokeMap",lastIndexOfFrom:"lastIndexOf",mergeAll:"merge",mergeAllWith:"mergeWith",padChars:"pad",padCharsEnd:"padEnd",padCharsStart:"padStart",propertyOf:"get",rangeStep:"range",rangeStepRight:"rangeRight",restFrom:"rest",spreadFrom:"spread",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart",zipAll:"zip"},i.skipFixed={castArray:!0,flow:!0,flowRight:!0,iteratee:!0,mixin:!0,rearg:!0,runInContext:!0},i.skipRearg={add:!0,assign:!0,assignIn:!0,bind:!0,bindKey:!0,concat:!0,difference:!0,divide:!0,eq:!0,gt:!0,gte:!0,isEqual:!0,lt:!0,lte:!0,matchesProperty:!0,merge:!0,multiply:!0,overArgs:!0,partial:!0,partialRight:!0,propertyOf:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0,zipObjectDeep:!0}})(_v);var R_={},ct=_v,x_=R_,Gm=Array.prototype.push;function N_(i,u){return u==2?function(o,h){return i.apply(void 0,arguments)}:function(o){return i.apply(void 0,arguments)}}function gm(i,u){return u==2?function(o,h){return i(o,h)}:function(o){return i(o)}}function qm(i){for(var u=i?i.length:0,o=Array(u);u--;)o[u]=i[u];return o}function z_(i){return function(u){return i({},u)}}function L_(i,u){return function(){for(var o=arguments.length,h=o-1,m=Array(o);o--;)m[o]=arguments[o];var A=m[u],S=m.slice(0,u);return A&&Gm.apply(S,A),u!=h&&Gm.apply(S,m.slice(u+1)),i.apply(this,S)}}function mm(i,u){return function(){var o=arguments.length;if(o){for(var h=Array(o);o--;)h[o]=arguments[o];var m=h[0]=u.apply(void 0,h);return i.apply(void 0,h),m}}}function Tm(i,u,o,h){var m=typeof u=="function",A=u===Object(u);if(A&&(h=o,o=u,u=void 0),o==null)throw new TypeError;h||(h={});var S={cap:"cap"in h?h.cap:!0,curry:"curry"in h?h.curry:!0,fixed:"fixed"in h?h.fixed:!0,immutable:"immutable"in h?h.immutable:!0,rearg:"rearg"in h?h.rearg:!0},C=m?o:x_,R="curry"in h&&h.curry,N="fixed"in h&&h.fixed,O="rearg"in h&&h.rearg,F=m?o.runInContext():void 0,U=m?o:{ary:i.ary,assign:i.assign,clone:i.clone,curry:i.curry,forEach:i.forEach,isArray:i.isArray,isError:i.isError,isFunction:i.isFunction,isWeakMap:i.isWeakMap,iteratee:i.iteratee,keys:i.keys,rearg:i.rearg,toInteger:i.toInteger,toPath:i.toPath},Q=U.ary,j=U.assign,J=U.clone,te=U.curry,X=U.forEach,ye=U.isArray,_e=U.isError,Le=U.isFunction,Ve=U.isWeakMap,Ye=U.keys,Me=U.rearg,hn=U.toInteger,$n=U.toPath,Qe=Ye(ct.aryMethod),En={castArray:function(G){return function(){var W=arguments[0];return ye(W)?G(qm(W)):G.apply(void 0,arguments)}},iteratee:function(G){return function(){var W=arguments[0],V=arguments[1],q=G(W,V),re=q.length;return S.cap&&typeof V=="number"?(V=V>2?V-2:1,re&&re<=V?q:gm(q,V)):q}},mixin:function(G){return function(W){var V=this;if(!Le(V))return G(V,Object(W));var q=[];return X(Ye(W),function(re){Le(W[re])&&q.push([re,V.prototype[re]])}),G(V,Object(W)),X(q,function(re){var ot=re[1];Le(ot)?V.prototype[re[0]]=ot:delete V.prototype[re[0]]}),V}},nthArg:function(G){return function(W){var V=W<0?1:hn(W)+1;return te(G(W),V)}},rearg:function(G){return function(W,V){var q=V?V.length:0;return te(G(W,V),q)}},runInContext:function(G){return function(W){return Tm(i,G(W),h)}}};function Sn(G,W){if(S.cap){var V=ct.iterateeRearg[G];if(V)return ei(W,V);var q=!m&&ct.iterateeAry[G];if(q)return Ro(W,q)}return W}function Kr(G,W,V){return R||S.curry&&V>1?te(W,V):W}function fr(G,W,V){if(S.fixed&&(N||!ct.skipFixed[G])){var q=ct.methodSpread[G],re=q&&q.start;return re===void 0?Q(W,V):L_(W,re)}return W}function Ze(G,W,V){return S.rearg&&V>1&&(O||!ct.skipRearg[G])?Me(W,ct.methodRearg[G]||ct.aryRearg[V]):W}function Wi(G,W){W=$n(W);for(var V=-1,q=W.length,re=q-1,ot=J(Object(G)),wt=ot;wt!=null&&++V<q;){var ut=W[V],Ke=wt[ut];Ke!=null&&!(Le(Ke)||_e(Ke)||Ve(Ke))&&(wt[ut]=J(V==re?Ke:Object(Ke))),wt=wt[ut]}return ot}function Ut(G){return Ge.runInContext.convert(G)(void 0)}function Kt(G,W){var V=ct.aliasToReal[G]||G,q=ct.remap[V]||V,re=h;return function(ot){var wt=m?F:U,ut=m?F[q]:W,Ke=j(j({},re),ot);return Tm(wt,V,ut,Ke)}}function Ro(G,W){return Mt(G,function(V){return typeof V=="function"?gm(V,W):V})}function ei(G,W){return Mt(G,function(V){var q=W.length;return N_(Me(gm(V,q),W),q)})}function Mt(G,W){return function(){var V=arguments.length;if(!V)return G();for(var q=Array(V);V--;)q[V]=arguments[V];var re=S.rearg?0:V-1;return q[re]=W(q[re]),G.apply(void 0,q)}}function xo(G,W,V){var q,re=ct.aliasToReal[G]||G,ot=W,wt=En[re];return wt?ot=wt(W):S.immutable&&(ct.mutate.array[re]?ot=mm(W,qm):ct.mutate.object[re]?ot=mm(W,z_(W)):ct.mutate.set[re]&&(ot=mm(W,Wi))),X(Qe,function(ut){return X(ct.aryMethod[ut],function(Ke){if(re==Ke){var De=ct.methodSpread[re],hr=De&&De.afterRearg;return q=hr?fr(re,Ze(re,ot,ut),ut):Ze(re,fr(re,ot,ut),ut),q=Sn(re,q),q=Kr(re,q,ut),!1}}),!q}),q||(q=ot),q==W&&(q=R?te(q,1):function(){return W.apply(this,arguments)}),q.convert=Kt(re,W),q.placeholder=W.placeholder=V,q}if(!A)return xo(u,o,C);var Ge=o,Nr=[];return X(Qe,function(G){X(ct.aryMethod[G],function(W){var V=Ge[ct.remap[W]||W];V&&Nr.push([W,xo(W,V,Ge)])})}),X(Ye(Ge),function(G){var W=Ge[G];if(typeof W=="function"){for(var V=Nr.length;V--;)if(Nr[V][0]==G)return;W.convert=Kt(G,W),Nr.push([G,W])}}),X(Nr,function(G){Ge[G[0]]=G[1]}),Ge.convert=Ut,Ge.placeholder=Ge,X(Ye(Ge),function(G){X(ct.realToAlias[G]||[],function(W){Ge[W]=Ge[G]})}),Ge}var D_=Tm,Hm=I_.runInContext(),rl=D_(Hm,Hm),Ie;(function(i){i.Arg="Arg",i.DynamicInput="DynamicInput",i.DynamicOutputMethod="DynamicOutputMethod",i.DynamicOutputProperty="DynamicOutputProperty",i.Enum="Enum",i.ExtendInputObject="ExtendInputObject",i.ExtendObject="ExtendObject",i.InputField="InputField",i.InputObject="InputObject",i.Interface="Interface",i.List="List",i.NonNull="NonNull",i.Null="Null",i.Object="Object",i.OutputField="OutputField",i.Plugin="Plugin",i.PrintedGenTyping="PrintedGenTyping",i.PrintedGenTypingImport="PrintedGenTypingImport",i.Scalar="Scalar",i.Union="Union"})(Ie||(Ie={}));const Mf=Symbol.for("@nexus/wrapped");function bt(i,u){i.prototype[Mf]=u}class P_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(P_,Ie.Interface);class F_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(F_,Ie.Object);class U_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(U_,Ie.Union);function M_(i,u){var o;return i.extensions=Object.assign(Object.assign({},i.extensions),{nexus:Object.assign(Object.assign({},Object((o=i.extensions)===null||o===void 0?void 0:o.nexus)),u)}),i}const Nf=Symbol.for("@nexus/meta/NEXUS_TYPE"),W_=Symbol.for("@nexus/meta/NEXUS_BUILD");function B_(i){return!!(i&&typeof sl.get(i,W_)=="function")}function j_(i){return $_(i)||bv(i)}function $_(i){return!!(i&&sl.has(i,Nf)&&la(sl.get(i,Nf)))}function bv(i){return!!(i&&sl.has(i,Nf)&&typeof sl.get(i,Nf)=="function")}function Nm(i){return B_(i)||j_(i)||bv(i)}class k_{constructor(u){this.config=u}}bt(k_,Ie.PrintedGenTypingImport);class V_{constructor(u){this.config=u}get imports(){return this.config.imports||[]}toString(){let u="";this.config.description&&(u=`/**
|
|
122
|
+
}`;var M=Ef(function(){return Or(f,x+"return "+E).apply(_,g)});if(M.source=E,Os(M))throw M;return M}function Rd(e){return me(e).toLowerCase()}function xd(e){return me(e).toUpperCase()}function Nd(e,t,n){if(e=me(e),e&&(n||t===_))return fr(e);if(!e||!(t=St(t)))return e;var r=De(e),a=De(t);return wr(r,Kt(r,a),Ro(r,a)+1).join("")}function zd(e,t,n){if(e=me(e),e&&(n||t===_))return e.slice(0,hr(e)+1);if(!e||!(t=St(t)))return e;var r=De(e);return wr(r,0,Ro(r,De(t))+1).join("")}function Ld(e,t,n){if(e=me(e),e&&(n||t===_))return e.replace(ya,"");if(!e||!(t=St(t)))return e;var r=De(e);return wr(r,Kt(r,De(t))).join("")}function Dd(e,t){var n=Vf,r=Gf;if(Fe(t)){var a="separator"in t?t.separator:a;n="length"in t?ae(t.length):n,r="omission"in t?St(t.omission):r}e=me(e);var s=e.length;if(Ge(e)){var c=De(e);s=c.length}if(n>=s)return e;var f=n-Ke(r);if(f<1)return r;var g=c?wr(c,0,f).join(""):e.slice(0,f);if(a===_)return g+r;if(c&&(f+=g.length-f),qs(a)){if(e.slice(f).search(a)){var w,b=g;for(a.global||(a=yt(a.source,me(wl.exec(a))+"g")),a.lastIndex=0;w=a.exec(b);)var E=w.index;g=g.slice(0,E===_?f:E)}}else if(e.indexOf(St(a),f)!=f){var T=g.lastIndexOf(a);T>-1&&(g=g.slice(0,T))}return g+r}function Pd(e){return e=me(e),e&&ga.test(e)?e.replace(gl,Rh):e}function Gc(e,t,n){return e=me(e),t=n?_:t,t===_?Nr(e)?cl(e):te(e):e.match(t)||[]}function Mu(e){var t=e==null?0:e.length,n=Z();return e=t?O(e,function(r){if(typeof r[1]!="function")throw new sn(At);return[n(r[0]),r[1]]}):[],le(function(r){for(var a=-1;++a<t;){var s=e[a];if(o(s[0],this,r))return o(s[1],this,r)}})}function Fd(e){return Uh(qt(e,Bt))}function Wu(e){return function(){return e}}function qc(e,t){return e==null||e!==e?t:e}function vt(e){return e}function Bu(e){return Xl(typeof e=="function"?e:qt(e,Bt))}function Hc(e){return Zl(qt(e,Bt))}function Yc(e,t){return Kl(e,qt(t,Bt))}function ju(e,t,n){var r=nt(t),a=ou(t,r);n!=null||Fe(t)&&(a.length||!r.length)||(n=t,t=e,e=this,a=ou(t,nt(t)));var s=!(Fe(n)&&"chain"in n&&!n.chain),c=tr(e);return m(a,function(f){var g=t[f];e[f]=g,c&&(e.prototype[f]=function(){var w=this.__chain__;if(s||w){var b=e(this.__wrapped__);return(b.__actions__=dt(this.__actions__)).push({func:g,args:arguments,thisArg:e}),b.__chain__=w,b}return g.apply(e,F([this.value()],arguments))})}),e}function Ud(){return at._===this&&(at._=qu),this}function xs(){}function Md(e){return e=ae(e),le(function(t){return ec(t,e)})}function Eo(e){return wu(e)?Me(Fn(e)):yn(e)}function $u(e){return function(t){return e==null?_:jr(e,t)}}function Ns(){return[]}function zs(){return!1}function Ls(){return{}}function Qc(){return""}function Wd(){return!0}function Bd(e,t){if(e=ae(e),e<1||e>Tn)return[];var n=On,r=H(e,On);t=Z(t),e-=On;for(var a=Sn(r,t);++n<e;)t(n);return a}function jd(e){return ie(e)?O(e,Fn):Yt(e)?[e]:dt(ff(me(e)))}function $d(e){var t=++Ps;return me(e)+t}function kd(e){return e&&e.length?_r(e,vt,$r):_}function Vd(e,t){return e&&e.length?_r(e,Z(t,2),$r):_}function Gd(e){return Ye(e,vt)}function qd(e,t){return Ye(e,Z(t,2))}function Hd(e){return e&&e.length?_r(e,vt,$a):_}function Yd(e,t){return e&&e.length?_r(e,Z(t,2),$a):_}function Qd(e){return e&&e.length?En(e,vt):0}function Jd(e,t){return e&&e.length?En(e,Z(t,2)):0}y=y==null?at:mn.defaults(at.Object(),y,mn.pick(at,zl));var we=y.Array,ku=y.Date,Ds=y.Error,Or=y.Function,ee=y.Math,xe=y.Object,yt=y.RegExp,ke=y.String,sn=y.TypeError,wn=we.prototype,Xd=Or.prototype,Ii=xe.prototype,Vu=y["__core-js_shared__"],Gu=Xd.toString,ve=Ii.hasOwnProperty,Ps=0,Jc=function(){var e=/[^.]+$/.exec(Vu&&Vu.keys&&Vu.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ln=Ii.toString,Xc=Gu.call(xe),qu=at._,Ue=yt("^"+Gu.call(ve).replace(ko,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ne=Pa?y.Buffer:_,rr=y.Symbol,Hu=y.Uint8Array,Zc=Ne?Ne.allocUnsafe:_,Yu=V(xe.getPrototypeOf,xe),Kc=xe.create,ef=Ii.propertyIsEnumerable,Qu=wn.splice,Fs=rr?rr.isConcatSpreadable:_,ir=rr?rr.iterator:_,or=rr?rr.toStringTag:_,Ju=function(){try{var e=Ar(xe,"defineProperty");return e({},"",{}),e}catch{}}(),tf=y.clearTimeout!==at.clearTimeout&&y.clearTimeout,Xu=ku&&ku.now!==at.Date.now&&ku.now,Qt=y.setTimeout!==at.setTimeout&&y.setTimeout,ur=ee.ceil,Zu=ee.floor,Us=xe.getOwnPropertySymbols,Zd=Ne?Ne.isBuffer:_,nf=y.isFinite,Kd=wn.join,rf=V(xe.keys,xe),Te=ee.max,H=ee.min,of=ku.now,cn=y.parseInt,Ms=ee.random,eg=wn.reverse,he=Ar(y,"DataView"),So=Ar(y,"Map"),Ku=Ar(y,"Promise"),ar=Ar(y,"Set"),To=Ar(y,"WeakMap"),Oo=Ar(xe,"create"),ea=To&&new To,Ri={},tg=Tr(he),ng=Tr(So),rg=Tr(Ku),ig=Tr(ar),og=Tr(To),ta=rr?rr.prototype:_,Co=ta?ta.valueOf:_,uf=ta?ta.toString:_,xi=function(){function e(){}return function(t){if(!Fe(t))return{};if(Kc)return Kc(t);e.prototype=t;var n=new e;return e.prototype=_,n}}();l.templateSettings={escape:li,evaluate:ml,interpolate:va,variable:"",imports:{_:l}},l.prototype=I.prototype,l.prototype.constructor=l,D.prototype=xi(I.prototype),D.prototype.constructor=D,P.prototype=xi(I.prototype),P.prototype.constructor=P,Ur.prototype.clear=tn,Ur.prototype.delete=Jo,Ur.prototype.get=Nh,Ur.prototype.has=hi,Ur.prototype.set=Xo,nn.prototype.clear=ge,nn.prototype.delete=zh,nn.prototype.get=Wl,nn.prototype.has=Zo,nn.prototype.set=Lh,Yn.prototype.clear=Dh,Yn.prototype.delete=Ko,Yn.prototype.get=yr,Yn.prototype.has=eu,Yn.prototype.set=Bl,In.prototype.add=In.prototype.push=jl,In.prototype.has=$l,Lt.prototype.clear=kl,Lt.prototype.delete=eo,Lt.prototype.get=Mr,Lt.prototype.has=tu,Lt.prototype.set=Ph;var Mn=_i(Rn),af=_i(Wa,!0),Io=Za(),sf=Za(!0),lf=ea?function(e,t){return ea.set(e,t),e}:vt,ug=Ju?function(e,t){return Ju(e,"toString",{configurable:!0,enumerable:!1,value:Wu(t),writable:!0})}:vt,rt=le,xt=tf||function(e){return at.clearTimeout(e)},ag=ar&&1/re(new ar([,-0]))[1]==Dr?function(e){return new ar(e)}:xs,Ws=ea?function(e){return ea.get(e)}:xs,Bs=Us?function(e){return e==null?[]:(e=xe(e),C(Us(e),function(t){return ef.call(e,t)}))}:Ns,js=Us?function(e){for(var t=[];e;)F(t,Bs(e)),e=Yu(e);return t}:Ns,_t=tt;(he&&_t(new he(new ArrayBuffer(1)))!=ai||So&&_t(new So)!=dn||Ku&&_t(Ku.resolve())!=Gi||ar&&_t(new ar)!=gn||To&&_t(new To)!=Yi)&&(_t=function(e){var t=tt(e),n=t==qn?e.constructor:_,r=n?Tr(n):"";if(r)switch(r){case tg:return ai;case ng:return dn;case rg:return Gi;case ig:return gn;case og:return Yi}return t});var sg=Vu?tr:zs,cf=ls(lf),Ni=Qt||function(e,t){return at.setTimeout(e,t)},$s=ls(ug),ff=Er(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(yl,function(n,r,a,s){t.push(a?s.replace(ch,"$1"):r||n)}),t}),lg=le(function(e,t){return $e(e)?Br(e,We(t,1,$e,!0)):[]}),hf=le(function(e,t){var n=Ot(t);return $e(n)&&(n=_),$e(e)?Br(e,We(t,1,$e,!0),Z(n,2)):[]}),pf=le(function(e,t){var n=Ot(t);return $e(n)&&(n=_),$e(e)?Br(e,We(t,1,$e,!0),_,n):[]}),cg=le(function(e){var t=O(e,cu);return t.length&&t[0]===e[0]?mi(t):[]}),fg=le(function(e){var t=Ot(e),n=O(e,cu);return t===Ot(n)?t=_:n.pop(),n.length&&n[0]===e[0]?mi(n,Z(t,2)):[]}),hg=le(function(e){var t=Ot(e),n=O(e,cu);return t=typeof t=="function"?t:_,t&&n.pop(),n.length&&n[0]===e[0]?mi(n,_,t):[]}),pg=le(mo),zi=Pn(function(e,t){var n=e==null?0:e.length,r=Ma(e,t);return nc(e,O(t,function(a){return gt(a,n)?+a:a}).sort(so)),r}),dg=le(function(e){return Dt(We(e,1,$e,!0))}),gg=le(function(e){var t=Ot(e);return $e(t)&&(t=_),Dt(We(e,1,$e,!0),Z(t,2))}),mg=le(function(e){var t=Ot(e);return t=typeof t=="function"?t:_,Dt(We(e,1,$e,!0),_,t)}),vg=le(function(e,t){return $e(e)?Br(e,t):[]}),yg=le(function(e){return kr(C(e,$e))}),df=le(function(e){var t=Ot(e);return $e(t)&&(t=_),kr(C(e,$e),Z(t,2))}),gf=le(function(e){var t=Ot(e);return t=typeof t=="function"?t:_,kr(C(e,$e),_,t)}),_g=le(vs),bg=le(function(e){var t=e.length,n=t>1?e[t-1]:_;return n=typeof n=="function"?(e.pop(),n):_,zu(e,n)}),wg=Pn(function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,a=function(s){return Ma(s,e)};return!(t>1||this.__actions__.length)&&r instanceof P&>(n)?(r=r.slice(n,+n+(t?1:0)),r.__actions__.push({func:vo,args:[a],thisArg:_}),new D(r,this.__chain__).thru(function(s){return t&&!s.length&&s.push(_),s})):this.thru(a)}),Ag=vi(function(e,t,n){ve.call(e,n)?++e[n]:Pe(e,n,1)}),Eg=hu(cs),Sg=hu(qr),Tg=vi(function(e,t,n){ve.call(e,n)?e[n].push(t):Pe(e,n,[t])}),Og=le(function(e,t,n){var r=-1,a=typeof t=="function",s=It(e)?we(e.length):[];return Mn(e,function(c){s[++r]=a?o(t,c,n):se(c,t,n)}),s}),Cg=vi(function(e,t,n){Pe(e,n,t)}),Ig=vi(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Rg=le(function(e,t){if(e==null)return[];var n=t.length;return n>1&&st(e,t[0],t[1])?t=[]:n>2&&st(t[0],t[1],t[2])&&(t=[t[0]]),br(e,We(t,1),[])}),na=Xu||function(){return at.Date.now()},ks=le(function(e,t,n){var r=jt;if(n.length){var a=q(n,ne(ks));r|=Vn}return Xn(e,r,t,n,a)}),mf=le(function(e,t,n){var r=jt|mr;if(n.length){var a=q(n,ne(mf));r|=Vn}return Xn(t,r,e,n,a)}),xg=le(function(e,t){return pi(e,1,t)}),Ng=le(function(e,t,n){return pi(e,an(t)||0,n)});Du.Cache=Yn;var zg=rt(function(e,t){t=t.length==1&&ie(t[0])?O(t[0],Ze(Z())):O(We(t,1),Ze(Z()));var n=t.length;return le(function(r){for(var a=-1,s=H(r.length,n);++a<s;)r[a]=t[a].call(this,r[a]);return o(e,this,r)})}),Vs=le(function(e,t){return Xn(e,Vn,_,t,q(t,ne(Vs)))}),vf=le(function(e,t){return Xn(e,$i,_,t,q(t,ne(vf)))}),Lg=Pn(function(e,t){return Xn(e,ni,_,_,_,t)}),Dg=co($r),Pg=co(function(e,t){return e>=t}),Qr=Ql(function(){return arguments}())?Ql:function(e){return Be(e)&&ve.call(e,"callee")&&!ef.call(e,"callee")},ie=we.isArray,Fg=Fl?Ze(Fl):Mh,Wn=Zd||zs,yf=Ul?Ze(Ul):Wh,Gs=Ml?Ze(Ml):jh,qs=Fr?Ze(Fr):$h,_f=en?Ze(en):Qn,Li=Fa?Ze(Fa):kh,Hs=co($a),Ug=co(function(e,t){return e<=t}),Mg=yi(function(e,t){if(Ai(t)||It(t))return Ln(t,nt(t),e),_;for(var n in t)ve.call(t,n)&&no(e,n,t[n])}),bf=yi(function(e,t){Ln(t,Ft(t),e)}),lt=yi(function(e,t,n,r){Ln(t,Ft(t),e,r)}),Ys=yi(function(e,t,n,r){Ln(t,nt(t),e,r)}),Wg=Pn(Ma),Bg=le(function(e,t){e=xe(e);var n=-1,r=t.length,a=r>2?t[2]:_;for(a&&st(t[0],t[1],a)&&(r=1);++n<r;)for(var s=t[n],c=Ft(s),f=-1,g=c.length;++f<g;){var w=c[f],b=e[w];(b===_||un(b,Ii[w])&&!ve.call(e,w))&&(e[w]=s[w])}return e}),jg=le(function(e){return e.push(_,ns),o(wf,_,e)}),$g=sc(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=ln.call(t)),e[t]=n},Wu(vt)),Qs=sc(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=ln.call(t)),ve.call(e,t)?e[t].push(n):e[t]=[n]},Z),kg=le(se),Js=yi(function(e,t,n){uu(e,t,n)}),wf=yi(function(e,t,n,r){uu(e,t,n,r)}),Vg=Pn(function(e,t){var n={};if(e==null)return n;var r=!1;t=O(t,function(s){return s=_n(s,e),r||(r=s.length>1),s}),Ln(e,os(e),n),r&&(n=qt(n,Bt|No|dr,ep));for(var a=t.length;a--;)Pt(n,t[a]);return n}),Gg=Pn(function(e,t){return e==null?{}:qh(e,t)}),Af=fo(nt),Xs=fo(Ft),qg=Dn(function(e,t,n){return t=t.toLowerCase(),e+(n?jc(t):t)}),Hg=Dn(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Yg=Dn(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Zs=ac("toLowerCase"),Ks=Dn(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Qg=Dn(function(e,t,n){return e+(n?" ":"")+el(t)}),Jg=Dn(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),el=ac("toUpperCase"),Ef=le(function(e,t){try{return o(e,_,t)}catch(n){return Os(n)?n:new Ds(n)}}),Xg=Pn(function(e,t){return m(t,function(n){n=Fn(n),Pe(e,n,ks(e[n],e))}),e}),Zg=Ka(),Kg=Ka(!0),em=le(function(e,t){return function(n){return se(n,e,t)}}),tm=le(function(e,t){return function(n){return se(e,n,t)}}),nm=gu(O),rm=gu(S),im=gu(j),om=mu(),um=mu(!0),am=du(function(e,t){return e+t},0),sm=vu("ceil"),lm=du(function(e,t){return e/t},1),cm=vu("floor"),fm=du(function(e,t){return e*t},1),hm=vu("round"),pm=du(function(e,t){return e-t},0);return l.after=As,l.ary=Es,l.assign=Mg,l.assignIn=bf,l.assignInWith=lt,l.assignWith=Ys,l.at=Wg,l.before=Ss,l.bind=ks,l.bindAll=Xg,l.bindKey=mf,l.castArray=Lp,l.chain=Oc,l.chunk=Un,l.compact=up,l.concat=ap,l.cond=Mu,l.conforms=Fd,l.constant=Wu,l.countBy=Ag,l.create=Kp,l.curry=_o,l.curryRight=Ts,l.debounce=bn,l.defaults=Bg,l.defaultsDeep=jg,l.defer=xg,l.delay=Ng,l.difference=lg,l.differenceBy=hf,l.differenceWith=pf,l.drop=Cu,l.dropRight=Ei,l.dropRightWhile=gc,l.dropWhile=mc,l.fill=sp,l.filter=bp,l.flatMap=_s,l.flatMapDeep=wp,l.flatMapDepth=Ap,l.flatten=Si,l.flattenDeep=lp,l.flattenDepth=vc,l.flip=Yr,l.flow=Zg,l.flowRight=Kg,l.fromPairs=yc,l.functions=id,l.functionsIn=od,l.groupBy=Tg,l.initial=Iu,l.intersection=cg,l.intersectionBy=fg,l.intersectionWith=hg,l.invert=$g,l.invertBy=Qs,l.invokeMap=Og,l.iteratee=Bu,l.keyBy=Cg,l.keys=nt,l.keysIn=Ft,l.map=Lu,l.mapKeys=ad,l.mapValues=Bc,l.matches=Hc,l.matchesProperty=Yc,l.memoize=Du,l.merge=Js,l.mergeWith=wf,l.method=em,l.methodOf=tm,l.mixin=ju,l.negate=bo,l.nthArg=Md,l.omit=Vg,l.omitBy=sd,l.once=Cp,l.orderBy=Ep,l.over=nm,l.overArgs=zg,l.overEvery=rm,l.overSome=im,l.partial=Vs,l.partialRight=vf,l.partition=Ig,l.pick=Gg,l.pickBy=Ao,l.property=Eo,l.propertyOf=$u,l.pull=pg,l.pullAll=mo,l.pullAllBy=wc,l.pullAllWith=hs,l.pullAt=zi,l.range=om,l.rangeRight=um,l.rearg=Lg,l.reject=Rc,l.remove=fp,l.rest=Ip,l.reverse=Ru,l.sampleSize=Op,l.set=cd,l.setWith=fd,l.shuffle=ws,l.slice=Zn,l.sortBy=Rg,l.sortedUniq=Kn,l.sortedUniqBy=ps,l.split=Od,l.spread=Rp,l.tail=ds,l.take=gs,l.takeRight=xu,l.takeRightWhile=Ti,l.takeWhile=K,l.tap=gp,l.throttle=xp,l.thru=vo,l.toArray=Fc,l.toPairs=Af,l.toPairsIn=Xs,l.toPath=jd,l.toPlainObject=Mc,l.transform=hd,l.unary=Np,l.union=dg,l.unionBy=gg,l.unionWith=mg,l.uniq=Nu,l.uniqBy=ms,l.uniqWith=Hr,l.unset=pd,l.unzip=vs,l.unzipWith=zu,l.update=dd,l.updateWith=gd,l.values=Ci,l.valuesIn=md,l.without=vg,l.words=Gc,l.wrap=zp,l.xor=yg,l.xorBy=df,l.xorWith=gf,l.zip=_g,l.zipObject=Tc,l.zipObjectDeep=mt,l.zipWith=bg,l.entries=Af,l.entriesIn=Xs,l.extend=bf,l.extendWith=lt,ju(l,l),l.add=am,l.attempt=Ef,l.camelCase=qg,l.capitalize=jc,l.ceil=sm,l.clamp=vd,l.clone=Dp,l.cloneDeep=Fp,l.cloneDeepWith=Up,l.cloneWith=Pp,l.conformsTo=zc,l.deburr=$c,l.defaultTo=qc,l.divide=lm,l.endsWith=bd,l.eq=un,l.escape=wd,l.escapeRegExp=kc,l.every=ys,l.find=Eg,l.findIndex=cs,l.findKey=ed,l.findLast=Sg,l.findLastIndex=qr,l.findLastKey=td,l.floor=cm,l.forEach=Oi,l.forEachRight=bs,l.forIn=nd,l.forInRight=rd,l.forOwn=Cs,l.forOwnRight=Wc,l.get=Is,l.gt=Dg,l.gte=Pg,l.has=ud,l.hasIn=Rs,l.head=go,l.identity=vt,l.includes=Ic,l.indexOf=_c,l.inRange=yd,l.invoke=kg,l.isArguments=Qr,l.isArray=ie,l.isArrayBuffer=Fg,l.isArrayLike=It,l.isArrayLikeObject=$e,l.isBoolean=Mp,l.isBuffer=Wn,l.isDate=yf,l.isElement=Wp,l.isEmpty=Lc,l.isEqual=Bp,l.isEqualWith=jp,l.isError=Os,l.isFinite=$p,l.isFunction=tr,l.isInteger=Dc,l.isLength=Rt,l.isMap=Gs,l.isMatch=kp,l.isMatchWith=Pc,l.isNaN=Vp,l.isNative=Gp,l.isNil=Hp,l.isNull=qp,l.isNumber=Pu,l.isObject=Fe,l.isObjectLike=Be,l.isPlainObject=wo,l.isRegExp=qs,l.isSafeInteger=Yp,l.isSet=_f,l.isString=Fu,l.isSymbol=Yt,l.isTypedArray=Li,l.isUndefined=Qp,l.isWeakMap=Jp,l.isWeakSet=Xp,l.join=fs,l.kebabCase=Hg,l.last=Ot,l.lastIndexOf=cp,l.lowerCase=Yg,l.lowerFirst=Zs,l.lt=Hs,l.lte=Ug,l.max=kd,l.maxBy=Vd,l.mean=Gd,l.meanBy=qd,l.min=Hd,l.minBy=Yd,l.stubArray=Ns,l.stubFalse=zs,l.stubObject=Ls,l.stubString=Qc,l.stubTrue=Wd,l.multiply=fm,l.nth=bc,l.noConflict=Ud,l.noop=xs,l.now=na,l.pad=Vc,l.padEnd=Ad,l.padStart=Ed,l.parseInt=Sd,l.random=_d,l.reduce=Sp,l.reduceRight=Tp,l.repeat=Td,l.replace=Uu,l.result=ld,l.round=hm,l.runInContext=p,l.sample=xc,l.size=Nc,l.snakeCase=Ks,l.some=yo,l.sortedIndex=Ac,l.sortedIndexBy=Ec,l.sortedIndexOf=hp,l.sortedLastIndex=Sc,l.sortedLastIndexBy=pp,l.sortedLastIndexOf=dp,l.startCase=Qg,l.startsWith=Cd,l.subtract=pm,l.sum=Qd,l.sumBy=Jd,l.template=Id,l.times=Bd,l.toFinite=nr,l.toInteger=ae,l.toLength=Uc,l.toLower=Rd,l.toNumber=an,l.toSafeInteger=Zp,l.toString=me,l.toUpper=xd,l.trim=Nd,l.trimEnd=zd,l.trimStart=Ld,l.truncate=Dd,l.unescape=Pd,l.uniqueId=$d,l.upperCase=Jg,l.upperFirst=el,l.each=Oi,l.eachRight=bs,l.first=go,ju(l,function(){var e={};return Rn(l,function(t,n){ve.call(l.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),l.VERSION=Bi,m(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){l[e].placeholder=l}),m(["drop","take"],function(e,t){P.prototype[e]=function(n){n=n===_?1:Te(ae(n),0);var r=this.__filtered__&&!t?new P(this):this.clone();return r.__filtered__?r.__takeCount__=H(n,r.__takeCount__):r.__views__.push({size:H(n,On),type:e+(r.__dir__<0?"Right":"")}),r},P.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),m(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n==ca||n==Qf;P.prototype[e]=function(a){var s=this.clone();return s.__iteratees__.push({iteratee:Z(a,3),type:n}),s.__filtered__=s.__filtered__||r,s}}),m(["head","last"],function(e,t){var n="take"+(t?"Right":"");P.prototype[e]=function(){return this[n](1).value()[0]}}),m(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");P.prototype[e]=function(){return this.__filtered__?new P(this):this[n](1)}}),P.prototype.compact=function(){return this.filter(vt)},P.prototype.find=function(e){return this.filter(e).head()},P.prototype.findLast=function(e){return this.reverse().find(e)},P.prototype.invokeMap=le(function(e,t){return typeof e=="function"?new P(this):this.map(function(n){return se(n,e,t)})}),P.prototype.reject=function(e){return this.filter(bo(Z(e)))},P.prototype.slice=function(e,t){e=ae(e);var n=this;return n.__filtered__&&(e>0||t<0)?new P(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==_&&(t=ae(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},P.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},P.prototype.toArray=function(){return this.take(On)},Rn(P.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),a=l[r?"take"+(t=="last"?"Right":""):t],s=r||/^find/.test(t);a&&(l.prototype[t]=function(){var c=this.__wrapped__,f=r?[1]:arguments,g=c instanceof P,w=f[0],b=g||ie(c),E=function(B){var $=a.apply(l,F([B],f));return r&&T?$[0]:$};b&&n&&typeof w=="function"&&w.length!=1&&(g=b=!1);var T=this.__chain__,x=!!this.__actions__.length,z=s&&!T,M=g&&!x;if(!s&&b){c=M?c:new P(this);var L=e.apply(c,f);return L.__actions__.push({func:vo,args:[E],thisArg:_}),new D(L,T)}return z&&M?e.apply(this,f):(L=this.thru(E),z?r?L.value()[0]:L.value():L)})}),m(["pop","push","shift","sort","splice","unshift"],function(e){var t=wn[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);l.prototype[e]=function(){var a=arguments;if(r&&!this.__chain__){var s=this.value();return t.apply(ie(s)?s:[],a)}return this[n](function(c){return t.apply(ie(c)?c:[],a)})}}),Rn(P.prototype,function(e,t){var n=l[t];if(n){var r=n.name+"";ve.call(Ri,r)||(Ri[r]=[]),Ri[r].push({name:t,func:n})}}),Ri[pu(_,mr).name]=[{name:"wrapper",func:_}],P.prototype.clone=fe,P.prototype.reverse=be,P.prototype.value=Ua,l.prototype.at=wg,l.prototype.chain=mp,l.prototype.commit=Cc,l.prototype.next=vp,l.prototype.plant=_p,l.prototype.reverse=er,l.prototype.toJSON=l.prototype.valueOf=l.prototype.value=Ct,l.prototype.first=l.prototype.head,ir&&(l.prototype[ir]=yp),l},mn=xh();Hn?((Hn.exports=mn)._=mn,Da._=mn):at._=mn}).call(Rr)})(xf,xf.exports);var N_=xf.exports,_v={};(function(i){i.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendAll:"assignInAll",extendAllWith:"assignInAllWith",extendWith:"assignInWith",first:"head",conforms:"conformsTo",matches:"isMatch",property:"get",__:"placeholder",F:"stubFalse",T:"stubTrue",all:"every",allPass:"overEvery",always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",dropLast:"dropRight",dropLastWhile:"dropRightWhile",equals:"isEqual",identical:"eq",indexBy:"keyBy",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",props:"at",symmetricDifference:"xor",symmetricDifferenceBy:"xorBy",symmetricDifferenceWith:"xorWith",takeLast:"takeRight",takeLastWhile:"takeRightWhile",unapply:"rest",unnest:"flatten",useWith:"overArgs",where:"conformsTo",whereEq:"isMatch",zipObj:"zipObject"},i.aryMethod={1:["assignAll","assignInAll","attempt","castArray","ceil","create","curry","curryRight","defaultsAll","defaultsDeepAll","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","mergeAll","methodOf","mixin","nthArg","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words","zipAll"],2:["add","after","ary","assign","assignAllWith","assignIn","assignInAllWith","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","conformsTo","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","defaultTo","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","meanBy","merge","mergeAllWith","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","propertyOf","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","findFrom","findIndexFrom","findLastFrom","findLastIndexFrom","getOr","includesFrom","indexOfFrom","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqualWith","isMatchWith","flatMapDepth","lastIndexOfFrom","mergeWith","orderBy","padChars","padCharsEnd","padCharsStart","pullAllBy","pullAllWith","rangeStep","rangeStepRight","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","update","xorBy","xorWith","zipWith"],4:["fill","setWith","updateWith"]},i.aryRearg={2:[1,0],3:[2,0,1],4:[3,2,0,1]},i.iterateeAry={dropRightWhile:1,dropWhile:1,every:1,filter:1,find:1,findFrom:1,findIndex:1,findIndexFrom:1,findKey:1,findLast:1,findLastFrom:1,findLastIndex:1,findLastIndexFrom:1,findLastKey:1,flatMap:1,flatMapDeep:1,flatMapDepth:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,transform:2},i.iterateeRearg={mapKeys:[1],reduceRight:[1,0]},i.methodRearg={assignInAllWith:[1,0],assignInWith:[1,2,0],assignAllWith:[1,0],assignWith:[1,2,0],differenceBy:[1,2,0],differenceWith:[1,2,0],getOr:[2,1,0],intersectionBy:[1,2,0],intersectionWith:[1,2,0],isEqualWith:[1,2,0],isMatchWith:[2,1,0],mergeAllWith:[1,0],mergeWith:[1,2,0],padChars:[2,1,0],padCharsEnd:[2,1,0],padCharsStart:[2,1,0],pullAllBy:[2,1,0],pullAllWith:[2,1,0],rangeStep:[1,2,0],rangeStepRight:[1,2,0],setWith:[3,1,2,0],sortedIndexBy:[2,1,0],sortedLastIndexBy:[2,1,0],unionBy:[1,2,0],unionWith:[1,2,0],updateWith:[3,1,2,0],xorBy:[1,2,0],xorWith:[1,2,0],zipWith:[1,2,0]},i.methodSpread={assignAll:{start:0},assignAllWith:{start:0},assignInAll:{start:0},assignInAllWith:{start:0},defaultsAll:{start:0},defaultsDeepAll:{start:0},invokeArgs:{start:2},invokeArgsMap:{start:2},mergeAll:{start:0},mergeAllWith:{start:0},partial:{start:1},partialRight:{start:1},without:{start:1},zipAll:{start:0}},i.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAllWith:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignAll:!0,assignAllWith:!0,assignIn:!0,assignInAll:!0,assignInAllWith:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsAll:!0,defaultsDeep:!0,defaultsDeepAll:!0,merge:!0,mergeAll:!0,mergeAllWith:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0,update:!0,updateWith:!0}},i.realToAlias=function(){var u=Object.prototype.hasOwnProperty,o=i.aliasToReal,h={};for(var m in o){var A=o[m];u.call(h,A)?h[A].push(m):h[A]=[m]}return h}(),i.remap={assignAll:"assign",assignAllWith:"assignWith",assignInAll:"assignIn",assignInAllWith:"assignInWith",curryN:"curry",curryRightN:"curryRight",defaultsAll:"defaults",defaultsDeepAll:"defaultsDeep",findFrom:"find",findIndexFrom:"findIndex",findLastFrom:"findLast",findLastIndexFrom:"findLastIndex",getOr:"get",includesFrom:"includes",indexOfFrom:"indexOf",invokeArgs:"invoke",invokeArgsMap:"invokeMap",lastIndexOfFrom:"lastIndexOf",mergeAll:"merge",mergeAllWith:"mergeWith",padChars:"pad",padCharsEnd:"padEnd",padCharsStart:"padStart",propertyOf:"get",rangeStep:"range",rangeStepRight:"rangeRight",restFrom:"rest",spreadFrom:"spread",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart",zipAll:"zip"},i.skipFixed={castArray:!0,flow:!0,flowRight:!0,iteratee:!0,mixin:!0,rearg:!0,runInContext:!0},i.skipRearg={add:!0,assign:!0,assignIn:!0,bind:!0,bindKey:!0,concat:!0,difference:!0,divide:!0,eq:!0,gt:!0,gte:!0,isEqual:!0,lt:!0,lte:!0,matchesProperty:!0,merge:!0,multiply:!0,overArgs:!0,partial:!0,partialRight:!0,propertyOf:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0,zipObjectDeep:!0}})(_v);var z_={},ct=_v,L_=z_,Gm=Array.prototype.push;function D_(i,u){return u==2?function(o,h){return i.apply(void 0,arguments)}:function(o){return i.apply(void 0,arguments)}}function gm(i,u){return u==2?function(o,h){return i(o,h)}:function(o){return i(o)}}function qm(i){for(var u=i?i.length:0,o=Array(u);u--;)o[u]=i[u];return o}function P_(i){return function(u){return i({},u)}}function F_(i,u){return function(){for(var o=arguments.length,h=o-1,m=Array(o);o--;)m[o]=arguments[o];var A=m[u],S=m.slice(0,u);return A&&Gm.apply(S,A),u!=h&&Gm.apply(S,m.slice(u+1)),i.apply(this,S)}}function mm(i,u){return function(){var o=arguments.length;if(o){for(var h=Array(o);o--;)h[o]=arguments[o];var m=h[0]=u.apply(void 0,h);return i.apply(void 0,h),m}}}function Tm(i,u,o,h){var m=typeof u=="function",A=u===Object(u);if(A&&(h=o,o=u,u=void 0),o==null)throw new TypeError;h||(h={});var S={cap:"cap"in h?h.cap:!0,curry:"curry"in h?h.curry:!0,fixed:"fixed"in h?h.fixed:!0,immutable:"immutable"in h?h.immutable:!0,rearg:"rearg"in h?h.rearg:!0},C=m?o:L_,R="curry"in h&&h.curry,N="fixed"in h&&h.fixed,O="rearg"in h&&h.rearg,F=m?o.runInContext():void 0,U=m?o:{ary:i.ary,assign:i.assign,clone:i.clone,curry:i.curry,forEach:i.forEach,isArray:i.isArray,isError:i.isError,isFunction:i.isFunction,isWeakMap:i.isWeakMap,iteratee:i.iteratee,keys:i.keys,rearg:i.rearg,toInteger:i.toInteger,toPath:i.toPath},Q=U.ary,j=U.assign,J=U.clone,te=U.curry,X=U.forEach,ye=U.isArray,_e=U.isError,Le=U.isFunction,Ve=U.isWeakMap,Ye=U.keys,Me=U.rearg,hn=U.toInteger,$n=U.toPath,Qe=Ye(ct.aryMethod),En={castArray:function(G){return function(){var W=arguments[0];return ye(W)?G(qm(W)):G.apply(void 0,arguments)}},iteratee:function(G){return function(){var W=arguments[0],V=arguments[1],q=G(W,V),re=q.length;return S.cap&&typeof V=="number"?(V=V>2?V-2:1,re&&re<=V?q:gm(q,V)):q}},mixin:function(G){return function(W){var V=this;if(!Le(V))return G(V,Object(W));var q=[];return X(Ye(W),function(re){Le(W[re])&&q.push([re,V.prototype[re]])}),G(V,Object(W)),X(q,function(re){var ot=re[1];Le(ot)?V.prototype[re[0]]=ot:delete V.prototype[re[0]]}),V}},nthArg:function(G){return function(W){var V=W<0?1:hn(W)+1;return te(G(W),V)}},rearg:function(G){return function(W,V){var q=V?V.length:0;return te(G(W,V),q)}},runInContext:function(G){return function(W){return Tm(i,G(W),h)}}};function Sn(G,W){if(S.cap){var V=ct.iterateeRearg[G];if(V)return ei(W,V);var q=!m&&ct.iterateeAry[G];if(q)return Ro(W,q)}return W}function Kr(G,W,V){return R||S.curry&&V>1?te(W,V):W}function fr(G,W,V){if(S.fixed&&(N||!ct.skipFixed[G])){var q=ct.methodSpread[G],re=q&&q.start;return re===void 0?Q(W,V):F_(W,re)}return W}function Ze(G,W,V){return S.rearg&&V>1&&(O||!ct.skipRearg[G])?Me(W,ct.methodRearg[G]||ct.aryRearg[V]):W}function Wi(G,W){W=$n(W);for(var V=-1,q=W.length,re=q-1,ot=J(Object(G)),wt=ot;wt!=null&&++V<q;){var ut=W[V],Ke=wt[ut];Ke!=null&&!(Le(Ke)||_e(Ke)||Ve(Ke))&&(wt[ut]=J(V==re?Ke:Object(Ke))),wt=wt[ut]}return ot}function Ut(G){return Ge.runInContext.convert(G)(void 0)}function Kt(G,W){var V=ct.aliasToReal[G]||G,q=ct.remap[V]||V,re=h;return function(ot){var wt=m?F:U,ut=m?F[q]:W,Ke=j(j({},re),ot);return Tm(wt,V,ut,Ke)}}function Ro(G,W){return Mt(G,function(V){return typeof V=="function"?gm(V,W):V})}function ei(G,W){return Mt(G,function(V){var q=W.length;return D_(Me(gm(V,q),W),q)})}function Mt(G,W){return function(){var V=arguments.length;if(!V)return G();for(var q=Array(V);V--;)q[V]=arguments[V];var re=S.rearg?0:V-1;return q[re]=W(q[re]),G.apply(void 0,q)}}function xo(G,W,V){var q,re=ct.aliasToReal[G]||G,ot=W,wt=En[re];return wt?ot=wt(W):S.immutable&&(ct.mutate.array[re]?ot=mm(W,qm):ct.mutate.object[re]?ot=mm(W,P_(W)):ct.mutate.set[re]&&(ot=mm(W,Wi))),X(Qe,function(ut){return X(ct.aryMethod[ut],function(Ke){if(re==Ke){var De=ct.methodSpread[re],hr=De&&De.afterRearg;return q=hr?fr(re,Ze(re,ot,ut),ut):Ze(re,fr(re,ot,ut),ut),q=Sn(re,q),q=Kr(re,q,ut),!1}}),!q}),q||(q=ot),q==W&&(q=R?te(q,1):function(){return W.apply(this,arguments)}),q.convert=Kt(re,W),q.placeholder=W.placeholder=V,q}if(!A)return xo(u,o,C);var Ge=o,Nr=[];return X(Qe,function(G){X(ct.aryMethod[G],function(W){var V=Ge[ct.remap[W]||W];V&&Nr.push([W,xo(W,V,Ge)])})}),X(Ye(Ge),function(G){var W=Ge[G];if(typeof W=="function"){for(var V=Nr.length;V--;)if(Nr[V][0]==G)return;W.convert=Kt(G,W),Nr.push([G,W])}}),X(Nr,function(G){Ge[G[0]]=G[1]}),Ge.convert=Ut,Ge.placeholder=Ge,X(Ye(Ge),function(G){X(ct.realToAlias[G]||[],function(W){Ge[W]=Ge[G]})}),Ge}var U_=Tm,Hm=N_.runInContext(),rl=U_(Hm,Hm),Ie;(function(i){i.Arg="Arg",i.DynamicInput="DynamicInput",i.DynamicOutputMethod="DynamicOutputMethod",i.DynamicOutputProperty="DynamicOutputProperty",i.Enum="Enum",i.ExtendInputObject="ExtendInputObject",i.ExtendObject="ExtendObject",i.InputField="InputField",i.InputObject="InputObject",i.Interface="Interface",i.List="List",i.NonNull="NonNull",i.Null="Null",i.Object="Object",i.OutputField="OutputField",i.Plugin="Plugin",i.PrintedGenTyping="PrintedGenTyping",i.PrintedGenTypingImport="PrintedGenTypingImport",i.Scalar="Scalar",i.Union="Union"})(Ie||(Ie={}));const Mf=Symbol.for("@nexus/wrapped");function bt(i,u){i.prototype[Mf]=u}class M_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(M_,Ie.Interface);class W_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(W_,Ie.Object);class B_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(B_,Ie.Union);function j_(i,u){var o;return i.extensions=Object.assign(Object.assign({},i.extensions),{nexus:Object.assign(Object.assign({},Object((o=i.extensions)===null||o===void 0?void 0:o.nexus)),u)}),i}const Nf=Symbol.for("@nexus/meta/NEXUS_TYPE"),$_=Symbol.for("@nexus/meta/NEXUS_BUILD");function k_(i){return!!(i&&typeof sl.get(i,$_)=="function")}function V_(i){return G_(i)||bv(i)}function G_(i){return!!(i&&sl.has(i,Nf)&&la(sl.get(i,Nf)))}function bv(i){return!!(i&&sl.has(i,Nf)&&typeof sl.get(i,Nf)=="function")}function Nm(i){return k_(i)||V_(i)||bv(i)}class q_{constructor(u){this.config=u}}bt(q_,Ie.PrintedGenTypingImport);class H_{constructor(u){this.config=u}get imports(){return this.config.imports||[]}toString(){let u="";this.config.description&&(u=`/**
|
|
123
123
|
${this.config.description.split(`
|
|
124
124
|
`).map(m=>m.trim()).filter(m=>m).map(m=>` * ${m}`).join(`
|
|
125
125
|
`)}
|
|
126
126
|
*/
|
|
127
|
-
`);const o=`${this.config.name}${this.config.optional?"?":""}`;return u+=`${o}: ${this.config.type}`,u}}bt(
|
|
127
|
+
`);const o=`${this.config.name}${this.config.optional?"?":""}`;return u+=`${o}: ${this.config.type}`,u}}bt(H_,Ie.PrintedGenTyping);j_(new nv({name:"NEXUS__UNKNOWN__TYPE",description:`
|
|
128
128
|
This scalar should never make it into production. It is used as a placeholder for situations
|
|
129
129
|
where GraphQL Nexus encounters a missing type. We don't want to error immediately, otherwise
|
|
130
130
|
the TypeScript definitions will not be updated.
|
|
131
|
-
`,parseValue(i){throw new Error("Error: NEXUS__UNKNOWN__TYPE is not a valid scalar.")},parseLiteral(i){throw new Error("Error: NEXUS__UNKNOWN__TYPE is not a valid scalar.")},serialize(i){throw new Error("Error: NEXUS__UNKNOWN__TYPE is not a valid scalar.")}}),{sourceType:"never"});const sl={has(i,u){return!!Object.getOwnPropertyDescriptor(i,u)},set(i,u,o){return Object.defineProperty(i,u,{value:o}),o},get(i,u){var o;return(o=Object.getOwnPropertyDescriptor(i,u))===null||o===void 0?void 0:o.value}};class wv{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(wv,Ie.Arg);function Wf(i){if(!i.type)throw new Error('You must provide a "type" for the arg()');return new wv(typeof i.type=="string"?i.type:i.type.name,i)}function Av(i){return Wf(Object.assign({type:"String"},i))}function Bf(i){return Wf(Object.assign({type:"Int"},i))}class
|
|
131
|
+
`,parseValue(i){throw new Error("Error: NEXUS__UNKNOWN__TYPE is not a valid scalar.")},parseLiteral(i){throw new Error("Error: NEXUS__UNKNOWN__TYPE is not a valid scalar.")},serialize(i){throw new Error("Error: NEXUS__UNKNOWN__TYPE is not a valid scalar.")}}),{sourceType:"never"});const sl={has(i,u){return!!Object.getOwnPropertyDescriptor(i,u)},set(i,u,o){return Object.defineProperty(i,u,{value:o}),o},get(i,u){var o;return(o=Object.getOwnPropertyDescriptor(i,u))===null||o===void 0?void 0:o.value}};class wv{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(wv,Ie.Arg);function Wf(i){if(!i.type)throw new Error('You must provide a "type" for the arg()');return new wv(typeof i.type=="string"?i.type:i.type.name,i)}function Av(i){return Wf(Object.assign({type:"String"},i))}function Bf(i){return Wf(Object.assign({type:"Int"},i))}class Y_{constructor(u){if(this.ofNexusType=u,this._isNexusListDef=!0,typeof u!="string"&&!la(u)&&!Nm(u)&&!ll(u))throw new Error("Cannot wrap unknown types in list(). Saw "+u)}}bt(Y_,Ie.List);class Om{constructor(u){if(this.ofNexusType=u,this._isNexusNonNullDef=!0,typeof u!="string"&&!la(u)&&!Nm(u)&&!ll(u))throw new Error("Cannot wrap unknown types in a nonNull(). Saw "+u)}}bt(Om,Ie.NonNull);function Ev(i){return Sv(i)||Rm(i)?i:Tv(i)?new Om(i.ofNexusType):new Om(i)}class Cm{constructor(u){if(this.ofNexusType=u,this._isNexusNullDef=!0,typeof u!="string"&&!la(u)&&!Nm(u)&&!ll(u))throw new Error("Cannot wrap unknown types in nullable(). Saw "+u)}}bt(Cm,Ie.Null);function zf(i){return Sv(i)?new Cm(i.ofNexusType):Tv(i)?i:new Cm(i)}Ie.Enum,Ie.Object,Ie.Scalar,Ie.Union,Ie.Interface,Ie.InputObject;function la(i){return i&&!!i[Mf]}function Sv(i){return la(i)&&i[Mf]===Ie.NonNull}function Tv(i){return la(i)&&i[Mf]===Ie.Null}class Q_{constructor(u){this.config=u}}bt(Q_,Ie.Plugin);class J_{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(J_,Ie.DynamicInput);class X_{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(X_,Ie.DynamicOutputMethod);const Z_={first:zf(Bf({description:"Returns the first n elements from the list."})),after:zf(Av({description:"Returns the elements in the list that come after the specified cursor"}))};Object.assign(Object.assign({},Z_),{first:Ev(Bf({description:"Returns the first n elements from the list."}))});const K_={last:zf(Bf({description:"Returns the last n elements from the list."})),before:zf(Av({description:"Returns the elements in the list that come before the specified cursor"}))};Object.assign(Object.assign({},K_),{last:Ev(Bf({description:"Returns the last n elements from the list."}))});var Lf=typeof Symbol=="function"?Symbol:void 0;Lf&&Lf.iterator;Lf&&Lf.asyncIterator;class e1{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}asArg(u){return Wf(Object.assign(Object.assign({},u),{type:this}))}}bt(e1,Ie.Enum);class Ov{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}asArg(u){return Wf(Object.assign(Object.assign({},u),{type:this}))}}bt(Ov,Ie.InputObject);function t1(i){return new Ov(i.name,i)}class n1{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(n1,Ie.Scalar);class r1{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(r1,Ie.ExtendInputObject);class i1{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(i1,Ie.ExtendObject);class o1{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(o1,Ie.DynamicOutputProperty);const Ym=["id"],u1=(i,u,o)=>{const{naming:h,mappers:m}=strapi.plugin("graphql").service("utils"),A=m.strapiScalarToGraphQLScalar(o.type);i.field(u,{type:h.getScalarFilterInputTypeName(A)})},a1=(i,u,o)=>{const h=strapi.plugin("graphql").service("utils"),m=strapi.plugin("graphql").service("extension"),{getFiltersInputTypeName:A}=h.naming,{isMorphRelation:S}=h.attributes,C=strapi.getModel(o.target);!C||S(o)||m.shadowCRUD(C.uid).isDisabled()||i.field(u,{type:A(C)})},s1=({strapi:i})=>{const{service:u}=i.plugin("graphql"),o=A=>{const{operators:S}=u("builders").filters;if(Array.isArray(A))return A.map(o);if(rl.isDate(A)||!rl.isObject(A))return A;const C={};for(const[R,N]of Object.entries(A)){const F=!!S[R]?S[R].strapiOperator:R;C[F]=o(N)}return C},h=()=>{const{operators:A}=i.plugin("graphql").service("builders").filters;return[A.and,A.or,A.not]},m=(A,S={})=>{const{isStrapiScalar:C,isMedia:R,isRelation:N}=u("utils").attributes,{operators:O}=u("builders").filters,F=[O.and,O.or,O.not];if(rl.isNil(A))return{};if(Array.isArray(A))return A.reduce((J,te)=>(J.push(m(te,S)),J),[]);const U={},{attributes:Q}=S,j=J=>Ym.includes(J)||rl.has(J,Q);for(const[J,te]of Object.entries(A))if(j(J)){const X=Q[J];if(Ym.includes(J)||C(X))U[J]=o(te);else if(N(X)||R(X)){const ye=i.getModel(X.target);U[J]=m(te,ye)}}else{const X=F.find(rl.propEq("fieldName",J));if(X){const{strapiOperator:ye}=X;U[ye]=m(te,S)}}return U};return{graphQLFiltersToStrapiQuery:m,buildContentTypeFilters(A){const S=i.plugin("graphql").service("utils"),C=i.plugin("graphql").service("extension"),{getFiltersInputTypeName:R,getScalarFilterInputTypeName:N}=S.naming,{isStrapiScalar:O,isRelation:F}=S.attributes,{attributes:U}=A,Q=R(A);return t1({name:Q,definition(j){const J=Object.entries(U).filter(([X])=>C.shadowCRUD(A.uid).field(X).hasFiltersEnabeld()),te=C.shadowCRUD(A.uid).field("id").hasFiltersEnabeld();A.kind==="collectionType"&&te&&j.field("id",{type:N("ID")});for(const[X,ye]of J)O(ye)?u1(j,X,ye):F(ye)&&a1(j,X,ye);for(const X of h())X.add(j,Q)}})}}},l1=({strapi:i})=>{const u=Uf(i);return{getConfig:async(o=!1)=>{const h=await u.get(o);if(pe(h))return h.right;throw h.left},update:async o=>{const h=await u.update(o);if(pe(h))return h.right;throw h.left},restore:async()=>{const o=await u.restore();if(pe(o))return o.right;throw o.left},restart:()=>i.reload()}},c1={admin:T_,client:C_,common:x_,settings:l1,gql:s1},f1={register:Wv,bootstrap:yy,config:wy,controllers:v_,routes:A_,services:c1,contentTypes:Pv};module.exports=f1;
|