!function(){"use strict";!function(){var e=window.wp.i18n,t=window.wp.element,l=window.wp.data,n=window.wp.blocks,c=window.wp.blockEditor,o="function"==typeof c.useInnerBlocksProps?c.useInnerBlocksProps:c.__experimentalUseInnerBlocksProps,s=JSON.parse('{"u2":"loos/accordion"}'),a=React.createElement("svg",{viewBox:"0 0 56 56"},React.createElement("path",{d:"M51.5,5h-47C3.6,5,3,5.6,3,6.5v17C3,24.4,3.6,25,4.5,25h47c0.9,0,1.5-0.6,1.5-1.5v-17C53,5.6,52.4,5,51.5,5z M50,8v14H6V8 H50z"}),React.createElement("path",{d:"M51.5,31h-47C3.6,31,3,31.6,3,32.5v17C3,50.4,3.6,51,4.5,51h47c0.9,0,1.5-0.6,1.5-1.5v-17C53,31.6,52.4,31,51.5,31z M50,34 v14H6V34H50z"}),React.createElement("polygon",{points:"47,13.8 44.2,13.8 44.2,11 41.8,11 41.8,13.8 39,13.8 39,16.2 41.8,16.2 41.8,19 44.2,19 44.2,16.2 47,16.2 "}),React.createElement("polygon",{points:"47,39.8 44.2,39.8 44.2,37 41.8,37 41.8,39.8 39,39.8 39,42.2 41.8,42.2 41.8,45 44.2,45 44.2,42.2 47,42.2 "})),r=window.wp.components;const i=[{set:1,closed:"icon-arrow_drop_down",opened:"icon-arrow_drop_up"},{set:2,closed:"icon-chevron-small-down",opened:"icon-chevron-small-up"},{set:3,closed:"icon-plus",opened:"icon-minus"}];var d=({iconOpened:t,updateIcons:l})=>React.createElement(r.PanelBody,{title:(0,e.__)("アコーディオン設定","swell")},React.createElement(r.BaseControl,null,React.createElement(r.BaseControl.VisualLabel,null,(0,e.__)("アイコンセットを選択","swell")),React.createElement("small",{className:"swl-helptext--btns"},(0,e.__)("( オープン時 / クローズ時 )","swell")),React.createElement(r.ButtonGroup,{className:"swl-btns--padSmall"},i.map((e=>{const n=e.opened===t;return React.createElement(r.Button,{isPrimary:n,onClick:()=>{l({iconOpened:e.opened,iconClosed:e.closed})},key:`iconkey_${e.set}`},React.createElement("i",{className:`${e.opened} u-fz-l`}),"/",React.createElement("i",{className:`${e.closed} u-fz-l`}))})))));const p=["loos/accordion-item"],m=[["loos/accordion-item"]],u="swell-block-accordion";(0,n.registerBlockType)(s.u2,{title:(0,e.__)("アコーディオン","swell"),description:(0,e.__)("クリックで展開できるアコーディオンコンテンツを作成できます。","swell"),icon:a,styles:[{name:"default",label:(0,e.__)("デフォルト","swell"),isDefault:!0},{name:"simple",label:(0,e.__)("シンプル","swell")},{name:"border",label:(0,e.__)("囲い枠","swell")},{name:"main",label:(0,e.__)("メインカラー","swell")}],edit:({attributes:n,setAttributes:s,clientId:a})=>{const r=(0,l.useSelect)((e=>e("core/block-editor").getBlocks(a)),[a]),{updateBlockAttributes:i}=(0,l.useDispatch)("core/block-editor"),w=(0,t.useCallback)((e=>{s(e),r.forEach((t=>{i(t.clientId,e)}))}),[r]);(0,t.useEffect)((()=>{w({iconOpened:n.iconOpened,iconClosed:n.iconClosed})}),[r]);const _=(0,c.useBlockProps)({className:`${u} swl-inner-blocks`}),k=o({},{allowedBlocks:p,template:m,templateLock:!1,renderAppender:c.InnerBlocks.ButtonBlockAppender});return React.createElement(React.Fragment,null,React.createElement(c.InspectorControls,null,React.createElement(d,{iconOpened:n.iconOpened,updateIcons:w})),React.createElement("div",_,React.createElement("div",{className:"swl-parentSelector"},(0,e.__)("親ブロックを選択","swell")),k.children))},save:()=>{const e=c.useBlockProps.save({className:u});return React.createElement("div",e,React.createElement(c.InnerBlocks.Content,null))}})}()}();