strapi-plugin-comments 3.0.15 → 3.0.16

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.
@@ -24,7 +24,7 @@ __p += '`),j&&(S+=`' +
24
24
  function print() { __p += __j.call(arguments, '') }
25
25
  `:`;
26
26
  `)+S+`return __p
27
- }`;var M=Gs(function(){return D(s,x+"return "+S).apply(o,c)});if(M.source=S,Ds(M))throw M;return M}function Vs(e){return he(e).toLowerCase()}function mf(e){return he(e).toUpperCase()}function Lg(e,t,n){if(e=he(e),e&&(n||t===o))return Nl(e);if(!e||!(t=Ht(t)))return e;var r=en(e),a=en(t),s=Ll(r,a),c=zl(r,a)+1;return Er(r,s,c).join("")}function zg(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=zl(r,en(t))+1;return Er(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 Er(r,a).join("")}function Qr(e,t){var n=Qe,r=Sn;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?Er(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 S=w.index;g=g.slice(0,S===o?f:S)}}else if(e.indexOf(Ht(a),f)!=f){var O=g.lastIndexOf(a);O>-1&&(g=g.slice(0,O))}return g+r}function ie(e){return e=he(e),e&&kf.test(e)?e.replace(ni,Oh):e}var Dg=qr(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Wn=cs("toUpperCase");function vf(e,t,n){return e=he(e),t=n?o:t,t===o?at(e)?Ch(e):Cl(e):e.match(t)||[]}var Gs=ne(function(e,t){try{return Lt(e,o,t)}catch(n){return Ds(n)?n:new P(n)}}),qs=Kn(function(e,t){return kt(t,function(n){n=bn(n),Nn(e,n,vt(e[n],e))}),e});function yf(e){var t=e==null?0:e.length,n=X();return e=t?Ce(e,function(r){if(typeof r[1]!="function")throw new tn(E);return[n(r[0]),r[1]]}):[],ne(function(r){for(var a=-1;++a<t;){var s=e[a];if(Lt(s[0],this,r))return Lt(s[1],this,r)}})}function zi(e){return ic(Dt(e,F))}function Hs(e){return function(){return e}}function Fg(e,t){return e==null||e!==e?t:e}var Ug=vc(),_f=vc(!0);function lt(e){return e}function Ys(e){return gu(typeof e=="function"?e:Dt(e,F))}function Mg(e){return es(Dt(e,F))}function Wg(e,t){return vu(e,Dt(t,F))}var Bg=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__),S=b.__actions__=Ot(this.__actions__);return S.push({func:g,args:arguments,thisArg:e}),b.__chain__=w,b}return g.apply(e,Vt([this.value()],arguments))})}),e}function jg(){return et._===this&&(et._=Yn),this}function Js(){}function bf(e){return e=H(e),ne(function(t){return ts(t,e)})}var kg=fs(Ce),Vg=fs(Ho),wf=fs(Ta);function Xs(e){return ys(e)?xa(bn(e)):ep(e)}function Gg(e){return function(t){return e==null?o:Vr(e,t)}}var qg=_c(),Hg=_c(!0);function Zs(){return[]}function Ks(){return!1}function Yg(){return{}}function Qg(){return""}function el(){return!0}function Af(e,t){if(e=H(e),e<1||e>Kt)return[];var n=Mt,r=De(e,Mt);t=X(t),e-=Mt;for(var a=za(r,t);++n<e;)t(n);return a}function Jg(e){return ee(e)?Ce(e,bn):Qt(e)?[e]:Ot(Os(he(e)))}function Xg(e){var t=++Nh;return he(e)+t}var Zg=Cu(function(e,t){return e+t},0),Kg=hs("ceil"),em=Cu(function(e,t){return e/t},1),tm=hs("floor");function nm(e){return e&&e.length?_n(e,lt,dt):o}function rm(e,t){return e&&e.length?_n(e,X(t,2),dt):o}function im(e){return xl(e,lt)}function om(e,t){return xl(e,X(t,2))}function um(e){return e&&e.length?_n(e,lt,mu):o}function am(e,t){return e&&e.length?_n(e,X(t,2),mu):o}var sm=Cu(function(e,t){return e*t},1),lm=hs("round"),cm=Cu(function(e,t){return e-t},0);function fm(e){return e&&e.length?La(e,lt):0}function hm(e,t){return e&&e.length?La(e,X(t,2)):0}return d.after=Dd,d.ary=Wu,d.assign=Eo,d.assignIn=Ku,d.assignInWith=ar,d.assignWith=Oo,d.at=To,d.before=Gc,d.bind=vt,d.bindAll=qs,d.bindKey=Bu,d.castArray=Vd,d.chain=Wc,d.chunk=Tp,d.compact=Ip,d.concat=Cp,d.cond=yf,d.conforms=zi,d.constant=Hs,d.countBy=gd,d.create=ea,d.curry=qc,d.curryRight=Hc,d.debounce=$u,d.defaults=xi,d.defaultsDeep=eg,d.defer=Fd,d.delay=Rs,d.difference=xp,d.differenceBy=Rp,d.differenceWith=Np,d.drop=Lp,d.dropRight=zp,d.dropRightWhile=Pp,d.dropWhile=Dp,d.fill=Fp,d.filter=vd,d.flatMap=$c,d.flatMapDeep=_d,d.flatMapDepth=bd,d.flatten=Ct,d.flattenDeep=je,d.flattenDepth=Up,d.flip=Ud,d.flow=Ug,d.flowRight=_f,d.fromPairs=Mp,d.functions=of,d.functionsIn=Ri,d.groupBy=wd,d.initial=Bp,d.intersection=Ts,d.intersectionBy=$p,d.intersectionWith=tr,d.invert=af,d.invertBy=sf,d.invokeMap=Sd,d.iteratee=Ys,d.keyBy=Ed,d.keys=rt,d.keysIn=Rt,d.map=Uu,d.mapKeys=ug,d.mapValues=Ws,d.matches=Mg,d.matchesProperty=Wg,d.memoize=So,d.merge=Bs,d.mergeWith=$s,d.method=Bg,d.methodOf=$g,d.mixin=Qs,d.negate=ju,d.nthArg=bf,d.omit=_t,d.omitBy=ag,d.once=Ns,d.orderBy=Od,d.over=kg,d.overArgs=Ls,d.overEvery=Vg,d.overSome=wf,d.partial=zs,d.partialRight=Yc,d.partition=Td,d.pick=lf,d.pickBy=Ni,d.property=Xs,d.propertyOf=Gg,d.pull=jp,d.pullAll=Pc,d.pullAllBy=kp,d.pullAllWith=Vp,d.pullAt=Gp,d.range=qg,d.rangeRight=Hg,d.rearg=Md,d.reject=xd,d.remove=qp,d.rest=Wd,d.reverse=Du,d.sampleSize=Nd,d.set=cf,d.setWith=sg,d.shuffle=Ld,d.slice=wo,d.sortBy=Vc,d.sortedUniq=Dc,d.sortedUniqBy=nr,d.split=gf,d.spread=Bd,d.tail=ue,d.take=Fc,d.takeRight=an,d.takeRightWhile=Uc,d.takeWhile=Xp,d.tap=ad,d.throttle=$d,d.thru=Ao,d.toArray=nf,d.toPairs=ff,d.toPairsIn=hf,d.toPath=Jg,d.toPlainObject=Ms,d.transform=lg,d.unary=jd,d.union=ge,d.unionBy=Zp,d.unionWith=Kp,d.uniq=ed,d.uniqBy=td,d.uniqWith=nd,d.unset=cg,d.unzip=Is,d.unzipWith=Mc,d.update=fg,d.updateWith=hg,d.values=Li,d.valuesIn=pg,d.without=rd,d.words=vf,d.wrap=kd,d.xor=id,d.xorBy=Cs,d.xorWith=od,d.zip=xs,d.zipObject=nt,d.zipObjectDeep=Ft,d.zipWith=ud,d.entries=ff,d.entriesIn=hf,d.extend=Ku,d.extendWith=ar,Qs(d,d),d.add=Zg,d.attempt=Gs,d.camelCase=vg,d.capitalize=pf,d.ceil=Kg,d.clamp=dg,d.clone=Gd,d.cloneDeep=Hd,d.cloneDeepWith=Yd,d.cloneWith=qd,d.conformsTo=Qd,d.deburr=df,d.defaultTo=Fg,d.divide=em,d.endsWith=yg,d.eq=_e,d.escape=_g,d.escapeRegExp=bg,d.every=md,d.find=yd,d.findIndex=Nc,d.findKey=tg,d.findLast=Bc,d.findLastIndex=un,d.findLastKey=ng,d.floor=tm,d.forEach=jc,d.forEachRight=kc,d.forIn=rg,d.forInRight=ig,d.forOwn=ta,d.forOwnRight=Io,d.get=Mn,d.gt=ku,d.gte=Ps,d.has=uf,d.hasIn=Co,d.head=Lc,d.identity=lt,d.includes=Ad,d.indexOf=Wp,d.inRange=gg,d.invoke=og,d.isArguments=Tr,d.isArray=ee,d.isArrayBuffer=Ne,d.isArrayLike=yt,d.isArrayLikeObject=ke,d.isBoolean=sn,d.isBuffer=wn,d.isDate=Jd,d.isElement=Ci,d.isEmpty=Vu,d.isEqual=Gu,d.isEqualWith=be,d.isError=Ds,d.isFinite=Qc,d.isFunction=ln,d.isInteger=Jc,d.isLength=qu,d.isMap=rr,d.isMatch=Hu,d.isMatchWith=Xc,d.isNaN=Yu,d.isNative=Zc,d.isNil=Qu,d.isNull=Kc,d.isNumber=Fs,d.isObject=Ue,d.isObjectLike=Le,d.isPlainObject=ir,d.isRegExp=or,d.isSafeInteger=Ju,d.isSet=ef,d.isString=Xu,d.isSymbol=Qt,d.isTypedArray=ur,d.isUndefined=Zu,d.isWeakMap=Us,d.isWeakSet=Xd,d.join=zc,d.kebabCase=wg,d.last=xt,d.lastIndexOf=Fe,d.lowerCase=Ag,d.lowerFirst=Sg,d.lt=tf,d.lte=Zd,d.max=nm,d.maxBy=rm,d.mean=im,d.meanBy=om,d.min=um,d.minBy=am,d.stubArray=Zs,d.stubFalse=Ks,d.stubObject=Yg,d.stubString=Qg,d.stubTrue=el,d.multiply=sm,d.nth=Be,d.noConflict=jg,d.noop=Js,d.now=Mu,d.pad=Eg,d.padEnd=Og,d.padStart=Tg,d.parseInt=Ig,d.random=mg,d.reduce=Id,d.reduceRight=Cd,d.repeat=Cg,d.replace=na,d.result=js,d.round=lm,d.runInContext=p,d.sample=Rd,d.size=zd,d.snakeCase=ks,d.some=Pd,d.sortedIndex=Hp,d.sortedIndexBy=Fu,d.sortedIndexOf=Yt,d.sortedLastIndex=Yp,d.sortedLastIndexBy=Qp,d.sortedLastIndexOf=Jp,d.startCase=xg,d.startsWith=Rg,d.subtract=cm,d.sum=fm,d.sumBy=hm,d.template=Ng,d.times=Af,d.toFinite=Oe,d.toInteger=H,d.toLength=rf,d.toLower=Vs,d.toNumber=cn,d.toSafeInteger=Kd,d.toString=he,d.toUpper=mf,d.trim=Lg,d.trimEnd=zg,d.trimStart=Pg,d.truncate=Qr,d.unescape=ie,d.uniqueId=Xg,d.upperCase=Dg,d.upperFirst=Wn,d.each=jc,d.eachRight=kc,d.first=Lc,Qs(d,function(){var e={};return Ln(d,function(t,n){ye.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){ae.prototype[e]=function(n){n=n===o?1:Je(H(n),0);var r=this.__filtered__&&!t?new ae(this):this.clone();return r.__filtered__?r.__takeCount__=De(n,r.__takeCount__):r.__views__.push({size:De(n,Mt),type:e+(r.__dir__<0?"Right":"")}),r},ae.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;ae.prototype[e]=function(a){var s=this.clone();return s.__iteratees__.push({iteratee:X(a,3),type:n}),s.__filtered__=s.__filtered__||r,s}}),kt(["head","last"],function(e,t){var n="take"+(t?"Right":"");ae.prototype[e]=function(){return this[n](1).value()[0]}}),kt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");ae.prototype[e]=function(){return this.__filtered__?new ae(this):this[n](1)}}),ae.prototype.compact=function(){return this.filter(lt)},ae.prototype.find=function(e){return this.filter(e).head()},ae.prototype.findLast=function(e){return this.reverse().find(e)},ae.prototype.invokeMap=ne(function(e,t){return typeof e=="function"?new ae(this):this.map(function(n){return _i(n,e,t)})}),ae.prototype.reject=function(e){return this.filter(ju(X(e)))},ae.prototype.slice=function(e,t){e=H(e);var n=this;return n.__filtered__&&(e>0||t<0)?new ae(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)},ae.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},ae.prototype.toArray=function(){return this.take(Mt)},Ln(ae.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 ae,w=f[0],b=g||ee(c),S=function(B){var j=a.apply(d,Vt([B],f));return r&&O?j[0]:j};b&&n&&typeof w=="function"&&w.length!=1&&(g=b=!1);var O=this.__chain__,x=!!this.__actions__.length,N=s&&!O,M=g&&!x;if(!s&&b){c=M?c:new ae(this);var L=e.apply(c,f);return L.__actions__.push({func:Ao,args:[S],thisArg:o}),new rn(L,O)}return N&&M?e.apply(this,f):(L=this.thru(S),N?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)})}}),Ln(ae.prototype,function(e,t){var n=d[t];if(n){var r=n.name+"";ye.call(We,r)||(We[r]=[]),We[r].push({name:t,func:n})}}),We[go(o,Q).name]=[{name:"wrapper",func:o}],ae.prototype.clone=Yl,ae.prototype.reverse=Uh,ae.prototype.value=Mh,d.prototype.at=sd,d.prototype.chain=ld,d.prototype.commit=cd,d.prototype.next=fd,d.prototype.plant=pd,d.prototype.reverse=dd,d.prototype.toJSON=d.prototype.valueOf=d.prototype.value=Ii,d.prototype.first=d.prototype.head,eo&&(d.prototype[eo]=hd),d},mn=xh();Dr?((Dr.exports=mn)._=mn,wa._=mn):et._=mn}).call(xr)})(Cf,Cf.exports);var Te=Cf.exports;const ua=i=>{const{sort:u,fields:o,omit:h,filters:m={},populate:A={},relation:E,pagination:T}=i,R=(m.$or||[]).filter(U=>!Object.keys(U).includes("removed")),z=m.$or?.some(U=>U.removed);let I={...A},F={threadOf:{populate:{authorUser:!0,...A}}};if("author"in A){const{author:U,...Z}=A;I={...Z,authorUser:U},F={threadOf:{populate:{authorUser:U,...Z}}}}return R.length&&!z?{...i,filters:{...Te.omit(m,"$or"),$and:[...m.$and||[],{$or:R},{$or:[{removed:{$null:!0}},{removed:!1}]}],related:E},populate:{...I,...F},pagination:T,sort:u,fields:o,omit:h}:{...i,filters:{...m,$or:[...R,{removed:{$null:!0}},{removed:!1}],related:E},populate:{...I,...F},pagination:T,sort:u,fields:o,omit:h}},$v=(i,u)=>{const{nonNull:o,stringArg:h}=u,{service:m}=i.plugin("graphql"),{args:A}=m("internals"),E=i.contentType(lr(i,"comment"));return{type:"ResponseFindAll",args:{relation:o(h()),filters:ft(i,"gql").buildContentTypeFilters(E),pagination:A.PaginationArg,sort:A.SortArg},async resolve(T,R){const{relation:z,filters:I,sort:F,pagination:U}=R;return await ft(i,"common").findAllFlat(ua({relation:z,filters:ft(i,"gql").graphQLFiltersToStrapiQuery(I,E),sort:F,pagination:U?{...U,withCount:!Te.isEmpty(U)}:void 0}),void 0)}}},jv=(i,u)=>{const{nonNull:o,list:h,stringArg:m}=u,{service:A}=i.plugin("graphql"),{args:E}=A("internals"),{naming:{getFiltersInputTypeName:T}}=A("utils"),R=i.contentType(lr(i,"comment"));return{type:o(h("CommentNested")),args:{relation:o(m()),sort:E.SortArg,filters:T(R)},async resolve(z,I){const{relation:F,filters:U,sort:Z}=I;return await ft(i,"common").findAllInHierarchy({...ua({relation:F,filters:ft(i,"gql").graphQLFiltersToStrapiQuery(U,R),sort:Z}),dropBlockedThreads:!0})}}},Ir={ENABLED_COLLECTIONS:"enabledCollections",APPROVAL_FLOW:"approvalFlow",ENTRY_LABEL:"entryLabel",MODERATOR_ROLES:"moderatorRoles",BAD_WORDS:"badWords",AUTHOR_BLOCKED_PROPS:"blockedAuthorProps"},ol={GENERIC:"GENERIC",STRAPI:"STRAPI"},kv={relatedUid:/^(?<uid>[a-z0-9-]+\:{2}[a-z0-9-]+\.[a-z0-9-]+)\:{1}(?<id>[a-z0-9-]+)$/i},Vv=(i,u)=>{const{nonNull:o,intArg:h,arg:m}=u,{service:A}=i.plugin("graphql"),{args:E}=A("internals"),{naming:{getFiltersInputTypeName:T}}=A("utils"),R=i.contentType(lr(i,"comment"));return{type:"ResponseFindAllPerAuthor",args:{authorId:o(h()),authorType:m({type:"CommentAuthorType"}),filters:T(R),pagination:E.PaginationArg,sort:E.SortArg},async resolve(z,I){const{authorId:F,authorType:U,filters:Z,sort:$,pagination:K}=I,te=U!==ol.GENERIC;return await ft(i,"common").findAllPerAuthor(ua({filters:ft(i,"gql").graphQLFiltersToStrapiQuery(Z,R),sort:$,pagination:K?{...K,withCount:!Te.isEmpty(K)}:void 0,authorId:F}),te)}}},Gv=(i,u)=>{const o={findAllFlat:$v,findAllInHierarchy:jv,findAllPerAuthor:Vv};return u.extendType({type:"Query",definition(h){for(const[m,A]of Object.entries(o)){const E=A(i,u);h.field(m,E)}}})},qv=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")}}),Hv=i=>i.objectType({name:"CommentAuthor",definition(u){u.id("id"),u.nonNull.string("name"),u.nonNull.string("email"),u.string("avatar")}}),Yv=i=>i.enumType({name:"CommentAuthorType",description:"User type which was the author of comment - Strapi built-in or generic",members:Object.values(ol)}),Qv=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")}}),Jv=i=>i.inputObjectType({name:"CreateComment",definition(u){u.nonNull.string("content"),u.nonNull.string("relation"),u.id("threadOf"),u.field("author",{type:"CreateCommentAuthor"})}}),Xv=i=>i.inputObjectType({name:"CreateCommentAuthor",definition(u){u.nonNull.id("id"),u.nonNull.string("name"),u.string("email"),u.string("avatar")}}),Zv=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 Hm(i){return typeof i=="object"&&i!==null}function Kv(i,u){if(!!!i)throw new Error("Unexpected invariant triggered.")}const e0=/\r\n|[\n\r]/g;function vm(i,u){let o=0,h=1;for(const m of i.body.matchAll(e0)){if(typeof m.index=="number"||Kv(!1),m.index>=u)break;o=m.index+m[0].length,h+=1}return{line:h,column:u+1-o}}function t0(i){return Ym(i.source,vm(i.source,i.start))}function Ym(i,u){const o=i.locationOffset.column-1,h="".padStart(o)+i.body,m=u.line-1,A=i.locationOffset.line-1,E=u.line+A,T=u.line===1?o:0,R=u.column+T,z=`${i.name}:${E}:${R}
27
+ }`;var M=Gs(function(){return D(s,x+"return "+S).apply(o,c)});if(M.source=S,Ds(M))throw M;return M}function Vs(e){return he(e).toLowerCase()}function mf(e){return he(e).toUpperCase()}function Lg(e,t,n){if(e=he(e),e&&(n||t===o))return Nl(e);if(!e||!(t=Ht(t)))return e;var r=en(e),a=en(t),s=Ll(r,a),c=zl(r,a)+1;return Er(r,s,c).join("")}function zg(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=zl(r,en(t))+1;return Er(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 Er(r,a).join("")}function Qr(e,t){var n=Qe,r=Sn;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?Er(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 S=w.index;g=g.slice(0,S===o?f:S)}}else if(e.indexOf(Ht(a),f)!=f){var O=g.lastIndexOf(a);O>-1&&(g=g.slice(0,O))}return g+r}function ie(e){return e=he(e),e&&kf.test(e)?e.replace(ni,Oh):e}var Dg=qr(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Wn=cs("toUpperCase");function vf(e,t,n){return e=he(e),t=n?o:t,t===o?at(e)?Ch(e):Cl(e):e.match(t)||[]}var Gs=ne(function(e,t){try{return Lt(e,o,t)}catch(n){return Ds(n)?n:new P(n)}}),qs=Kn(function(e,t){return kt(t,function(n){n=bn(n),Nn(e,n,vt(e[n],e))}),e});function yf(e){var t=e==null?0:e.length,n=X();return e=t?Ce(e,function(r){if(typeof r[1]!="function")throw new tn(E);return[n(r[0]),r[1]]}):[],ne(function(r){for(var a=-1;++a<t;){var s=e[a];if(Lt(s[0],this,r))return Lt(s[1],this,r)}})}function zi(e){return ic(Dt(e,F))}function Hs(e){return function(){return e}}function Fg(e,t){return e==null||e!==e?t:e}var Ug=vc(),_f=vc(!0);function lt(e){return e}function Ys(e){return gu(typeof e=="function"?e:Dt(e,F))}function Mg(e){return es(Dt(e,F))}function Wg(e,t){return vu(e,Dt(t,F))}var Bg=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__),S=b.__actions__=Ot(this.__actions__);return S.push({func:g,args:arguments,thisArg:e}),b.__chain__=w,b}return g.apply(e,Vt([this.value()],arguments))})}),e}function jg(){return et._===this&&(et._=Yn),this}function Js(){}function bf(e){return e=H(e),ne(function(t){return ts(t,e)})}var kg=fs(Ce),Vg=fs(Ho),wf=fs(Ta);function Xs(e){return ys(e)?xa(bn(e)):ep(e)}function Gg(e){return function(t){return e==null?o:Vr(e,t)}}var qg=_c(),Hg=_c(!0);function Zs(){return[]}function Ks(){return!1}function Yg(){return{}}function Qg(){return""}function el(){return!0}function Af(e,t){if(e=H(e),e<1||e>Kt)return[];var n=Mt,r=De(e,Mt);t=X(t),e-=Mt;for(var a=za(r,t);++n<e;)t(n);return a}function Jg(e){return ee(e)?Ce(e,bn):Qt(e)?[e]:Ot(Os(he(e)))}function Xg(e){var t=++Nh;return he(e)+t}var Zg=Cu(function(e,t){return e+t},0),Kg=hs("ceil"),em=Cu(function(e,t){return e/t},1),tm=hs("floor");function nm(e){return e&&e.length?_n(e,lt,dt):o}function rm(e,t){return e&&e.length?_n(e,X(t,2),dt):o}function im(e){return xl(e,lt)}function om(e,t){return xl(e,X(t,2))}function um(e){return e&&e.length?_n(e,lt,mu):o}function am(e,t){return e&&e.length?_n(e,X(t,2),mu):o}var sm=Cu(function(e,t){return e*t},1),lm=hs("round"),cm=Cu(function(e,t){return e-t},0);function fm(e){return e&&e.length?La(e,lt):0}function hm(e,t){return e&&e.length?La(e,X(t,2)):0}return d.after=Dd,d.ary=Wu,d.assign=Eo,d.assignIn=Ku,d.assignInWith=ar,d.assignWith=Oo,d.at=To,d.before=Gc,d.bind=vt,d.bindAll=qs,d.bindKey=Bu,d.castArray=Vd,d.chain=Wc,d.chunk=Tp,d.compact=Ip,d.concat=Cp,d.cond=yf,d.conforms=zi,d.constant=Hs,d.countBy=gd,d.create=ea,d.curry=qc,d.curryRight=Hc,d.debounce=$u,d.defaults=xi,d.defaultsDeep=eg,d.defer=Fd,d.delay=Rs,d.difference=xp,d.differenceBy=Rp,d.differenceWith=Np,d.drop=Lp,d.dropRight=zp,d.dropRightWhile=Pp,d.dropWhile=Dp,d.fill=Fp,d.filter=vd,d.flatMap=$c,d.flatMapDeep=_d,d.flatMapDepth=bd,d.flatten=Ct,d.flattenDeep=je,d.flattenDepth=Up,d.flip=Ud,d.flow=Ug,d.flowRight=_f,d.fromPairs=Mp,d.functions=of,d.functionsIn=Ri,d.groupBy=wd,d.initial=Bp,d.intersection=Ts,d.intersectionBy=$p,d.intersectionWith=tr,d.invert=af,d.invertBy=sf,d.invokeMap=Sd,d.iteratee=Ys,d.keyBy=Ed,d.keys=rt,d.keysIn=Rt,d.map=Uu,d.mapKeys=ug,d.mapValues=Ws,d.matches=Mg,d.matchesProperty=Wg,d.memoize=So,d.merge=Bs,d.mergeWith=$s,d.method=Bg,d.methodOf=$g,d.mixin=Qs,d.negate=ju,d.nthArg=bf,d.omit=_t,d.omitBy=ag,d.once=Ns,d.orderBy=Od,d.over=kg,d.overArgs=Ls,d.overEvery=Vg,d.overSome=wf,d.partial=zs,d.partialRight=Yc,d.partition=Td,d.pick=lf,d.pickBy=Ni,d.property=Xs,d.propertyOf=Gg,d.pull=jp,d.pullAll=Pc,d.pullAllBy=kp,d.pullAllWith=Vp,d.pullAt=Gp,d.range=qg,d.rangeRight=Hg,d.rearg=Md,d.reject=xd,d.remove=qp,d.rest=Wd,d.reverse=Du,d.sampleSize=Nd,d.set=cf,d.setWith=sg,d.shuffle=Ld,d.slice=wo,d.sortBy=Vc,d.sortedUniq=Dc,d.sortedUniqBy=nr,d.split=gf,d.spread=Bd,d.tail=ue,d.take=Fc,d.takeRight=an,d.takeRightWhile=Uc,d.takeWhile=Xp,d.tap=ad,d.throttle=$d,d.thru=Ao,d.toArray=nf,d.toPairs=ff,d.toPairsIn=hf,d.toPath=Jg,d.toPlainObject=Ms,d.transform=lg,d.unary=jd,d.union=ge,d.unionBy=Zp,d.unionWith=Kp,d.uniq=ed,d.uniqBy=td,d.uniqWith=nd,d.unset=cg,d.unzip=Is,d.unzipWith=Mc,d.update=fg,d.updateWith=hg,d.values=Li,d.valuesIn=pg,d.without=rd,d.words=vf,d.wrap=kd,d.xor=id,d.xorBy=Cs,d.xorWith=od,d.zip=xs,d.zipObject=nt,d.zipObjectDeep=Ft,d.zipWith=ud,d.entries=ff,d.entriesIn=hf,d.extend=Ku,d.extendWith=ar,Qs(d,d),d.add=Zg,d.attempt=Gs,d.camelCase=vg,d.capitalize=pf,d.ceil=Kg,d.clamp=dg,d.clone=Gd,d.cloneDeep=Hd,d.cloneDeepWith=Yd,d.cloneWith=qd,d.conformsTo=Qd,d.deburr=df,d.defaultTo=Fg,d.divide=em,d.endsWith=yg,d.eq=_e,d.escape=_g,d.escapeRegExp=bg,d.every=md,d.find=yd,d.findIndex=Nc,d.findKey=tg,d.findLast=Bc,d.findLastIndex=un,d.findLastKey=ng,d.floor=tm,d.forEach=jc,d.forEachRight=kc,d.forIn=rg,d.forInRight=ig,d.forOwn=ta,d.forOwnRight=Io,d.get=Mn,d.gt=ku,d.gte=Ps,d.has=uf,d.hasIn=Co,d.head=Lc,d.identity=lt,d.includes=Ad,d.indexOf=Wp,d.inRange=gg,d.invoke=og,d.isArguments=Tr,d.isArray=ee,d.isArrayBuffer=Ne,d.isArrayLike=yt,d.isArrayLikeObject=ke,d.isBoolean=sn,d.isBuffer=wn,d.isDate=Jd,d.isElement=Ci,d.isEmpty=Vu,d.isEqual=Gu,d.isEqualWith=be,d.isError=Ds,d.isFinite=Qc,d.isFunction=ln,d.isInteger=Jc,d.isLength=qu,d.isMap=rr,d.isMatch=Hu,d.isMatchWith=Xc,d.isNaN=Yu,d.isNative=Zc,d.isNil=Qu,d.isNull=Kc,d.isNumber=Fs,d.isObject=Ue,d.isObjectLike=Le,d.isPlainObject=ir,d.isRegExp=or,d.isSafeInteger=Ju,d.isSet=ef,d.isString=Xu,d.isSymbol=Qt,d.isTypedArray=ur,d.isUndefined=Zu,d.isWeakMap=Us,d.isWeakSet=Xd,d.join=zc,d.kebabCase=wg,d.last=xt,d.lastIndexOf=Fe,d.lowerCase=Ag,d.lowerFirst=Sg,d.lt=tf,d.lte=Zd,d.max=nm,d.maxBy=rm,d.mean=im,d.meanBy=om,d.min=um,d.minBy=am,d.stubArray=Zs,d.stubFalse=Ks,d.stubObject=Yg,d.stubString=Qg,d.stubTrue=el,d.multiply=sm,d.nth=Be,d.noConflict=jg,d.noop=Js,d.now=Mu,d.pad=Eg,d.padEnd=Og,d.padStart=Tg,d.parseInt=Ig,d.random=mg,d.reduce=Id,d.reduceRight=Cd,d.repeat=Cg,d.replace=na,d.result=js,d.round=lm,d.runInContext=p,d.sample=Rd,d.size=zd,d.snakeCase=ks,d.some=Pd,d.sortedIndex=Hp,d.sortedIndexBy=Fu,d.sortedIndexOf=Yt,d.sortedLastIndex=Yp,d.sortedLastIndexBy=Qp,d.sortedLastIndexOf=Jp,d.startCase=xg,d.startsWith=Rg,d.subtract=cm,d.sum=fm,d.sumBy=hm,d.template=Ng,d.times=Af,d.toFinite=Oe,d.toInteger=H,d.toLength=rf,d.toLower=Vs,d.toNumber=cn,d.toSafeInteger=Kd,d.toString=he,d.toUpper=mf,d.trim=Lg,d.trimEnd=zg,d.trimStart=Pg,d.truncate=Qr,d.unescape=ie,d.uniqueId=Xg,d.upperCase=Dg,d.upperFirst=Wn,d.each=jc,d.eachRight=kc,d.first=Lc,Qs(d,function(){var e={};return Ln(d,function(t,n){ye.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){ae.prototype[e]=function(n){n=n===o?1:Je(H(n),0);var r=this.__filtered__&&!t?new ae(this):this.clone();return r.__filtered__?r.__takeCount__=De(n,r.__takeCount__):r.__views__.push({size:De(n,Mt),type:e+(r.__dir__<0?"Right":"")}),r},ae.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;ae.prototype[e]=function(a){var s=this.clone();return s.__iteratees__.push({iteratee:X(a,3),type:n}),s.__filtered__=s.__filtered__||r,s}}),kt(["head","last"],function(e,t){var n="take"+(t?"Right":"");ae.prototype[e]=function(){return this[n](1).value()[0]}}),kt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");ae.prototype[e]=function(){return this.__filtered__?new ae(this):this[n](1)}}),ae.prototype.compact=function(){return this.filter(lt)},ae.prototype.find=function(e){return this.filter(e).head()},ae.prototype.findLast=function(e){return this.reverse().find(e)},ae.prototype.invokeMap=ne(function(e,t){return typeof e=="function"?new ae(this):this.map(function(n){return _i(n,e,t)})}),ae.prototype.reject=function(e){return this.filter(ju(X(e)))},ae.prototype.slice=function(e,t){e=H(e);var n=this;return n.__filtered__&&(e>0||t<0)?new ae(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)},ae.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},ae.prototype.toArray=function(){return this.take(Mt)},Ln(ae.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 ae,w=f[0],b=g||ee(c),S=function(B){var j=a.apply(d,Vt([B],f));return r&&O?j[0]:j};b&&n&&typeof w=="function"&&w.length!=1&&(g=b=!1);var O=this.__chain__,x=!!this.__actions__.length,N=s&&!O,M=g&&!x;if(!s&&b){c=M?c:new ae(this);var L=e.apply(c,f);return L.__actions__.push({func:Ao,args:[S],thisArg:o}),new rn(L,O)}return N&&M?e.apply(this,f):(L=this.thru(S),N?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)})}}),Ln(ae.prototype,function(e,t){var n=d[t];if(n){var r=n.name+"";ye.call(We,r)||(We[r]=[]),We[r].push({name:t,func:n})}}),We[go(o,Q).name]=[{name:"wrapper",func:o}],ae.prototype.clone=Yl,ae.prototype.reverse=Uh,ae.prototype.value=Mh,d.prototype.at=sd,d.prototype.chain=ld,d.prototype.commit=cd,d.prototype.next=fd,d.prototype.plant=pd,d.prototype.reverse=dd,d.prototype.toJSON=d.prototype.valueOf=d.prototype.value=Ii,d.prototype.first=d.prototype.head,eo&&(d.prototype[eo]=hd),d},mn=xh();Dr?((Dr.exports=mn)._=mn,wa._=mn):et._=mn}).call(xr)})(Cf,Cf.exports);var Te=Cf.exports;const ua=i=>{const{sort:u,fields:o,omit:h,filters:m={},populate:A={},relation:E,pagination:T}=i,R=(m.$or||[]).filter(U=>!Object.keys(U).includes("removed")),z=m.$or?.some(U=>U.removed);let I={reports:{where:{resolved:!1}},...A},F={threadOf:{populate:{authorUser:!0,...A}}};if("author"in A){const{author:U,...Z}=A;I={reports:{where:{resolved:!1}},...Z,authorUser:U},F={threadOf:{populate:{authorUser:U,...Z}}}}return R.length&&!z?{...i,filters:{...Te.omit(m,"$or"),$and:[...m.$and||[],{$or:R},{$or:[{removed:{$null:!0}},{removed:!1}]}],related:E},populate:{...I,...F},pagination:T,sort:u,fields:o,omit:h}:{...i,filters:{...m,$or:[...R,{removed:{$null:!0}},{removed:!1}],related:E},populate:{...I,...F},pagination:T,sort:u,fields:o,omit:h}},$v=(i,u)=>{const{nonNull:o,stringArg:h}=u,{service:m}=i.plugin("graphql"),{args:A}=m("internals"),E=i.contentType(lr(i,"comment"));return{type:"ResponseFindAll",args:{relation:o(h()),filters:ft(i,"gql").buildContentTypeFilters(E),pagination:A.PaginationArg,sort:A.SortArg},async resolve(T,R){const{relation:z,filters:I,sort:F,pagination:U}=R;return await ft(i,"common").findAllFlat(ua({relation:z,filters:ft(i,"gql").graphQLFiltersToStrapiQuery(I,E),sort:F,pagination:U?{...U,withCount:!Te.isEmpty(U)}:void 0}),void 0)}}},jv=(i,u)=>{const{nonNull:o,list:h,stringArg:m}=u,{service:A}=i.plugin("graphql"),{args:E}=A("internals"),{naming:{getFiltersInputTypeName:T}}=A("utils"),R=i.contentType(lr(i,"comment"));return{type:o(h("CommentNested")),args:{relation:o(m()),sort:E.SortArg,filters:T(R)},async resolve(z,I){const{relation:F,filters:U,sort:Z}=I;return await ft(i,"common").findAllInHierarchy({...ua({relation:F,filters:ft(i,"gql").graphQLFiltersToStrapiQuery(U,R),sort:Z}),dropBlockedThreads:!0})}}},Ir={ENABLED_COLLECTIONS:"enabledCollections",APPROVAL_FLOW:"approvalFlow",ENTRY_LABEL:"entryLabel",MODERATOR_ROLES:"moderatorRoles",BAD_WORDS:"badWords",AUTHOR_BLOCKED_PROPS:"blockedAuthorProps"},ol={GENERIC:"GENERIC",STRAPI:"STRAPI"},kv={relatedUid:/^(?<uid>[a-z0-9-]+\:{2}[a-z0-9-]+\.[a-z0-9-]+)\:{1}(?<id>[a-z0-9-]+)$/i},Vv=(i,u)=>{const{nonNull:o,intArg:h,arg:m}=u,{service:A}=i.plugin("graphql"),{args:E}=A("internals"),{naming:{getFiltersInputTypeName:T}}=A("utils"),R=i.contentType(lr(i,"comment"));return{type:"ResponseFindAllPerAuthor",args:{authorId:o(h()),authorType:m({type:"CommentAuthorType"}),filters:T(R),pagination:E.PaginationArg,sort:E.SortArg},async resolve(z,I){const{authorId:F,authorType:U,filters:Z,sort:$,pagination:K}=I,te=U!==ol.GENERIC;return await ft(i,"common").findAllPerAuthor(ua({filters:ft(i,"gql").graphQLFiltersToStrapiQuery(Z,R),sort:$,pagination:K?{...K,withCount:!Te.isEmpty(K)}:void 0,authorId:F}),te)}}},Gv=(i,u)=>{const o={findAllFlat:$v,findAllInHierarchy:jv,findAllPerAuthor:Vv};return u.extendType({type:"Query",definition(h){for(const[m,A]of Object.entries(o)){const E=A(i,u);h.field(m,E)}}})},qv=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")}}),Hv=i=>i.objectType({name:"CommentAuthor",definition(u){u.id("id"),u.nonNull.string("name"),u.nonNull.string("email"),u.string("avatar")}}),Yv=i=>i.enumType({name:"CommentAuthorType",description:"User type which was the author of comment - Strapi built-in or generic",members:Object.values(ol)}),Qv=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")}}),Jv=i=>i.inputObjectType({name:"CreateComment",definition(u){u.nonNull.string("content"),u.nonNull.string("relation"),u.id("threadOf"),u.field("author",{type:"CreateCommentAuthor"})}}),Xv=i=>i.inputObjectType({name:"CreateCommentAuthor",definition(u){u.nonNull.id("id"),u.nonNull.string("name"),u.string("email"),u.string("avatar")}}),Zv=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 Hm(i){return typeof i=="object"&&i!==null}function Kv(i,u){if(!!!i)throw new Error("Unexpected invariant triggered.")}const e0=/\r\n|[\n\r]/g;function vm(i,u){let o=0,h=1;for(const m of i.body.matchAll(e0)){if(typeof m.index=="number"||Kv(!1),m.index>=u)break;o=m.index+m[0].length,h+=1}return{line:h,column:u+1-o}}function t0(i){return Ym(i.source,vm(i.source,i.start))}function Ym(i,u){const o=i.locationOffset.column-1,h="".padStart(o)+i.body,m=u.line-1,A=i.locationOffset.line-1,E=u.line+A,T=u.line===1?o:0,R=u.column+T,z=`${i.name}:${E}:${R}
28
28
  `,I=h.split(/\r\n|[\n\r]/g),F=I[m];if(F.length>120){const U=Math.floor(R/80),Z=R%80,$=[];for(let K=0;K<F.length;K+=80)$.push(F.slice(K,K+80));return z+Rm([[`${E} |`,$[0]],...$.slice(1,U+1).map(K=>["|",K]),["|","^".padStart(Z)],["|",$[U+1]]])}return z+Rm([[`${E-1} |`,I[m-1]],[`${E} |`,F],["|","^".padStart(R)],[`${E+1} |`,I[m+1]]])}function Rm(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
29
  `)}function n0(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:E,source:T,positions:R,path:z,originalError:I,extensions:F}=n0(o);super(u),this.name="GraphQLError",this.path=z??void 0,this.originalError=I??void 0,this.nodes=Nm(Array.isArray(E)?E:E?[E]:void 0);const U=Nm((h=this.nodes)===null||h===void 0?void 0:h.map($=>$.loc).filter($=>$!=null));this.source=T??(U==null||(m=U[0])===null||m===void 0?void 0:m.source),this.positions=R??U?.map($=>$.start),this.locations=R&&T?R.map($=>vm(T,$)):U?.map($=>vm($.source,$.start));const Z=Hm(I?.extensions)?I?.extensions:void 0;this.extensions=(A=F??Z)!==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}}),I!=null&&I.stack?Object.defineProperty(this,"stack",{value:I.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
 
@@ -73,7 +73,7 @@ spurious results.`)}}return!1},g0=5;function m0(i,u){const[o,h]=u?[i,u]:[void 0,
73
73
  `)))!==null&&u!==void 0?u:!1}function _m(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=>_m(o,u));case Xt.OBJECT:return Om(i.fields,o=>o.name.value,o=>_m(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(!u0(i.charCodeAt(u)))throw new Bn(`Names must only contain [_a-zA-Z0-9] but "${i}" does not.`);if(!o0(i.charCodeAt(0)))throw new Bn(`Names must start with [_a-zA-Z] but "${i}" does not.`);return i}function N0(i){if(i==="true"||i==="false"||i==="null")throw new Bn(`Enum values cannot be named: ${i}`);return cr(i)}function sl(i){return L0(i)||z0(i)||P0(i)||D0(i)||F0(i)||U0(i)||M0(i)||Tm(i)}function L0(i){return Ui(i,ev)}function z0(i){return Ui(i,j0)}function P0(i){return Ui(i,G0)}function D0(i){return Ui(i,q0)}function F0(i){return Ui(i,Y0)}function U0(i){return Ui(i,Q0)}function M0(i){return Ui(i,W0)}function Tm(i){return Ui(i,B0)}class W0{constructor(u){sl(u)||He(!1,`Expected ${$n(u)} to be a GraphQL type.`),this.ofType=u}get[Symbol.toStringTag](){return"GraphQLList"}toString(){return"["+String(this.ofType)+"]"}toJSON(){return this.toString()}}class B0{constructor(u){$0(u)||He(!1,`Expected ${$n(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 $0(i){return sl(i)&&!Tm(i)}function Zm(i){return typeof i=="function"?i():i}function Km(i){return typeof i=="function"?i():i}class ev{constructor(u){var o,h,m,A;const E=(o=u.parseValue)!==null&&o!==void 0?o:Dm;this.name=cr(u.name),this.description=u.description,this.specifiedByURL=u.specifiedByURL,this.serialize=(h=u.serialize)!==null&&h!==void 0?h:Dm,this.parseValue=E,this.parseLiteral=(m=u.parseLiteral)!==null&&m!==void 0?m:(T,R)=>E(_m(T,R)),this.extensions=Rr(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: ${$n(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 j0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.isTypeOf=u.isTypeOf,this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._fields=()=>nv(u),this._interfaces=()=>tv(u),u.isTypeOf==null||typeof u.isTypeOf=="function"||He(!1,`${this.name} must provide "isTypeOf" as a function, but got: ${$n(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:rv(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function tv(i){var u;const o=Zm((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 nv(i){const u=Km(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: ${$n(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:k0(A),resolve:o.resolve,subscribe:o.subscribe,deprecationReason:o.deprecationReason,extensions:Rr(o.extensions),astNode:o.astNode}})}function k0(i){return Object.entries(i).map(([u,o])=>({name:cr(u),description:o.description,type:o.type,defaultValue:o.defaultValue,deprecationReason:o.deprecationReason,extensions:Rr(o.extensions),astNode:o.astNode}))}function aa(i){return Hm(i)&&!Array.isArray(i)}function rv(i){return Pf(i,u=>({description:u.description,type:u.type,args:V0(u.args),resolve:u.resolve,subscribe:u.subscribe,deprecationReason:u.deprecationReason,extensions:u.extensions,astNode:u.astNode}))}function V0(i){return Om(i,u=>u.name,u=>({description:u.description,type:u.type,defaultValue:u.defaultValue,deprecationReason:u.deprecationReason,extensions:u.extensions,astNode:u.astNode}))}class G0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.resolveType=u.resolveType,this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._fields=nv.bind(void 0,u),this._interfaces=tv.bind(void 0,u),u.resolveType==null||typeof u.resolveType=="function"||He(!1,`${this.name} must provide "resolveType" as a function, but got: ${$n(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:rv(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class q0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.resolveType=u.resolveType,this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._types=H0.bind(void 0,u),u.resolveType==null||typeof u.resolveType=="function"||He(!1,`${this.name} must provide "resolveType" as a function, but got: ${$n(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 H0(i){const u=Zm(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 Y0{constructor(u){var o;this.name=cr(u.name),this.description=u.description,this.extensions=Rr(u.extensions),this.astNode=u.astNode,this.extensionASTNodes=(o=u.extensionASTNodes)!==null&&o!==void 0?o:[],this._values=typeof u.values=="function"?u.values:Wm(this.name,u.values),this._valueLookup=null,this._nameLookup=null}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){return typeof this._values=="function"&&(this._values=Wm(this.name,this._values())),this._values}getValue(u){return this._nameLookup===null&&(this._nameLookup=v0(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: ${$n(u)}`);return o.name}parseValue(u){if(typeof u!="string"){const h=$n(u);throw new Bn(`Enum "${this.name}" cannot represent non-string value: ${h}.`+Ef(this,h))}const o=this.getValue(u);if(o==null)throw new Bn(`Value "${u}" does not exist in "${this.name}" enum.`+Ef(this,u));return o.value}parseLiteral(u,o){if(u.kind!==Xt.ENUM){const m=Um(u);throw new Bn(`Enum "${this.name}" cannot represent non-enum value: ${m}.`+Ef(this,m),{nodes:u})}const h=this.getValue(u.value);if(h==null){const m=Um(u);throw new Bn(`Value "${m}" does not exist in "${this.name}" enum.`+Ef(this,m),{nodes:u})}return h.value}toConfig(){const u=Om(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 Ef(i,u){const o=i.getValues().map(m=>m.name),h=b0(u,o);return m0("the enum value",h)}function Wm(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: ${$n(h)}.`),{name:N0(o),description:h.description,value:h.value!==void 0?h.value:o,deprecationReason:h.deprecationReason,extensions:Rr(h.extensions),astNode:h.astNode}))}class Q0{constructor(u){var o,h;this.name=cr(u.name),this.description=u.description,this.extensions=Rr(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=J0.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 J0(i){const u=Km(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:Rr(o.extensions),astNode:o.astNode}))}function Mi(i){const u=X0(i);if(u)throw u;return i}function X0(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 Z0=i=>i.scalarType({name:"ID",asNexusMethod:"id",description:"id as string or integer",serialize:u=>u,parseValue(u){const o=parseInt(u);return Te.isNumber(o)?o:u},parseLiteral(u){return u.kind===Xt.INT||u.kind===Xt.STRING?u.value:null}}),K0=i=>i.inputObjectType({name:"IdentifyCommentAuthor",definition(u){u.nonNull.id("id")}}),ey=i=>i.inputObjectType({name:"RemoveComment",definition(u){u.id("id"),u.nonNull.string("relation"),u.field("author",{type:"IdentifyCommentAuthor"})}}),ty=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")}}),ny=(i,{reportReasons:u})=>i.enumType({name:"ReportReason",description:"Reason of abuse report",members:Object.values(u)}),ry=i=>i.objectType({name:"ResponseFindAll",definition(u){u.nonNull.list.field("data",{type:"CommentSingle"}),u.field("meta",{type:"ResponseMeta"})}}),iy=i=>i.objectType({name:"ResponseFindAllPerAuthor",definition(u){u.nonNull.list.field("data",{type:"CommentSingle"}),u.field("meta",{type:"ResponseMeta"})}}),oy=i=>i.objectType({name:"ResponseMeta",definition(u){u.field("pagination",{type:"ResponsePagination"})}}),uy=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")}}),ay=i=>i.inputObjectType({name:"UpdateComment",definition(u){u.id("id"),u.nonNull.string("content"),u.nonNull.string("relation"),u.field("author",{type:"IdentifyCommentAuthor"})}}),sy=[qv,Hv,Yv,Qv,Jv,Xv,Zv,Z0,K0,ey,ny,ry,iy,oy,uy,ay,ty],ly=(i,u)=>sy.map(o=>o(u,i)),iv=i=>i.plugin("graphql").service("extension"),cy=i=>{const u=iv(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()},fy=async({strapi:i})=>{i.plugin("graphql")&&(cy(i),(await ft(i,"common").getConfig(oa.ENABLED_COLLECTIONS,[])).length&&await hy(i))},hy=async i=>{const u=iv(i),o=await ft(i,"common").getConfig();u.use(({strapi:h,nexus:m})=>{const A=ly(o,m),E=Gv(h,m),T=Bv(h,m),R=Dv(o);return{types:[A,E,T],resolversConfig:R}})},ra={comments:{read:"comments-read",moderate:"comments-moderate"},reports:{read:"reports-read",review:"reports-review"},settings:{read:"settings-read",change:"settings-change"}},py=async({strapi:i})=>{if(i.plugin("graphql")&&await fy({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)},dy={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:[]},gy=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)}),bm=v.z.object({isValidationEnabled:v.z.boolean().optional(),reportReasons:gy.optional(),isGQLPluginEnabled:v.z.boolean().optional(),[Ir.ENABLED_COLLECTIONS]:v.z.array(v.z.string()),[Ir.MODERATOR_ROLES]:v.z.array(v.z.string()),[Ir.APPROVAL_FLOW]:v.z.array(v.z.string()),[Ir.ENTRY_LABEL]:v.z.record(v.z.array(v.z.string())),[Ir.BAD_WORDS]:v.z.boolean().optional(),[Ir.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})}),my={default:bm.parse(dy),validate:i=>bm.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
74
74
  Left: ${JSON.stringify(i)}
75
75
  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")},vy=i=>i.left!==void 0,pe=i=>i.right!==void 0,ov=i=>({left:i}),il=i=>({right:i});let An=class uv 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,uv.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,yy=v.z.union([v.z.object({$eq:v.z.string().min(1)}),v.z.object({$eqi:v.z.string().min(1)})]),_y=v.z.union([v.z.object({$ne:v.z.string().min(1)}),v.z.object({$nei:v.z.string().min(1)})]),by=v.z.union([v.z.object({$gt:v.z.string().min(1)}),v.z.object({$gte:v.z.string().min(1)})]),wy=v.z.union([v.z.object({$lt:v.z.string().min(1)}),v.z.object({$lte:v.z.string().min(1)})]),Ay=v.z.union([v.z.object({$startsWith:v.z.string().min(1)}),v.z.object({$startsWithi:v.z.string().min(1)})]),Sy=v.z.union([v.z.object({$endsWith:v.z.string().min(1)}),v.z.object({$endsWithi:v.z.string().min(1)})]),Ey=v.z.union([v.z.object({$contains:v.z.string().min(1)}),v.z.object({$containsi:v.z.string().min(1)})]),Oy=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()),Ty=v.z.union([v.z.string(),v.z.boolean()]).transform(i=>typeof i=="string"?["t","true"].includes(i):i).pipe(v.z.boolean()),Iy=v.z.object({_q:v.z.string().optional()}),av=v.z.string().regex(/^(content|createdAt|updatedAt|id):(desc|asc|ASC|DESC)$/,"Invalid orderBy options"),Cy=v.z.union([v.z.string(),v.z.number(),yy,_y,by,wy,Ay,Sy,Ey,Oy,v.z.object({$null:v.z.string().min(1)}),v.z.object({$notNull:v.z.boolean()})]),wm=i=>v.z.object(Object.keys(i).reduce((u,o)=>({...u,[o]:Cy.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)},xy=v.z.object({pageSize:Xr.default(10),page:Xr.default(1)}).merge(Iy).merge(v.z.object({orderBy:av.optional().nullable()})).merge(v.z.object({filters:wm({removed:!0,approvalStatus:!0}).merge(v.z.object({$or:v.z.array(wm({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(`
76
- `);return ov(new An(400,u))}return il(i.data)},Df=i=>v.z.string().regex(gm.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"),Ry=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 sv=xy.merge(v.z.object({_q:v.z.string().optional()})),Jr=i=>Nt(sa({id:Zr.single}).safeParse(i)),Ny=i=>Nt(sv.safeParse(i)),Ly=i=>Nt(sv.safeParse(i)),zy=(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)),Dy=i=>{const u=sa({id:Zr.single,reportIds:Zr.array}).safeParse(i);return Nt(u)},Fy=i=>{const u=sa({reportIds:Zr.array}).safeParse(i);return Nt(u)},Uy=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()}),lv=v.z.object({id:v.z.union([v.z.string(),v.z.number()]),content:v.z.string(),author:Uy}),My=i=>Nt(lv.safeParse(i)),Wy=i=>Nt(lv.pick({content:!0,id:!0}).safeParse(i)),By=i=>Nt(bm.safeParse(i)),cv=i=>v.z.object({relation:Df(i),content:v.z.string().min(1),author:Ry.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(cv(i).safeParse({...o,relation:u})),jy=(i,u)=>Nt(cv(i).pick({content:!0,relation:!0,author:!0}).merge(sa({commentId:Zr.single})).safeParse(u)),ky=i=>v.z.object({relation:Df(i)}),Vy=v.z.object({pagination:v.z.object({pageSize:Xr.default(10),page:Xr.default(1),withCount:Ty.optional().default(!1)}).optional()}),Im=i=>{const u=wm({id:!0,content:!0,authorId:!0,authorName:!0,authorEmail:!0,createdAt:!0,updatedAt:!0,removed:!0,blocked:!0,blockedThread:!0,approvalStatus:!0,isAdminComment:!0});return v.z.object({sort:av.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:v.z.record(v.z.union([v.z.boolean(),v.z.object({populate:v.z.boolean()})])).optional(),limit:Xr.optional(),skip:Xr.optional(),locale:v.z.string().optional()}).merge(ky(i)).merge(Vy)},Gy=(i,u,o)=>Nt(Im(i).safeParse({...o,relation:u})),qy=(i,u,o)=>{const h=Im(i).pick({sort:!0,fields:!0,omit:!0,filters:!0,isAdmin:!0,populate:!0,limit:!0,skip:!0,relation:!0,locale:!0}).merge(v.z.object({startingFromId:v.z.number().optional(),dropBlockedThreads:v.z.boolean().optional().default(!1)}));return Nt(h.safeParse({...o,relation:u}))},Hy=(i,u)=>{const o=Im([]).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(ol.GENERIC),v.z.literal("generic")]).optional(),authorId:v.z.union([v.z.string(),v.z.number()])}));return Nt(o.safeParse({...u,...i}))},Yy=i=>v.z.object({relation:Df(i[Ir.ENABLED_COLLECTIONS]),commentId:Xr,content:v.z.string().min(1),reason:v.z.nativeEnum(i.reportReasons)}),Qy=(i,u)=>Nt(Yy(i).safeParse(u)),Jy=i=>v.z.object({relation:Df(i),commentId:v.z.union([v.z.string(),v.z.number()]),authorId:v.z.union([v.z.string(),v.z.number()])}),Xy=(i,u)=>Nt(Jy(i).safeParse(u)),Zy=({strapi:i})=>({getService(u){return ft(i,u)},async findAll(u){const o=Ny(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=zy(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=Dy({...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=Fy(u.request.body);if(pe(o))return this.getService("admin").resolveMultipleAbuseReports(Y(o));throw ce(u,Y(o))},async postComment(u){const o=My({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=Wy({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))}}),Cr=async(i,u,o)=>Ff(i).getLocalConfig(u,o),fv=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(),email:v.z.string().email()})]).optional().nullable(),locale:v.z.string().nullable()}),hv=v.z.object({page:v.z.number(),pageSize:v.z.number(),pageCount:v.z.number(),total:v.z.number()}),Di=(i,u)=>o=>i?u.parseAsync(o):Promise.resolve(o),pv=(i,u)=>o=>i?u.parseAsync(o):Promise.resolve(o),Ky=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()}),Bm=fv.merge(v.z.object({gotThread:v.z.boolean().nullable().optional(),threadFirstItemId:v.z.number().nullable().optional(),reports:v.z.array(Ky).default([]),author:v.z.any()})),ul=Bm.extend({threadOf:v.z.lazy(()=>v.z.union([v.z.number(),Bm])).nullable().optional()}),e_=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()});ul.omit({related:!0}).extend({related:e_.nullable().optional()});const t_=v.z.array(ul),n_=v.z.object({pagination:hv,results:v.z.array(ul)}),ia={findMany:t_,findWithCount:n_,findOne:ul,create:ul},r_=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(),authorName:v.z.string(),authorEmail:v.z.string(),authorAvatar: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(),publishedAt:v.z.string(),locale:v.z.string().nullable()}),dv=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:r_.nullable().optional()}),i_=v.z.object({results:v.z.array(dv),pagination:hv}),o_=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()}),u_=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:fv.nullable()})),Of={findMany:u_,findPage:i_,update:o_,create:dv},a_=i=>{const u=lr(i,"comment-report"),o=i.query(u);return{async findPage(h){const m=await Cr(i,"isValidationEnabled",!1);return o.findPage(h).then(Di(m,Of.findPage))},async findMany(h){const m=await Cr(i,"isValidationEnabled",!1);return o.findMany(h).then(pv(m,Of.findMany))},async update(h){const m=await Cr(i,"isValidationEnabled",!1);return o.update(h).then(Di(m,Of.update))},async updateMany(h){return o.updateMany(h)},async create(h){const m=await Cr(i,"isValidationEnabled",!1);return o.create(h).then(Di(m,Of.create))}}},Pi=Te.once(a_),s_=i=>{const u=lr(i,"comment");return{async findMany(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).findMany(o).then(pv(h,ia.findMany))},async findWithCount(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).findPage(o).then(Di(h,ia.findWithCount))},async findOne(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).findOne(o).then(m=>m?Di(h,ia.findOne)(m):null)},async update(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).update(o).then(Di(h,ia.findOne))},async delete(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).delete(o).then(m=>m?Di(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 Cr(i,"isValidationEnabled",!1);return i.query(u).create(o).then(Di(h,ia.create))}}},it=Te.once(s_),l_=i=>({getLocalConfig(u,o){return i.config.get([Ov,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(gm).reduce((I,F)=>({...I,[F]:gm[F].toString()}),{})},m=!!i.plugin("graphql"),A=this.getLocalConfig("reportReasons");if(o)return il({...o,...h,reportReasons:A,isGQLPluginEnabled:u?m:void 0});const E=this.getLocalConfig("entryLabel"),T=this.getLocalConfig("approvalFlow"),R=this.getLocalConfig("blockedAuthorProps"),z={entryLabel:E,approvalFlow:T,blockedAuthorProps:R,reportReasons:A,...h};if(u){const I=this.getLocalConfig("enabledCollections"),F=this.getLocalConfig("moderatorRoles");return il({...z,enabledCollections:I,moderatorRoles:F,isGQLPluginEnabled:m})}return il(z)},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()}}),Ff=Te.once(l_),c_=({strapi:i})=>({getService(u){return ft(i,u)},getStoreRepository(){return Ff(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=Gy(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=qy(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=Hy(u.params,u.query);if(pe(o))return this.getService("common").findAllPerAuthor(ua(o.right),u.params.type?![ol.GENERIC.toLowerCase(),ol.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=jy(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),E=Qy(A,{...u.request.body,...u.params});if(pe(E))return await this.getService("client").reportAbuse(E.right,h);throw ce(u,Y(E))}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),E=Xy(A.enabledCollections,{...u.query,...u.params});if(pe(E))return await this.getService("client").markAsRemoved(E.right,h);throw ce(u,Y(E))}throw ce(u,Y(m))}}),f_=({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=By(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)}}}},h_={admin:Zy,client:c_,settings:f_},p_=[{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:[]}}],d_=[{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:[]}}],g_=[...p_,...d_],m_=[{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"}}}],v_={"content-api":{type:"content-api",routes:m_},admin:{type:"admin",routes:g_}};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 gv=(i,u=null,o="threadOf",h=!1,m=!1)=>i.filter(A=>{const E=Te.get(A,o);if(E===null&&u===null)return!0;let T=E;return T&&typeof u=="string"&&(T=T.toString()),T&&T==u||Te.isObject(E)&&E.id===u}).map(A=>({...A,[o]:void 0,related:void 0,blockedThread:m||A.blockedThread,children:A.blockedThread&&h?[]:gv(i,A.id,o,h,A.blockedThread)})),$m=i=>i.split(kv.relatedUid).filter(u=>u&&u.length>0),mv=i=>i&&{...i,reports:(i.reports||[]).filter(u=>!u.resolved)},jm=(i,u,o=[])=>{const{authorUser:h,authorId:m,authorName:A,authorEmail:E,authorAvatar:T,...R}=i;let z={};if(h&&typeof h!="string"){const I=h;z=o.reduce((F,U)=>({...F,[U]:I[U]}),{id:I.id,name:I.username,email:I.email,avatar:I.avatar})}else m&&(z={id:m,name:A,email:E,avatar:T});return z=Te.isEmpty(z)?z:Object.fromEntries(Object.entries(z).filter(([I])=>!u.includes(I))),{...R,author:Te.isEmpty(z)?i.author||{}:z}},Tf=i=>{throw i?new fn(401,"Not authenticated"):new fn(403,"Not authorized")},y_=i=>{const{lastname:u,username:o,firstname:h}=i;return u&&h?`${h} ${u}`:o||h||""},__=Te.once(i=>({findAll:{createParams(u,o,h,m,A){const[E,T]=mm(u),R={orderBy:u?{[E]:T}:void 0,where:A,page:o,pageSize:h};return m&&Te.set(R,"where.content.$contains",m),R},getPopulate(){return{authorUser:rl(i),threadOf:{populate:{authorUser:rl(i)}},reports:{where:{resolved:!1}}}}},findReports:{getDefaultWhere(){return{resolved:{$notNull:!0}}},createParams(u,o,h,m){const[A,E]=mm(u),T={orderBy:u?{[A]:E}:void 0,where:this.getDefaultWhere(),page:o,pageSize:h};return m&&Te.set(T,"where.content.$contains",m),T}},findOneAndThread:{getDefaultWhere(u){return u?{$or:[{removed:!1},{removed:{$notNull:!1}}]}:{}},getPopulate(){const u=rl(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}}}}}}})),b_=({strapi:i})=>{const u=__(i);return{getCommonService(){return ft(i,"common")},async findAll({_q:o,orderBy:h,page:m,pageSize:A,filters:E}){const T=u.findAll.createParams(h,m,A,o,E),R=u.findAll.getPopulate(),z=it(i),{pagination:I,results:F}=await z.findWithCount({...T,count:!0,populate:R}),U=await this.getCommonService().findRelatedEntitiesFor(F);return{pagination:I,result:F.map(Z=>this.getCommonService().sanitizeCommentEntity(Z,[],[])).map(Z=>this.getCommonService().mergeRelatedEntityTo(Z,U))}},async findReports({_q:o,orderBy:h,page:m,pageSize:A}){const E=u.findReports.createParams(h,m,A,o),{pagination:T,results:R}=await Pi(i).findPage({...E,populate:["related"]}),z=R.map($=>typeof $.related=="object"?$.related.id:null).filter(Boolean),I=rl(i),F=await it(i).findMany({where:{threadOf:z},populate:["threadOf"],limit:Number.MAX_SAFE_INTEGER}),U=Array.from(new Set(F.map(({threadOf:$})=>typeof $=="object"?$.id:null).filter(Boolean)));return{result:R.map($=>{const K=U.includes($.related.id),te=this.getCommonService(),Q={...$,related:te.sanitizeCommentEntity({...$.related,gotThread:K},[])},we=typeof I!="boolean"?I?.populate:{};return mv(te.sanitizeCommentEntity(Q,[],[],we))}),pagination:T}},async findOneAndThread({id:o,removed:h,...m}){const A=rl(i),E=u.findOneAndThread.getDefaultWhere(h),T=u.findOneAndThread.getPopulate(),R=await it(i).findOne({...T,where:{id:o}});if(!R)throw new An(404,"Not found");const{relatedId:z,uid:I}=this.getCommonService().parseRelationString(R.related),F=await i.documents(I).findOne({documentId:z}).then(te=>{if(!te)throw new An(404,"Relation not found");return{...te,uid:I}}),U=R.threadOf&&typeof R.threadOf=="object"?R.threadOf.id:null,Z=await this.getCommonService().findAllInHierarchy({filters:{...E,...m,threadOf:U,related:R.related},...T,startingFromId:U,isAdmin:!0,limit:Number.MAX_SAFE_INTEGER},!1),$=typeof A!="boolean"?A?.populate:{},K=this.getCommonService().sanitizeCommentEntity({...R,threadOf:R.threadOf||null},[],[],$);return{entity:F,selected:K,level:Z}},async changeBlockedComment(o,h){const m=await this.getCommonService().findOne({id:o});return this.getCommonService().updateComment({id:o},{blocked:Te.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,E=await this.getCommonService().updateComment({id:o},{blocked:A,blockedThread:A});return await this.blockNestedThreads(o,A),this.getCommonService().sanitizeCommentEntity(E,[])},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 Pi(i).update({where:{id:h,related:o},data:{resolved:!0}})},async resolveCommentMultipleAbuseReports({id:o,reportIds:h}){if((await Pi(i).findMany({where:{id:h,related:o},populate:["related"]})).length===h.length)return Pi(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 Pi(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 Pi(i).updateMany({where:{related:h.map(({id:m})=>m).concat([o]),resolved:!1},data:{resolved:!0}})},async resolveMultipleAbuseReports({reportIds:o}){return Pi(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:y_(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,[])}}},w_=async(i,u)=>{try{return il(await i())}catch{return ov(u)}},A_=({strapi:i})=>{const u=async(o,h)=>{if(h){const m=await i.query("plugin::users-permissions.user").findOne({where:{id:h.id},populate:["avatar"]});return{authorId:h.id,authorName:h.username,authorEmail:h.email,authorAvatar:m?.avatar?.url||null}}else 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:E,locale:T},R){const{uid:z,relatedId:I}=this.getCommonService().parseRelationString(o),F=await i.documents(z).findOne({documentId:I,locale:T});if(!F)throw new fn(400,'Relation for field "related" does not exist. Check your payload please.');const Z=(await this.getCommonService().getConfig(oa.APPROVAL_FLOW,[])).includes(z)||F.requireCommentsApproval,$=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]),K=await w_(async()=>m?await this.getCommonService().findOne({id:m,related:o,locale:T||null}):null,new fn(400,"Thread does not exist"));if(vy(K))throw Y(K);const te=Y(K);if(!A&&!this.getCommonService().isValidUserContext(R))throw Tf(R);const[Q,we]=await Promise.all([this.getCommonService().checkBadWords(h),u(A,R)]),me=!Te.isEmpty(we)&&!we.authorId;if(Te.isEmpty(we)||me)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(Z&&E&&E!==Fi.PENDING)throw new fn(400,"Invalid approval status");const Ve={...await it(i).create({data:{...we,threadOf:m,locale:T,content:Q,related:o,approvalStatus:Z?Fi.PENDING:Fi.APPROVED}}),threadOf:te},Ye=this.getCommonService().sanitizeCommentEntity(Ve,$);try{await this.sendResponseNotification(Ye)}catch(Me){console.error(Me)}return Ye},async update({commentId:o,content:h,author:m,relation:A},E){if(!m&&!this.getCommonService().isValidUserContext(E))throw Tf(E);const T=E?.id||m?.id;if(await this.getCommonService().checkBadWords(h)){const R=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]),z=await this.getCommonService().findOne({id:o,related:A});if(z&&z.author?.id?.toString()===T?.toString()){const I=await it(i).update({where:{id:o},data:{content:h},populate:{threadOf:!0,authorUser:!0}});return this.getCommonService().sanitizeCommentEntity(I,R)}}},async reportAbuse({commentId:o,relation:h,...m},A){if(!this.getCommonService().isValidUserContext(A))throw Tf(A);try{const E=await this.getCommonService().findOne({id:o,related:h});if(E.isAdminComment)throw new fn(403,"You're not allowed to take an action on that entity. This in a admin comment.");if(E){const T=await Pi(i).create({data:{...m,resolved:!1,related:o}});if(T){const R={...T,related:E};try{return await this.sendAbuseReportEmail(T.reason,T.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(E){throw E}},async markAsRemoved({commentId:o,relation:h,authorId:m},A){if(!m&&!this.getCommonService().isValidUserContext(A))throw Tf(A);const E=A?.id||m;if(!E)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 T=A?.id?{authorUser:E}:{authorId:E};if(await this.getCommonService().findOne({id:o,related:h,...T})){const z=await it(i).update({where:{id:o,related:h},data:{removed:!0},populate:{threadOf:!0,authorUser:!0}});await this.markAsRemovedNested(o,!0);const I=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]);return this.getCommonService().sanitizeCommentEntity(z,I)}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 E=await i.query("admin::user").findMany({where:{roles:{code:A}}}).then(T=>T.map(R=>R.email));if(E.length>0){const T=await i.query("admin::user").findOne({where:{roles:{code:m}}});i.plugin("email")&&await i.plugin("email").service("email").send({to:E,from:T.email,subject:"New abuse report on comment",text:`
76
+ `);return ov(new An(400,u))}return il(i.data)},Df=i=>v.z.string().regex(gm.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"),Ry=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 sv=xy.merge(v.z.object({_q:v.z.string().optional()})),Jr=i=>Nt(sa({id:Zr.single}).safeParse(i)),Ny=i=>Nt(sv.safeParse(i)),Ly=i=>Nt(sv.safeParse(i)),zy=(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)),Dy=i=>{const u=sa({id:Zr.single,reportIds:Zr.array}).safeParse(i);return Nt(u)},Fy=i=>{const u=sa({reportIds:Zr.array}).safeParse(i);return Nt(u)},Uy=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()}),lv=v.z.object({id:v.z.union([v.z.string(),v.z.number()]),content:v.z.string(),author:Uy}),My=i=>Nt(lv.safeParse(i)),Wy=i=>Nt(lv.pick({content:!0,id:!0}).safeParse(i)),By=i=>Nt(bm.safeParse(i)),cv=i=>v.z.object({relation:Df(i),content:v.z.string().min(1),author:Ry.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(cv(i).safeParse({...o,relation:u})),jy=(i,u)=>Nt(cv(i).pick({content:!0,relation:!0,author:!0}).merge(sa({commentId:Zr.single})).safeParse(u)),ky=i=>v.z.object({relation:Df(i)}),Vy=v.z.object({pagination:v.z.object({pageSize:Xr.default(10),page:Xr.default(1),withCount:Ty.optional().default(!1)}).optional()}),Gy=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(),Im=i=>{const u=wm({id:!0,content:!0,authorId:!0,authorName:!0,authorEmail:!0,createdAt:!0,updatedAt:!0,removed:!0,blocked:!0,blockedThread:!0,approvalStatus:!0,isAdminComment:!0});return v.z.object({sort:av.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:Gy,limit:Xr.optional(),skip:Xr.optional(),locale:v.z.string().optional()}).merge(ky(i)).merge(Vy)},qy=(i,u,o)=>Nt(Im(i).safeParse({...o,relation:u})),Hy=(i,u,o)=>{const h=Im(i).pick({sort:!0,fields:!0,omit:!0,filters:!0,isAdmin:!0,populate:!0,limit:!0,skip:!0,relation:!0,locale:!0}).merge(v.z.object({startingFromId:v.z.number().optional(),dropBlockedThreads:v.z.boolean().optional().default(!1)}));return Nt(h.safeParse({...o,relation:u}))},Yy=(i,u)=>{const o=Im([]).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(ol.GENERIC),v.z.literal("generic")]).optional(),authorId:v.z.union([v.z.string(),v.z.number()])}));return Nt(o.safeParse({...u,...i}))},Qy=i=>v.z.object({relation:Df(i[Ir.ENABLED_COLLECTIONS]),commentId:Xr,content:v.z.string().min(1),reason:v.z.nativeEnum(i.reportReasons)}),Jy=(i,u)=>Nt(Qy(i).safeParse(u)),Xy=i=>v.z.object({relation:Df(i),commentId:v.z.union([v.z.string(),v.z.number()]),authorId:v.z.union([v.z.string(),v.z.number()])}),Zy=(i,u)=>Nt(Xy(i).safeParse(u)),Ky=({strapi:i})=>({getService(u){return ft(i,u)},async findAll(u){const o=Ny(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=zy(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=Dy({...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=Fy(u.request.body);if(pe(o))return this.getService("admin").resolveMultipleAbuseReports(Y(o));throw ce(u,Y(o))},async postComment(u){const o=My({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=Wy({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))}}),Cr=async(i,u,o)=>Ff(i).getLocalConfig(u,o),fv=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(),email:v.z.string().email()})]).optional().nullable(),locale:v.z.string().nullable()}),hv=v.z.object({page:v.z.number(),pageSize:v.z.number(),pageCount:v.z.number(),total:v.z.number()}),Di=(i,u)=>o=>i?u.parseAsync(o):Promise.resolve(o),pv=(i,u)=>o=>i?u.parseAsync(o):Promise.resolve(o),e_=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()}),Bm=fv.merge(v.z.object({gotThread:v.z.boolean().nullable().optional(),threadFirstItemId:v.z.number().nullable().optional(),reports:v.z.array(e_).default([]),author:v.z.any()})),ul=Bm.extend({threadOf:v.z.lazy(()=>v.z.union([v.z.number(),Bm])).nullable().optional()}),t_=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()});ul.omit({related:!0}).extend({related:t_.nullable().optional()});const n_=v.z.array(ul),r_=v.z.object({pagination:hv,results:v.z.array(ul)}),ia={findMany:n_,findWithCount:r_,findOne:ul,create:ul},i_=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(),authorName:v.z.string(),authorEmail:v.z.string(),authorAvatar: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(),publishedAt:v.z.string(),locale:v.z.string().nullable()}),dv=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:i_.nullable().optional()}),o_=v.z.object({results:v.z.array(dv),pagination:hv}),u_=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()}),a_=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:fv.nullable()})),Of={findMany:a_,findPage:o_,update:u_,create:dv},s_=i=>{const u=lr(i,"comment-report"),o=i.query(u);return{async findPage(h){const m=await Cr(i,"isValidationEnabled",!1);return o.findPage(h).then(Di(m,Of.findPage))},async findMany(h){const m=await Cr(i,"isValidationEnabled",!1);return o.findMany(h).then(pv(m,Of.findMany))},async update(h){const m=await Cr(i,"isValidationEnabled",!1);return o.update(h).then(Di(m,Of.update))},async updateMany(h){return o.updateMany(h)},async create(h){const m=await Cr(i,"isValidationEnabled",!1);return o.create(h).then(Di(m,Of.create))}}},Pi=Te.once(s_),l_=i=>{const u=lr(i,"comment");return{async findMany(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).findMany(o).then(pv(h,ia.findMany))},async findWithCount(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).findPage(o).then(Di(h,ia.findWithCount))},async findOne(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).findOne(o).then(m=>m?Di(h,ia.findOne)(m):null)},async update(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).update(o).then(Di(h,ia.findOne))},async delete(o){const h=await Cr(i,"isValidationEnabled",!1);return i.query(u).delete(o).then(m=>m?Di(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 Cr(i,"isValidationEnabled",!1);return i.query(u).create(o).then(Di(h,ia.create))}}},it=Te.once(l_),c_=i=>({getLocalConfig(u,o){return i.config.get([Ov,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(gm).reduce((I,F)=>({...I,[F]:gm[F].toString()}),{})},m=!!i.plugin("graphql"),A=this.getLocalConfig("reportReasons");if(o)return il({...o,...h,reportReasons:A,isGQLPluginEnabled:u?m:void 0});const E=this.getLocalConfig("entryLabel"),T=this.getLocalConfig("approvalFlow"),R=this.getLocalConfig("blockedAuthorProps"),z={entryLabel:E,approvalFlow:T,blockedAuthorProps:R,reportReasons:A,...h};if(u){const I=this.getLocalConfig("enabledCollections"),F=this.getLocalConfig("moderatorRoles");return il({...z,enabledCollections:I,moderatorRoles:F,isGQLPluginEnabled:m})}return il(z)},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()}}),Ff=Te.once(c_),f_=({strapi:i})=>({getService(u){return ft(i,u)},getStoreRepository(){return Ff(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=qy(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=Hy(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=Yy(u.params,u.query);if(pe(o))return this.getService("common").findAllPerAuthor(ua(o.right),u.params.type?![ol.GENERIC.toLowerCase(),ol.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=jy(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),E=Jy(A,{...u.request.body,...u.params});if(pe(E))return await this.getService("client").reportAbuse(E.right,h);throw ce(u,Y(E))}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),E=Zy(A.enabledCollections,{...u.query,...u.params});if(pe(E))return await this.getService("client").markAsRemoved(E.right,h);throw ce(u,Y(E))}throw ce(u,Y(m))}}),h_=({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=By(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)}}}},p_={admin:Ky,client:f_,settings:h_},d_=[{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:[]}}],g_=[{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:[]}}],m_=[...d_,...g_],v_=[{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"}}}],y_={"content-api":{type:"content-api",routes:v_},admin:{type:"admin",routes:m_}};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 gv=(i,u=null,o="threadOf",h=!1,m=!1)=>i.filter(A=>{const E=Te.get(A,o);if(E===null&&u===null)return!0;let T=E;return T&&typeof u=="string"&&(T=T.toString()),T&&T==u||Te.isObject(E)&&E.id===u}).map(A=>({...A,[o]:void 0,related:void 0,blockedThread:m||A.blockedThread,children:A.blockedThread&&h?[]:gv(i,A.id,o,h,A.blockedThread)})),$m=i=>i.split(kv.relatedUid).filter(u=>u&&u.length>0),mv=i=>i&&{...i,reports:(i.reports||[]).filter(u=>!u.resolved)},jm=(i,u,o=[])=>{const{authorUser:h,authorId:m,authorName:A,authorEmail:E,authorAvatar:T,...R}=i;let z={};if(h&&typeof h!="string"){const I=h;z=o.reduce((F,U)=>({...F,[U]:I[U]}),{id:I.id,name:I.username,email:I.email,avatar:I.avatar})}else m&&(z={id:m,name:A,email:E,avatar:T});return z=Te.isEmpty(z)?z:Object.fromEntries(Object.entries(z).filter(([I])=>!u.includes(I))),{...R,author:Te.isEmpty(z)?i.author||{}:z}},Tf=i=>{throw i?new fn(401,"Not authenticated"):new fn(403,"Not authorized")},__=i=>{const{lastname:u,username:o,firstname:h}=i;return u&&h?`${h} ${u}`:o||h||""},b_=Te.once(i=>({findAll:{createParams(u,o,h,m,A){const[E,T]=mm(u),R={orderBy:u?{[E]:T}:void 0,where:A,page:o,pageSize:h};return m&&Te.set(R,"where.content.$contains",m),R},getPopulate(){return{authorUser:rl(i),threadOf:{populate:{authorUser:rl(i)}},reports:{where:{resolved:!1}}}}},findReports:{getDefaultWhere(){return{resolved:{$notNull:!0}}},createParams(u,o,h,m){const[A,E]=mm(u),T={orderBy:u?{[A]:E}:void 0,where:this.getDefaultWhere(),page:o,pageSize:h};return m&&Te.set(T,"where.content.$contains",m),T}},findOneAndThread:{getDefaultWhere(u){return u?{$or:[{removed:!1},{removed:{$notNull:!1}}]}:{}},getPopulate(){const u=rl(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}}}}}}})),w_=({strapi:i})=>{const u=b_(i);return{getCommonService(){return ft(i,"common")},async findAll({_q:o,orderBy:h,page:m,pageSize:A,filters:E}){const T=u.findAll.createParams(h,m,A,o,E),R=u.findAll.getPopulate(),z=it(i),{pagination:I,results:F}=await z.findWithCount({...T,count:!0,populate:R}),U=await this.getCommonService().findRelatedEntitiesFor(F);return{pagination:I,result:F.map(Z=>this.getCommonService().sanitizeCommentEntity(Z,[],[])).map(Z=>this.getCommonService().mergeRelatedEntityTo(Z,U))}},async findReports({_q:o,orderBy:h,page:m,pageSize:A}){const E=u.findReports.createParams(h,m,A,o),{pagination:T,results:R}=await Pi(i).findPage({...E,populate:["related"]}),z=R.map($=>typeof $.related=="object"?$.related.id:null).filter(Boolean),I=rl(i),F=await it(i).findMany({where:{threadOf:z},populate:["threadOf"],limit:Number.MAX_SAFE_INTEGER}),U=Array.from(new Set(F.map(({threadOf:$})=>typeof $=="object"?$.id:null).filter(Boolean)));return{result:R.map($=>{const K=U.includes($.related.id),te=this.getCommonService(),Q={...$,related:te.sanitizeCommentEntity({...$.related,gotThread:K},[])},we=typeof I!="boolean"?I?.populate:{};return mv(te.sanitizeCommentEntity(Q,[],[],we))}),pagination:T}},async findOneAndThread({id:o,removed:h,...m}){const A=rl(i),E=u.findOneAndThread.getDefaultWhere(h),T=u.findOneAndThread.getPopulate(),R=await it(i).findOne({...T,where:{id:o}});if(!R)throw new An(404,"Not found");const{relatedId:z,uid:I}=this.getCommonService().parseRelationString(R.related),F=await i.documents(I).findOne({documentId:z}).then(te=>{if(!te)throw new An(404,"Relation not found");return{...te,uid:I}}),U=R.threadOf&&typeof R.threadOf=="object"?R.threadOf.id:null,Z=await this.getCommonService().findAllInHierarchy({filters:{...E,...m,threadOf:U,related:R.related},...T,startingFromId:U,isAdmin:!0,limit:Number.MAX_SAFE_INTEGER},!1),$=typeof A!="boolean"?A?.populate:{},K=this.getCommonService().sanitizeCommentEntity({...R,threadOf:R.threadOf||null},[],[],$);return{entity:F,selected:K,level:Z}},async changeBlockedComment(o,h){const m=await this.getCommonService().findOne({id:o});return this.getCommonService().updateComment({id:o},{blocked:Te.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,E=await this.getCommonService().updateComment({id:o},{blocked:A,blockedThread:A});return await this.blockNestedThreads(o,A),this.getCommonService().sanitizeCommentEntity(E,[])},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 Pi(i).update({where:{id:h,related:o},data:{resolved:!0}})},async resolveCommentMultipleAbuseReports({id:o,reportIds:h}){if((await Pi(i).findMany({where:{id:h,related:o},populate:["related"]})).length===h.length)return Pi(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 Pi(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 Pi(i).updateMany({where:{related:h.map(({id:m})=>m).concat([o]),resolved:!1},data:{resolved:!0}})},async resolveMultipleAbuseReports({reportIds:o}){return Pi(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:__(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,[])}}},A_=async(i,u)=>{try{return il(await i())}catch{return ov(u)}},S_=({strapi:i})=>{const u=async(o,h)=>{if(h){const m=await i.query("plugin::users-permissions.user").findOne({where:{id:h.id},populate:["avatar"]});return{authorId:h.id,authorName:h.username,authorEmail:h.email,authorAvatar:m?.avatar?.url||null}}else 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:E,locale:T},R){const{uid:z,relatedId:I}=this.getCommonService().parseRelationString(o),F=await i.documents(z).findOne({documentId:I,locale:T});if(!F)throw new fn(400,'Relation for field "related" does not exist. Check your payload please.');const Z=(await this.getCommonService().getConfig(oa.APPROVAL_FLOW,[])).includes(z)||F.requireCommentsApproval,$=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]),K=await A_(async()=>m?await this.getCommonService().findOne({id:m,related:o,locale:T||null}):null,new fn(400,"Thread does not exist"));if(vy(K))throw Y(K);const te=Y(K);if(!A&&!this.getCommonService().isValidUserContext(R))throw Tf(R);const[Q,we]=await Promise.all([this.getCommonService().checkBadWords(h),u(A,R)]),me=!Te.isEmpty(we)&&!we.authorId;if(Te.isEmpty(we)||me)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(Z&&E&&E!==Fi.PENDING)throw new fn(400,"Invalid approval status");const Ve={...await it(i).create({data:{...we,threadOf:m,locale:T,content:Q,related:o,approvalStatus:Z?Fi.PENDING:Fi.APPROVED}}),threadOf:te},Ye=this.getCommonService().sanitizeCommentEntity(Ve,$);try{await this.sendResponseNotification(Ye)}catch(Me){console.error(Me)}return Ye},async update({commentId:o,content:h,author:m,relation:A},E){if(!m&&!this.getCommonService().isValidUserContext(E))throw Tf(E);const T=E?.id||m?.id;if(await this.getCommonService().checkBadWords(h)){const R=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]),z=await this.getCommonService().findOne({id:o,related:A});if(z&&z.author?.id?.toString()===T?.toString()){const I=await it(i).update({where:{id:o},data:{content:h},populate:{threadOf:!0,authorUser:!0}});return this.getCommonService().sanitizeCommentEntity(I,R)}}},async reportAbuse({commentId:o,relation:h,...m},A){if(!this.getCommonService().isValidUserContext(A))throw Tf(A);try{const E=await this.getCommonService().findOne({id:o,related:h});if(E.isAdminComment)throw new fn(403,"You're not allowed to take an action on that entity. This in a admin comment.");if(E){const T=await Pi(i).create({data:{...m,resolved:!1,related:o}});if(T){const R={...T,related:E};try{return await this.sendAbuseReportEmail(T.reason,T.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(E){throw E}},async markAsRemoved({commentId:o,relation:h,authorId:m},A){if(!m&&!this.getCommonService().isValidUserContext(A))throw Tf(A);const E=A?.id||m;if(!E)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 T=A?.id?{authorUser:E}:{authorId:E};if(await this.getCommonService().findOne({id:o,related:h,...T})){const z=await it(i).update({where:{id:o,related:h},data:{removed:!0},populate:{threadOf:!0,authorUser:!0}});await this.markAsRemovedNested(o,!0);const I=await this.getCommonService().getConfig(oa.AUTHOR_BLOCKED_PROPS,[]);return this.getCommonService().sanitizeCommentEntity(z,I)}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 E=await i.query("admin::user").findMany({where:{roles:{code:A}}}).then(T=>T.map(R=>R.email));if(E.length>0){const T=await i.query("admin::user").findOne({where:{roles:{code:m}}});i.plugin("email")&&await i.plugin("email").service("email").send({to:E,from:T.email,subject:"New abuse report on comment",text:`
77
77
  There was a new abuse report on your app.
78
78
  Reason: ${o}
79
79
  Message: ${h}
@@ -87,7 +87,7 @@ spurious results.`)}}return!1},g0=5;function m0(i,u){const[o,h]=u?[i,u]:[void 0,
87
87
  ------
88
88
 
89
89
  Visit ${T} and continue the discussion.
90
- `})}catch(R){throw i.log.error(R),R}}}}}},S_=10,E_=["id"],O_=({strapi:i})=>({async getConfig(u,o,h=!1){const m=Ff(i),A=await m.getConfig();return u&&!h?Te.get(A,u,o):h?m.getLocalConfig(u,o):A},parseRelationString(u){const[o,h]=$m(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 Te.omit({...jm({...u,threadOf:Te.isObject(u.threadOf)?jm(u.threadOf,o,A):u.threadOf},o,A)},h)},async findAllFlat({fields:u,limit:o,skip:h,sort:m,populate:A,omit:E=[],isAdmin:T=!1,pagination:R,filters:z={},locale:I},F){const U=E.filter(Qe=>!E_.includes(Qe)),Z=["id","related"].filter(Qe=>!U.includes(Qe)),$={authorUser:!0,...Te.isObject(A)?A:{}},K=T?[]:await this.getConfig(Ir.AUTHOR_BLOCKED_PROPS,[]),[te,Q]=mm(m),we={orderBy:{[te]:Q},select:Array.isArray(u)?Te.uniq([...u,Z].flat()):u},me={where:{...z,...I?{locale:I}:{}},populate:$,...we,pageSize:R?.pageSize||o||S_,page:R?.page||(h?Math.floor(h/o):1)||1},{results:ze,pagination:Ve}=await it(i).findWithCount(me),Ye=await Promise.all(ze.map(async Qe=>{const{results:Sn,pagination:{total:En}}=await it(i).findWithCount({where:{threadOf:Qe.id}});return{id:Qe.id,itemsInTread:En,firstThreadItemId:Te.first(Sn)?.id}})),Me=U.includes("related")?[]:F!==null?[F]:await this.findRelatedEntitiesFor([...ze]),hn=Me.filter(Qe=>Qe).length>0,jn=ze.map(Qe=>{const Sn=Ye.find(Ze=>Ze.id===Qe.id),En="threadOf"in z?Te.isString(z.threadOf)?Te.parseInt(z.threadOf):z.threadOf:null;let Kr={};Te.isObject($?.authorUser)&&(Kr="populate"in $.authorUser?$.authorUser.populate:$.authorUser);const fr=typeof En=="number"?En:null;return this.sanitizeCommentEntity({...Qe,threadOf:fr||Qe.threadOf,gotThread:(Sn?.itemsInTread||0)>0,threadFirstItemId:Sn?.firstThreadItemId},K,U,Kr)});return{data:hn?jn.map(Qe=>this.mergeRelatedEntityTo(Qe,Me)):jn,pagination:Ve}},async findAllInHierarchy({filters:u,populate:o,sort:h,fields:m,startingFromId:A,dropBlockedThreads:E,isAdmin:T=!1,omit:R=[],locale:z,limit:I},F){const U=await this.findAllFlat({filters:u,populate:o,sort:h,fields:m,isAdmin:T,omit:R,locale:z,limit:I},F);return gv(U?.data,A,"threadOf",E,!1)},async findOne(u){const o=await it(i).findOne({where:u,populate:{reports:!0,authorUser:!0}});if(!o)throw new An(400,"Comment does not exist. Check your payload please.");const h=await this.getConfig(Ir.AUTHOR_BLOCKED_PROPS,[]),m=this.sanitizeCommentEntity(o,h);return mv(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:E=!1,authorId:T},R=!1){{if(Te.isNil(T))return{data:[]};const z=R?{authorUser:{id:T}}:{authorId:T},I=await this.findAllFlat({filters:{...Te.omit(u,["related"]),...z},pagination:h,populate:o,sort:m,fields:A,isAdmin:E});return{...I,data:I.data.map(({author:F,...U})=>U)}}},async findRelatedEntitiesFor(u){const o=u.reduce((h,m)=>{const[A,E]=$m(m.related);return{...h,[A]:{...h[A]||{},documentIds:[...h[A]?.documentIds||[],E],locale:[...h[A]?.locale||[],m.locale]}}},{});return Promise.all(Object.entries(o).map(async([h,{documentIds:m,locale:A}])=>Promise.all(m.map((E,T)=>i.documents(h).findOne({documentId:E.toString(),locale:Te.isNil(A[T])?void 0:A[T],status:"published"}))).then(E=>E.filter(T=>T).map(T=>({...T,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}}),E=await it(i).updateMany({where:{id:A.map(T=>T.id)},data:{[o]:h}});return A.length===E.count&&E.count>0?(await Promise.all(A.map(R=>this.modifiedNestedNestedComments(R.id,o,h,m-1)))).length===E.count:!0}catch{return!1}},async checkBadWords(u){if(await this.getConfig(Ir.BAD_WORDS,!0)&&u&&xm.isProfane({testString:u}))throw new An(400,"Bad language used! Please polite your comment...",{content:{original:u,filtered:u&&xm.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}})},registerLifecycleHook(){},async runLifecycleHook(){}});var xf={exports:{}};/**
90
+ `})}catch(R){throw i.log.error(R),R}}}}}},E_=10,O_=["id"],T_=({strapi:i})=>({async getConfig(u,o,h=!1){const m=Ff(i),A=await m.getConfig();return u&&!h?Te.get(A,u,o):h?m.getLocalConfig(u,o):A},parseRelationString(u){const[o,h]=$m(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 Te.omit({...jm({...u,threadOf:Te.isObject(u.threadOf)?jm(u.threadOf,o,A):u.threadOf},o,A)},h)},async findAllFlat({fields:u,limit:o,skip:h,sort:m,populate:A,omit:E=[],isAdmin:T=!1,pagination:R,filters:z={},locale:I},F){const U=E.filter(Qe=>!O_.includes(Qe)),Z=["id","related"].filter(Qe=>!U.includes(Qe)),$={authorUser:!0,...Te.isObject(A)?A:{}},K=T?[]:await this.getConfig(Ir.AUTHOR_BLOCKED_PROPS,[]),[te,Q]=mm(m),we={orderBy:{[te]:Q},select:Array.isArray(u)?Te.uniq([...u,Z].flat()):u},me={where:{...z,...I?{locale:I}:{}},populate:$,...we,pageSize:R?.pageSize||o||E_,page:R?.page||(h?Math.floor(h/o):1)||1},{results:ze,pagination:Ve}=await it(i).findWithCount(me),Ye=await Promise.all(ze.map(async Qe=>{const{results:Sn,pagination:{total:En}}=await it(i).findWithCount({where:{threadOf:Qe.id}});return{id:Qe.id,itemsInTread:En,firstThreadItemId:Te.first(Sn)?.id}})),Me=U.includes("related")?[]:F!==null?[F]:await this.findRelatedEntitiesFor([...ze]),hn=Me.filter(Qe=>Qe).length>0,jn=ze.map(Qe=>{const Sn=Ye.find(Ze=>Ze.id===Qe.id),En="threadOf"in z?Te.isString(z.threadOf)?Te.parseInt(z.threadOf):z.threadOf:null;let Kr={};Te.isObject($?.authorUser)&&(Kr="populate"in $.authorUser?$.authorUser.populate:$.authorUser);const fr=typeof En=="number"?En:null;return this.sanitizeCommentEntity({...Qe,threadOf:fr||Qe.threadOf,gotThread:(Sn?.itemsInTread||0)>0,threadFirstItemId:Sn?.firstThreadItemId},K,U,Kr)});return{data:hn?jn.map(Qe=>this.mergeRelatedEntityTo(Qe,Me)):jn,pagination:Ve}},async findAllInHierarchy({filters:u,populate:o,sort:h,fields:m,startingFromId:A,dropBlockedThreads:E,isAdmin:T=!1,omit:R=[],locale:z,limit:I},F){const U=await this.findAllFlat({filters:u,populate:o,sort:h,fields:m,isAdmin:T,omit:R,locale:z,limit:I},F);return gv(U?.data,A,"threadOf",E,!1)},async findOne(u){const o=await it(i).findOne({where:u,populate:{reports:!0,authorUser:!0}});if(!o)throw new An(400,"Comment does not exist. Check your payload please.");const h=await this.getConfig(Ir.AUTHOR_BLOCKED_PROPS,[]),m=this.sanitizeCommentEntity(o,h);return mv(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:E=!1,authorId:T},R=!1){{if(Te.isNil(T))return{data:[]};const z=R?{authorUser:{id:T}}:{authorId:T},I=await this.findAllFlat({filters:{...Te.omit(u,["related"]),...z},pagination:h,populate:o,sort:m,fields:A,isAdmin:E});return{...I,data:I.data.map(({author:F,...U})=>U)}}},async findRelatedEntitiesFor(u){const o=u.reduce((h,m)=>{const[A,E]=$m(m.related);return{...h,[A]:{...h[A]||{},documentIds:[...h[A]?.documentIds||[],E],locale:[...h[A]?.locale||[],m.locale]}}},{});return Promise.all(Object.entries(o).map(async([h,{documentIds:m,locale:A}])=>Promise.all(m.map((E,T)=>i.documents(h).findOne({documentId:E.toString(),locale:Te.isNil(A[T])?void 0:A[T],status:"published"}))).then(E=>E.filter(T=>T).map(T=>({...T,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}}),E=await it(i).updateMany({where:{id:A.map(T=>T.id)},data:{[o]:h}});return A.length===E.count&&E.count>0?(await Promise.all(A.map(R=>this.modifiedNestedNestedComments(R.id,o,h,m-1)))).length===E.count:!0}catch{return!1}},async checkBadWords(u){if(await this.getConfig(Ir.BAD_WORDS,!0)&&u&&xm.isProfane({testString:u}))throw new An(400,"Bad language used! Please polite your comment...",{content:{original:u,filtered:u&&xm.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}})},registerLifecycleHook(){},async runLifecycleHook(){}});var xf={exports:{}};/**
91
91
  * @license
92
92
  * Lodash <https://lodash.com/>
93
93
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
@@ -113,13 +113,13 @@ __p += '`),j&&(S+=`' +
113
113
  function print() { __p += __j.call(arguments, '') }
114
114
  `:`;
115
115
  `)+S+`return __p
116
- }`;var M=Af(function(){return Tr(f,x+"return "+S).apply(_,g)});if(M.source=S,Ts(M))throw M;return M}function Cd(e){return ge(e).toLowerCase()}function xd(e){return ge(e).toUpperCase()}function Rd(e,t,n){if(e=ge(e),e&&(n||t===_))return fr(e);if(!e||!(t=Et(t)))return e;var r=Pe(e),a=Pe(t);return wr(r,Kt(r,a),xo(r,a)+1).join("")}function Nd(e,t,n){if(e=ge(e),e&&(n||t===_))return e.slice(0,hr(e)+1);if(!e||!(t=Et(t)))return e;var r=Pe(e);return wr(r,0,xo(r,Pe(t))+1).join("")}function Ld(e,t,n){if(e=ge(e),e&&(n||t===_))return e.replace(ya,"");if(!e||!(t=Et(t)))return e;var r=Pe(e);return wr(r,Kt(r,Pe(t))).join("")}function zd(e,t){var n=kf,r=Vf;if(Fe(t)){var a="separator"in t?t.separator:a;n="length"in t?ue(t.length):n,r="omission"in t?Et(t.omission):r}e=ge(e);var s=e.length;if(Ge(e)){var c=Pe(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,ge(bl.exec(a))+"g")),a.lastIndex=0;w=a.exec(b);)var S=w.index;g=g.slice(0,S===_?f:S)}}else if(e.indexOf(Et(a),f)!=f){var O=g.lastIndexOf(a);O>-1&&(g=g.slice(0,O))}return g+r}function Pd(e){return e=ge(e),e&&ga.test(e)?e.replace(dl,Ch):e}function Vc(e,t,n){return e=ge(e),t=n?_:t,t===_?Nr(e)?ll(e):te(e):e.match(t)||[]}function Mu(e){var t=e==null?0:e.length,n=J();return e=t?I(e,function(r){if(typeof r[1]!="function")throw new sn(At);return[n(r[0]),r[1]]}):[],se(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 Dd(e){return Fh(qt(e,Bt))}function Wu(e){return function(){return e}}function Gc(e,t){return e==null||e!==e?t:e}function vt(e){return e}function Bu(e){return Jl(typeof e=="function"?e:qt(e,Bt))}function qc(e){return Xl(qt(e,Bt))}function Hc(e,t){return Zl(e,qt(t,Bt))}function $u(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 Fd(){return at._===this&&(at._=qu),this}function Rs(){}function Ud(e){return e=ue(e),se(function(t){return Kl(t,e)})}function So(e){return wu(e)?Me(Fn(e)):yn(e)}function ju(e){return function(t){return e==null?_:$r(e,t)}}function Ns(){return[]}function Ls(){return!1}function zs(){return{}}function Yc(){return""}function Md(){return!0}function Wd(e,t){if(e=ue(e),e<1||e>On)return[];var n=Tn,r=H(e,Tn);t=J(t),e-=Tn;for(var a=En(r,t);++n<e;)t(n);return a}function Bd(e){return ie(e)?I(e,Fn):Yt(e)?[e]:dt(cf(ge(e)))}function $d(e){var t=++Ds;return ge(e)+t}function jd(e){return e&&e.length?_r(e,vt,jr):_}function kd(e,t){return e&&e.length?_r(e,J(t,2),jr):_}function Vd(e){return Ye(e,vt)}function Gd(e,t){return Ye(e,J(t,2))}function qd(e){return e&&e.length?_r(e,vt,ja):_}function Hd(e,t){return e&&e.length?_r(e,J(t,2),ja):_}function Yd(e){return e&&e.length?Sn(e,vt):0}function Qd(e,t){return e&&e.length?Sn(e,J(t,2)):0}y=y==null?at:mn.defaults(at.Object(),y,mn.pick(at,Nl));var _e=y.Array,ku=y.Date,Ps=y.Error,Tr=y.Function,ee=y.Math,Ne=y.Object,yt=y.RegExp,ke=y.String,sn=y.TypeError,wn=_e.prototype,Jd=Tr.prototype,Ci=Ne.prototype,Vu=y["__core-js_shared__"],Gu=Jd.toString,be=Ci.hasOwnProperty,Ds=0,Qc=function(){var e=/[^.]+$/.exec(Vu&&Vu.keys&&Vu.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ln=Ci.toString,Jc=Gu.call(Ne),qu=at._,Ue=yt("^"+Gu.call(be).replace(ko,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=Da?y.Buffer:_,rr=y.Symbol,Hu=y.Uint8Array,Xc=Le?Le.allocUnsafe:_,Yu=k(Ne.getPrototypeOf,Ne),Zc=Ne.create,Kc=Ci.propertyIsEnumerable,Qu=wn.splice,Fs=rr?rr.isConcatSpreadable:_,ir=rr?rr.iterator:_,or=rr?rr.toStringTag:_,Ju=function(){try{var e=Ar(Ne,"defineProperty");return e({},"",{}),e}catch{}}(),ef=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=Ne.getOwnPropertySymbols,Xd=Le?Le.isBuffer:_,tf=y.isFinite,Zd=wn.join,nf=k(Ne.keys,Ne),Oe=ee.max,H=ee.min,rf=ku.now,cn=y.parseInt,Ms=ee.random,Kd=wn.reverse,he=Ar(y,"DataView"),Eo=Ar(y,"Map"),Ku=Ar(y,"Promise"),ar=Ar(y,"Set"),Oo=Ar(y,"WeakMap"),To=Ar(Ne,"create"),ea=Oo&&new Oo,xi={},eg=Or(he),tg=Or(Eo),ng=Or(Ku),rg=Or(ar),ig=Or(Oo),ta=rr?rr.prototype:_,Io=ta?ta.valueOf:_,of=ta?ta.toString:_,Ri=function(){function e(){}return function(t){if(!Fe(t))return{};if(Zc)return Zc(t);e.prototype=t;var n=new e;return e.prototype=_,n}}();l.templateSettings={escape:li,evaluate:gl,interpolate:va,variable:"",imports:{_:l}},l.prototype=C.prototype,l.prototype.constructor=l,P.prototype=Ri(C.prototype),P.prototype.constructor=P,D.prototype=Ri(C.prototype),D.prototype.constructor=D,Ur.prototype.clear=tn,Ur.prototype.delete=Jo,Ur.prototype.get=Rh,Ur.prototype.has=hi,Ur.prototype.set=Xo,nn.prototype.clear=ye,nn.prototype.delete=Nh,nn.prototype.get=Ml,nn.prototype.has=Zo,nn.prototype.set=Lh,Yn.prototype.clear=zh,Yn.prototype.delete=Ko,Yn.prototype.get=yr,Yn.prototype.has=eu,Yn.prototype.set=Wl,Cn.prototype.add=Cn.prototype.push=Bl,Cn.prototype.has=$l,zt.prototype.clear=jl,zt.prototype.delete=eo,zt.prototype.get=Mr,zt.prototype.has=tu,zt.prototype.set=Ph;var Mn=_i(xn),uf=_i(Wa,!0),Co=Za(),af=Za(!0),sf=ea?function(e,t){return ea.set(e,t),e}:vt,og=Ju?function(e,t){return Ju(e,"toString",{configurable:!0,enumerable:!1,value:Wu(t),writable:!0})}:vt,rt=se,Rt=ef||function(e){return at.clearTimeout(e)},ug=ar&&1/re(new ar([,-0]))[1]==Pr?function(e){return new ar(e)}:Rs,Ws=ea?function(e){return ea.get(e)}:Rs,Bs=Us?function(e){return e==null?[]:(e=Ne(e),T(Us(e),function(t){return Kc.call(e,t)}))}:Ns,$s=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||Eo&&_t(new Eo)!=dn||Ku&&_t(Ku.resolve())!=Gi||ar&&_t(new ar)!=gn||Oo&&_t(new Oo)!=Yi)&&(_t=function(e){var t=tt(e),n=t==qn?e.constructor:_,r=n?Or(n):"";if(r)switch(r){case eg:return ai;case tg:return dn;case ng:return Gi;case rg:return gn;case ig:return Yi}return t});var ag=Vu?tr:Ls,lf=ls(sf),Ni=Qt||function(e,t){return at.setTimeout(e,t)},js=ls(og),cf=Sr(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(vl,function(n,r,a,s){t.push(a?s.replace(lh,"$1"):r||n)}),t}),sg=se(function(e,t){return je(e)?Br(e,We(t,1,je,!0)):[]}),ff=se(function(e,t){var n=Tt(t);return je(n)&&(n=_),je(e)?Br(e,We(t,1,je,!0),J(n,2)):[]}),hf=se(function(e,t){var n=Tt(t);return je(n)&&(n=_),je(e)?Br(e,We(t,1,je,!0),_,n):[]}),lg=se(function(e){var t=I(e,cu);return t.length&&t[0]===e[0]?mi(t):[]}),cg=se(function(e){var t=Tt(e),n=I(e,cu);return t===Tt(n)?t=_:n.pop(),n.length&&n[0]===e[0]?mi(n,J(t,2)):[]}),fg=se(function(e){var t=Tt(e),n=I(e,cu);return t=typeof t=="function"?t:_,t&&n.pop(),n.length&&n[0]===e[0]?mi(n,_,t):[]}),hg=se(mo),Li=Dn(function(e,t){var n=e==null?0:e.length,r=Ma(e,t);return tc(e,I(t,function(a){return gt(a,n)?+a:a}).sort(so)),r}),pg=se(function(e){return Pt(We(e,1,je,!0))}),dg=se(function(e){var t=Tt(e);return je(t)&&(t=_),Pt(We(e,1,je,!0),J(t,2))}),gg=se(function(e){var t=Tt(e);return t=typeof t=="function"?t:_,Pt(We(e,1,je,!0),_,t)}),mg=se(function(e,t){return je(e)?Br(e,t):[]}),vg=se(function(e){return kr(T(e,je))}),pf=se(function(e){var t=Tt(e);return je(t)&&(t=_),kr(T(e,je),J(t,2))}),df=se(function(e){var t=Tt(e);return t=typeof t=="function"?t:_,kr(T(e,je),_,t)}),yg=se(vs),_g=se(function(e){var t=e.length,n=t>1?e[t-1]:_;return n=typeof n=="function"?(e.pop(),n):_,Lu(e,n)}),bg=Dn(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 D&&gt(n)?(r=r.slice(n,+n+(t?1:0)),r.__actions__.push({func:vo,args:[a],thisArg:_}),new P(r,this.__chain__).thru(function(s){return t&&!s.length&&s.push(_),s})):this.thru(a)}),wg=vi(function(e,t,n){be.call(e,n)?++e[n]:De(e,n,1)}),Ag=hu(cs),Sg=hu(qr),Eg=vi(function(e,t,n){be.call(e,n)?e[n].push(t):De(e,n,[t])}),Og=se(function(e,t,n){var r=-1,a=typeof t=="function",s=Ct(e)?_e(e.length):[];return Mn(e,function(c){s[++r]=a?o(t,c,n):ae(c,t,n)}),s}),Tg=vi(function(e,t,n){De(e,n,t)}),Ig=vi(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Cg=se(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=se(function(e,t,n){var r=$t;if(n.length){var a=q(n,ne(ks));r|=Vn}return Xn(e,r,t,n,a)}),gf=se(function(e,t,n){var r=$t|mr;if(n.length){var a=q(n,ne(gf));r|=Vn}return Xn(t,r,e,n,a)}),xg=se(function(e,t){return pi(e,1,t)}),Rg=se(function(e,t,n){return pi(e,an(t)||0,n)});Pu.Cache=Yn;var Ng=rt(function(e,t){t=t.length==1&&ie(t[0])?I(t[0],Ze(J())):I(We(t,1),Ze(J()));var n=t.length;return se(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=se(function(e,t){return Xn(e,Vn,_,t,q(t,ne(Vs)))}),mf=se(function(e,t){return Xn(e,ji,_,t,q(t,ne(mf)))}),Lg=Dn(function(e,t){return Xn(e,ni,_,_,_,t)}),zg=co(jr),Pg=co(function(e,t){return e>=t}),Qr=Yl(function(){return arguments}())?Yl:function(e){return Be(e)&&be.call(e,"callee")&&!Kc.call(e,"callee")},ie=_e.isArray,Dg=Dl?Ze(Dl):Uh,Wn=Xd||Ls,vf=Fl?Ze(Fl):Mh,Gs=Ul?Ze(Ul):Bh,qs=Fr?Ze(Fr):$h,yf=en?Ze(en):Qn,zi=Fa?Ze(Fa):jh,Hs=co(ja),Fg=co(function(e,t){return e<=t}),Ug=yi(function(e,t){if(Ai(t)||Ct(t))return zn(t,nt(t),e),_;for(var n in t)be.call(t,n)&&no(e,n,t[n])}),_f=yi(function(e,t){zn(t,Ft(t),e)}),lt=yi(function(e,t,n,r){zn(t,Ft(t),e,r)}),Ys=yi(function(e,t,n,r){zn(t,nt(t),e,r)}),Mg=Dn(Ma),Wg=se(function(e,t){e=Ne(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,Ci[w])&&!be.call(e,w))&&(e[w]=s[w])}return e}),Bg=se(function(e){return e.push(_,ns),o(bf,_,e)}),$g=ac(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=ln.call(t)),e[t]=n},Wu(vt)),Qs=ac(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=ln.call(t)),be.call(e,t)?e[t].push(n):e[t]=[n]},J),jg=se(ae),Js=yi(function(e,t,n){uu(e,t,n)}),bf=yi(function(e,t,n,r){uu(e,t,n,r)}),kg=Dn(function(e,t){var n={};if(e==null)return n;var r=!1;t=I(t,function(s){return s=_n(s,e),r||(r=s.length>1),s}),zn(e,os(e),n),r&&(n=qt(n,Bt|No|dr,Kh));for(var a=t.length;a--;)Dt(n,t[a]);return n}),Vg=Dn(function(e,t){return e==null?{}:Gh(e,t)}),wf=fo(nt),Xs=fo(Ft),Gg=Pn(function(e,t,n){return t=t.toLowerCase(),e+(n?Bc(t):t)}),qg=Pn(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Hg=Pn(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Zs=uc("toLowerCase"),Ks=Pn(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Yg=Pn(function(e,t,n){return e+(n?" ":"")+el(t)}),Qg=Pn(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),el=uc("toUpperCase"),Af=se(function(e,t){try{return o(e,_,t)}catch(n){return Ts(n)?n:new Ps(n)}}),Jg=Dn(function(e,t){return m(t,function(n){n=Fn(n),De(e,n,ks(e[n],e))}),e}),Xg=Ka(),Zg=Ka(!0),Kg=se(function(e,t){return function(n){return ae(n,e,t)}}),em=se(function(e,t){return function(n){return ae(e,n,t)}}),tm=gu(I),nm=gu(E),rm=gu($),im=mu(),om=mu(!0),um=du(function(e,t){return e+t},0),am=vu("ceil"),sm=du(function(e,t){return e/t},1),lm=vu("floor"),cm=du(function(e,t){return e*t},1),fm=vu("round"),hm=du(function(e,t){return e-t},0);return l.after=As,l.ary=Ss,l.assign=Ug,l.assignIn=_f,l.assignInWith=lt,l.assignWith=Ys,l.at=Mg,l.before=Es,l.bind=ks,l.bindAll=Jg,l.bindKey=gf,l.castArray=Lp,l.chain=Oc,l.chunk=Un,l.compact=op,l.concat=up,l.cond=Mu,l.conforms=Dd,l.constant=Wu,l.countBy=wg,l.create=Zp,l.curry=_o,l.curryRight=Os,l.debounce=bn,l.defaults=Wg,l.defaultsDeep=Bg,l.defer=xg,l.delay=Rg,l.difference=sg,l.differenceBy=ff,l.differenceWith=hf,l.drop=Iu,l.dropRight=Si,l.dropRightWhile=dc,l.dropWhile=gc,l.fill=ap,l.filter=_p,l.flatMap=_s,l.flatMapDeep=bp,l.flatMapDepth=wp,l.flatten=Ei,l.flattenDeep=sp,l.flattenDepth=mc,l.flip=Yr,l.flow=Xg,l.flowRight=Zg,l.fromPairs=vc,l.functions=rd,l.functionsIn=id,l.groupBy=Eg,l.initial=Cu,l.intersection=lg,l.intersectionBy=cg,l.intersectionWith=fg,l.invert=$g,l.invertBy=Qs,l.invokeMap=Og,l.iteratee=Bu,l.keyBy=Tg,l.keys=nt,l.keysIn=Ft,l.map=zu,l.mapKeys=ud,l.mapValues=Wc,l.matches=qc,l.matchesProperty=Hc,l.memoize=Pu,l.merge=Js,l.mergeWith=bf,l.method=Kg,l.methodOf=em,l.mixin=$u,l.negate=bo,l.nthArg=Ud,l.omit=kg,l.omitBy=ad,l.once=Tp,l.orderBy=Ap,l.over=tm,l.overArgs=Ng,l.overEvery=nm,l.overSome=rm,l.partial=Vs,l.partialRight=mf,l.partition=Ig,l.pick=Vg,l.pickBy=Ao,l.property=So,l.propertyOf=ju,l.pull=hg,l.pullAll=mo,l.pullAllBy=bc,l.pullAllWith=hs,l.pullAt=Li,l.range=im,l.rangeRight=om,l.rearg=Lg,l.reject=Cc,l.remove=cp,l.rest=Ip,l.reverse=xu,l.sampleSize=Op,l.set=ld,l.setWith=cd,l.shuffle=ws,l.slice=Zn,l.sortBy=Cg,l.sortedUniq=Kn,l.sortedUniqBy=ps,l.split=Od,l.spread=Cp,l.tail=ds,l.take=gs,l.takeRight=Ru,l.takeRightWhile=Oi,l.takeWhile=X,l.tap=dp,l.throttle=xp,l.thru=vo,l.toArray=Dc,l.toPairs=wf,l.toPairsIn=Xs,l.toPath=Bd,l.toPlainObject=Uc,l.transform=fd,l.unary=Rp,l.union=pg,l.unionBy=dg,l.unionWith=gg,l.uniq=Nu,l.uniqBy=ms,l.uniqWith=Hr,l.unset=hd,l.unzip=vs,l.unzipWith=Lu,l.update=pd,l.updateWith=dd,l.values=Ii,l.valuesIn=gd,l.without=mg,l.words=Vc,l.wrap=Np,l.xor=vg,l.xorBy=pf,l.xorWith=df,l.zip=yg,l.zipObject=Ec,l.zipObjectDeep=mt,l.zipWith=_g,l.entries=wf,l.entriesIn=Xs,l.extend=_f,l.extendWith=lt,$u(l,l),l.add=um,l.attempt=Af,l.camelCase=Gg,l.capitalize=Bc,l.ceil=am,l.clamp=md,l.clone=zp,l.cloneDeep=Dp,l.cloneDeepWith=Fp,l.cloneWith=Pp,l.conformsTo=Nc,l.deburr=$c,l.defaultTo=Gc,l.divide=sm,l.endsWith=_d,l.eq=un,l.escape=bd,l.escapeRegExp=jc,l.every=ys,l.find=Ag,l.findIndex=cs,l.findKey=Kp,l.findLast=Sg,l.findLastIndex=qr,l.findLastKey=ed,l.floor=lm,l.forEach=Ti,l.forEachRight=bs,l.forIn=td,l.forInRight=nd,l.forOwn=Is,l.forOwnRight=Mc,l.get=Cs,l.gt=zg,l.gte=Pg,l.has=od,l.hasIn=xs,l.head=go,l.identity=vt,l.includes=Ic,l.indexOf=yc,l.inRange=vd,l.invoke=jg,l.isArguments=Qr,l.isArray=ie,l.isArrayBuffer=Dg,l.isArrayLike=Ct,l.isArrayLikeObject=je,l.isBoolean=Up,l.isBuffer=Wn,l.isDate=vf,l.isElement=Mp,l.isEmpty=Lc,l.isEqual=Wp,l.isEqualWith=Bp,l.isError=Ts,l.isFinite=$p,l.isFunction=tr,l.isInteger=zc,l.isLength=xt,l.isMap=Gs,l.isMatch=jp,l.isMatchWith=Pc,l.isNaN=kp,l.isNative=Vp,l.isNil=qp,l.isNull=Gp,l.isNumber=Du,l.isObject=Fe,l.isObjectLike=Be,l.isPlainObject=wo,l.isRegExp=qs,l.isSafeInteger=Hp,l.isSet=yf,l.isString=Fu,l.isSymbol=Yt,l.isTypedArray=zi,l.isUndefined=Yp,l.isWeakMap=Qp,l.isWeakSet=Jp,l.join=fs,l.kebabCase=qg,l.last=Tt,l.lastIndexOf=lp,l.lowerCase=Hg,l.lowerFirst=Zs,l.lt=Hs,l.lte=Fg,l.max=jd,l.maxBy=kd,l.mean=Vd,l.meanBy=Gd,l.min=qd,l.minBy=Hd,l.stubArray=Ns,l.stubFalse=Ls,l.stubObject=zs,l.stubString=Yc,l.stubTrue=Md,l.multiply=cm,l.nth=_c,l.noConflict=Fd,l.noop=Rs,l.now=na,l.pad=kc,l.padEnd=wd,l.padStart=Ad,l.parseInt=Sd,l.random=yd,l.reduce=Sp,l.reduceRight=Ep,l.repeat=Ed,l.replace=Uu,l.result=sd,l.round=fm,l.runInContext=p,l.sample=xc,l.size=Rc,l.snakeCase=Ks,l.some=yo,l.sortedIndex=wc,l.sortedIndexBy=Ac,l.sortedIndexOf=fp,l.sortedLastIndex=Sc,l.sortedLastIndexBy=hp,l.sortedLastIndexOf=pp,l.startCase=Yg,l.startsWith=Td,l.subtract=hm,l.sum=Yd,l.sumBy=Qd,l.template=Id,l.times=Wd,l.toFinite=nr,l.toInteger=ue,l.toLength=Fc,l.toLower=Cd,l.toNumber=an,l.toSafeInteger=Xp,l.toString=ge,l.toUpper=xd,l.trim=Rd,l.trimEnd=Nd,l.trimStart=Ld,l.truncate=zd,l.unescape=Pd,l.uniqueId=$d,l.upperCase=Qg,l.upperFirst=el,l.each=Ti,l.eachRight=bs,l.first=go,$u(l,function(){var e={};return xn(l,function(t,n){be.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){D.prototype[e]=function(n){n=n===_?1:Oe(ue(n),0);var r=this.__filtered__&&!t?new D(this):this.clone();return r.__filtered__?r.__takeCount__=H(n,r.__takeCount__):r.__views__.push({size:H(n,Tn),type:e+(r.__dir__<0?"Right":"")}),r},D.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==Yf;D.prototype[e]=function(a){var s=this.clone();return s.__iteratees__.push({iteratee:J(a,3),type:n}),s.__filtered__=s.__filtered__||r,s}}),m(["head","last"],function(e,t){var n="take"+(t?"Right":"");D.prototype[e]=function(){return this[n](1).value()[0]}}),m(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");D.prototype[e]=function(){return this.__filtered__?new D(this):this[n](1)}}),D.prototype.compact=function(){return this.filter(vt)},D.prototype.find=function(e){return this.filter(e).head()},D.prototype.findLast=function(e){return this.reverse().find(e)},D.prototype.invokeMap=se(function(e,t){return typeof e=="function"?new D(this):this.map(function(n){return ae(n,e,t)})}),D.prototype.reject=function(e){return this.filter(bo(J(e)))},D.prototype.slice=function(e,t){e=ue(e);var n=this;return n.__filtered__&&(e>0||t<0)?new D(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==_&&(t=ue(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},D.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},D.prototype.toArray=function(){return this.take(Tn)},xn(D.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 D,w=f[0],b=g||ie(c),S=function(B){var j=a.apply(l,F([B],f));return r&&O?j[0]:j};b&&n&&typeof w=="function"&&w.length!=1&&(g=b=!1);var O=this.__chain__,x=!!this.__actions__.length,N=s&&!O,M=g&&!x;if(!s&&b){c=M?c:new D(this);var L=e.apply(c,f);return L.__actions__.push({func:vo,args:[S],thisArg:_}),new P(L,O)}return N&&M?e.apply(this,f):(L=this.thru(S),N?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)})}}),xn(D.prototype,function(e,t){var n=l[t];if(n){var r=n.name+"";be.call(xi,r)||(xi[r]=[]),xi[r].push({name:t,func:n})}}),xi[pu(_,mr).name]=[{name:"wrapper",func:_}],D.prototype.clone=fe,D.prototype.reverse=ve,D.prototype.value=Ua,l.prototype.at=bg,l.prototype.chain=gp,l.prototype.commit=Tc,l.prototype.next=mp,l.prototype.plant=yp,l.prototype.reverse=er,l.prototype.toJSON=l.prototype.valueOf=l.prototype.value=It,l.prototype.first=l.prototype.head,ir&&(l.prototype[ir]=vp),l},mn=xh();Hn?((Hn.exports=mn)._=mn,Pa._=mn):at._=mn}).call(xr)})(xf,xf.exports);var T_=xf.exports,vv={};(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}})(vv);var I_={},ct=vv,C_=I_,km=Array.prototype.push;function x_(i,u){return u==2?function(o,h){return i.apply(void 0,arguments)}:function(o){return i.apply(void 0,arguments)}}function pm(i,u){return u==2?function(o,h){return i(o,h)}:function(o){return i(o)}}function Vm(i){for(var u=i?i.length:0,o=Array(u);u--;)o[u]=i[u];return o}function R_(i){return function(u){return i({},u)}}function N_(i,u){return function(){for(var o=arguments.length,h=o-1,m=Array(o);o--;)m[o]=arguments[o];var A=m[u],E=m.slice(0,u);return A&&km.apply(E,A),u!=h&&km.apply(E,m.slice(u+1)),i.apply(this,E)}}function dm(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 Am(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 E={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},T=m?o:C_,R="curry"in h&&h.curry,z="fixed"in h&&h.fixed,I="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},Z=U.ary,$=U.assign,K=U.clone,te=U.curry,Q=U.forEach,we=U.isArray,me=U.isError,ze=U.isFunction,Ve=U.isWeakMap,Ye=U.keys,Me=U.rearg,hn=U.toInteger,jn=U.toPath,Qe=Ye(ct.aryMethod),Sn={castArray:function(G){return function(){var W=arguments[0];return we(W)?G(Vm(W)):G.apply(void 0,arguments)}},iteratee:function(G){return function(){var W=arguments[0],k=arguments[1],q=G(W,k),re=q.length;return E.cap&&typeof k=="number"?(k=k>2?k-2:1,re&&re<=k?q:pm(q,k)):q}},mixin:function(G){return function(W){var k=this;if(!ze(k))return G(k,Object(W));var q=[];return Q(Ye(W),function(re){ze(W[re])&&q.push([re,k.prototype[re]])}),G(k,Object(W)),Q(q,function(re){var ot=re[1];ze(ot)?k.prototype[re[0]]=ot:delete k.prototype[re[0]]}),k}},nthArg:function(G){return function(W){var k=W<0?1:hn(W)+1;return te(G(W),k)}},rearg:function(G){return function(W,k){var q=k?k.length:0;return te(G(W,k),q)}},runInContext:function(G){return function(W){return Am(i,G(W),h)}}};function En(G,W){if(E.cap){var k=ct.iterateeRearg[G];if(k)return ei(W,k);var q=!m&&ct.iterateeAry[G];if(q)return xo(W,q)}return W}function Kr(G,W,k){return R||E.curry&&k>1?te(W,k):W}function fr(G,W,k){if(E.fixed&&(z||!ct.skipFixed[G])){var q=ct.methodSpread[G],re=q&&q.start;return re===void 0?Z(W,k):N_(W,re)}return W}function Ze(G,W,k){return E.rearg&&k>1&&(I||!ct.skipRearg[G])?Me(W,ct.methodRearg[G]||ct.aryRearg[k]):W}function Wi(G,W){W=jn(W);for(var k=-1,q=W.length,re=q-1,ot=K(Object(G)),wt=ot;wt!=null&&++k<q;){var ut=W[k],Ke=wt[ut];Ke!=null&&!(ze(Ke)||me(Ke)||Ve(Ke))&&(wt[ut]=K(k==re?Ke:Object(Ke))),wt=wt[ut]}return ot}function Ut(G){return Ge.runInContext.convert(G)(void 0)}function Kt(G,W){var k=ct.aliasToReal[G]||G,q=ct.remap[k]||k,re=h;return function(ot){var wt=m?F:U,ut=m?F[q]:W,Ke=$($({},re),ot);return Am(wt,k,ut,Ke)}}function xo(G,W){return Mt(G,function(k){return typeof k=="function"?pm(k,W):k})}function ei(G,W){return Mt(G,function(k){var q=W.length;return x_(Me(pm(k,q),W),q)})}function Mt(G,W){return function(){var k=arguments.length;if(!k)return G();for(var q=Array(k);k--;)q[k]=arguments[k];var re=E.rearg?0:k-1;return q[re]=W(q[re]),G.apply(void 0,q)}}function Ro(G,W,k){var q,re=ct.aliasToReal[G]||G,ot=W,wt=Sn[re];return wt?ot=wt(W):E.immutable&&(ct.mutate.array[re]?ot=dm(W,Vm):ct.mutate.object[re]?ot=dm(W,R_(W)):ct.mutate.set[re]&&(ot=dm(W,Wi))),Q(Qe,function(ut){return Q(ct.aryMethod[ut],function(Ke){if(re==Ke){var Pe=ct.methodSpread[re],hr=Pe&&Pe.afterRearg;return q=hr?fr(re,Ze(re,ot,ut),ut):Ze(re,fr(re,ot,ut),ut),q=En(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=k,q}if(!A)return Ro(u,o,T);var Ge=o,Nr=[];return Q(Qe,function(G){Q(ct.aryMethod[G],function(W){var k=Ge[ct.remap[W]||W];k&&Nr.push([W,Ro(W,k,Ge)])})}),Q(Ye(Ge),function(G){var W=Ge[G];if(typeof W=="function"){for(var k=Nr.length;k--;)if(Nr[k][0]==G)return;W.convert=Kt(G,W),Nr.push([G,W])}}),Q(Nr,function(G){Ge[G[0]]=G[1]}),Ge.convert=Ut,Ge.placeholder=Ge,Q(Ye(Ge),function(G){Q(ct.realToAlias[G]||[],function(W){Ge[W]=Ge[G]})}),Ge}var L_=Am,Gm=T_.runInContext(),nl=L_(Gm,Gm),xe;(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"})(xe||(xe={}));const Uf=Symbol.for("@nexus/wrapped");function bt(i,u){i.prototype[Uf]=u}class z_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(z_,xe.Interface);class P_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(P_,xe.Object);class D_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(D_,xe.Union);function F_(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 Rf=Symbol.for("@nexus/meta/NEXUS_TYPE"),U_=Symbol.for("@nexus/meta/NEXUS_BUILD");function M_(i){return!!(i&&typeof al.get(i,U_)=="function")}function W_(i){return B_(i)||yv(i)}function B_(i){return!!(i&&al.has(i,Rf)&&la(al.get(i,Rf)))}function yv(i){return!!(i&&al.has(i,Rf)&&typeof al.get(i,Rf)=="function")}function Cm(i){return M_(i)||W_(i)||yv(i)}class $_{constructor(u){this.config=u}}bt($_,xe.PrintedGenTypingImport);class j_{constructor(u){this.config=u}get imports(){return this.config.imports||[]}toString(){let u="";this.config.description&&(u=`/**
116
+ }`;var M=Af(function(){return Tr(f,x+"return "+S).apply(_,g)});if(M.source=S,Ts(M))throw M;return M}function Cd(e){return ge(e).toLowerCase()}function xd(e){return ge(e).toUpperCase()}function Rd(e,t,n){if(e=ge(e),e&&(n||t===_))return fr(e);if(!e||!(t=Et(t)))return e;var r=Pe(e),a=Pe(t);return wr(r,Kt(r,a),xo(r,a)+1).join("")}function Nd(e,t,n){if(e=ge(e),e&&(n||t===_))return e.slice(0,hr(e)+1);if(!e||!(t=Et(t)))return e;var r=Pe(e);return wr(r,0,xo(r,Pe(t))+1).join("")}function Ld(e,t,n){if(e=ge(e),e&&(n||t===_))return e.replace(ya,"");if(!e||!(t=Et(t)))return e;var r=Pe(e);return wr(r,Kt(r,Pe(t))).join("")}function zd(e,t){var n=kf,r=Vf;if(Fe(t)){var a="separator"in t?t.separator:a;n="length"in t?ue(t.length):n,r="omission"in t?Et(t.omission):r}e=ge(e);var s=e.length;if(Ge(e)){var c=Pe(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,ge(bl.exec(a))+"g")),a.lastIndex=0;w=a.exec(b);)var S=w.index;g=g.slice(0,S===_?f:S)}}else if(e.indexOf(Et(a),f)!=f){var O=g.lastIndexOf(a);O>-1&&(g=g.slice(0,O))}return g+r}function Pd(e){return e=ge(e),e&&ga.test(e)?e.replace(dl,Ch):e}function Vc(e,t,n){return e=ge(e),t=n?_:t,t===_?Nr(e)?ll(e):te(e):e.match(t)||[]}function Mu(e){var t=e==null?0:e.length,n=J();return e=t?I(e,function(r){if(typeof r[1]!="function")throw new sn(At);return[n(r[0]),r[1]]}):[],se(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 Dd(e){return Fh(qt(e,Bt))}function Wu(e){return function(){return e}}function Gc(e,t){return e==null||e!==e?t:e}function vt(e){return e}function Bu(e){return Jl(typeof e=="function"?e:qt(e,Bt))}function qc(e){return Xl(qt(e,Bt))}function Hc(e,t){return Zl(e,qt(t,Bt))}function $u(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 Fd(){return at._===this&&(at._=qu),this}function Rs(){}function Ud(e){return e=ue(e),se(function(t){return Kl(t,e)})}function So(e){return wu(e)?Me(Fn(e)):yn(e)}function ju(e){return function(t){return e==null?_:$r(e,t)}}function Ns(){return[]}function Ls(){return!1}function zs(){return{}}function Yc(){return""}function Md(){return!0}function Wd(e,t){if(e=ue(e),e<1||e>On)return[];var n=Tn,r=H(e,Tn);t=J(t),e-=Tn;for(var a=En(r,t);++n<e;)t(n);return a}function Bd(e){return ie(e)?I(e,Fn):Yt(e)?[e]:dt(cf(ge(e)))}function $d(e){var t=++Ds;return ge(e)+t}function jd(e){return e&&e.length?_r(e,vt,jr):_}function kd(e,t){return e&&e.length?_r(e,J(t,2),jr):_}function Vd(e){return Ye(e,vt)}function Gd(e,t){return Ye(e,J(t,2))}function qd(e){return e&&e.length?_r(e,vt,ja):_}function Hd(e,t){return e&&e.length?_r(e,J(t,2),ja):_}function Yd(e){return e&&e.length?Sn(e,vt):0}function Qd(e,t){return e&&e.length?Sn(e,J(t,2)):0}y=y==null?at:mn.defaults(at.Object(),y,mn.pick(at,Nl));var _e=y.Array,ku=y.Date,Ps=y.Error,Tr=y.Function,ee=y.Math,Ne=y.Object,yt=y.RegExp,ke=y.String,sn=y.TypeError,wn=_e.prototype,Jd=Tr.prototype,Ci=Ne.prototype,Vu=y["__core-js_shared__"],Gu=Jd.toString,be=Ci.hasOwnProperty,Ds=0,Qc=function(){var e=/[^.]+$/.exec(Vu&&Vu.keys&&Vu.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ln=Ci.toString,Jc=Gu.call(Ne),qu=at._,Ue=yt("^"+Gu.call(be).replace(ko,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=Da?y.Buffer:_,rr=y.Symbol,Hu=y.Uint8Array,Xc=Le?Le.allocUnsafe:_,Yu=k(Ne.getPrototypeOf,Ne),Zc=Ne.create,Kc=Ci.propertyIsEnumerable,Qu=wn.splice,Fs=rr?rr.isConcatSpreadable:_,ir=rr?rr.iterator:_,or=rr?rr.toStringTag:_,Ju=function(){try{var e=Ar(Ne,"defineProperty");return e({},"",{}),e}catch{}}(),ef=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=Ne.getOwnPropertySymbols,Xd=Le?Le.isBuffer:_,tf=y.isFinite,Zd=wn.join,nf=k(Ne.keys,Ne),Oe=ee.max,H=ee.min,rf=ku.now,cn=y.parseInt,Ms=ee.random,Kd=wn.reverse,he=Ar(y,"DataView"),Eo=Ar(y,"Map"),Ku=Ar(y,"Promise"),ar=Ar(y,"Set"),Oo=Ar(y,"WeakMap"),To=Ar(Ne,"create"),ea=Oo&&new Oo,xi={},eg=Or(he),tg=Or(Eo),ng=Or(Ku),rg=Or(ar),ig=Or(Oo),ta=rr?rr.prototype:_,Io=ta?ta.valueOf:_,of=ta?ta.toString:_,Ri=function(){function e(){}return function(t){if(!Fe(t))return{};if(Zc)return Zc(t);e.prototype=t;var n=new e;return e.prototype=_,n}}();l.templateSettings={escape:li,evaluate:gl,interpolate:va,variable:"",imports:{_:l}},l.prototype=C.prototype,l.prototype.constructor=l,P.prototype=Ri(C.prototype),P.prototype.constructor=P,D.prototype=Ri(C.prototype),D.prototype.constructor=D,Ur.prototype.clear=tn,Ur.prototype.delete=Jo,Ur.prototype.get=Rh,Ur.prototype.has=hi,Ur.prototype.set=Xo,nn.prototype.clear=ye,nn.prototype.delete=Nh,nn.prototype.get=Ml,nn.prototype.has=Zo,nn.prototype.set=Lh,Yn.prototype.clear=zh,Yn.prototype.delete=Ko,Yn.prototype.get=yr,Yn.prototype.has=eu,Yn.prototype.set=Wl,Cn.prototype.add=Cn.prototype.push=Bl,Cn.prototype.has=$l,zt.prototype.clear=jl,zt.prototype.delete=eo,zt.prototype.get=Mr,zt.prototype.has=tu,zt.prototype.set=Ph;var Mn=_i(xn),uf=_i(Wa,!0),Co=Za(),af=Za(!0),sf=ea?function(e,t){return ea.set(e,t),e}:vt,og=Ju?function(e,t){return Ju(e,"toString",{configurable:!0,enumerable:!1,value:Wu(t),writable:!0})}:vt,rt=se,Rt=ef||function(e){return at.clearTimeout(e)},ug=ar&&1/re(new ar([,-0]))[1]==Pr?function(e){return new ar(e)}:Rs,Ws=ea?function(e){return ea.get(e)}:Rs,Bs=Us?function(e){return e==null?[]:(e=Ne(e),T(Us(e),function(t){return Kc.call(e,t)}))}:Ns,$s=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||Eo&&_t(new Eo)!=dn||Ku&&_t(Ku.resolve())!=Gi||ar&&_t(new ar)!=gn||Oo&&_t(new Oo)!=Yi)&&(_t=function(e){var t=tt(e),n=t==qn?e.constructor:_,r=n?Or(n):"";if(r)switch(r){case eg:return ai;case tg:return dn;case ng:return Gi;case rg:return gn;case ig:return Yi}return t});var ag=Vu?tr:Ls,lf=ls(sf),Ni=Qt||function(e,t){return at.setTimeout(e,t)},js=ls(og),cf=Sr(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(vl,function(n,r,a,s){t.push(a?s.replace(lh,"$1"):r||n)}),t}),sg=se(function(e,t){return je(e)?Br(e,We(t,1,je,!0)):[]}),ff=se(function(e,t){var n=Tt(t);return je(n)&&(n=_),je(e)?Br(e,We(t,1,je,!0),J(n,2)):[]}),hf=se(function(e,t){var n=Tt(t);return je(n)&&(n=_),je(e)?Br(e,We(t,1,je,!0),_,n):[]}),lg=se(function(e){var t=I(e,cu);return t.length&&t[0]===e[0]?mi(t):[]}),cg=se(function(e){var t=Tt(e),n=I(e,cu);return t===Tt(n)?t=_:n.pop(),n.length&&n[0]===e[0]?mi(n,J(t,2)):[]}),fg=se(function(e){var t=Tt(e),n=I(e,cu);return t=typeof t=="function"?t:_,t&&n.pop(),n.length&&n[0]===e[0]?mi(n,_,t):[]}),hg=se(mo),Li=Dn(function(e,t){var n=e==null?0:e.length,r=Ma(e,t);return tc(e,I(t,function(a){return gt(a,n)?+a:a}).sort(so)),r}),pg=se(function(e){return Pt(We(e,1,je,!0))}),dg=se(function(e){var t=Tt(e);return je(t)&&(t=_),Pt(We(e,1,je,!0),J(t,2))}),gg=se(function(e){var t=Tt(e);return t=typeof t=="function"?t:_,Pt(We(e,1,je,!0),_,t)}),mg=se(function(e,t){return je(e)?Br(e,t):[]}),vg=se(function(e){return kr(T(e,je))}),pf=se(function(e){var t=Tt(e);return je(t)&&(t=_),kr(T(e,je),J(t,2))}),df=se(function(e){var t=Tt(e);return t=typeof t=="function"?t:_,kr(T(e,je),_,t)}),yg=se(vs),_g=se(function(e){var t=e.length,n=t>1?e[t-1]:_;return n=typeof n=="function"?(e.pop(),n):_,Lu(e,n)}),bg=Dn(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 D&&gt(n)?(r=r.slice(n,+n+(t?1:0)),r.__actions__.push({func:vo,args:[a],thisArg:_}),new P(r,this.__chain__).thru(function(s){return t&&!s.length&&s.push(_),s})):this.thru(a)}),wg=vi(function(e,t,n){be.call(e,n)?++e[n]:De(e,n,1)}),Ag=hu(cs),Sg=hu(qr),Eg=vi(function(e,t,n){be.call(e,n)?e[n].push(t):De(e,n,[t])}),Og=se(function(e,t,n){var r=-1,a=typeof t=="function",s=Ct(e)?_e(e.length):[];return Mn(e,function(c){s[++r]=a?o(t,c,n):ae(c,t,n)}),s}),Tg=vi(function(e,t,n){De(e,n,t)}),Ig=vi(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Cg=se(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=se(function(e,t,n){var r=$t;if(n.length){var a=q(n,ne(ks));r|=Vn}return Xn(e,r,t,n,a)}),gf=se(function(e,t,n){var r=$t|mr;if(n.length){var a=q(n,ne(gf));r|=Vn}return Xn(t,r,e,n,a)}),xg=se(function(e,t){return pi(e,1,t)}),Rg=se(function(e,t,n){return pi(e,an(t)||0,n)});Pu.Cache=Yn;var Ng=rt(function(e,t){t=t.length==1&&ie(t[0])?I(t[0],Ze(J())):I(We(t,1),Ze(J()));var n=t.length;return se(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=se(function(e,t){return Xn(e,Vn,_,t,q(t,ne(Vs)))}),mf=se(function(e,t){return Xn(e,ji,_,t,q(t,ne(mf)))}),Lg=Dn(function(e,t){return Xn(e,ni,_,_,_,t)}),zg=co(jr),Pg=co(function(e,t){return e>=t}),Qr=Yl(function(){return arguments}())?Yl:function(e){return Be(e)&&be.call(e,"callee")&&!Kc.call(e,"callee")},ie=_e.isArray,Dg=Dl?Ze(Dl):Uh,Wn=Xd||Ls,vf=Fl?Ze(Fl):Mh,Gs=Ul?Ze(Ul):Bh,qs=Fr?Ze(Fr):$h,yf=en?Ze(en):Qn,zi=Fa?Ze(Fa):jh,Hs=co(ja),Fg=co(function(e,t){return e<=t}),Ug=yi(function(e,t){if(Ai(t)||Ct(t))return zn(t,nt(t),e),_;for(var n in t)be.call(t,n)&&no(e,n,t[n])}),_f=yi(function(e,t){zn(t,Ft(t),e)}),lt=yi(function(e,t,n,r){zn(t,Ft(t),e,r)}),Ys=yi(function(e,t,n,r){zn(t,nt(t),e,r)}),Mg=Dn(Ma),Wg=se(function(e,t){e=Ne(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,Ci[w])&&!be.call(e,w))&&(e[w]=s[w])}return e}),Bg=se(function(e){return e.push(_,ns),o(bf,_,e)}),$g=ac(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=ln.call(t)),e[t]=n},Wu(vt)),Qs=ac(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=ln.call(t)),be.call(e,t)?e[t].push(n):e[t]=[n]},J),jg=se(ae),Js=yi(function(e,t,n){uu(e,t,n)}),bf=yi(function(e,t,n,r){uu(e,t,n,r)}),kg=Dn(function(e,t){var n={};if(e==null)return n;var r=!1;t=I(t,function(s){return s=_n(s,e),r||(r=s.length>1),s}),zn(e,os(e),n),r&&(n=qt(n,Bt|No|dr,Kh));for(var a=t.length;a--;)Dt(n,t[a]);return n}),Vg=Dn(function(e,t){return e==null?{}:Gh(e,t)}),wf=fo(nt),Xs=fo(Ft),Gg=Pn(function(e,t,n){return t=t.toLowerCase(),e+(n?Bc(t):t)}),qg=Pn(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Hg=Pn(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Zs=uc("toLowerCase"),Ks=Pn(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Yg=Pn(function(e,t,n){return e+(n?" ":"")+el(t)}),Qg=Pn(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),el=uc("toUpperCase"),Af=se(function(e,t){try{return o(e,_,t)}catch(n){return Ts(n)?n:new Ps(n)}}),Jg=Dn(function(e,t){return m(t,function(n){n=Fn(n),De(e,n,ks(e[n],e))}),e}),Xg=Ka(),Zg=Ka(!0),Kg=se(function(e,t){return function(n){return ae(n,e,t)}}),em=se(function(e,t){return function(n){return ae(e,n,t)}}),tm=gu(I),nm=gu(E),rm=gu($),im=mu(),om=mu(!0),um=du(function(e,t){return e+t},0),am=vu("ceil"),sm=du(function(e,t){return e/t},1),lm=vu("floor"),cm=du(function(e,t){return e*t},1),fm=vu("round"),hm=du(function(e,t){return e-t},0);return l.after=As,l.ary=Ss,l.assign=Ug,l.assignIn=_f,l.assignInWith=lt,l.assignWith=Ys,l.at=Mg,l.before=Es,l.bind=ks,l.bindAll=Jg,l.bindKey=gf,l.castArray=Lp,l.chain=Oc,l.chunk=Un,l.compact=op,l.concat=up,l.cond=Mu,l.conforms=Dd,l.constant=Wu,l.countBy=wg,l.create=Zp,l.curry=_o,l.curryRight=Os,l.debounce=bn,l.defaults=Wg,l.defaultsDeep=Bg,l.defer=xg,l.delay=Rg,l.difference=sg,l.differenceBy=ff,l.differenceWith=hf,l.drop=Iu,l.dropRight=Si,l.dropRightWhile=dc,l.dropWhile=gc,l.fill=ap,l.filter=_p,l.flatMap=_s,l.flatMapDeep=bp,l.flatMapDepth=wp,l.flatten=Ei,l.flattenDeep=sp,l.flattenDepth=mc,l.flip=Yr,l.flow=Xg,l.flowRight=Zg,l.fromPairs=vc,l.functions=rd,l.functionsIn=id,l.groupBy=Eg,l.initial=Cu,l.intersection=lg,l.intersectionBy=cg,l.intersectionWith=fg,l.invert=$g,l.invertBy=Qs,l.invokeMap=Og,l.iteratee=Bu,l.keyBy=Tg,l.keys=nt,l.keysIn=Ft,l.map=zu,l.mapKeys=ud,l.mapValues=Wc,l.matches=qc,l.matchesProperty=Hc,l.memoize=Pu,l.merge=Js,l.mergeWith=bf,l.method=Kg,l.methodOf=em,l.mixin=$u,l.negate=bo,l.nthArg=Ud,l.omit=kg,l.omitBy=ad,l.once=Tp,l.orderBy=Ap,l.over=tm,l.overArgs=Ng,l.overEvery=nm,l.overSome=rm,l.partial=Vs,l.partialRight=mf,l.partition=Ig,l.pick=Vg,l.pickBy=Ao,l.property=So,l.propertyOf=ju,l.pull=hg,l.pullAll=mo,l.pullAllBy=bc,l.pullAllWith=hs,l.pullAt=Li,l.range=im,l.rangeRight=om,l.rearg=Lg,l.reject=Cc,l.remove=cp,l.rest=Ip,l.reverse=xu,l.sampleSize=Op,l.set=ld,l.setWith=cd,l.shuffle=ws,l.slice=Zn,l.sortBy=Cg,l.sortedUniq=Kn,l.sortedUniqBy=ps,l.split=Od,l.spread=Cp,l.tail=ds,l.take=gs,l.takeRight=Ru,l.takeRightWhile=Oi,l.takeWhile=X,l.tap=dp,l.throttle=xp,l.thru=vo,l.toArray=Dc,l.toPairs=wf,l.toPairsIn=Xs,l.toPath=Bd,l.toPlainObject=Uc,l.transform=fd,l.unary=Rp,l.union=pg,l.unionBy=dg,l.unionWith=gg,l.uniq=Nu,l.uniqBy=ms,l.uniqWith=Hr,l.unset=hd,l.unzip=vs,l.unzipWith=Lu,l.update=pd,l.updateWith=dd,l.values=Ii,l.valuesIn=gd,l.without=mg,l.words=Vc,l.wrap=Np,l.xor=vg,l.xorBy=pf,l.xorWith=df,l.zip=yg,l.zipObject=Ec,l.zipObjectDeep=mt,l.zipWith=_g,l.entries=wf,l.entriesIn=Xs,l.extend=_f,l.extendWith=lt,$u(l,l),l.add=um,l.attempt=Af,l.camelCase=Gg,l.capitalize=Bc,l.ceil=am,l.clamp=md,l.clone=zp,l.cloneDeep=Dp,l.cloneDeepWith=Fp,l.cloneWith=Pp,l.conformsTo=Nc,l.deburr=$c,l.defaultTo=Gc,l.divide=sm,l.endsWith=_d,l.eq=un,l.escape=bd,l.escapeRegExp=jc,l.every=ys,l.find=Ag,l.findIndex=cs,l.findKey=Kp,l.findLast=Sg,l.findLastIndex=qr,l.findLastKey=ed,l.floor=lm,l.forEach=Ti,l.forEachRight=bs,l.forIn=td,l.forInRight=nd,l.forOwn=Is,l.forOwnRight=Mc,l.get=Cs,l.gt=zg,l.gte=Pg,l.has=od,l.hasIn=xs,l.head=go,l.identity=vt,l.includes=Ic,l.indexOf=yc,l.inRange=vd,l.invoke=jg,l.isArguments=Qr,l.isArray=ie,l.isArrayBuffer=Dg,l.isArrayLike=Ct,l.isArrayLikeObject=je,l.isBoolean=Up,l.isBuffer=Wn,l.isDate=vf,l.isElement=Mp,l.isEmpty=Lc,l.isEqual=Wp,l.isEqualWith=Bp,l.isError=Ts,l.isFinite=$p,l.isFunction=tr,l.isInteger=zc,l.isLength=xt,l.isMap=Gs,l.isMatch=jp,l.isMatchWith=Pc,l.isNaN=kp,l.isNative=Vp,l.isNil=qp,l.isNull=Gp,l.isNumber=Du,l.isObject=Fe,l.isObjectLike=Be,l.isPlainObject=wo,l.isRegExp=qs,l.isSafeInteger=Hp,l.isSet=yf,l.isString=Fu,l.isSymbol=Yt,l.isTypedArray=zi,l.isUndefined=Yp,l.isWeakMap=Qp,l.isWeakSet=Jp,l.join=fs,l.kebabCase=qg,l.last=Tt,l.lastIndexOf=lp,l.lowerCase=Hg,l.lowerFirst=Zs,l.lt=Hs,l.lte=Fg,l.max=jd,l.maxBy=kd,l.mean=Vd,l.meanBy=Gd,l.min=qd,l.minBy=Hd,l.stubArray=Ns,l.stubFalse=Ls,l.stubObject=zs,l.stubString=Yc,l.stubTrue=Md,l.multiply=cm,l.nth=_c,l.noConflict=Fd,l.noop=Rs,l.now=na,l.pad=kc,l.padEnd=wd,l.padStart=Ad,l.parseInt=Sd,l.random=yd,l.reduce=Sp,l.reduceRight=Ep,l.repeat=Ed,l.replace=Uu,l.result=sd,l.round=fm,l.runInContext=p,l.sample=xc,l.size=Rc,l.snakeCase=Ks,l.some=yo,l.sortedIndex=wc,l.sortedIndexBy=Ac,l.sortedIndexOf=fp,l.sortedLastIndex=Sc,l.sortedLastIndexBy=hp,l.sortedLastIndexOf=pp,l.startCase=Yg,l.startsWith=Td,l.subtract=hm,l.sum=Yd,l.sumBy=Qd,l.template=Id,l.times=Wd,l.toFinite=nr,l.toInteger=ue,l.toLength=Fc,l.toLower=Cd,l.toNumber=an,l.toSafeInteger=Xp,l.toString=ge,l.toUpper=xd,l.trim=Rd,l.trimEnd=Nd,l.trimStart=Ld,l.truncate=zd,l.unescape=Pd,l.uniqueId=$d,l.upperCase=Qg,l.upperFirst=el,l.each=Ti,l.eachRight=bs,l.first=go,$u(l,function(){var e={};return xn(l,function(t,n){be.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){D.prototype[e]=function(n){n=n===_?1:Oe(ue(n),0);var r=this.__filtered__&&!t?new D(this):this.clone();return r.__filtered__?r.__takeCount__=H(n,r.__takeCount__):r.__views__.push({size:H(n,Tn),type:e+(r.__dir__<0?"Right":"")}),r},D.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==Yf;D.prototype[e]=function(a){var s=this.clone();return s.__iteratees__.push({iteratee:J(a,3),type:n}),s.__filtered__=s.__filtered__||r,s}}),m(["head","last"],function(e,t){var n="take"+(t?"Right":"");D.prototype[e]=function(){return this[n](1).value()[0]}}),m(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");D.prototype[e]=function(){return this.__filtered__?new D(this):this[n](1)}}),D.prototype.compact=function(){return this.filter(vt)},D.prototype.find=function(e){return this.filter(e).head()},D.prototype.findLast=function(e){return this.reverse().find(e)},D.prototype.invokeMap=se(function(e,t){return typeof e=="function"?new D(this):this.map(function(n){return ae(n,e,t)})}),D.prototype.reject=function(e){return this.filter(bo(J(e)))},D.prototype.slice=function(e,t){e=ue(e);var n=this;return n.__filtered__&&(e>0||t<0)?new D(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==_&&(t=ue(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},D.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},D.prototype.toArray=function(){return this.take(Tn)},xn(D.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 D,w=f[0],b=g||ie(c),S=function(B){var j=a.apply(l,F([B],f));return r&&O?j[0]:j};b&&n&&typeof w=="function"&&w.length!=1&&(g=b=!1);var O=this.__chain__,x=!!this.__actions__.length,N=s&&!O,M=g&&!x;if(!s&&b){c=M?c:new D(this);var L=e.apply(c,f);return L.__actions__.push({func:vo,args:[S],thisArg:_}),new P(L,O)}return N&&M?e.apply(this,f):(L=this.thru(S),N?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)})}}),xn(D.prototype,function(e,t){var n=l[t];if(n){var r=n.name+"";be.call(xi,r)||(xi[r]=[]),xi[r].push({name:t,func:n})}}),xi[pu(_,mr).name]=[{name:"wrapper",func:_}],D.prototype.clone=fe,D.prototype.reverse=ve,D.prototype.value=Ua,l.prototype.at=bg,l.prototype.chain=gp,l.prototype.commit=Tc,l.prototype.next=mp,l.prototype.plant=yp,l.prototype.reverse=er,l.prototype.toJSON=l.prototype.valueOf=l.prototype.value=It,l.prototype.first=l.prototype.head,ir&&(l.prototype[ir]=vp),l},mn=xh();Hn?((Hn.exports=mn)._=mn,Pa._=mn):at._=mn}).call(xr)})(xf,xf.exports);var I_=xf.exports,vv={};(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}})(vv);var C_={},ct=vv,x_=C_,km=Array.prototype.push;function R_(i,u){return u==2?function(o,h){return i.apply(void 0,arguments)}:function(o){return i.apply(void 0,arguments)}}function pm(i,u){return u==2?function(o,h){return i(o,h)}:function(o){return i(o)}}function Vm(i){for(var u=i?i.length:0,o=Array(u);u--;)o[u]=i[u];return o}function N_(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],E=m.slice(0,u);return A&&km.apply(E,A),u!=h&&km.apply(E,m.slice(u+1)),i.apply(this,E)}}function dm(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 Am(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 E={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},T=m?o:x_,R="curry"in h&&h.curry,z="fixed"in h&&h.fixed,I="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},Z=U.ary,$=U.assign,K=U.clone,te=U.curry,Q=U.forEach,we=U.isArray,me=U.isError,ze=U.isFunction,Ve=U.isWeakMap,Ye=U.keys,Me=U.rearg,hn=U.toInteger,jn=U.toPath,Qe=Ye(ct.aryMethod),Sn={castArray:function(G){return function(){var W=arguments[0];return we(W)?G(Vm(W)):G.apply(void 0,arguments)}},iteratee:function(G){return function(){var W=arguments[0],k=arguments[1],q=G(W,k),re=q.length;return E.cap&&typeof k=="number"?(k=k>2?k-2:1,re&&re<=k?q:pm(q,k)):q}},mixin:function(G){return function(W){var k=this;if(!ze(k))return G(k,Object(W));var q=[];return Q(Ye(W),function(re){ze(W[re])&&q.push([re,k.prototype[re]])}),G(k,Object(W)),Q(q,function(re){var ot=re[1];ze(ot)?k.prototype[re[0]]=ot:delete k.prototype[re[0]]}),k}},nthArg:function(G){return function(W){var k=W<0?1:hn(W)+1;return te(G(W),k)}},rearg:function(G){return function(W,k){var q=k?k.length:0;return te(G(W,k),q)}},runInContext:function(G){return function(W){return Am(i,G(W),h)}}};function En(G,W){if(E.cap){var k=ct.iterateeRearg[G];if(k)return ei(W,k);var q=!m&&ct.iterateeAry[G];if(q)return xo(W,q)}return W}function Kr(G,W,k){return R||E.curry&&k>1?te(W,k):W}function fr(G,W,k){if(E.fixed&&(z||!ct.skipFixed[G])){var q=ct.methodSpread[G],re=q&&q.start;return re===void 0?Z(W,k):L_(W,re)}return W}function Ze(G,W,k){return E.rearg&&k>1&&(I||!ct.skipRearg[G])?Me(W,ct.methodRearg[G]||ct.aryRearg[k]):W}function Wi(G,W){W=jn(W);for(var k=-1,q=W.length,re=q-1,ot=K(Object(G)),wt=ot;wt!=null&&++k<q;){var ut=W[k],Ke=wt[ut];Ke!=null&&!(ze(Ke)||me(Ke)||Ve(Ke))&&(wt[ut]=K(k==re?Ke:Object(Ke))),wt=wt[ut]}return ot}function Ut(G){return Ge.runInContext.convert(G)(void 0)}function Kt(G,W){var k=ct.aliasToReal[G]||G,q=ct.remap[k]||k,re=h;return function(ot){var wt=m?F:U,ut=m?F[q]:W,Ke=$($({},re),ot);return Am(wt,k,ut,Ke)}}function xo(G,W){return Mt(G,function(k){return typeof k=="function"?pm(k,W):k})}function ei(G,W){return Mt(G,function(k){var q=W.length;return R_(Me(pm(k,q),W),q)})}function Mt(G,W){return function(){var k=arguments.length;if(!k)return G();for(var q=Array(k);k--;)q[k]=arguments[k];var re=E.rearg?0:k-1;return q[re]=W(q[re]),G.apply(void 0,q)}}function Ro(G,W,k){var q,re=ct.aliasToReal[G]||G,ot=W,wt=Sn[re];return wt?ot=wt(W):E.immutable&&(ct.mutate.array[re]?ot=dm(W,Vm):ct.mutate.object[re]?ot=dm(W,N_(W)):ct.mutate.set[re]&&(ot=dm(W,Wi))),Q(Qe,function(ut){return Q(ct.aryMethod[ut],function(Ke){if(re==Ke){var Pe=ct.methodSpread[re],hr=Pe&&Pe.afterRearg;return q=hr?fr(re,Ze(re,ot,ut),ut):Ze(re,fr(re,ot,ut),ut),q=En(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=k,q}if(!A)return Ro(u,o,T);var Ge=o,Nr=[];return Q(Qe,function(G){Q(ct.aryMethod[G],function(W){var k=Ge[ct.remap[W]||W];k&&Nr.push([W,Ro(W,k,Ge)])})}),Q(Ye(Ge),function(G){var W=Ge[G];if(typeof W=="function"){for(var k=Nr.length;k--;)if(Nr[k][0]==G)return;W.convert=Kt(G,W),Nr.push([G,W])}}),Q(Nr,function(G){Ge[G[0]]=G[1]}),Ge.convert=Ut,Ge.placeholder=Ge,Q(Ye(Ge),function(G){Q(ct.realToAlias[G]||[],function(W){Ge[W]=Ge[G]})}),Ge}var z_=Am,Gm=I_.runInContext(),nl=z_(Gm,Gm),xe;(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"})(xe||(xe={}));const Uf=Symbol.for("@nexus/wrapped");function bt(i,u){i.prototype[Uf]=u}class P_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(P_,xe.Interface);class D_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(D_,xe.Object);class F_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(F_,xe.Union);function U_(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 Rf=Symbol.for("@nexus/meta/NEXUS_TYPE"),M_=Symbol.for("@nexus/meta/NEXUS_BUILD");function W_(i){return!!(i&&typeof al.get(i,M_)=="function")}function B_(i){return $_(i)||yv(i)}function $_(i){return!!(i&&al.has(i,Rf)&&la(al.get(i,Rf)))}function yv(i){return!!(i&&al.has(i,Rf)&&typeof al.get(i,Rf)=="function")}function Cm(i){return W_(i)||B_(i)||yv(i)}class j_{constructor(u){this.config=u}}bt(j_,xe.PrintedGenTypingImport);class k_{constructor(u){this.config=u}get imports(){return this.config.imports||[]}toString(){let u="";this.config.description&&(u=`/**
117
117
  ${this.config.description.split(`
118
118
  `).map(m=>m.trim()).filter(m=>m).map(m=>` * ${m}`).join(`
119
119
  `)}
120
120
  */
121
- `);const o=`${this.config.name}${this.config.optional?"?":""}`;return u+=`${o}: ${this.config.type}`,u}}bt(j_,xe.PrintedGenTyping);F_(new ev({name:"NEXUS__UNKNOWN__TYPE",description:`
121
+ `);const o=`${this.config.name}${this.config.optional?"?":""}`;return u+=`${o}: ${this.config.type}`,u}}bt(k_,xe.PrintedGenTyping);U_(new ev({name:"NEXUS__UNKNOWN__TYPE",description:`
122
122
  This scalar should never make it into production. It is used as a placeholder for situations
123
123
  where GraphQL Nexus encounters a missing type. We don't want to error immediately, otherwise
124
124
  the TypeScript definitions will not be updated.
125
- `,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 al={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 _v{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(_v,xe.Arg);function Mf(i){if(!i.type)throw new Error('You must provide a "type" for the arg()');return new _v(typeof i.type=="string"?i.type:i.type.name,i)}function bv(i){return Mf(Object.assign({type:"String"},i))}function Wf(i){return Mf(Object.assign({type:"Int"},i))}class k_{constructor(u){if(this.ofNexusType=u,this._isNexusListDef=!0,typeof u!="string"&&!la(u)&&!Cm(u)&&!sl(u))throw new Error("Cannot wrap unknown types in list(). Saw "+u)}}bt(k_,xe.List);class Sm{constructor(u){if(this.ofNexusType=u,this._isNexusNonNullDef=!0,typeof u!="string"&&!la(u)&&!Cm(u)&&!sl(u))throw new Error("Cannot wrap unknown types in a nonNull(). Saw "+u)}}bt(Sm,xe.NonNull);function wv(i){return Av(i)||Tm(i)?i:Sv(i)?new Sm(i.ofNexusType):new Sm(i)}class Em{constructor(u){if(this.ofNexusType=u,this._isNexusNullDef=!0,typeof u!="string"&&!la(u)&&!Cm(u)&&!sl(u))throw new Error("Cannot wrap unknown types in nullable(). Saw "+u)}}bt(Em,xe.Null);function Nf(i){return Av(i)?new Em(i.ofNexusType):Sv(i)?i:new Em(i)}xe.Enum,xe.Object,xe.Scalar,xe.Union,xe.Interface,xe.InputObject;function la(i){return i&&!!i[Uf]}function Av(i){return la(i)&&i[Uf]===xe.NonNull}function Sv(i){return la(i)&&i[Uf]===xe.Null}class V_{constructor(u){this.config=u}}bt(V_,xe.Plugin);class G_{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(G_,xe.DynamicInput);class q_{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(q_,xe.DynamicOutputMethod);const H_={first:Nf(Wf({description:"Returns the first n elements from the list."})),after:Nf(bv({description:"Returns the elements in the list that come after the specified cursor"}))};Object.assign(Object.assign({},H_),{first:wv(Wf({description:"Returns the first n elements from the list."}))});const Y_={last:Nf(Wf({description:"Returns the last n elements from the list."})),before:Nf(bv({description:"Returns the elements in the list that come before the specified cursor"}))};Object.assign(Object.assign({},Y_),{last:wv(Wf({description:"Returns the last n elements from the list."}))});var Lf=typeof Symbol=="function"?Symbol:void 0;Lf&&Lf.iterator;Lf&&Lf.asyncIterator;class Q_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}asArg(u){return Mf(Object.assign(Object.assign({},u),{type:this}))}}bt(Q_,xe.Enum);class Ev{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}asArg(u){return Mf(Object.assign(Object.assign({},u),{type:this}))}}bt(Ev,xe.InputObject);function J_(i){return new Ev(i.name,i)}class X_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(X_,xe.Scalar);class Z_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(Z_,xe.ExtendInputObject);class K_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(K_,xe.ExtendObject);class e1{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(e1,xe.DynamicOutputProperty);const qm=["id"],t1=(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)})},n1=(i,u,o)=>{const h=strapi.plugin("graphql").service("utils"),m=strapi.plugin("graphql").service("extension"),{getFiltersInputTypeName:A}=h.naming,{isMorphRelation:E}=h.attributes,T=strapi.getModel(o.target);!T||E(o)||m.shadowCRUD(T.uid).isDisabled()||i.field(u,{type:A(T)})},r1=({strapi:i})=>{const{service:u}=i.plugin("graphql"),o=A=>{const{operators:E}=u("builders").filters;if(Array.isArray(A))return A.map(o);if(nl.isDate(A)||!nl.isObject(A))return A;const T={};for(const[R,z]of Object.entries(A)){const F=!!E[R]?E[R].strapiOperator:R;T[F]=o(z)}return T},h=()=>{const{operators:A}=i.plugin("graphql").service("builders").filters;return[A.and,A.or,A.not]},m=(A,E={})=>{const{isStrapiScalar:T,isMedia:R,isRelation:z}=u("utils").attributes,{operators:I}=u("builders").filters,F=[I.and,I.or,I.not];if(nl.isNil(A))return{};if(Array.isArray(A))return A.reduce((K,te)=>(K.push(m(te,E)),K),[]);const U={},{attributes:Z}=E,$=K=>qm.includes(K)||nl.has(K,Z);for(const[K,te]of Object.entries(A))if($(K)){const Q=Z[K];if(qm.includes(K)||T(Q))U[K]=o(te);else if(z(Q)||R(Q)){const we=i.getModel(Q.target);U[K]=m(te,we)}}else{const Q=F.find(nl.propEq("fieldName",K));if(Q){const{strapiOperator:we}=Q;U[we]=m(te,E)}}return U};return{graphQLFiltersToStrapiQuery:m,buildContentTypeFilters(A){const E=i.plugin("graphql").service("utils"),T=i.plugin("graphql").service("extension"),{getFiltersInputTypeName:R,getScalarFilterInputTypeName:z}=E.naming,{isStrapiScalar:I,isRelation:F}=E.attributes,{attributes:U}=A,Z=R(A);return J_({name:Z,definition($){const K=Object.entries(U).filter(([Q])=>T.shadowCRUD(A.uid).field(Q).hasFiltersEnabeld()),te=T.shadowCRUD(A.uid).field("id").hasFiltersEnabeld();A.kind==="collectionType"&&te&&$.field("id",{type:z("ID")});for(const[Q,we]of K)I(we)?t1($,Q,we):F(we)&&n1($,Q,we);for(const Q of h())Q.add($,Z)}})}}},i1=({strapi:i})=>{const u=Ff(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()}},o1={admin:b_,client:A_,common:O_,settings:i1,gql:r1},u1={register:Pv,bootstrap:py,config:my,controllers:h_,routes:v_,services:o1,contentTypes:Rv};module.exports=u1;
125
+ `,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 al={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 _v{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(_v,xe.Arg);function Mf(i){if(!i.type)throw new Error('You must provide a "type" for the arg()');return new _v(typeof i.type=="string"?i.type:i.type.name,i)}function bv(i){return Mf(Object.assign({type:"String"},i))}function Wf(i){return Mf(Object.assign({type:"Int"},i))}class V_{constructor(u){if(this.ofNexusType=u,this._isNexusListDef=!0,typeof u!="string"&&!la(u)&&!Cm(u)&&!sl(u))throw new Error("Cannot wrap unknown types in list(). Saw "+u)}}bt(V_,xe.List);class Sm{constructor(u){if(this.ofNexusType=u,this._isNexusNonNullDef=!0,typeof u!="string"&&!la(u)&&!Cm(u)&&!sl(u))throw new Error("Cannot wrap unknown types in a nonNull(). Saw "+u)}}bt(Sm,xe.NonNull);function wv(i){return Av(i)||Tm(i)?i:Sv(i)?new Sm(i.ofNexusType):new Sm(i)}class Em{constructor(u){if(this.ofNexusType=u,this._isNexusNullDef=!0,typeof u!="string"&&!la(u)&&!Cm(u)&&!sl(u))throw new Error("Cannot wrap unknown types in nullable(). Saw "+u)}}bt(Em,xe.Null);function Nf(i){return Av(i)?new Em(i.ofNexusType):Sv(i)?i:new Em(i)}xe.Enum,xe.Object,xe.Scalar,xe.Union,xe.Interface,xe.InputObject;function la(i){return i&&!!i[Uf]}function Av(i){return la(i)&&i[Uf]===xe.NonNull}function Sv(i){return la(i)&&i[Uf]===xe.Null}class G_{constructor(u){this.config=u}}bt(G_,xe.Plugin);class q_{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(q_,xe.DynamicInput);class H_{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(H_,xe.DynamicOutputMethod);const Y_={first:Nf(Wf({description:"Returns the first n elements from the list."})),after:Nf(bv({description:"Returns the elements in the list that come after the specified cursor"}))};Object.assign(Object.assign({},Y_),{first:wv(Wf({description:"Returns the first n elements from the list."}))});const Q_={last:Nf(Wf({description:"Returns the last n elements from the list."})),before:Nf(bv({description:"Returns the elements in the list that come before the specified cursor"}))};Object.assign(Object.assign({},Q_),{last:wv(Wf({description:"Returns the last n elements from the list."}))});var Lf=typeof Symbol=="function"?Symbol:void 0;Lf&&Lf.iterator;Lf&&Lf.asyncIterator;class J_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}asArg(u){return Mf(Object.assign(Object.assign({},u),{type:this}))}}bt(J_,xe.Enum);class Ev{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}asArg(u){return Mf(Object.assign(Object.assign({},u),{type:this}))}}bt(Ev,xe.InputObject);function X_(i){return new Ev(i.name,i)}class Z_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(Z_,xe.Scalar);class K_{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(K_,xe.ExtendInputObject);class e1{constructor(u,o){this.name=u,this.config=o,Mi(u)}get value(){return this.config}}bt(e1,xe.ExtendObject);class t1{constructor(u,o){this.name=u,this.config=o}get value(){return this.config}}bt(t1,xe.DynamicOutputProperty);const qm=["id"],n1=(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)})},r1=(i,u,o)=>{const h=strapi.plugin("graphql").service("utils"),m=strapi.plugin("graphql").service("extension"),{getFiltersInputTypeName:A}=h.naming,{isMorphRelation:E}=h.attributes,T=strapi.getModel(o.target);!T||E(o)||m.shadowCRUD(T.uid).isDisabled()||i.field(u,{type:A(T)})},i1=({strapi:i})=>{const{service:u}=i.plugin("graphql"),o=A=>{const{operators:E}=u("builders").filters;if(Array.isArray(A))return A.map(o);if(nl.isDate(A)||!nl.isObject(A))return A;const T={};for(const[R,z]of Object.entries(A)){const F=!!E[R]?E[R].strapiOperator:R;T[F]=o(z)}return T},h=()=>{const{operators:A}=i.plugin("graphql").service("builders").filters;return[A.and,A.or,A.not]},m=(A,E={})=>{const{isStrapiScalar:T,isMedia:R,isRelation:z}=u("utils").attributes,{operators:I}=u("builders").filters,F=[I.and,I.or,I.not];if(nl.isNil(A))return{};if(Array.isArray(A))return A.reduce((K,te)=>(K.push(m(te,E)),K),[]);const U={},{attributes:Z}=E,$=K=>qm.includes(K)||nl.has(K,Z);for(const[K,te]of Object.entries(A))if($(K)){const Q=Z[K];if(qm.includes(K)||T(Q))U[K]=o(te);else if(z(Q)||R(Q)){const we=i.getModel(Q.target);U[K]=m(te,we)}}else{const Q=F.find(nl.propEq("fieldName",K));if(Q){const{strapiOperator:we}=Q;U[we]=m(te,E)}}return U};return{graphQLFiltersToStrapiQuery:m,buildContentTypeFilters(A){const E=i.plugin("graphql").service("utils"),T=i.plugin("graphql").service("extension"),{getFiltersInputTypeName:R,getScalarFilterInputTypeName:z}=E.naming,{isStrapiScalar:I,isRelation:F}=E.attributes,{attributes:U}=A,Z=R(A);return X_({name:Z,definition($){const K=Object.entries(U).filter(([Q])=>T.shadowCRUD(A.uid).field(Q).hasFiltersEnabeld()),te=T.shadowCRUD(A.uid).field("id").hasFiltersEnabeld();A.kind==="collectionType"&&te&&$.field("id",{type:z("ID")});for(const[Q,we]of K)I(we)?n1($,Q,we):F(we)&&r1($,Q,we);for(const Q of h())Q.add($,Z)}})}}},o1=({strapi:i})=>{const u=Ff(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()}},u1={admin:w_,client:S_,common:T_,settings:o1,gql:i1},a1={register:Pv,bootstrap:py,config:my,controllers:p_,routes:y_,services:u1,contentTypes:Rv};module.exports=a1;