관리-도구
편집 파일: reviews-by-category.js
this.kkart=this.kkart||{},this.kkart.blocks=this.kkart.blocks||{},this.kkart.blocks["reviews-by-category"]=function(e){function t(t){for(var n,i,a=t[0],s=t[1],u=t[2],d=0,b=[];d<a.length;d++)i=a[d],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&b.push(o[i][0]),o[i]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(l&&l(t);b.length;)b.shift()();return c.push.apply(c,u||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,a=1;a<r.length;a++){var s=r[a];0!==o[s]&&(n=!1)}n&&(c.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={35:0},c=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var u=0;u<a.length;u++)t(a[u]);var l=s;return c.push([830,0]),r()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},108:function(e,t){},109:function(e,t){},110:function(e,t){},111:function(e,t){},112:function(e,t){},113:function(e,t){},114:function(e,t){},115:function(e,t){},116:function(e,t){},117:function(e,t){},118:function(e,t){},119:function(e,t){},120:function(e,t){},121:function(e,t){},122:function(e,t){},13:function(e,t){!function(){e.exports=this.wp.apiFetch}()},132:function(e,t){},137:function(e,t,r){"use strict";r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return b})),r.d(t,"c",(function(){return p}));var n=r(0),o=r(1),c=r(192),i=r(4),a=r(14),s=r(3),u=r(5),l=r(74),d=function(e,t){return Object(n.createElement)(a.BlockControls,null,Object(n.createElement)(i.Toolbar,{controls:[{icon:"edit",title:Object(o.__)("Edit",'kkart'),onClick:function(){return t({editMode:!e})},isActive:e}]}))},b=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Product rating",'kkart'),checked:e.showReviewRating,onChange:function(){return t({showReviewRating:!e.showReviewRating})}}),e.showReviewRating&&!u.K&&Object(n.createElement)(i.Notice,{className:"kkart-block-base-control-notice",isDismissible:!1},Object(c.a)(Object(o.__)("Product rating is disabled in your <a>store settings</a>.",'kkart'),{a:Object(n.createElement)("a",{href:Object(s.getAdminLink)("admin.php?page=kkart-settings&tab=products"),target:"_blank",rel:"noopener noreferrer"})})),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Reviewer name",'kkart'),checked:e.showReviewerName,onChange:function(){return t({showReviewerName:!e.showReviewerName})}}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Image",'kkart'),checked:e.showReviewImage,onChange:function(){return t({showReviewImage:!e.showReviewImage})}}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Review date",'kkart'),checked:e.showReviewDate,onChange:function(){return t({showReviewDate:!e.showReviewDate})}}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Review content",'kkart'),checked:e.showReviewContent,onChange:function(){return t({showReviewContent:!e.showReviewContent})}}),e.showReviewImage&&Object(n.createElement)(n.Fragment,null,Object(n.createElement)(l.a,{label:Object(o.__)("Review image",'kkart'),value:e.imageType,options:[{label:Object(o.__)("Reviewer photo",'kkart'),value:"reviewer"},{label:Object(o.__)("Product",'kkart'),value:"product"}],onChange:function(e){return t({imageType:e})}}),"reviewer"===e.imageType&&!u.Q&&Object(n.createElement)(i.Notice,{className:"kkart-block-base-control-notice",isDismissible:!1},Object(c.a)(Object(o.__)("Reviewer photo is disabled in your <a>site settings</a>.",'kkart'),{a:Object(n.createElement)("a",{href:Object(s.getAdminLink)("options-discussion.php"),target:"_blank",rel:"noopener noreferrer"})}))))},p=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Order by",'kkart'),checked:e.showOrderby,onChange:function(){return t({showOrderby:!e.showOrderby})}}),Object(n.createElement)(i.SelectControl,{label:Object(o.__)("Order Product Reviews by",'kkart'),value:e.orderby,options:[{label:"Most recent",value:"most-recent"},{label:"Highest Rating",value:"highest-rating"},{label:"Lowest Rating",value:"lowest-rating"}],onChange:function(e){return t({orderby:e})}}),Object(n.createElement)(i.RangeControl,{label:Object(o.__)("Starting Number of Reviews",'kkart'),value:e.reviewsOnPageLoad,onChange:function(e){return t({reviewsOnPageLoad:e})},max:20,min:1}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Load more",'kkart'),checked:e.showLoadMore,onChange:function(){return t({showLoadMore:!e.showLoadMore})}}),e.showLoadMore&&Object(n.createElement)(i.RangeControl,{label:Object(o.__)("Load More Reviews",'kkart'),value:e.reviewsOnLoadMore,onChange:function(e){return t({reviewsOnLoadMore:e})},max:20,min:1}))}},14:function(e,t){!function(){e.exports=this.wp.blockEditor}()},144:function(e,t,r){"use strict";var n=r(0),o=r(57),c=Object(n.createElement)(o.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}));t.a=c},147:function(e,t){},149:function(e,t,r){"use strict";var n=r(0),o=(r(2),r(7)),c=r.n(o),i=r(48),a=r(193);r(202);t.a=Object(a.a)((function(e){var t=e.className,r=e.instanceId,o=e.defaultValue,a=e.label,s=e.onChange,u=e.options,l=e.screenReaderLabel,d=e.readOnly,b=e.value,p="kkart-block-components-sort-select__select-".concat(r);return Object(n.createElement)("div",{className:c()("kkart-block-sort-select","kkart-block-components-sort-select",t)},Object(n.createElement)(i.a,{label:a,screenReaderLabel:l,wrapperElement:"label",wrapperProps:{className:"kkart-block-sort-select__label kkart-block-components-sort-select__label",htmlFor:p}}),Object(n.createElement)("select",{id:p,className:"kkart-block-sort-select__select kkart-block-components-sort-select__select",defaultValue:o,onChange:s,readOnly:d,value:b},u.map((function(e){return Object(n.createElement)("option",{key:e.key,value:e.key},e.label)}))))}))},15:function(e,t){!function(){e.exports=this.regeneratorRuntime}()},157:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(1),o=r(5),c={attributes:{editMode:!1,imageType:"reviewer",orderby:"most-recent",reviewsOnLoadMore:10,reviewsOnPageLoad:10,showLoadMore:!0,showOrderby:!0,showReviewDate:!0,showReviewerName:!0,showReviewImage:!0,showReviewRating:!0,showReviewContent:!0,previewReviews:[{id:1,date_created:"2019-07-15T17:05:04",formatted_date_created:Object(n.__)("July 15, 2019",'kkart'),date_created_gmt:"2019-07-15T15:05:04",product_id:0,product_name:Object(n.__)("WordPress Pennant",'kkart'),product_permalink:"#",reviewer:Object(n.__)("Alice",'kkart'),review:"<p>".concat(Object(n.__)("I bought this product last week and I'm very happy with it.",'kkart'),"</p>\n"),reviewer_avatar_urls:{48:o.U+"img/avatar.jpg",96:o.U+"img/avatar.jpg"},rating:5,verified:!0},{id:2,date_created:"2019-07-12T12:39:39",formatted_date_created:Object(n.__)("July 12, 2019",'kkart'),date_created_gmt:"2019-07-12T10:39:39",product_id:0,product_name:Object(n.__)("WordPress Pennant",'kkart'),product_permalink:"#",reviewer:Object(n.__)("Bob",'kkart'),review:"<p>".concat(Object(n.__)("This product is awesome, I love it!",'kkart'),"</p>\n"),reviewer_avatar_urls:{48:o.U+"img/avatar.jpg",96:o.U+"img/avatar.jpg"},rating:null,verified:!1}]}}},17:function(e,t){!function(){e.exports=this.wp.blocks}()},18:function(e,t){!function(){e.exports=this.wp.url}()},182:function(e,t,r){"use strict";t.a={editMode:{type:"boolean",default:!0},imageType:{type:"string",default:"reviewer"},orderby:{type:"string",default:"most-recent"},reviewsOnLoadMore:{type:"number",default:10},reviewsOnPageLoad:{type:"number",default:10},showLoadMore:{type:"boolean",default:!0},showOrderby:{type:"boolean",default:!0},showReviewDate:{type:"boolean",default:!0},showReviewerName:{type:"boolean",default:!0},showReviewImage:{type:"boolean",default:!0},showReviewRating:{type:"boolean",default:!0},showReviewContent:{type:"boolean",default:!0},previewReviews:{type:"array",default:null}}},183:function(e,t,r){"use strict";var n=r(10),o=r.n(n),c=r(0),i=(r(201),r(71));t.a=function(e){var t=e.attributes;return Object(c.createElement)("div",o()({className:Object(i.a)(t)},Object(i.b)(t)))}},188:function(e,t,r){"use strict";var n=r(22),o=r.n(n),c=r(25),i=r.n(c),a=r(23),s=r.n(a),u=r(24),l=r.n(u),d=r(12),b=r.n(d),p=r(0),g=r(1),f=r(9),w=(r(2),r(6)),m=r(4),v=r(5),h=r(93),O=r(48),j=(r(258),function(e){var t=e.onClick,r=e.label,n=e.screenReaderLabel;return Object(p.createElement)("div",{className:"wp-block-button kkart-block-load-more kkart-block-components-load-more"},Object(p.createElement)("button",{className:"wp-block-button__link",onClick:t},Object(p.createElement)(O.a,{label:r,screenReaderLabel:n})))});j.defaultProps={label:Object(g.__)("Load more",'kkart')};var y=j,_=r(149),k=(r(255),function(e){var t=e.defaultValue,r=e.onChange,n=e.readOnly,o=e.value;return Object(p.createElement)(_.a,{className:"kkart-block-review-sort-select kkart-block-components-review-sort-select",defaultValue:t,label:Object(g.__)("Order by",'kkart'),onChange:r,options:[{key:"most-recent",label:Object(g.__)("Most recent",'kkart')},{key:"highest-rating",label:Object(g.__)("Highest rating",'kkart')},{key:"lowest-rating",label:Object(g.__)("Lowest rating",'kkart')}],readOnly:n,screenReaderLabel:Object(g.__)("Order reviews by",'kkart'),value:o})}),R=r(8),E=r.n(R),P=r(7),S=r.n(P),C=r(19),x=r.n(C),N=r(232),L=r.n(N),D=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...",n=L()(e,{suffix:r,limit:t});return n.html},T=function(e,t,r,n){var o=I(e,t,r);return D(e,o-n.length,n)},I=function(e,t,r){for(var n={start:0,middle:0,end:e.length};n.start<=n.end;)n.middle=Math.floor((n.start+n.end)/2),t.innerHTML=D(e,n.middle),n=M(n,t.clientHeight,r);return n.middle},M=function(e,t,r){return t<=r?e.start=e.middle+1:e.end=e.middle-1,e};function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=b()(e);if(t){var o=b()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return l()(this,r)}}var B=function(e){s()(r,e);var t=A(r);function r(e){var n;return o()(this,r),(n=t.apply(this,arguments)).state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},n.reviewSummary=Object(f.createRef)(),n.reviewContent=Object(f.createRef)(),n.getButton=n.getButton.bind(x()(n)),n.onClick=n.onClick.bind(x()(n)),n}return i()(r,[{key:"componentDidMount",value:function(){if(this.props.children){var e=this.props,t=e.maxLines,r=e.ellipsis,n=(this.reviewSummary.current.clientHeight+1)*t+1,o=this.reviewContent.current.clientHeight+1>n;this.setState({clampEnabled:o}),o&&this.setState({summary:T(this.reviewContent.current.innerHTML,this.reviewSummary.current,n,r)})}}},{key:"getButton",value:function(){var e=this.state.isExpanded,t=this.props,r=t.className,n=t.lessText,o=t.moreText,c=e?n:o;if(c)return Object(p.createElement)("a",{href:"#more",className:r+"__read_more",onClick:this.onClick,"aria-expanded":!e,role:"button"},c)}},{key:"onClick",value:function(e){e.preventDefault();var t=this.state.isExpanded;this.setState({isExpanded:!t})}},{key:"render",value:function(){var e=this.props.className,t=this.state,r=t.content,n=t.summary,o=t.clampEnabled,c=t.isExpanded;return r?!1===o?Object(p.createElement)("div",{className:e},Object(p.createElement)("div",{ref:this.reviewContent},r)):Object(p.createElement)("div",{className:e},(!c||null===o)&&Object(p.createElement)("div",{ref:this.reviewSummary,"aria-hidden":c,dangerouslySetInnerHTML:{__html:n}}),(c||null===o)&&Object(p.createElement)("div",{ref:this.reviewContent,"aria-hidden":!c},r),this.getButton()):null}}]),r}(f.Component);B.defaultProps={maxLines:3,ellipsis:"…",moreText:Object(g.__)("Read more",'kkart'),lessText:Object(g.__)("Read less",'kkart'),className:"read-more-content"};var H=B;r(257);var F=function(e){var t=e.attributes,r=e.review,n=void 0===r?{}:r,o=t.imageType,c=t.showReviewDate,i=t.showReviewerName,a=t.showReviewImage,s=t.showReviewRating,u=t.showReviewContent,l=t.showProductName,d=n.rating,b=!Object.keys(n).length>0,f=Number.isFinite(d)&&s;return Object(p.createElement)("li",{className:S()("kkart-block-review-list-item__item","kkart-block-components-review-list-item__item",{"is-loading":b}),"aria-hidden":b},(l||c||i||a||f)&&Object(p.createElement)("div",{className:"kkart-block-review-list-item__info kkart-block-components-review-list-item__info"},a&&function(e,t,r){var n,o;return r||!e?Object(p.createElement)("div",{className:"kkart-block-review-list-item__image kkart-block-components-review-list-item__image",width:"48",height:"48"}):Object(p.createElement)("div",{className:"kkart-block-review-list-item__image kkart-block-components-review-list-item__image"},"product"===t?Object(p.createElement)("img",{"aria-hidden":"true",alt:(null===(n=e.product_image)||void 0===n?void 0:n.alt)||"",src:(null===(o=e.product_image)||void 0===o?void 0:o.thumbnail)||""}):Object(p.createElement)("img",{"aria-hidden":"true",alt:"",src:e.reviewer_avatar_urls[48]||"",srcSet:e.reviewer_avatar_urls[96]+" 2x"}),e.verified&&Object(p.createElement)("div",{className:"kkart-block-review-list-item__verified kkart-block-components-review-list-item__verified",title:Object(g.__)("Verified buyer",'kkart')},Object(g.__)("Verified buyer",'kkart')))}(n,o,b),(l||i||f||c)&&Object(p.createElement)("div",{className:"kkart-block-review-list-item__meta kkart-block-components-review-list-item__meta"},f&&function(e){var t=e.rating,r={width:t/5*100+"%"};return Object(p.createElement)("div",{className:"kkart-block-review-list-item__rating kkart-block-components-review-list-item__rating"},Object(p.createElement)("div",{className:"kkart-block-review-list-item__rating__stars kkart-block-components-review-list-item__rating__stars",role:"img"},Object(p.createElement)("span",{style:r},Object(g.sprintf)(Object(g.__)("Rated %f out of 5",'kkart'),t))))}(n),l&&function(e){return Object(p.createElement)("div",{className:"kkart-block-review-list-item__product kkart-block-components-review-list-item__product"},Object(p.createElement)("a",{href:e.product_permalink,dangerouslySetInnerHTML:{__html:e.product_name}}))}(n),i&&function(e){var t=e.reviewer,r=void 0===t?"":t;return Object(p.createElement)("div",{className:"kkart-block-review-list-item__author kkart-block-components-review-list-item__author"},r)}(n),c&&function(e){var t=e.date_created,r=e.formatted_date_created;return Object(p.createElement)("time",{className:"kkart-block-review-list-item__published-date kkart-block-components-review-list-item__published-date",dateTime:t},r)}(n))),u&&function(e){return Object(p.createElement)(H,{maxLines:10,moreText:Object(g.__)("Read full review",'kkart'),lessText:Object(g.__)("Hide full review",'kkart'),className:"kkart-block-review-list-item__text kkart-block-components-review-list-item__text"},Object(p.createElement)("div",{dangerouslySetInnerHTML:{__html:e.review||""}}))}(n))};r(256);function V(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?V(Object(r),!0).forEach((function(t){E()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var U=function(e){var t=e.attributes,r=e.reviews,n=(v.Q||"product"===t.imageType)&&t.showReviewImage,o=v.K&&t.showReviewRating,c=z(z({},t),{},{showReviewImage:n,showReviewRating:o});return Object(p.createElement)("ul",{className:"kkart-block-review-list kkart-block-components-review-list"},0===r.length?Object(p.createElement)(F,{attributes:c}):r.map((function(e,t){return Object(p.createElement)(F,{key:e.id||t,attributes:c,review:e})})))},$=r(10),Q=r.n($),W=r(15),q=r.n(W),G=r(37),J=r.n(G),K=r(43),Y=r.n(K),X=r(71),Z=r(44);function ee(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=b()(e);if(t){var o=b()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return l()(this,r)}}function te(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=b()(e);if(t){var o=b()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return l()(this,r)}}var re=function(e){var t=function(t){s()(n,t);var r=ee(n);function n(){var e;o()(this,n);for(var t=arguments.length,c=new Array(t),i=0;i<t;i++)c[i]=arguments[i];return e=r.call.apply(r,[this].concat(c)),E()(x()(e),"isPreview",!!e.props.attributes.previewReviews),E()(x()(e),"delayedAppendReviews",e.props.delayFunction(e.appendReviews)),E()(x()(e),"state",{error:null,loading:!0,reviews:e.isPreview?e.props.attributes.previewReviews:[],totalReviews:e.isPreview?e.props.attributes.previewReviews.length:0}),E()(x()(e),"setError",function(){var t=J()(q.a.mark((function t(r){var n,o;return q.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.props.onReviewsLoadError,t.next=3,Object(Z.a)(r);case 3:o=t.sent,e.setState({reviews:[],loading:!1,error:o}),n(o);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),e}return i()(n,[{key:"componentDidMount",value:function(){this.replaceReviews()}},{key:"componentDidUpdate",value:function(e){e.reviewsToDisplay<this.props.reviewsToDisplay?this.delayedAppendReviews():this.shouldReplaceReviews(e,this.props)&&this.replaceReviews()}},{key:"shouldReplaceReviews",value:function(e,t){return e.orderby!==t.orderby||e.order!==t.order||e.productId!==t.productId||!Y()(e.categoryIds,t.categoryIds)}},{key:"componentWillUnMount",value:function(){this.delayedAppendReviews.cancel&&this.delayedAppendReviews.cancel()}},{key:"getArgs",value:function(e){var t=this.props,r=t.categoryIds,n=t.order,o=t.orderby,c=t.productId,i={order:n,orderby:o,per_page:t.reviewsToDisplay-e,offset:e};return r&&r.length&&(i.category_id=Array.isArray(r)?r.join(","):r),c&&(i.product_id=c),i}},{key:"replaceReviews",value:function(){if(!this.isPreview){var e=this.props.onReviewsReplaced;this.updateListOfReviews().then(e)}}},{key:"appendReviews",value:function(){if(!this.isPreview){var e=this.props,t=e.onReviewsAppended,r=e.reviewsToDisplay,n=this.state.reviews;r<=n.length||this.updateListOfReviews(n).then(t)}}},{key:"updateListOfReviews",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=this.props.reviewsToDisplay,n=this.state.totalReviews,o=Math.min(n,r)-t.length;return this.setState({loading:!0,reviews:t.concat(Array(o).fill({}))}),Object(X.c)(this.getArgs(t.length)).then((function(r){var n=r.reviews,o=r.totalReviews;return e.setState({reviews:t.filter((function(e){return Object.keys(e).length})).concat(n),totalReviews:o,loading:!1,error:null}),{newReviews:n}})).catch(this.setError)}},{key:"render",value:function(){var t=this.props.reviewsToDisplay,r=this.state,n=r.error,o=r.loading,c=r.reviews,i=r.totalReviews;return Object(p.createElement)(e,Q()({},this.props,{error:n,isLoading:o,reviews:c.slice(0,t),totalReviews:i}))}}]),n}(f.Component);E()(t,"defaultProps",{delayFunction:function(e){return e},onReviewsAppended:function(){},onReviewsLoadError:function(){},onReviewsReplaced:function(){}});var r=e.displayName,n=void 0===r?e.name||"Component":r;return t.displayName="WithReviews( ".concat(n," )"),t}(function(e){s()(r,e);var t=te(r);function r(){return o()(this,r),t.apply(this,arguments)}return i()(r,[{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.error,n=e.isLoading,o=e.noReviewsPlaceholder,c=e.reviews,i=e.totalReviews;return r?Object(p.createElement)(h.a,{className:"kkart-block-featured-product-error",error:r,isLoading:n}):0!==c.length||n?Object(p.createElement)(m.Disabled,null,t.showOrderby&&v.K&&Object(p.createElement)(k,{readOnly:!0,value:t.orderby}),Object(p.createElement)(U,{attributes:t,reviews:c}),t.showLoadMore&&i>c.length&&Object(p.createElement)(y,{screenReaderLabel:Object(g.__)("Load more reviews",'kkart')})):Object(p.createElement)(o,{attributes:t})}}]),r}(f.Component));function ne(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=b()(e);if(t){var o=b()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return l()(this,r)}}var oe=function(e){s()(r,e);var t=ne(r);function r(){return o()(this,r),t.apply(this,arguments)}return i()(r,[{key:"renderHiddenContentPlaceholder",value:function(){var e=this.props,t=e.icon,r=e.name;return Object(p.createElement)(m.Placeholder,{icon:t,label:r},Object(g.__)("The content for this block is hidden due to block settings.",'kkart'))}},{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.noReviewsPlaceholder,n=t.categoryIds,o=t.productId,c=t.reviewsOnPageLoad,i=t.showProductName,a=t.showReviewDate,s=t.showReviewerName,u=t.showReviewContent,l=t.showReviewImage,d=t.showReviewRating,b=Object(X.d)(t.orderby),g=b.order,f=b.orderby;return!(u||d||a||s||l||i)?this.renderHiddenContentPlaceholder():Object(p.createElement)("div",{className:Object(X.a)(t)},Object(p.createElement)(re,{attributes:t,categoryIds:n,delayFunction:function(e){return Object(w.debounce)(e,400)},noReviewsPlaceholder:r,orderby:f,order:g,productId:o,reviewsToDisplay:c}))}}]),r}(f.Component);t.a=oe},201:function(e,t){},202:function(e,t){},255:function(e,t){},256:function(e,t){},257:function(e,t){},258:function(e,t){},26:function(e,t){!function(){e.exports=this.wp.compose}()},3:function(e,t){!function(){e.exports=this.kkart.wcSettings}()},33:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},35:function(e,t){!function(){e.exports=this.moment}()},4:function(e,t){!function(){e.exports=this.wp.components}()},40:function(e,t,r){"use strict";r.d(t,"h",(function(){return b})),r.d(t,"e",(function(){return p})),r.d(t,"b",(function(){return g})),r.d(t,"i",(function(){return f})),r.d(t,"f",(function(){return w})),r.d(t,"c",(function(){return m})),r.d(t,"d",(function(){return v})),r.d(t,"g",(function(){return h})),r.d(t,"a",(function(){return O}));var n=r(8),o=r.n(n),c=r(18),i=r(13),a=r.n(i),s=r(6),u=r(5);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function d(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var b=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,o=void 0===n?"":n,i=e.queryArgs,l=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,o=void 0===n?"":n,i=e.queryArgs,a=void 0===i?[]:i,s={per_page:u.v?100:0,catalog_visibility:"any",search:o,orderby:"title",order:"asc"},l=[Object(c.addQueryArgs)("/kkart/store/products",d(d({},s),a))];return u.v&&r.length&&l.push(Object(c.addQueryArgs)("/kkart/store/products",{catalog_visibility:"any",include:r})),l}({selected:r,search:o,queryArgs:void 0===i?[]:i});return Promise.all(l.map((function(e){return a()({path:e})}))).then((function(e){return Object(s.uniqBy)(Object(s.flatten)(e),"id").map((function(e){return d(d({},e),{},{parent:0})}))})).catch((function(e){throw e}))},p=function(e){return a()({path:"/kkart/store/products/".concat(e)})},g=function(){return a()({path:"kkart/store/products/attributes"})},f=function(e){return a()({path:"kkart/store/products/attributes/".concat(e,"/terms")})},w=function(e){var t=e.selected,r=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,o=[Object(c.addQueryArgs)("kkart/store/products/tags",{per_page:u.y?100:0,orderby:u.y?"count":"name",order:u.y?"desc":"asc",search:n})];return u.y&&r.length&&o.push(Object(c.addQueryArgs)("kkart/store/products/tags",{include:r})),o}({selected:void 0===t?[]:t,search:e.search});return Promise.all(r.map((function(e){return a()({path:e})}))).then((function(e){return Object(s.uniqBy)(Object(s.flatten)(e),"id")}))},m=function(e){return a()({path:Object(c.addQueryArgs)("kkart/store/products/categories",d({per_page:0},e))})},v=function(e){return a()({path:"kkart/store/products/categories/".concat(e)})},h=function(e){return a()({path:Object(c.addQueryArgs)("kkart/store/products",{per_page:0,type:"variation",parent:e})})},O=function(e,t){if(!e.title.raw)return e.slug;var r=1===t.filter((function(t){return t.title.raw===e.title.raw})).length;return e.title.raw+(r?"":" - ".concat(e.slug))}},43:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},44:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(15),o=r.n(n),c=r(37),i=r.n(c),a=function(){var e=i()(o.a.mark((function e(t){var r;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof t.json){e.next=11;break}return e.prev=1,e.next=4,t.json();case 4:return r=e.sent,e.abrupt("return",{message:r.message,type:r.type||"api"});case 8:return e.prev=8,e.t0=e.catch(1),e.abrupt("return",{message:e.t0.message,type:"general"});case 11:return e.abrupt("return",{message:t.message,type:t.type||"general"});case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}()},47:function(e,t){!function(){e.exports=this.wp.escapeHtml}()},48:function(e,t,r){"use strict";var n=r(8),o=r.n(n),c=r(0),i=(r(2),r(9)),a=r(7),s=r.n(a);function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}t.a=function(e){var t,r=e.label,n=e.screenReaderLabel,o=e.wrapperElement,a=e.wrapperProps,u=void 0===a?{}:a,d=null!=r,b=null!=n;return!d&&b?(t=o||"span",u=l(l({},u),{},{className:s()(u.className,"screen-reader-text")}),Object(c.createElement)(t,u,n)):(t=o||i.Fragment,d&&b&&r!==n?Object(c.createElement)(t,u,Object(c.createElement)("span",{"aria-hidden":"true"},r),Object(c.createElement)("span",{className:"screen-reader-text"},n)):Object(c.createElement)(t,u,r))}},49:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(47));t.a=function(e){var t,r,i,a=e.error;return Object(n.createElement)("div",{className:"kkart-block-error-message"},(r=(t=a).message,i=t.type,r?"general"===i?Object(n.createElement)("span",null,Object(o.__)("The following error was returned",'kkart'),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(c.escapeHTML)(r))):"api"===i?Object(n.createElement)("span",null,Object(o.__)("The following error was returned from the API",'kkart'),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(c.escapeHTML)(r))):r:Object(o.__)("An unknown error occurred which prevented the block from being updated.",'kkart')))}},5:function(e,t,r){"use strict";r.d(t,"l",(function(){return o})),r.d(t,"K",(function(){return c})),r.d(t,"Q",(function(){return i})),r.d(t,"A",(function(){return a})),r.d(t,"C",(function(){return s})),r.d(t,"m",(function(){return u})),r.d(t,"B",(function(){return l})),r.d(t,"E",(function(){return d})),r.d(t,"o",(function(){return b})),r.d(t,"D",(function(){return p})),r.d(t,"n",(function(){return g})),r.d(t,"G",(function(){return f})),r.d(t,"v",(function(){return w})),r.d(t,"y",(function(){return m})),r.d(t,"s",(function(){return v})),r.d(t,"t",(function(){return h})),r.d(t,"u",(function(){return O})),r.d(t,"k",(function(){return j})),r.d(t,"M",(function(){return y})),r.d(t,"R",(function(){return _})),r.d(t,"q",(function(){return k})),r.d(t,"r",(function(){return R})),r.d(t,"p",(function(){return E})),r.d(t,"J",(function(){return P})),r.d(t,"c",(function(){return S})),r.d(t,"w",(function(){return C})),r.d(t,"x",(function(){return x})),r.d(t,"U",(function(){return L})),r.d(t,"V",(function(){return D})),r.d(t,"L",(function(){return T})),r.d(t,"a",(function(){return I})),r.d(t,"O",(function(){return M})),r.d(t,"b",(function(){return A})),r.d(t,"N",(function(){return B})),r.d(t,"F",(function(){return H})),r.d(t,"i",(function(){return F})),r.d(t,"P",(function(){return U})),r.d(t,"h",(function(){return $})),r.d(t,"j",(function(){return Q})),r.d(t,"I",(function(){return W})),r.d(t,"H",(function(){return q})),r.d(t,"T",(function(){return G})),r.d(t,"S",(function(){return J})),r.d(t,"d",(function(){return K})),r.d(t,"e",(function(){return Y})),r.d(t,"f",(function(){return X})),r.d(t,"g",(function(){return Z})),r.d(t,"z",(function(){return ee})),r.d(t,"Y",(function(){return re})),r.d(t,"Z",(function(){return ne})),r.d(t,"W",(function(){return oe})),r.d(t,"X",(function(){return ce}));var n=r(3),o=Object(n.getSetting)("currentUserIsAdmin",!1),c=Object(n.getSetting)("reviewRatingsEnabled",!0),i=Object(n.getSetting)("showAvatars",!0),a=Object(n.getSetting)("max_columns",6),s=Object(n.getSetting)("min_columns",1),u=Object(n.getSetting)("default_columns",3),l=Object(n.getSetting)("max_rows",6),d=Object(n.getSetting)("min_rows",1),b=Object(n.getSetting)("default_rows",3),p=Object(n.getSetting)("min_height",500),g=Object(n.getSetting)("default_height",500),f=Object(n.getSetting)("placeholderImgSrc",""),w=(Object(n.getSetting)("thumbnail_size",300),Object(n.getSetting)("isLargeCatalog")),m=Object(n.getSetting)("limitTags"),v=Object(n.getSetting)("hasProducts",!0),h=Object(n.getSetting)("hasTags",!0),O=Object(n.getSetting)("homeUrl",""),j=Object(n.getSetting)("couponsEnabled",!0),y=Object(n.getSetting)("shippingEnabled",!0),_=Object(n.getSetting)("taxesEnabled",!0),k=Object(n.getSetting)("displayItemizedTaxes",!1),R=Object(n.getSetting)("hasDarkEditorStyleSupport",!1),E=(Object(n.getSetting)("displayShopPricesIncludingTax",!1),Object(n.getSetting)("displayCartPricesIncludingTax",!1)),P=Object(n.getSetting)("productCount",0),S=Object(n.getSetting)("attributes",[]),C=Object(n.getSetting)("isShippingCalculatorEnabled",!0),x=Object(n.getSetting)("isShippingCostHidden",!1),N=Object(n.getSetting)("kkartBlocksPhase",1),L=Object(n.getSetting)("wcBlocksAssetUrl",""),D=Object(n.getSetting)("wcBlocksBuildUrl",""),T=Object(n.getSetting)("shippingCountries",{}),I=Object(n.getSetting)("allowedCountries",{}),M=Object(n.getSetting)("shippingStates",{}),A=Object(n.getSetting)("allowedStates",{}),B=Object(n.getSetting)("shippingMethodsExist",!1),H=Object(n.getSetting)("paymentGatewaySortOrder",[]),F=Object(n.getSetting)("checkoutShowLoginReminder",!0),V={id:0,title:"",permalink:""},z=Object(n.getSetting)("storePages",{shop:V,cart:V,checkout:V,privacy:V,terms:V}),U=z.shop.permalink,$=z.checkout.id,Q=z.checkout.permalink,W=z.privacy.permalink,q=z.privacy.title,G=z.terms.permalink,J=z.terms.title,K=z.cart.id,Y=z.cart.permalink,X=Object(n.getSetting)("checkoutAllowsGuest",!1),Z=Object(n.getSetting)("checkoutAllowsSignup",!1),ee=Object(n.getSetting)("loginUrl","/wp-login.php"),te=r(17),re=function(e,t){if(N>2)return Object(te.registerBlockType)(e,t)},ne=function(e,t){if(N>1)return Object(te.registerBlockType)(e,t)},oe=function(){return N>2},ce=function(){return N>1}},54:function(e,t){!function(){e.exports=this.wp.keycodes}()},6:function(e,t){!function(){e.exports=this.lodash}()},61:function(e,t,r){"use strict";var n=r(8),o=r.n(n),c=r(27),i=r.n(c),a=r(9);r(2);function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}t.a=function(e){var t=e.srcElement,r=e.size,n=void 0===r?24:r,c=i()(e,["srcElement","size"]);return Object(a.isValidElement)(t)&&Object(a.cloneElement)(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({width:n,height:n},c))}},71:function(e,t,r){"use strict";r.d(t,"d",(function(){return s})),r.d(t,"c",(function(){return u})),r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return d}));var n=r(13),o=r.n(n),c=r(7),i=r.n(c),a=r(5),s=function(e){if(a.K){if("lowest-rating"===e)return{order:"asc",orderby:"rating"};if("highest-rating"===e)return{order:"desc",orderby:"rating"}}return{order:"desc",orderby:"date_gmt"}},u=function(e){return o()({path:"/kkart/store/products/reviews?"+Object.entries(e).map((function(e){return e.join("=")})).join("&"),parse:!1}).then((function(e){return e.json().then((function(t){return{reviews:t,totalReviews:parseInt(e.headers.get("x-wp-total"),10)}}))}))},l=function(e){var t=e.className,r=e.categoryIds,n=e.productId,o=e.showReviewDate,c=e.showReviewerName,a=e.showReviewContent,s=e.showProductName,u=e.showReviewImage,l=e.showReviewRating,d="kkart-block-all-reviews";return n&&(d="kkart-block-reviews-by-product"),Array.isArray(r)&&(d="kkart-block-reviews-by-category"),i()(d,t,{"has-image":u,"has-name":c,"has-date":o,"has-rating":l,"has-content":a,"has-product-name":s})},d=function(e){var t=e.categoryIds,r=e.imageType,n=e.orderby,o=e.productId,c={"data-image-type":r,"data-orderby":n,"data-reviews-on-page-load":e.reviewsOnPageLoad,"data-reviews-on-load-more":e.reviewsOnLoadMore,"data-show-load-more":e.showLoadMore,"data-show-orderby":e.showOrderby};return o&&(c["data-product-id"]=o),Array.isArray(t)&&(c["data-category-ids"]=t.join(",")),c}},74:function(e,t,r){"use strict";var n=r(10),o=r.n(n),c=r(22),i=r.n(c),a=r(25),s=r.n(a),u=r(19),l=r.n(u),d=r(23),b=r.n(d),p=r(24),g=r.n(p),f=r(12),w=r.n(f),m=r(0),v=r(6),h=r(7),O=r.n(h),j=r(4),y=r(26);r(122);function _(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=w()(e);if(t){var o=w()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return g()(this,r)}}var k=function(e){b()(r,e);var t=_(r);function r(){var e;return i()(this,r),(e=t.apply(this,arguments)).onClick=e.onClick.bind(l()(e)),e}return s()(r,[{key:"onClick",value:function(e){this.props.onChange&&this.props.onChange(e.target.value)}},{key:"render",value:function(){var e,t=this,r=this.props,n=r.label,c=r.checked,i=r.instanceId,a=r.className,s=r.help,u=r.options,l=r.value,d="inspector-toggle-button-control-".concat(i);return s&&(e=Object(v.isFunction)(s)?s(c):s),Object(m.createElement)(j.BaseControl,{id:d,help:e,className:O()("components-toggle-button-control",a)},Object(m.createElement)("label",{id:d+"__label",htmlFor:d,className:"components-toggle-button-control__label"},n),Object(m.createElement)(j.ButtonGroup,{"aria-labelledby":d+"__label"},u.map((function(e,r){var c={};return l===e.value?(c.isPrimary=!0,c["aria-pressed"]=!0):(c.isDefault=!0,c["aria-pressed"]=!1),Object(m.createElement)(j.Button,o()({key:"".concat(e.label,"-").concat(e.value,"-").concat(r),value:e.value,onClick:t.onClick,"aria-label":n+": "+e.label},c),e.label)}))))}}]),r}(m.Component);t.a=Object(y.withInstanceId)(k)},75:function(e,t){!function(){e.exports=this.wp.hooks}()},77:function(e,t){!function(){e.exports=this.ReactDOM}()},78:function(e,t){!function(){e.exports=this.wp.dom}()},83:function(e,t){!function(){e.exports=this.wp.viewport}()},830:function(e,t,r){e.exports=r(914)},84:function(e,t,r){"use strict";var n=r(10),o=r.n(n),c=r(0),i=r(1),a=r(6),s=(r(2),r(50)),u=r(4),l=r(15),d=r.n(l),b=r(37),p=r.n(b),g=r(22),f=r.n(g),w=r(25),m=r.n(w),v=r(19),h=r.n(v),O=r(23),j=r.n(O),y=r(24),_=r.n(y),k=r(12),R=r.n(k),E=r(26),P=r(40),S=r(44);function C(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=R()(e);if(t){var o=R()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return _()(this,r)}}var x=Object(E.createHigherOrderComponent)((function(e){return function(t){j()(n,t);var r=C(n);function n(){var e;return f()(this,n),(e=r.apply(this,arguments)).state={error:null,loading:!1,categories:null},e.loadCategories=e.loadCategories.bind(h()(e)),e}return m()(n,[{key:"componentDidMount",value:function(){this.loadCategories()}},{key:"loadCategories",value:function(){var e=this;this.setState({loading:!0}),Object(P.c)().then((function(t){e.setState({categories:t,loading:!1,error:null})})).catch(function(){var t=p()(d.a.mark((function t(r){var n;return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(S.a)(r);case 2:n=t.sent,e.setState({categories:null,loading:!1,error:n});case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},{key:"render",value:function(){var t=this.state,r=t.error,n=t.loading,i=t.categories;return Object(c.createElement)(e,o()({},this.props,{error:r,isLoading:n,categories:i}))}}]),n}(c.Component)}),"withCategories"),N=r(49),L=(r(132),function(e){var t=e.categories,r=e.error,n=e.isLoading,l=e.onChange,d=e.onOperatorChange,b=e.operator,p=e.selected,g=e.isSingle,f=e.showReviewCount,w={clear:Object(i.__)("Clear all product categories",'kkart'),list:Object(i.__)("Product Categories",'kkart'),noItems:Object(i.__)("Your store doesn't have any product categories.",'kkart'),search:Object(i.__)("Search for product categories",'kkart'),selected:function(e){return Object(i.sprintf)(Object(i._n)("%d category selected","%d categories selected",e,'kkart'),e)},updated:Object(i.__)("Category search results updated.",'kkart')};return r?Object(c.createElement)(N.a,{error:r}):Object(c.createElement)(c.Fragment,null,Object(c.createElement)(s.a,{className:"kkart-product-categories",list:t,isLoading:n,selected:p.map((function(e){return Object(a.find)(t,{id:e})})).filter(Boolean),onChange:l,renderItem:function(e){var t=e.item,r=e.search,n=e.depth,a=void 0===n?0:n,u=["kkart-product-categories__item"];r.length&&u.push("is-searching"),0===a&&0!==t.parent&&u.push("is-skip-level");var l=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name,d=f?Object(i.sprintf)(Object(i._n)("%1$s, has %2$d review","%1$s, has %2$d reviews",t.review_count,'kkart'),l,t.review_count):Object(i.sprintf)(Object(i._n)("%1$s, has %2$d product","%1$s, has %2$d products",t.count,'kkart'),l,t.count),b=f?Object(i.sprintf)(Object(i._n)("%d Review","%d Reviews",t.review_count,'kkart'),t.review_count):Object(i.sprintf)(Object(i._n)("%d Product","%d Products",t.count,'kkart'),t.count);return Object(c.createElement)(s.b,o()({className:u.join(" ")},e,{showCount:!0,countLabel:b,"aria-label":d}))},messages:w,isHierarchical:!0,isSingle:g}),!!d&&Object(c.createElement)("div",{className:p.length<2?"screen-reader-text":""},Object(c.createElement)(u.SelectControl,{className:"kkart-product-categories__operator",label:Object(i.__)("Display products matching",'kkart'),help:Object(i.__)("Pick at least two categories to use this setting.",'kkart'),value:b,onChange:d,options:[{label:Object(i.__)("Any selected categories",'kkart'),value:"any"},{label:Object(i.__)("All selected categories",'kkart'),value:"all"}]})))});L.defaultProps={operator:"any",isSingle:!1};t.a=x(L)},9:function(e,t){!function(){e.exports=this.React}()},914:function(e,t,r){"use strict";r.r(t);var n=r(8),o=r.n(n),c=r(0),i=r(1),a=r(17),s=r(61),u=r(57),l=Object(c.createElement)(u.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(c.createElement)("path",{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H5.17l-.59.59-.58.58V4h16v12zm-9.5-2H18v-2h-5.5zm3.86-5.87c.2-.2.2-.51 0-.71l-1.77-1.77c-.2-.2-.51-.2-.71 0L6 11.53V14h2.47l5.89-5.87z"})),d=r(10),b=r.n(d),p=r(14),g=r(4),f=r(50),w=(r(2),r(84)),m=r(188),v=function(){return Object(c.createElement)(g.Placeholder,{className:"kkart-block-reviews-by-category",icon:Object(c.createElement)(s.a,{srcElement:l,className:"block-editor-block-icon"}),label:Object(i.__)("Reviews by Category",'kkart')},Object(i.__)("This block lists reviews for products from selected categories. The selected categories do not have any reviews yet, but they will show up here when they do.",'kkart'))},h=r(137),O=Object(g.withSpokenMessages)((function(e){var t=e.attributes,r=e.debouncedSpeak,n=e.setAttributes,o=t.editMode,a=t.categoryIds,u=function(e){var t=e.item,r=e.search,n=e.depth,o=void 0===n?0:n,a=["kkart-product-categories__item"];r.length&&a.push("is-searching"),0===o&&0!==t.parent&&a.push("is-skip-level");var s=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name;return Object(c.createElement)(f.b,b()({className:a.join(" ")},e,{showCount:!0,"aria-label":Object(i.sprintf)(Object(i._n)("%1$s, has %2$d product","%1$s, has %2$d products",t.count,'kkart'),s,t.count)}))};return!a||o?Object(c.createElement)(g.Placeholder,{icon:Object(c.createElement)(s.a,{srcElement:l,className:"block-editor-block-icon"}),label:Object(i.__)("Reviews by Category",'kkart'),className:"kkart-block-reviews-by-category"},Object(i.__)("Show product reviews from specific categories.",'kkart'),Object(c.createElement)("div",{className:"kkart-block-reviews__selection"},Object(c.createElement)(w.a,{selected:t.categoryIds,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map((function(e){return e.id}));n({categoryIds:t})},showReviewCount:!0}),Object(c.createElement)(g.Button,{isPrimary:!0,onClick:function(){n({editMode:!1}),r(Object(i.__)("Showing Reviews by Category block preview.",'kkart'))}},Object(i.__)("Done",'kkart')))):Object(c.createElement)(c.Fragment,null,Object(h.a)(o,n),Object(c.createElement)(p.InspectorControls,{key:"inspector"},Object(c.createElement)(g.PanelBody,{title:Object(i.__)("Category",'kkart'),initialOpen:!1},Object(c.createElement)(w.a,{selected:t.categoryIds,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map((function(e){return e.id}));n({categoryIds:t})},renderItem:u})),Object(c.createElement)(g.PanelBody,{title:Object(i.__)("Content",'kkart')},Object(c.createElement)(g.ToggleControl,{label:Object(i.__)("Product name",'kkart'),checked:t.showProductName,onChange:function(){return n({showProductName:!t.showProductName})}}),Object(h.b)(t,n)),Object(c.createElement)(g.PanelBody,{title:Object(i.__)("List Settings",'kkart')},Object(h.c)(t,n))),Object(c.createElement)(m.a,{attributes:t,icon:Object(c.createElement)(s.a,{srcElement:l,className:"block-editor-block-icon"}),name:Object(i.__)("Reviews by Category",'kkart'),noReviewsPlaceholder:v}))})),j=r(182),y=r(183),_=r(157);function k(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function R(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?k(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):k(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}Object(a.registerBlockType)("kkart/reviews-by-category",{title:Object(i.__)("Reviews by Category",'kkart'),icon:{src:Object(c.createElement)(s.a,{srcElement:l}),foreground:"#96588a"},category:"kkart",keywords:[Object(i.__)("Kkart",'kkart')],description:Object(i.__)("Show product reviews from specific categories.",'kkart'),supports:{html:!1},example:R(R({},_.a),{},{attributes:R(R({},_.a.attributes),{},{categoryIds:[1],showProductName:!0})}),attributes:R(R({},j.a),{},{categoryIds:{type:"array",default:[]},showProductName:{type:"boolean",default:!0}}),edit:function(e){return Object(c.createElement)(O,e)},save:y.a})},93:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(61)),i=r(144),a=r(7),s=r.n(a),u=r(4),l=r(49);r(147);t.a=function(e){var t=e.className,r=e.error,a=e.isLoading,d=e.onRetry;return Object(n.createElement)(u.Placeholder,{icon:Object(n.createElement)(c.a,{srcElement:i.a}),label:Object(o.__)("Sorry, an error occurred",'kkart'),className:s()("kkart-block-api-error",t)},Object(n.createElement)(l.a,{error:r}),d&&Object(n.createElement)(n.Fragment,null,a?Object(n.createElement)(u.Spinner,null):Object(n.createElement)(u.Button,{isDefault:!0,onClick:d},Object(o.__)("Retry",'kkart'))))}},94:function(e,t){!function(){e.exports=this.wp.date}()}});