u();function u(){y(),penpot.closePlugin()}function y(){const l=penpot.library.local.colors.sort((t,n)=>t.name.toLowerCase()>n.name.toLowerCase()?1:t.name.toLowerCase()<n.name.toLowerCase()?-1:0),r=4,s=Math.ceil(l.length/r),d=r*200+Math.max(0,r-1)*10+20,h=s*100+Math.max(0,s-1)*10+20,a=penpot.createBoard();a.name="Palette";const p=penpot.viewport;if(a.x=p.center.x-d/2,a.y=p.center.y-h/2,l.length===0)return;a.resize(d,h),a.borderRadius=8;const o=a.addGridLayout();for(let t=0;t<s;t++)o.addRow("flex",1);for(let t=0;t<r;t++)o.addColumn("flex",1);o.alignItems="center",o.justifyItems="start",o.justifyContent="stretch",o.alignContent="stretch",o.rowGap=10,o.columnGap=10,o.verticalPadding=10,o.horizontalPadding=10,o.horizontalSizing="auto";for(let t=0;t<s;t++)for(let n=0;n<r;n++){const f=t*r+n,g=l[f];if(f>=l.length)return;const e=penpot.createBoard();o.appendChild(e,t+1,n+1),e.fills=[g.asFill()],e.strokes=[{strokeColor:"#000000",strokeOpacity:.3,strokeStyle:"solid"}],e.layoutChild&&(e.layoutChild.horizontalSizing="fill",e.layoutChild.verticalSizing="fill");const c=e.addFlexLayout();c.alignItems="center",c.justifyContent="center",c.verticalPadding=8,c.horizontalPadding=8;const i=penpot.createText(g.name);i.fontWeight="bold",i.fontVariantId="bold",i.growType="auto-width",i.strokes=[{strokeColor:"#FFFFFF",strokeWidth:1,strokeAlignment:"outer",strokeOpacity:.5,strokeStyle:"solid"}],e.appendChild(i)}}
