parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"jEQo":[function(require,module,exports) {
function n(n,r){(null==r||r>n.length)&&(r=n.length);for(var e=0,l=new Array(r);e<r;e++)l[e]=n[e];return l}module.exports=n;
},{}],"o3SL":[function(require,module,exports) {
var r=require("./arrayLikeToArray");function a(a){if(Array.isArray(a))return r(a)}module.exports=a;
},{"./arrayLikeToArray":"jEQo"}],"lZpU":[function(require,module,exports) {
function e(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}module.exports=e;
},{}],"Dbv9":[function(require,module,exports) {
var r=require("./arrayLikeToArray");function t(t,e){if(t){if("string"==typeof t)return r(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(o):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?r(t,e):void 0}}module.exports=t;
},{"./arrayLikeToArray":"jEQo"}],"NCaH":[function(require,module,exports) {
function e(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}module.exports=e;
},{}],"I9dH":[function(require,module,exports) {
var r=require("./arrayWithoutHoles"),e=require("./iterableToArray"),u=require("./unsupportedIterableToArray"),a=require("./nonIterableSpread");function o(o){return r(o)||e(o)||u(o)||a()}module.exports=o;
},{"./arrayWithoutHoles":"o3SL","./iterableToArray":"lZpU","./unsupportedIterableToArray":"Dbv9","./nonIterableSpread":"NCaH"}],"DCTP":[function(require,module,exports) {
function r(r){if(Array.isArray(r))return r}module.exports=r;
},{}],"LoeL":[function(require,module,exports) {
function r(r,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r)){var e=[],n=!0,o=!1,l=void 0;try{for(var i,u=r[Symbol.iterator]();!(n=(i=u.next()).done)&&(e.push(i.value),!t||e.length!==t);n=!0);}catch(a){o=!0,l=a}finally{try{n||null==u.return||u.return()}finally{if(o)throw l}}return e}}module.exports=r;
},{}],"MWEO":[function(require,module,exports) {
function e(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}module.exports=e;
},{}],"DERy":[function(require,module,exports) {
var r=require("./arrayWithHoles"),e=require("./iterableToArrayLimit"),t=require("./unsupportedIterableToArray"),i=require("./nonIterableRest");function u(u,a){return r(u)||e(u,a)||t(u,a)||i()}module.exports=u;
},{"./arrayWithHoles":"DCTP","./iterableToArrayLimit":"LoeL","./unsupportedIterableToArray":"Dbv9","./nonIterableRest":"MWEO"}],"gr8I":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EXTRA_DATA=exports.AVATAR_SIZES=void 0;var e=wp,s=e.i18n.__,l=[{label:s("None","buddypress"),value:"none"},{label:s("Thumb","buddypress"),value:"thumb"},{label:s("Full","buddypress"),value:"full"}];exports.AVATAR_SIZES=l;var t=[{label:s("None","buddypress"),value:"none"},{label:s("Last time the user was active","buddypress"),value:"last_activity"},{label:s("Latest activity the user posted","buddypress"),value:"latest_update"}];exports.EXTRA_DATA=t;
},{}],"PZSE":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=a(require("@babel/runtime/helpers/toConsumableArray")),t=a(require("@babel/runtime/helpers/slicedToArray")),n=require("./constants");function a(e){return e&&e.__esModule?e:{default:e}}var r=wp,s=r.blockEditor,l=s.InspectorControls,i=s.BlockControls,o=r.components,u=o.Placeholder,d=o.PanelBody,c=o.SelectControl,m=o.ToggleControl,p=o.Button,b=o.Dashicon,y=o.Tooltip,h=o.ToolbarGroup,v=o.RangeControl,f=r.element,g=f.createElement,_=f.Fragment,A=f.useState,k=r.i18n,C=k.__,x=k.sprintf,S=r.apiFetch,N=r.url.addQueryArgs,T=bp,D=T.blockComponents.AutoCompleter,I=T.blockData.isActive,M=lodash,P=M.reject,q=M.remove,w=M.sortBy,B=function(e){return e&&e.mention_name?e.mention_name:null},E=function(a){var r,s=a.attributes,o=a.setAttributes,f=a.isSelected,k=I("members","avatar"),T=I("activity","mentions"),M=s.itemIDs,E=s.avatarSize,R=s.displayMentionSlug,O=s.displayUserName,j=s.extraData,z=s.layoutPreference,L=s.columns,F=0!==M.length,G=A([]),Q=(0,t.default)(G,2),U=Q[0],V=Q[1],X=[{icon:"text",title:C("List view","buddypress"),onClick:function(){return o({layoutPreference:"list"})},isActive:"list"===z},{icon:"screenoptions",title:C("Grid view","buddypress"),onClick:function(){return o({layoutPreference:"grid"})},isActive:"grid"===z}],H="bp-block-members avatar-"+E,Z=n.EXTRA_DATA;"grid"===z&&(H+=" is-grid columns-"+L,Z=n.EXTRA_DATA.filter(function(e){return"latest_update"!==e.value}));return F&&M.length!==U.length&&S({path:N("/buddypress/v1/members",{populate_extras:!0,include:M})}).then(function(e){V(w(e,[function(e){return M.indexOf(e.id)}]))}),U.length&&(r=U.map(function(e){var t=!1,n="member-content";return"list"===z&&"latest_update"===j&&e.latest_update&&e.latest_update.rendered&&(t=!0,n="member-content has-activity"),g("div",{key:"bp-member-"+e.id,className:n},f&&g(y,{text:C("Remove member","buddypress")},g(p,{className:"is-right",onClick:function(){var t;(t=e.id)&&-1!==M.indexOf(t)&&(V(P(U,["id",t])),o({itemIDs:q(M,function(e){return e!==t})}))},label:C("Remove member","buddypress")},g(b,{icon:"no"}))),k&&"none"!==E&&g("div",{className:"item-header-avatar"},g("a",{href:e.link,target:"_blank"},g("img",{key:"avatar-"+e.id,className:"avatar",alt:x(C("Profile photo of %s","buddypress"),e.name),src:e.avatar_urls[E]}))),g("div",{className:"member-description"},t&&g("blockquote",{className:"wp-block-quote"},g("div",{dangerouslySetInnerHTML:{__html:e.latest_update.rendered}}),g("cite",null,O&&g("span",null,e.name)," ",T&&R&&g("a",{href:e.link,target:"_blank"},"(@",e.mention_name,")"))),!t&&O&&g("strong",null,g("a",{href:e.link,target:"_blank"},e.name)),!t&&T&&R&&g("span",{className:"user-nicename"},"@",e.mention_name),"last_activity"===j&&e.last_activity&&e.last_activity.date&&g("time",{dateTime:e.last_activity.date},x(C("Active %s","buddypress"),e.last_activity.timediff))))})),g(_,null,g(l,null,g(d,{title:C("Settings","buddypress"),initialOpen:!0},g(m,{label:C("Display the user name","buddypress"),checked:!!O,onChange:function(){o({displayUserName:!O})},help:C(O?"Include the user's display name.":"Toggle to include user's display name.","buddypress")}),T&&g(m,{label:C("Display Mention slug","buddypress"),checked:!!R,onChange:function(){o({displayMentionSlug:!R})},help:C(R?"Include the user's mention name under their display name.":"Toggle to display the user's mention name under their display name.","buddypress")}),k&&g(c,{label:C("Avatar size","buddypress"),value:E,options:n.AVATAR_SIZES,help:C('Select "None" to disable the avatar.',"buddypress"),onChange:function(e){o({avatarSize:e})}}),g(c,{label:C("BuddyPress extra information","buddypress"),value:j,options:Z,help:C('Select "None" to show no extra information.',"buddypress"),onChange:function(e){o({extraData:e})}}),"grid"===z&&g(v,{label:C("Columns","buddypress"),value:L,onChange:function(e){return o({columns:e})},min:2,max:4,required:!0}))),g(i,null,g(h,{controls:X})),F&&g("div",{className:H},r),(f||0===M.length)&&g(u,{icon:F?"":"groups",label:F?"":C("BuddyPress Members","buddypress"),instructions:C("Start typing the name of the member you want to add to the members list.","buddypress"),className:0!==M.length?"is-appender":"is-large"},g(D,{component:"members",objectQueryArgs:{exclude:M},slugValue:B,ariaLabel:C("Member's username","buddypress"),placeholder:C("Enter Member's username here…","buddypress"),onSelectItem:function(t){var n=t.itemID;n&&-1===M.indexOf(n)&&o({itemIDs:[].concat((0,e.default)(M),[parseInt(n,10)])})},useAvatar:k})))},R=E;exports.default=R;
},{"@babel/runtime/helpers/toConsumableArray":"I9dH","@babel/runtime/helpers/slicedToArray":"DERy","./constants":"gr8I"}],"XEHU":[function(require,module,exports) {
"use strict";var e=t(require("./members/edit"));function t(e){return e&&e.__esModule?e:{default:e}}var r=wp,s=r.blocks.registerBlockType,a=r.i18n.__;s("bp/members",{title:a("Members","buddypress"),description:a("BuddyPress Members.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"groups"},category:"buddypress",attributes:{itemIDs:{type:"array",items:{type:"integer"},default:[]},avatarSize:{type:"string",default:"full"},displayMentionSlug:{type:"boolean",default:!0},displayUserName:{type:"boolean",default:!0},extraData:{type:"string",default:"none"},layoutPreference:{type:"string",default:"list"},columns:{type:"number",default:2}},edit:e.default});
},{"./members/edit":"PZSE"}]},{},["XEHU"], null)
//# sourceMappingURL=/bp-members/js/blocks/members.js.map