(()=>{"use strict";const e=window.React,l=window.wp.i18n,a=window.wp.blocks,t=JSON.parse('{"NQ":"hakoniwa-blocks","L1":"Hakoniwa"}'),n=JSON.parse('{"UU":"hakoniwa-blocks/block01"}'),o=window.wp.blockEditor,c=window.wp.components,i=t.NQ,r=t.L1,m=n.UU,s=(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)("g",{style:{opacity:"0.31"}},(0,e.createElement)("circle",{cx:"12",cy:"12",r:"12"})),(0,e.createElement)("g",{style:{opacity:"0.31"}},(0,e.createElement)("path",{d:"M12,4a8,8,0,1,1-8,8,8.00907,8.00907,0,0,1,8-8m0-1a9,9,0,1,0,9,9,9,9,0,0,0-9-9Z"})),(0,e.createElement)("g",{style:{opacity:"0.31"}},(0,e.createElement)("path",{d:"M12,8a4,4,0,1,1-4,4,4.00453,4.00453,0,0,1,4-4m0-1a5,5,0,1,0,5,5,5,5,0,0,0-5-5Z"})),(0,e.createElement)("g",{style:{opacity:"0.31"}},(0,e.createElement)("path",{d:"M12,11a1,1,0,1,0,1,1,1,1,0,0,0-1-1Z"})),(0,e.createElement)("polygon",{style:{opacity:"0.64"},points:"14.837 9.212 6.509 2.567 2.497 12.059 6.509 21.552 17.47 21.552 22.95 12.059 14.837 9.212"}),(0,e.createElement)("line",{y1:"12",x2:"24",y2:"12"}),(0,e.createElement)("line",{x1:"18",y1:"2",x2:"6",y2:"22"}),(0,e.createElement)("line",{x1:"6",y1:"2",x2:"18",y2:"22"}));(0,a.registerBlockType)(m,{icon:s,category:r,edit:function(a){const{attributes:{content:t,balloonName:n,balloonType:r,balloonBgColor:m,balloonTextColor:s,balloonAlign:g,backgroundImage:b,animation:p,fontSize:u},className:d,setAttributes:E}=a,_=(0,o.useBlockProps)({className:`${d} ${g} ${r} animation-${p}`});return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(o.InspectorControls,null,(0,e.createElement)(c.PanelBody,{title:"吹き出し設定"},(0,e.createElement)(c.RangeControl,{label:(0,l.__)("文字の大きさ",i),value:u,min:16,max:100,onChange:e=>E({fontSize:e})}),(0,e.createElement)(c.RadioControl,{label:(0,l.__)("タイプ",i),help:(0,l.__)("吹き出しのタイプを指定してください。",i),selected:r,options:[{label:(0,l.__)("セリフ",i),value:"type-serif"},{label:(0,l.__)("考え中",i),value:"type-think"}],onChange:e=>E({balloonType:e})}),(0,e.createElement)(c.RadioControl,{label:(0,l.__)("配置",i),help:(0,l.__)("吹き出しの配置を指定してください。",i),selected:g,options:[{label:(0,l.__)("左",i),value:"balloon-left"},{label:(0,l.__)("右",i),value:"balloon-right"}],onChange:e=>E({balloonAlign:e})}),(0,e.createElement)(c.RadioControl,{label:(0,l.__)("アニメーション",i),help:(0,l.__)("吹き出しのアニメーションを指定してください。",i),selected:p,options:[{label:(0,l.__)("なし",i),value:"none"},{label:(0,l.__)("振動",i),value:"vibration"}],onChange:e=>E({animation:e})}),(0,e.createElement)(o.PanelColorSettings,{title:(0,l.__)("色設定",i),initialOpen:!0,colorSettings:[{value:m,onChange:e=>E({balloonBgColor:e}),label:(0,l.__)("背景カラー",i)},{value:s,onChange:e=>E({balloonTextColor:e}),label:(0,l.__)("テキストカラー",i)}]}))),(0,e.createElement)("div",{..._},(0,e.createElement)("div",{className:"image"},(0,e.createElement)(o.MediaUploadCheck,null,(0,e.createElement)(o.MediaUpload,{onSelect:e=>E({backgroundImage:e.sizes.full.url}),type:"image",className:"icon",value:b,render:({open:l})=>(0,e.createElement)(c.Button,{onClick:l,className:b?"image-button":"button button-large"},b?(0,e.createElement)("img",{className:"icon-image",src:b,alt:n||"画像アップロード"}):"アイコン選択")})),(0,e.createElement)(o.RichText,{tagName:"figcaption",onChange:e=>E({balloonName:e}),value:n,placeholder:(0,l.__)("アイコン名",i),keepPlaceholderOnFocus:!0})),(0,e.createElement)(o.RichText,{style:{background:m||"#efeedc",border:m||"#efeedc",color:s,fontSize:u+"px"},tagName:"p",onChange:e=>E({content:e}),value:t,placeholder:(0,l.__)("文字を入れてください",i)})))},save:function(l){const{attributes:{content:a,balloonName:t,balloonType:n,balloonBgColor:c,balloonTextColor:i,balloonAlign:r,backgroundImage:m,animation:s,fontSize:g},className:b}=l,p=o.useBlockProps.save({className:`${r} ${n} animation-${s}`});return(0,e.createElement)("div",{...p},(0,e.createElement)("div",{className:"image"},m?(0,e.createElement)("figure",null,(0,e.createElement)("img",{className:"icon",src:m,alt:t?`${t}`:""}),(0,e.createElement)(o.RichText.Content,{tagName:"figcaption",value:t})):""),(0,e.createElement)(o.RichText.Content,{className:"text",style:{background:c||"#f5f5f5",border:c||"#f5f5f5",color:i,fontSize:g+"px"},tagName:"p",value:a}))}})})();