(()=>{"use strict";var e,t={706(){const e=window.wp.blocks,t=window.wp.blockEditor;function r(e){var t,n,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=r(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}const n=function(){for(var e,t,n=0,o="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=r(e))&&(o&&(o+=" "),o+=t);return o},o=window.wp.element,i=window.wp.data,l=window.wp.i18n,a=window.wp.components,s=window.wp.coreData,c=window.ReactJSXRuntime;function u(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,c.jsx)("path",{fill:"currentColor",d:"M4 4h16v2H4V4zm0 5h16v2H4V9zm0 5h16v2H4v-2z"})})}function p(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,c.jsx)("path",{fill:"currentColor",d:"M4 4h7v7H4V4zm9 0h7v7h-7V4zM4 13h7v7H4v-7zm9 0h7v7h-7v-7z"})})}const d=[["clanbite/player-avatar",{avatarPreset:"medium"}],["clanbite/player-display-name"]],v=JSON.parse('{"UU":"clanbite/player-template"}');(0,e.registerBlockType)(v.UU,{edit:function({attributes:e,setAttributes:r,context:v,__unstableLayoutClassNames:h}){const{layout:w}=e,{type:b,columnCount:f=3}=w||{},m=(0,i.useSelect)(e=>{const t=e(s.store).getCurrentUser();return t?.id?Number(t.id):0},[]),y=(0,o.useMemo)(()=>{const e=v&&"object"==typeof v?{...v}:{};return m>0&&(e["clanbite/playerId"]=m),e},[v,m]),g=(0,t.useBlockProps)({className:n(h,{[`columns-${f}`]:"grid"===b&&f})}),x=(0,t.useInnerBlocksProps)({className:"clanbite-player-template__preview-inner"},{template:d,__unstableDisableLayoutClassNames:!0}),j=e=>r({layout:{...w,...e}}),k=(0,l._x)("List view","Player template block display setting","clanbite"),C=(0,l._x)("Grid view","Player template block display setting","clanbite"),O="default"===b||"constrained"===b||!b;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(t.BlockControls,{children:(0,c.jsxs)(a.ToolbarGroup,{children:[(0,c.jsx)(a.ToolbarButton,{icon:u,label:k,isPressed:O,onClick:()=>j({type:"default"})}),(0,c.jsx)(a.ToolbarButton,{icon:p,label:C,isPressed:"grid"===b,onClick:()=>j({type:"grid",columnCount:f})})]})}),(0,c.jsx)("ul",{...g,children:(0,c.jsx)(t.BlockContextProvider,{value:y,children:(0,c.jsx)("li",{...x})})})]})},save:()=>(0,c.jsx)(t.InnerBlocks.Content,{})})}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.m=t,e=[],n.O=(t,r,o,i)=>{if(!r){var l=1/0;for(u=0;u<e.length;u++){for(var[r,o,i]=e[u],a=!0,s=0;s<r.length;s++)(!1&i||l>=i)&&Object.keys(n.O).every(e=>n.O[e](r[s]))?r.splice(s--,1):(a=!1,i<l&&(l=i));if(a){e.splice(u--,1);var c=o();void 0!==c&&(t=c)}}return t}i=i||0;for(var u=e.length;u>0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[r,o,i]},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={101:0,8473:0};n.O.j=t=>0===e[t];var t=(t,r)=>{var o,i,[l,a,s]=r,c=0;if(l.some(t=>0!==e[t])){for(o in a)n.o(a,o)&&(n.m[o]=a[o]);if(s)var u=s(n)}for(t&&t(r);c<l.length;c++)i=l[c],n.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return n.O(u)},r=globalThis.webpackChunkclanbite=globalThis.webpackChunkclanbite||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var o=n.O(void 0,[8473],()=>n(706));o=n.O(o)})();