@tatamicks/core 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PalettePanel-Dipvtj7D.cjs → PalettePanel-0cFP3tbA.cjs} +2 -2
- package/dist/PalettePanel-0cFP3tbA.cjs.map +1 -0
- package/dist/{PalettePanel-CtXsH6Cb.js → PalettePanel-N5Y1TJAk.js} +232 -242
- package/dist/PalettePanel-N5Y1TJAk.js.map +1 -0
- package/dist/canvas.cjs +1 -1
- package/dist/canvas.mjs +13 -13
- package/dist/index.cjs +3 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +430 -571
- package/dist/index.mjs.map +1 -1
- package/dist/{paperSettingsWidget-sLJsIUxS.cjs → paperSettingsWidget-CJ4QFjYK.cjs} +1 -1
- package/dist/{paperSettingsWidget-sLJsIUxS.cjs.map → paperSettingsWidget-CJ4QFjYK.cjs.map} +1 -1
- package/dist/{paperSettingsWidget-DgDoBA0P.js → paperSettingsWidget-d93s3Gsr.js} +1 -1
- package/dist/{paperSettingsWidget-DgDoBA0P.js.map → paperSettingsWidget-d93s3Gsr.js.map} +1 -1
- package/dist/shell.cjs +1 -1
- package/dist/shell.mjs +2 -2
- package/dist/sidebarPortal-B2Mk9Aba.js +875 -0
- package/dist/sidebarPortal-B2Mk9Aba.js.map +1 -0
- package/dist/sidebarPortal-BCIVv4yO.cjs +3 -0
- package/dist/sidebarPortal-BCIVv4yO.cjs.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/package.json +1 -1
- package/dist/PalettePanel-CtXsH6Cb.js.map +0 -1
- package/dist/PalettePanel-Dipvtj7D.cjs.map +0 -1
- package/dist/sidebarPortal-C06y4JSP.js +0 -723
- package/dist/sidebarPortal-C06y4JSP.js.map +0 -1
- package/dist/sidebarPortal-C3HszQyp.cjs +0 -1
- package/dist/sidebarPortal-C3HszQyp.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";require('./PalettePanel.css');const e=require("react/jsx-runtime"),h=require("react"),g=require("./sidebarPortal-C3HszQyp.cjs"),xt=require("react-dom"),Jt="_container_1xv5c_4",Xt="_section_1xv5c_16",Qt="_divider_1xv5c_23",en="_sectionLabel_1xv5c_31",tn="_select_1xv5c_38",nn="_numberInput_1xv5c_59",sn="_heightModeSwitch_1xv5c_87",ln="_switchLabel_1xv5c_93",an="_switchLabelActive_1xv5c_101",on="_toggle_1xv5c_105",rn="_thumb_1xv5c_122",M={container:Jt,section:Xt,divider:Qt,sectionLabel:en,select:tn,numberInput:nn,heightModeSwitch:sn,switchLabel:ln,switchLabelActive:an,toggle:on,thumb:rn},pt=t=>e.jsx("div",{className:M.divider,"aria-hidden":"true"});pt.displayName="ActionBarDivider";const Fe=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("path",{d:"M3 7.5a5 5 0 1 1 1.5 3.5"}),e.jsx("path",{d:"M3 3.5v4h4"})]});Fe.displayName="UndoIcon";const Oe=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("path",{d:"M13 7.5a5 5 0 1 0-1.5 3.5"}),e.jsx("path",{d:"M13 3.5v4h-4"})]});Oe.displayName="RedoIcon";const Ue=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("polyline",{points:"3,5 13,5"}),e.jsx("path",{d:"M6 5V3h4v2"}),e.jsx("path",{d:"M4 5l1 9h6l1-9"}),e.jsx("line",{x1:"6.5",y1:"7.5",x2:"6.5",y2:"11.5"}),e.jsx("line",{x1:"9.5",y1:"7.5",x2:"9.5",y2:"11.5"})]});Ue.displayName="TrashIcon";const Ve=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("rect",{x:"5",y:"5",width:"8",height:"9",rx:"1"}),e.jsx("path",{d:"M3 11V3h8"})]});Ve.displayName="CopyIcon";const Ce=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("rect",{x:"2",y:"6",width:"12",height:"9",rx:"1"}),e.jsx("path",{d:"M5 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"}),e.jsx("line",{x1:"8",y1:"9",x2:"8",y2:"12"}),e.jsx("line",{x1:"6.5",y1:"10.5",x2:"9.5",y2:"10.5"})]});Ce.displayName="PasteIcon";const Ge=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("rect",{x:"1",y:"4",width:"9",height:"9",rx:"1"}),e.jsx("path",{d:"M5 4V2h9v9h-2"})]});Ge.displayName="DuplicateIcon";const mt=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("rect",{x:"2",y:"5",width:"12",height:"8",rx:"1"}),e.jsx("path",{d:"M5 5V2h6v3"}),e.jsx("path",{d:"M5 12h6"}),e.jsx("path",{d:"M5 10h3"}),e.jsx("rect",{x:"4",y:"8",width:"2",height:"1.5",fill:"currentColor",stroke:"none"})]});mt.displayName="PrintIcon";const bt=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("circle",{cx:"5",cy:"5",r:"2.5"}),e.jsx("circle",{cx:"11",cy:"5",r:"2.5"}),e.jsx("circle",{cx:"5",cy:"11",r:"2.5"}),e.jsx("circle",{cx:"11",cy:"11",r:"2.5"})]});bt.displayName="StyleIcon";const vt=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("rect",{x:"1.5",y:"1.5",width:"13",height:"13",rx:"1"}),e.jsx("line",{x1:"1.5",y1:"5.5",x2:"14.5",y2:"5.5"}),e.jsx("line",{x1:"7",y1:"5.5",x2:"7",y2:"14.5"})]});vt.displayName="LayoutIcon";const ft=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("rect",{x:"2",y:"2",width:"5",height:"5",rx:"0.5"}),e.jsx("rect",{x:"9",y:"2",width:"5",height:"5",rx:"0.5"}),e.jsx("rect",{x:"2",y:"9",width:"5",height:"5",rx:"0.5"}),e.jsx("circle",{cx:"11.5",cy:"11.5",r:"2.5"}),e.jsx("line",{x1:"11.5",y1:"10",x2:"11.5",y2:"13"}),e.jsx("line",{x1:"10",y1:"11.5",x2:"13",y2:"11.5"})]});ft.displayName="BlockSettingsIcon";const jt=({size:t=16,...n})=>e.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"currentColor","aria-hidden":"true",...n,children:e.jsx("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})});jt.displayName="ChevronLeftIcon";const gt=({size:t=16,...n})=>e.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"currentColor","aria-hidden":"true",...n,children:e.jsx("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})});gt.displayName="ChevronRightIcon";const yt=({size:t=16,...n})=>e.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"currentColor","aria-hidden":"true",...n,children:e.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"})});yt.displayName="AddPageIcon";const _t=({size:t=16,...n})=>e.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"currentColor","aria-hidden":"true",...n,children:e.jsx("path",{d:"M19 13H5v-2h14v2z"})});_t.displayName="DeletePageIcon";const cn={undo:{actionId:"undo",message:"元に戻しました",shortcut:"Ctrl+Z / Cmd+Z"},redo:{actionId:"redo",message:"やり直しました",shortcut:"Ctrl+Y / Cmd+Y, Ctrl+Shift+Z / Cmd+Shift+Z"},delete:{actionId:"delete",message:"選択を削除しました",shortcut:"Delete / Backspace"},copy:{actionId:"copy",message:"選択をコピーしました",shortcut:"Ctrl+C / Cmd+C"},paste:{actionId:"paste",message:"貼り付けました",shortcut:"Ctrl+V / Cmd+V"},duplicate:{actionId:"duplicate",message:"選択を複製しました",shortcut:"Ctrl+D / Cmd+D"},select_all:{actionId:"select_all",message:"全て選択しました",shortcut:"Ctrl+A / Cmd+A"},deselect_all:{actionId:"deselect_all",message:"選択を解除しました",shortcut:null},prev_page:{actionId:"prev_page",message:"前のページへ移動しました",shortcut:null},next_page:{actionId:"next_page",message:"次のページへ移動しました",shortcut:null},add_page:{actionId:"add_page",message:"ページを追加しました",shortcut:null},delete_page:{actionId:"delete_page",message:"ページを削除しました",shortcut:null}},qe=t=>cn[t],dn="_container_1tnp6_5",un="_input_1tnp6_13",hn="_label_1tnp6_29",Le={container:dn,input:un,label:hn},ee=({value:t,onChange:n,readOnly:l=!1,label:s,config:i})=>{const a=s??(i==null?void 0:i.label),c=h.useCallback(r=>{n(r.target.checked)},[n]);return e.jsxs("label",{className:Le.container,children:[e.jsx("input",{type:"checkbox",className:Le.input,checked:!!t,onChange:c,disabled:l}),a&&e.jsx("span",{className:Le.label,children:a})]})};ee.displayName="Checkbox";const xn="_header_1c1mq_6",pn="_title_1c1mq_32",mn="_actions_1c1mq_43",bn="_titleGroup_1c1mq_49",vn="_infoIcon_1c1mq_60",fn="_chevron_1c1mq_84",jn="_chevronOpen_1c1mq_92",gn="_statusBadge_1c1mq_98",yn="_statusBadgeOn_1c1mq_108",_n="_statusBadgeOff_1c1mq_113",wn="_content_1c1mq_120",Cn="_contentNoPadding_1c1mq_127",B={header:xn,title:pn,actions:mn,titleGroup:bn,infoIcon:vn,chevron:fn,chevronOpen:jn,statusBadge:gn,statusBadgeOn:yn,statusBadgeOff:_n,content:wn,contentNoPadding:Cn},F=({title:t,children:n,collapsible:l=!1,defaultCollapsed:s=!0,isOpen:i,onOpenChange:a,description:c,actions:r,openLabel:o,closeLabel:d,noPadding:x=!1})=>{const[u,v]=h.useState(l?s:!1),b=i!==void 0,p=b?!i:u,f=()=>{const k=p;b||v(!k),a==null||a(k)},j=!l||!p,_=x?B.contentNoPadding:B.content,I=l?p?d:o:void 0;return e.jsxs("div",{className:B.section,children:[l?e.jsxs("button",{type:"button",className:B.header,onClick:f,"aria-expanded":!p,children:[e.jsxs("span",{className:B.titleGroup,children:[e.jsx("span",{className:B.title,children:t}),c&&e.jsx("span",{className:B.infoIcon,title:c,role:"img","aria-label":c,children:"i"})]}),r&&e.jsx("span",{role:"none",className:B.actions,onClick:k=>k.stopPropagation(),children:r}),I&&e.jsx("span",{className:`${B.statusBadge} ${p?B.statusBadgeOff:B.statusBadgeOn}`,"aria-hidden":"true",children:I}),e.jsx("span",{className:`${B.chevron} ${p?"":B.chevronOpen}`,"aria-hidden":!0,children:"▾"})]}):e.jsxs("div",{className:B.header,children:[e.jsxs("span",{className:B.titleGroup,children:[e.jsx("span",{className:B.title,children:t}),c&&e.jsx("span",{className:B.infoIcon,title:c,role:"img","aria-label":c,children:"i"})]}),r&&e.jsx("span",{className:B.actions,children:r})]}),j&&e.jsx("div",{className:_,children:n})]})};F.displayName="CollapsibleSection";function je(t){if(!t)return null;const n=t.match(/^#([0-9a-f]{6}|[0-9a-f]{8})$/i);if(n&&typeof n[1]=="string"){const s=n[1],i=Number.parseInt(s.slice(0,2),16),a=Number.parseInt(s.slice(2,4),16),c=Number.parseInt(s.slice(4,6),16),r=s.length===8?Number.parseInt(s.slice(6,8),16)/255:1;return{r:i,g:a,b:c,a:r}}const l=t.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)$/);if(l){const s=Number.parseInt(l[1]??"",10),i=Number.parseInt(l[2]??"",10),a=Number.parseInt(l[3]??"",10),c=l[4]?Number.parseFloat(l[4]):1;return{r:s,g:i,b:a,a:c}}return null}function Nn(t){const{r:n,g:l,b:s,a:i}=t;if(i===0)return;const a=n.toString(16).padStart(2,"0"),c=l.toString(16).padStart(2,"0"),r=s.toString(16).padStart(2,"0");if(i<1){const o=Math.round(i*255).toString(16).padStart(2,"0");return`#${a}${c}${r}${o}`}return`#${a}${c}${r}`}const Sn=[{label:"無色",value:void 0},{label:"白",value:"#ffffff"},{label:"グレー1",value:"#efefef"},{label:"グレー2",value:"#d9d9d9"},{label:"グレー3",value:"#cccccc"},{label:"グレー4",value:"#b7b7b7"},{label:"グレー5",value:"#999999"},{label:"グレー6",value:"#666666"},{label:"グレー7",value:"#434343"},{label:"黒",value:"#000000"},{label:"薄茶",value:"#E6B8AF"},{label:"薄赤",value:"#F4CCCC"},{label:"薄橙",value:"#FCE5CD"},{label:"薄黄",value:"#FFF2CC"},{label:"薄緑",value:"#D9EAD3"},{label:"薄青緑",value:"#D0E0E3"},{label:"薄青",value:"#C9DAF8"},{label:"薄青紫",value:"#CFE2F3"},{label:"薄紫",value:"#D9D2E9"},{label:"薄赤紫",value:"#EAD1DC"},{label:"茶",value:"#DD7E6B"},{label:"赤",value:"#EA9999"},{label:"橙",value:"#F9CB9C"},{label:"黄",value:"#FFE599"},{label:"緑",value:"#B6D7A8"},{label:"青緑",value:"#A2C4C9"},{label:"青",value:"#A4C2F4"},{label:"青紫",value:"#9FC5E8"},{label:"紫",value:"#B4A7D6"},{label:"赤紫",value:"#D5A6BD"}],kn="_container_1cdzu_5",In="_colorButton_1cdzu_13",$n="_textInputWrapper_1cdzu_40",Ln="_textInputPrefix_1cdzu_62",Tn="_textInput_1cdzu_40",Pn="_popover_1cdzu_96",An="_palette_1cdzu_112",Mn="_paletteButton_1cdzu_119",En="_selected_1cdzu_142",Dn="_transparentPaletteButton_1cdzu_148",zn="_rgbaInputs_1cdzu_154",Bn="_rgbaInputGroup_1cdzu_161",Rn="_rgbaLabel_1cdzu_175",z={container:kn,colorButton:In,textInputWrapper:$n,textInputPrefix:Ln,textInput:Tn,popover:Pn,palette:An,paletteButton:Mn,selected:En,transparentPaletteButton:Dn,rgbaInputs:zn,rgbaInputGroup:Bn,rgbaLabel:Rn},wt=({onColorSelect:t,selectedColor:n,readOnly:l=!1})=>e.jsx("div",{className:z.palette,children:Sn.map((s,i)=>{const a=s.value===void 0,c=s.value===n,r=a?{}:{backgroundColor:s.value};return e.jsx("button",{type:"button",className:`${z.paletteButton} ${a?z.transparentPaletteButton:""} ${c?z.selected:""}`,onClick:()=>t(s.value),disabled:l,title:s.label,"aria-label":s.label,style:r},s.value??`undefined-${i}`)})});wt.displayName="ColorPalette";const Wn="_input_14n56_5",Fn={input:Wn},U=({value:t,onChange:n,readOnly:l=!1,min:s,max:i,step:a,integer:c,placeholder:r,width:o,height:d,ariaLabel:x,config:u,onBlur:v})=>{const b=s??(u==null?void 0:u.min)??1,p=i??(u==null?void 0:u.max),f=a??(u==null?void 0:u.step)??1,j=c??(u==null?void 0:u.integer)??!1,_=r??(u==null?void 0:u.placeholder),I=o??(u==null?void 0:u.width),k=d??(u==null?void 0:u.height),$=h.useCallback(N=>{const m=N.target.value;if(m===""){n(void 0);return}let y=Number.parseFloat(m);Number.isNaN(y)||(j&&(y=Math.round(y)),b!==void 0&&y<b&&(y=b),p!==void 0&&y>p&&(y=p),n(y))},[n,b,p,j]),S={};return I!==void 0&&(S.width=`${I}px`),k!==void 0&&(S.height=`${k}px`,S.paddingTop=0,S.paddingBottom=0),e.jsx("input",{type:"number",className:Fn.input,style:S,value:t??"",onChange:$,onBlur:v,disabled:l,min:b,max:p,step:f,placeholder:_,"aria-label":x})};U.displayName="NumberInput";const Ct=({rgba:t,onChange:n,readOnly:l=!1})=>e.jsxs("div",{className:z.rgbaInputs,children:[e.jsxs("div",{className:z.rgbaInputGroup,children:[e.jsx("span",{className:z.rgbaLabel,children:"R"}),e.jsx(U,{value:t.r,onChange:s=>n("r",s),min:0,max:255,step:1,integer:!0,width:48,readOnly:l})]}),e.jsxs("div",{className:z.rgbaInputGroup,children:[e.jsx("span",{className:z.rgbaLabel,children:"G"}),e.jsx(U,{value:t.g,onChange:s=>n("g",s),min:0,max:255,step:1,integer:!0,width:48,readOnly:l})]}),e.jsxs("div",{className:z.rgbaInputGroup,children:[e.jsx("span",{className:z.rgbaLabel,children:"B"}),e.jsx(U,{value:t.b,onChange:s=>n("b",s),min:0,max:255,step:1,integer:!0,width:48,readOnly:l})]}),e.jsxs("div",{className:z.rgbaInputGroup,children:[e.jsx("span",{className:z.rgbaLabel,children:"A"}),e.jsx(U,{value:Math.round(t.a*100),onChange:s=>n("a",s!==void 0?s/100:void 0),min:0,max:100,step:1,integer:!0,width:48,readOnly:l})]})]});Ct.displayName="RGBAInputs";const Nt=({isOpen:t,onClose:n,rgba:l,onRgbaChange:s,onColorSelect:i,selectedColor:a,readOnly:c=!1})=>{const r=h.useRef(null);return h.useEffect(()=>{if(!t)return;const o=d=>{r.current&&!r.current.contains(d.target)&&n()};return document.addEventListener("mousedown",o),()=>{document.removeEventListener("mousedown",o)}},[t,n]),t?e.jsxs("div",{className:z.popover,ref:r,style:{zIndex:g.Z_INDEX.DROPDOWN},children:[e.jsx(wt,{onColorSelect:i,selectedColor:a,readOnly:c}),e.jsx(Ct,{rgba:l,onChange:s,readOnly:c})]}):null};Nt.displayName="ColorPickerPopover";const X=({value:t,onChange:n,readOnly:l=!1,showTextInput:s=!0,allowUndefined:i,placeholder:a,width:c,height:r,config:o})=>{const d=i??(o==null?void 0:o.allowUndefined)??!0,x=a??(d?"未設定":"#000000"),u=c??(o==null?void 0:o.width),v=r??(o==null?void 0:o.height),[b,p]=h.useState(!1),f=h.useRef(null),[j,_]=h.useState(()=>je(t)??{r:0,g:0,b:0,a:1});h.useEffect(()=>{const T=je(t);T&&_(T)},[t]);const I=h.useCallback(()=>{l||p(T=>!T)},[l]),[k,$]=h.useState(t?t.replace(/^#/,""):"");h.useEffect(()=>{$(t?t.replace(/^#/,""):"")},[t]);const S=h.useCallback(T=>{const D=T.target.value;/^[0-9A-Fa-f]*$/.test(D)&&$(D)},[]),N=h.useCallback(T=>{if(T===""&&d){n(void 0);return}if(/^[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/.test(T)){const D=`#${T}`,Z=je(D);Z&&_(Z),n(D)}else $(t?t.replace(/^#/,""):"")},[n,d,t]),m=h.useCallback(T=>{N(T.target.value)},[N]),y=h.useCallback(T=>{T.key==="Enter"&&(T.preventDefault(),N(T.currentTarget.value),T.currentTarget.blur())},[N]),w=h.useCallback(T=>{if(T){const D=je(T);D&&(_(D),$(T.replace(/^#/,"")))}else $("");n(T)},[n]),C=h.useCallback((T,D)=>{if(D===void 0)return;const Z={...j,[T]:D};_(Z),n(Nn(Z))},[j,n]),L=t??"未設定",E={};t&&(E.background=t);const P={};return u!==void 0?P.width=`${u}px`:P.width="100%",v!==void 0&&(P.height=`${v}px`),e.jsxs("div",{className:z.container,style:P,ref:f,children:[e.jsx("button",{type:"button",className:z.colorButton,onClick:I,disabled:l,title:L,"aria-label":"カラーピッカーを開く",style:E}),s&&e.jsxs("div",{className:z.textInputWrapper,children:[e.jsx("span",{className:z.textInputPrefix,children:"#"}),e.jsx("input",{type:"text",className:z.textInput,value:k,onChange:S,onKeyDown:y,onBlur:m,disabled:l,placeholder:x,maxLength:8})]}),e.jsx(Nt,{isOpen:b,onClose:()=>p(!1),rgba:j,onRgbaChange:C,onColorSelect:w,selectedColor:t,readOnly:l})]})};X.displayName="ColorPicker";const On="_container_1n9lj_5",Un="_valueInput_1n9lj_23",Vn="_unitSelect_1n9lj_45",Te={container:On,valueInput:Un,unitSelect:Vn},W=t=>{const{value:n,onChange:l,readOnly:s=!1,config:i}=t,a=t.allowedUnits??(i==null?void 0:i.allowedUnits),c=t.min??(i==null?void 0:i.min),r=t.max??(i==null?void 0:i.max),o=t.step??(i==null?void 0:i.step)??1,d=t.placeholder??(i==null?void 0:i.placeholder),x=t.width??(i==null?void 0:i.width),u=t.height??(i==null?void 0:i.height),v=t.ariaLabel,b=(n==null?void 0:n.unit)??(a==null?void 0:a[0]),p=h.useCallback($=>{const S=$.target.value,N=(n==null?void 0:n.unit)??b;if(N===void 0)return;let m=Number.parseFloat(S);if(Number.isNaN(m))return;const y=c??1;m<y&&(m=y),r!==void 0&&m>r&&(m=r),l({value:m,unit:N})},[n,l,b,c,r]),f=h.useCallback($=>{const S=$.target.value;if(S==="")return;const N=(n==null?void 0:n.unit)??b;if(N===void 0)return;let m=Number.parseFloat(S);if(Number.isNaN(m))return;const y=c??1;m<y&&(m=y,l({value:m,unit:N})),r!==void 0&&m>r&&(m=r,l({value:m,unit:N}))},[n,l,b,c,r]),j=h.useCallback($=>{const S=$.target.value;l({value:(n==null?void 0:n.value)??1,unit:S})},[n,l]),_=(n==null?void 0:n.value)??"",I=(n==null?void 0:n.unit)??b??"",k={};return x!==void 0?k.width=`${x}px`:k.width="100%",u!==void 0&&(k.height=`${u}px`),e.jsxs("div",{className:Te.container,style:k,children:[e.jsx("input",{type:"number",className:Te.valueInput,value:_,onChange:p,onBlur:f,placeholder:d,min:c??1,max:r,step:o,readOnly:s,disabled:s,"aria-label":v}),e.jsx("select",{className:Te.unitSelect,value:I,onChange:j,disabled:s||!a||a.length<=1,"aria-label":"単位",children:a?a.map($=>e.jsx("option",{value:$,children:$},$)):e.jsx("option",{value:I,children:I})})]})},Gn="_container_14f2v_5",qn="_select_14f2v_11",Hn="_placeholderOverlay_14f2v_44",Pe={container:Gn,select:qn,placeholderOverlay:Hn},oe=t=>{const{value:n,onChange:l,readOnly:s=!1,config:i}=t,a=t.options??(i==null?void 0:i.options)??[],c=t.placeholder??(i==null?void 0:i.placeholder)??"選択してください",r=t.width??(i==null?void 0:i.width),o=t.height??(i==null?void 0:i.height),d=t.allowEmpty??(i==null?void 0:i.allowEmpty)??!0,x=h.useCallback(f=>{const j=f.target.value;if(j==="")l(void 0);else{const _=a.find(I=>String(I.value)===j);l(_?_.value:j)}},[l,a]),u=n??"",v=n!==void 0&&n!=="",b={};r!==void 0?b.width=`${r}px`:b.width="100%";const p={width:"100%",height:o?`${o}px`:void 0};return e.jsxs("div",{className:Pe.container,style:b,children:[!v&&e.jsx("div",{className:Pe.placeholderOverlay,style:p,children:c}),e.jsxs("select",{className:Pe.select,style:p,value:u,onChange:x,disabled:s,"aria-label":t.ariaLabel,children:[d&&e.jsx("option",{value:"",style:{display:"none"}}),a.map(f=>e.jsx("option",{value:String(f.value),children:f.label},String(f.value)))]})]})};oe.displayName="Dropdown";const Zn="_button_16snt_1",Kn={button:Zn},q=({icon:t,label:n,onClick:l,onMouseEnter:s,disabled:i,title:a,preventFocusOnMouseDown:c=!1})=>e.jsx("button",{type:"button",className:Kn.button,onMouseDown:c?r=>r.preventDefault():void 0,onMouseEnter:s,onClick:l,disabled:i,title:a??n,"aria-label":n,children:t});q.displayName="IconActionButton";const Yn="_container_ytzac_4",Jn="_scrollArea_ytzac_21",Xn="_emptyState_ytzac_29",Ae={container:Yn,scrollArea:Jn,emptyState:Xn},He=({children:t,emptyMessage:n,className:l})=>e.jsx("div",{className:`${Ae.container} ${l||""}`,children:t?e.jsx("div",{className:Ae.scrollArea,children:t}):n&&e.jsx("div",{className:Ae.emptyState,children:n})}),Qn="_root_vttth_1",es="_list_vttth_9",ts="_trigger_vttth_24",ns="_content_vttth_69",Ne={root:Qn,list:es,trigger:ts,content:ns},Se=h.createContext(void 0),St=({defaultValue:t,value:n,onValueChange:l,children:s,variant:i="default",className:a=""})=>{const[c,r]=h.useState(t),o=n??c,d=x=>{r(x),l==null||l(x)};return e.jsx(Se.Provider,{value:{value:o,onChange:d,variant:i},children:e.jsx("div",{className:`${Ne.root} ${a}`,"data-variant":i,children:s})})},kt=({children:t,className:n="",width:l,height:s,style:i})=>{const a=h.useContext(Se);if(!a)throw new Error("TabsList must be used within a Tabs component");const{variant:c}=a,r={...i};return l!==void 0&&(r.width=`${l}px`),s!==void 0&&(r.height=`${s}px`),e.jsx("div",{className:`${Ne.list} ${n}`,"data-variant":c,style:r,children:t})},de=({value:t,children:n,className:l="",disabled:s=!1,width:i,height:a,style:c})=>{const r=h.useContext(Se);if(!r)throw new Error("TabsTrigger must be used within a Tabs component");const{value:o,onChange:d,variant:x}=r,u=o===t,v={...c};return i!==void 0&&(v.width=`${i}px`),a!==void 0&&(v.height=`${a}px`),e.jsx("button",{className:`${Ne.trigger} ${l}`,"data-state":u?"active":"inactive","data-variant":x,onClick:()=>d(t),disabled:s,type:"button",style:v,children:n})},ue=({value:t,children:n,className:l=""})=>{const s=h.useContext(Se);if(!s)throw new Error("TabsContent must be used within a Tabs component");const{value:i}=s;return i!==t?null:e.jsx("div",{className:`${Ne.content} ${l}`,children:n})},ss="_input_jxjyc_5",ls={input:ss},he=({value:t,onChange:n,readOnly:l=!1,placeholder:s,maxLength:i,multiline:a,rows:c,width:r,height:o,ariaLabel:d,config:x,onBlur:u})=>{const v=s??(x==null?void 0:x.placeholder),b=i??(x==null?void 0:x.maxLength),p=a??(x==null?void 0:x.multiline)??!1,f=c??(x==null?void 0:x.rows)??3,j=h.useCallback(k=>{n(k.target.value)},[n]),_={};r!==void 0?_.width=`${r}px`:_.width="100%",o!==void 0&&(_.height=`${o}px`);const I={className:ls.input,style:_,value:t??"",onChange:j,disabled:l,placeholder:v,maxLength:b,"aria-label":d};return p?e.jsx("textarea",{...I,rows:f}):e.jsx("input",{...I,type:"text",onBlur:u})};he.displayName="TextInput";const It=({actionContext:t,onActionFeedback:n,onPrint:l})=>{const s=t.isEnabled("undo"),i=t.isEnabled("redo"),a=t.isEnabled("paste"),c=h.useCallback(r=>{t.execute(r);const o=qe(r);o&&(n==null||n(o))},[t,n]);return e.jsxs(e.Fragment,{children:[e.jsx(q,{icon:e.jsx(Fe,{"aria-hidden":"true"}),label:"元に戻す",title:"元に戻す (Ctrl+Z / Cmd+Z)",onClick:()=>c("undo"),disabled:!s,preventFocusOnMouseDown:!0}),e.jsx(q,{icon:e.jsx(Oe,{"aria-hidden":"true"}),label:"やり直し",title:"やり直し (Ctrl+Y / Cmd+Y)",onClick:()=>c("redo"),disabled:!i,preventFocusOnMouseDown:!0}),e.jsx(q,{icon:e.jsx(Ce,{"aria-hidden":"true"}),label:"貼り付け",title:"貼り付け (Ctrl+V / Cmd+V)",onClick:()=>c("paste"),disabled:!a,preventFocusOnMouseDown:!0}),e.jsx(q,{icon:e.jsx(mt,{"aria-hidden":"true"}),label:"印刷",title:"印刷 (Ctrl+P)",onClick:()=>l?l():window.print(),preventFocusOnMouseDown:!0})]})};It.displayName="CanvasActionSection";const ot={value:1,unit:"fr"},$t=({grid:t,onGridChange:n})=>{const l=h.useCallback(i=>{const a=parseInt(i.target.value,10);if(!a||a<1||a>100)return;const c=g.expandSparseCols(t),r=t.colCount,o=[...c];if(a>r)for(let d=r;d<a;d++)o.push({...ot});else o.splice(a);n({...t,...g.colsToSparse(o)})},[t,n]),s=h.useCallback(i=>{const a=parseInt(i.target.value,10);if(!a||a<1||a>100)return;const c=g.expandSparseRows(t),r=t.rowCount,o=[...c];if(a>r)for(let d=r;d<a;d++)o.push({...ot});else o.splice(a);n({...t,...g.rowsToSparse(o)})},[t,n]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:M.sectionLabel,children:"列"}),e.jsx("input",{type:"number",className:M.numberInput,value:t.colCount,min:1,max:100,onChange:l,"aria-label":"列数",title:"列数"}),e.jsx("span",{className:M.sectionLabel,children:"行"}),e.jsx("input",{type:"number",className:M.numberInput,value:t.rowCount,min:1,max:100,onChange:s,"aria-label":"行数",title:"行数"})]})};$t.displayName="GridSettingsSection";function ge(t,n){switch(n){case"cm":return t/10;case"inch":return t/25.4;default:return t}}const is=[{value:g.PaperSizePreset.A4,label:"A4"},{value:g.PaperSizePreset.A3,label:"A3"},{value:g.PaperSizePreset.B5,label:"B5"},{value:g.PaperSizePreset.LETTER,label:"Letter"},{value:g.PaperSizePreset.LEGAL,label:"Legal"},{value:g.PaperSizePreset.CUSTOM,label:"カスタム"}],Lt=({paper:t,onPaperChange:n})=>{const l=t.size.preset===g.PaperSizePreset.CUSTOM,s=t.autoHeight===!0,i=t.autoWidth===!0,a=h.useCallback(u=>{const v=u.target.value;v&&n({...t,size:{...g.DEFAULT_PAPER_SIZES[v]}})},[t,n]),c=h.useCallback(({target:u})=>{const v=Number(u.value);if(!v||v<=0)return;const b=g.toMm.fromDim(t.margin.left)+g.toMm.fromDim(t.margin.right),p=ge(b,t.size.width.unit);if(v<p)return;const f={...t.size,width:{...t.size.width,value:v}};n({...t,size:f})},[t,n]),r=h.useCallback(({target:u})=>{const v=Number(u.value);if(!v||v<=0)return;const b=g.toMm.fromDim(t.margin.top)+g.toMm.fromDim(t.margin.bottom),p=ge(b,t.size.height.unit);if(v<p)return;const f={...t.size,height:{...t.size.height,value:v}};n({...t,size:f})},[t,n]),o=h.useCallback(({target:u})=>{const v=u.value,b={...t.size,width:{...t.size.width,unit:v},height:{...t.size.height,unit:v}};n({...t,size:b})},[t,n]),d=h.useCallback(()=>{n({...t,autoHeight:s?void 0:!0})},[t,s,n]),x=h.useCallback(()=>{n({...t,autoWidth:i?void 0:!0})},[t,i,n]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:M.sectionLabel,children:"用紙"}),e.jsx("select",{className:M.select,value:t.size.preset,onChange:a,"aria-label":"用紙サイズ",title:"用紙サイズ",children:is.map(u=>e.jsx("option",{value:u.value,children:u.label},u.value))}),e.jsxs("div",{className:M.heightModeSwitch,children:[e.jsx("span",{className:`${M.switchLabel} ${s?"":M.switchLabelActive}`,children:"固定"}),e.jsx("button",{type:"button",role:"switch","aria-checked":s,"aria-label":"高さモード",className:M.toggle,onClick:d,children:e.jsx("span",{className:M.thumb})}),e.jsx("span",{className:`${M.switchLabel} ${s?M.switchLabelActive:""}`,children:"自動"})]}),e.jsxs("div",{className:M.heightModeSwitch,children:[e.jsx("span",{className:`${M.switchLabel} ${i?"":M.switchLabelActive}`,children:"幅固定"}),e.jsx("button",{type:"button",role:"switch","aria-checked":i,"aria-label":"幅モード",className:M.toggle,onClick:x,children:e.jsx("span",{className:M.thumb})}),e.jsx("span",{className:`${M.switchLabel} ${i?M.switchLabelActive:""}`,children:"幅自動"})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"number",className:M.numberInput,value:t.size.width.value,min:ge(g.toMm.fromDim(t.margin.left)+g.toMm.fromDim(t.margin.right),t.size.width.unit),max:9999,step:.5,onChange:c,"aria-label":"用紙幅",title:"幅"}),e.jsx("span",{className:M.sectionLabel,children:"×"}),e.jsx("input",{type:"number",className:M.numberInput,value:t.size.height.value,min:ge(g.toMm.fromDim(t.margin.top)+g.toMm.fromDim(t.margin.bottom),t.size.height.unit),max:9999,step:.5,onChange:r,"aria-label":"用紙高さ",title:"高さ"}),e.jsxs("select",{className:M.select,value:t.size.width.unit,onChange:o,"aria-label":"用紙単位",title:"単位",children:[e.jsx("option",{value:"mm",children:"mm"}),e.jsx("option",{value:"cm",children:"cm"}),e.jsx("option",{value:"inch",children:"inch"})]})]})]})};Lt.displayName="PaperSettingsSection";function Q(t,n,l){const s=n.split("."),i=(a,c)=>{const r=s[c];if(c===s.length-1){if(l==null){const{[r]:x,...u}=a;return u}return{...a,[r]:l}}const o=(a==null?void 0:a[r])??{},d=i(o,c+1);if(Object.keys(d).length===0){const{[r]:x,...u}=a;return u}return{...a,[r]:d}};return i(t,0)}function H(t,n){if(t.length===0)return;const l=(c,r)=>{let o=c;for(const d of r){if(o==null||typeof o!="object"||Array.isArray(o))return;o=o[d]}return o},s=n.split("."),i=l(t[0],s);return t.every(c=>l(c,s)===i)?i:void 0}function as(t,n,l){var a,c;if(!t)return[];const s=[],i=[{key:"top",style:t.top,x1:0,y1:0,x2:n,y2:0},{key:"right",style:t.right,x1:n,y1:0,x2:n,y2:l},{key:"bottom",style:t.bottom,x1:0,y1:l,x2:n,y2:l},{key:"left",style:t.left,x1:0,y1:0,x2:0,y2:l}];for(const{key:r,style:o,x1:d,y1:x,x2:u,y2:v}of i){if(!(o!=null&&o.type))continue;const b=((a=o.width)==null?void 0:a.unit)==="px"?o.width.value:((c=o.width)==null?void 0:c.value)??1,p=o.type===g.LineType.DASHED?"8 4":o.type===g.LineType.DOTTED?"2 4":void 0;s.push(e.jsx("line",{x1:d,y1:x,x2:u,y2:v,stroke:o.color??"#000",strokeWidth:b,strokeDasharray:p},r))}return s}function os(t){const n=t==null?void 0:t.border;if(!n)return;const l=i=>{const a=n[i]??n.all;if(a!=null&&a.type)return a},s={top:l("top"),right:l("right"),bottom:l("bottom"),left:l("left")};if(!(!s.top&&!s.right&&!s.bottom&&!s.left))return s}const ke=({selectedBlocks:t,onUpdateBlocks:n})=>{const l=x=>{const u={};for(const v of t)u[v.id]={style:{...v.style,backgroundColor:x}};n(u)},s=(x,u,v)=>{var f,j,_;const b={},p=x==="all"?["top","right","bottom","left"]:[x];for(const I of t){let k=I.style||{};for(const $ of p){if(k=Q(k,`border.${$}.${u}`,v),u==="type"&&v==null&&(k=Q(k,`border.${$}.width`,null),k=Q(k,`border.${$}.color`,null)),u==="type"&&v!==void 0&&v!==null){const S=(f=I.style)==null?void 0:f.border,N=S==null?void 0:S[$];N!=null&&N.width||(k=Q(k,`border.${$}.width`,{value:1,unit:"px"})),N!=null&&N.color||(k=Q(k,`border.${$}.color`,"#000000"))}if(u==="color"&&v!==void 0&&v!==null){const S=(j=I.style)==null?void 0:j.border,N=S==null?void 0:S[$];N!=null&&N.type||(k=Q(k,`border.${$}.type`,g.LineType.SOLID)),N!=null&&N.width||(k=Q(k,`border.${$}.width`,{value:1,unit:"px"}))}if(u==="width"&&v!==void 0&&v!==null){const S=(_=I.style)==null?void 0:_.border,N=S==null?void 0:S[$];N!=null&&N.type||(k=Q(k,`border.${$}.type`,g.LineType.SOLID)),N!=null&&N.color||(k=Q(k,`border.${$}.color`,"#000000"))}}b[I.id]={style:k}}n(b)},i=H(t,"style.backgroundColor"),a=h.useMemo(()=>{if(t.length!==1)return;const x=t[0];return os(x==null?void 0:x.style)},[t]),c=h.useMemo(()=>as(a,80,80),[a]);if(t.length===0)return null;const r=x=>x==="all"?"top":x,o=x=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[e.jsx(oe,{value:H(t,`style.border.${r(x)}.type`),onChange:u=>s(x,"type",u??null),placeholder:"スタイル",height:24,options:[{label:"",value:null},{label:"実線",value:g.LineType.SOLID},{label:"破線",value:g.LineType.DASHED},{label:"点線",value:g.LineType.DOTTED}]}),e.jsx(W,{value:H(t,`style.border.${r(x)}.width`),onChange:u=>s(x,"width",u),placeholder:"太さ",height:24,allowedUnits:g.BORDER_UNITS,min:1}),e.jsx(X,{value:H(t,`style.border.${r(x)}.color`)??void 0,onChange:u=>s(x,"color",u??null),showTextInput:!0,allowUndefined:!0,height:24})]}),d={flex:1,padding:"0 2px",fontSize:"12px",minWidth:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"};return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"88px 1fr",gridTemplateRows:"auto auto",gap:"4px",padding:"4px"},children:[e.jsx("div",{style:{gridRow:"1 / 3",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("div",{style:{width:"80px",height:"80px",borderRadius:"0.25rem",display:"flex",alignItems:"center",justifyContent:"center",position:"relative",backgroundColor:i??"transparent"},children:[e.jsxs("svg",{width:"80",height:"80",viewBox:"0 0 80 80",style:{position:"absolute",top:0,left:0,opacity:.3,pointerEvents:"none"},children:[e.jsx("title",{children:"枠線ガイド"}),e.jsx("line",{x1:"40",y1:"0",x2:"40",y2:"80",stroke:"#9ca3af",strokeWidth:"1",strokeDasharray:"4 2"}),e.jsx("line",{x1:"0",y1:"40",x2:"80",y2:"40",stroke:"#9ca3af",strokeWidth:"1",strokeDasharray:"4 2"})]}),c.length>0?e.jsxs("svg",{width:"80",height:"80",viewBox:"0 0 80 80",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[e.jsx("title",{children:"枠線プレビュー"}),c]}):e.jsxs("svg",{width:"80",height:"80",viewBox:"0 0 80 80",style:{position:"absolute",top:0,left:0,opacity:.3},children:[e.jsx("title",{children:"枠線未設定"}),e.jsx("rect",{x:"0",y:"0",width:"80",height:"80",fill:"none",stroke:"#9ca3af",strokeWidth:"1",strokeDasharray:"4 2"})]})]})}),e.jsx(X,{value:i,onChange:x=>l(x),showTextInput:!0,allowUndefined:!0}),e.jsx("div",{style:{minWidth:0},children:e.jsxs(St,{defaultValue:"all",variant:"segmented",children:[e.jsx("div",{style:{width:"100%"},children:e.jsxs(kt,{style:{width:"100%",display:"flex"},children:[e.jsx(de,{value:"all",height:24,style:d,children:"共通"}),e.jsx(de,{value:"top",height:24,style:d,children:"上"}),e.jsx(de,{value:"bottom",height:24,style:d,children:"下"}),e.jsx(de,{value:"left",height:24,style:d,children:"左"}),e.jsx(de,{value:"right",height:24,style:d,children:"右"})]})}),e.jsxs("div",{style:{marginTop:"4px"},children:[e.jsx(ue,{value:"all",children:o("all")}),e.jsx(ue,{value:"top",children:o("top")}),e.jsx(ue,{value:"bottom",children:o("bottom")}),e.jsx(ue,{value:"left",children:o("left")}),e.jsx(ue,{value:"right",children:o("right")})]})]})})]})};ke.displayName="BackgroundBorderPanel";const rs="_container_1gf2q_1",cs="_grid_1gf2q_9",ds="_field_1gf2q_15",us="_label_1gf2q_22",hs="_inputWrapper_1gf2q_32",V={container:rs,grid:cs,field:ds,label:us,inputWrapper:hs},Ie=({selectedBlocks:t,onUpdateBlocks:n,gridSize:l})=>{if(t.length===0)return null;const s=t.length>1,i=s?Math.min(...t.map(r=>r.layout.x)):void 0,a=s?Math.min(...t.map(r=>r.layout.y)):void 0,c=(r,o)=>{if(o===void 0)return;const d={};if(s&&(r==="x"||r==="y")){const x=r==="x"?i:a;if(x===void 0)return;const u=Math.max(...t.map(_=>_.layout.x+_.layout.w)),v=Math.max(...t.map(_=>_.layout.y+_.layout.h)),b=u-(i??0),p=v-(a??0);let f=o;r==="x"&&l?f=Math.max(0,Math.min(o,l.cols-b)):r==="y"&&l?f=Math.max(0,Math.min(o,l.rows-p)):f=Math.max(0,o);const j=f-x;t.forEach(_=>{const I=_.layout[r]+j;d[_.id]={layout:{..._.layout,[r]:I}}})}else t.forEach(x=>{let u=o;if(r==="x"&&l)u=Math.max(0,Math.min(o,l.cols-x.layout.w));else if(r==="y"&&l)u=Math.max(0,Math.min(o,l.rows-x.layout.h));else if(r==="w"&&l){const v=l.cols-x.layout.x;u=Math.max(1,Math.min(o,v))}else if(r==="h"&&l){const v=l.rows-x.layout.y;u=Math.max(1,Math.min(o,v))}else r==="w"||r==="h"?u=Math.max(1,o):u=Math.max(0,o);d[x.id]={layout:{...x.layout,[r]:u}}});n(d,{mergeKey:g.layoutPanelKey(r,t.map(x=>x.id))})};return e.jsx("div",{className:V.container,children:e.jsxs("div",{className:V.grid,children:[e.jsxs("div",{className:V.field,children:[e.jsx("span",{className:V.label,children:"X"}),e.jsx("div",{className:V.inputWrapper,children:e.jsx(U,{value:s?i:H(t,"layout.x"),onChange:r=>c("x",r),min:0,max:l?l.cols-1:void 0,integer:!0,height:22,placeholder:"-"})})]}),e.jsxs("div",{className:V.field,children:[e.jsx("span",{className:V.label,children:"Y"}),e.jsx("div",{className:V.inputWrapper,children:e.jsx(U,{value:s?a:H(t,"layout.y"),onChange:r=>c("y",r),min:0,max:l?l.rows-1:void 0,integer:!0,height:22,placeholder:"-"})})]}),e.jsxs("div",{className:V.field,children:[e.jsx("span",{className:V.label,children:"W"}),e.jsx("div",{className:V.inputWrapper,children:e.jsx(U,{value:H(t,"layout.w"),onChange:r=>c("w",r),min:1,max:l?l.cols:void 0,integer:!0,height:22,placeholder:"-"})})]}),e.jsxs("div",{className:V.field,children:[e.jsx("span",{className:V.label,children:"H"}),e.jsx("div",{className:V.inputWrapper,children:e.jsx(U,{value:H(t,"layout.h"),onChange:r=>c("h",r),min:1,max:l?l.rows:void 0,integer:!0,height:22,placeholder:"-"})})]})]})})};Ie.displayName="LayoutPanel";const xs="_group_xhfvf_1",ps="_btn_xhfvf_13",ms="_active_xhfvf_46",Me={group:xs,btn:ps,active:ms},Re=h.memo(({options:t,current:n,onChange:l})=>e.jsx("fieldset",{className:Me.group,children:t.map(s=>{const i=n===s.value;return e.jsx("button",{type:"button",className:[Me.btn,i?Me.active:""].filter(Boolean).join(" "),title:s.label,"aria-label":s.label,"aria-pressed":i,onClick:()=>l(s.value),children:s.icon},String(s.value))})}));Re.displayName="AlignmentToggle";const te=g.checkboxStyleProp.defaultProps.styleConfig,ne={fontSize:11,color:"#888",whiteSpace:"nowrap",width:62,flexShrink:0},se={display:"flex",gap:4,alignItems:"center"},Tt=({value:t,onChange:n,readOnly:l=!1})=>{const s=h.useMemo(()=>({checkboxSize:(t==null?void 0:t.checkboxSize)??te.checkboxSize,borderWidth:(t==null?void 0:t.borderWidth)??te.borderWidth,borderColor:(t==null?void 0:t.borderColor)??te.borderColor,checkWidth:(t==null?void 0:t.checkWidth)??te.checkWidth,checkColor:(t==null?void 0:t.checkColor)??te.checkColor,backgroundColor:(t==null?void 0:t.backgroundColor)??te.backgroundColor,checkedBackgroundColor:(t==null?void 0:t.checkedBackgroundColor)??te.checkedBackgroundColor}),[t]),i=h.useCallback((a,c)=>{n({...t??{},[a]:c})},[t,n]);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx("div",{style:{padding:8,backgroundColor:"#f5f5f5",borderRadius:4,display:"flex",justifyContent:"center",gap:24,marginBottom:4},children:[!1,!0].map(a=>e.jsxs("div",{style:{textAlign:"center"},children:[e.jsx("div",{style:{fontSize:11,color:"#888",marginBottom:4},children:a?"チェック":"未チェック"}),e.jsx("div",{style:{width:24,height:24},children:e.jsx(g.ClassicCheckboxVisual,{checked:a,styleConfig:s})})]},String(a)))}),e.jsxs("div",{style:se,children:[e.jsx("span",{style:ne,children:"サイズ"}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(W,{value:s.checkboxSize,onChange:a=>i("checkboxSize",a),readOnly:l,allowedUnits:["px","mm"],config:{min:8,max:64,step:1,placeholder:"16px"}})})]}),e.jsxs("div",{style:se,children:[e.jsx("span",{style:ne,children:"枠線 幅"}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(W,{value:s.borderWidth,onChange:a=>i("borderWidth",a),readOnly:l,allowedUnits:["px","%"],config:{min:0,step:.5,placeholder:"1px"}})})]}),e.jsxs("div",{style:se,children:[e.jsx("span",{style:ne,children:"枠線 色"}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(X,{value:s.borderColor,onChange:a=>i("borderColor",a),readOnly:l,showTextInput:!0})})]}),e.jsxs("div",{style:se,children:[e.jsx("span",{style:ne,children:"チェック 幅"}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(W,{value:s.checkWidth,onChange:a=>i("checkWidth",a),readOnly:l,allowedUnits:["px","%"],config:{min:0,step:.5,placeholder:"3.5px"}})})]}),e.jsxs("div",{style:se,children:[e.jsx("span",{style:ne,children:"チェック 色"}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(X,{value:s.checkColor,onChange:a=>i("checkColor",a),readOnly:l,showTextInput:!0})})]}),e.jsxs("div",{style:se,children:[e.jsx("span",{style:ne,children:"背景色"}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(X,{value:s.backgroundColor,onChange:a=>i("backgroundColor",a),readOnly:l,showTextInput:!0})})]}),e.jsxs("div",{style:se,children:[e.jsx("span",{style:ne,children:"チェック時 背景色"}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(X,{value:s.checkedBackgroundColor,onChange:a=>i("checkedBackgroundColor",a),readOnly:l,showTextInput:!0,allowUndefined:!0})})]})]})};Tt.displayName="CheckboxStyleEditor";const bs="_group_1uyid_1",vs="_btn_1uyid_13",fs="_active_1uyid_46",js="_iconBold_1uyid_52",gs="_iconItalic_1uyid_59",ys="_iconUnderline_1uyid_66",_s="_iconLineThrough_1uyid_73",ie={group:bs,btn:vs,active:fs,iconBold:js,iconItalic:gs,iconUnderline:ys,iconLineThrough:_s},ws=[{key:"fontWeight",label:"太字",icon:e.jsx("span",{className:ie.iconBold,"aria-hidden":"true",children:"B"})},{key:"italic",label:"斜体",icon:e.jsx("span",{className:ie.iconItalic,"aria-hidden":"true",children:"I"})},{key:"underline",label:"下線",icon:e.jsx("span",{className:ie.iconUnderline,"aria-hidden":"true",children:"U"})},{key:"lineThrough",label:"取り消し線",icon:e.jsx("span",{className:ie.iconLineThrough,"aria-hidden":"true",children:"S"})}],Pt=({value:t,onChange:n,readOnly:l=!1})=>{const s=t??{},i=a=>{l||n({...s,[a]:!s[a]})};return e.jsx("fieldset",{className:ie.group,children:ws.map(({key:a,label:c,icon:r})=>{const o=!!s[a];return e.jsx("button",{type:"button",className:[ie.btn,o?ie.active:""].filter(Boolean).join(" "),title:c,"aria-label":c,"aria-pressed":o,disabled:l,onClick:()=>i(a),children:r},a)})})};Pt.displayName="FontDecorationToggle";const Cs="_root_12n4v_6",Ns="_fontFamilyCell_12n4v_13",Ss="_fontSizeCell_12n4v_14",ks="_colorCell_12n4v_15",xe={root:Cs,fontFamilyCell:Ns,fontSizeCell:Ss,colorCell:ks},Is=[{label:"ゴシック体",value:"sans-serif"},{label:"明朝体",value:"serif"},{label:"等幅",value:"monospace"},{label:"Arial",value:"Arial, sans-serif"},{label:"Times New Roman",value:"'Times New Roman', serif"}],At=({value:t,onChange:n,readOnly:l=!1})=>{const s=t??{},i=h.useCallback(d=>n({...s,fontFamily:d}),[s,n]),a=h.useCallback(d=>n({...s,fontSize:d}),[s,n]),c=h.useCallback(d=>n({...s,color:d}),[s,n]),r=h.useCallback(d=>n({...s,fontWeight:d.fontWeight,italic:d.italic,underline:d.underline,lineThrough:d.lineThrough}),[s,n]),o={fontWeight:s.fontWeight,italic:s.italic,underline:s.underline,lineThrough:s.lineThrough};return e.jsxs("div",{className:xe.root,children:[e.jsx("div",{className:xe.fontFamilyCell,children:e.jsx(oe,{value:s.fontFamily,onChange:i,readOnly:l,options:Is,placeholder:"フォント"})}),e.jsx("div",{className:xe.fontSizeCell,children:e.jsx(W,{value:s.fontSize,onChange:a,readOnly:l,config:{allowedUnits:g.FONT_UNITS,min:1,step:1}})}),e.jsx("div",{className:xe.colorCell,children:e.jsx(X,{value:s.color,onChange:c,readOnly:l,allowUndefined:!0})}),e.jsx("div",{className:xe.decorationCell,children:e.jsx(Pt,{value:o,onChange:r,readOnly:l})})]})};At.displayName="FontStyleEditor";const Mt=({value:t,onChange:n,readOnly:l=!1})=>{const s=t.options??[],i=h.useId(),a=h.useMemo(()=>{const b=new Map,p=new Set;for(const[f,j]of s.entries())b.has(j.value)?(p.add(b.get(j.value)),p.add(f)):b.set(j.value,f);return p},[s]),c=h.useCallback(()=>{const b={label:`選択肢${s.length+1}`,value:`option${s.length+1}`};n({...t,options:[...s,b]})},[s,t,n]),r=h.useCallback(b=>{n({...t,options:s.filter((p,f)=>f!==b)})},[s,t,n]),o=h.useCallback((b,p)=>{n({...t,options:s.map((f,j)=>j===b?{...f,label:p}:f)})},[s,t,n]),d=h.useCallback((b,p)=>{n({...t,options:s.map((f,j)=>j===b?{...f,value:p}:f)})},[s,t,n]),x=h.useCallback((b,p)=>{n({...t,options:s.map((f,j)=>j===b?{...f,color:p}:f)})},[s,t,n]),u=h.useCallback(b=>{n({...t,allowEmpty:b})},[t,n]),v={padding:"4px 8px",border:"1px solid #ccc",borderRadius:4,fontSize:12,flex:1,boxSizing:"border-box",width:"100%"};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx(ee,{value:t.allowEmpty??!0,onChange:b=>u(b??!0),label:"空選択を許可",readOnly:l}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4,maxHeight:300,overflowY:"auto"},children:s.map((b,p)=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,padding:"2px 0",borderBottom:"1px solid #f0f0f0"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("span",{style:{fontSize:12,fontWeight:600,color:"#333"},children:["オプション",p+1]}),e.jsx("button",{type:"button",style:{fontSize:11,color:"#e53e3e",background:"none",border:"none",cursor:"pointer",padding:"2px 4px"},onClick:()=>r(p),disabled:l||s.length===1,children:"削除"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("label",{style:{fontSize:11,color:"#666",minWidth:32,flexShrink:0},htmlFor:`${i}-label-${p}`,children:"ラベル"}),e.jsx("input",{type:"text",id:`${i}-label-${p}`,style:v,value:b.label,onChange:f=>o(p,f.target.value),disabled:l,placeholder:"表示名"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("label",{style:{fontSize:11,color:"#666",minWidth:32,flexShrink:0},htmlFor:`${i}-value-${p}`,children:"値"}),e.jsxs("div",{style:{flex:1},children:[e.jsx("input",{type:"text",id:`${i}-value-${p}`,style:{...v,borderColor:a.has(p)?"#e53e3e":"#ccc"},value:b.value,onChange:f=>d(p,f.target.value),disabled:l,placeholder:"内部値"}),a.has(p)&&e.jsx("p",{style:{fontSize:11,color:"#e53e3e",margin:"2px 0 0"},children:"値が重複しています"})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("label",{style:{fontSize:11,color:"#666",minWidth:32,flexShrink:0},htmlFor:`${i}-color-${p}`,children:"色"}),e.jsx(X,{value:b.color,onChange:f=>x(p,f),allowUndefined:!0,placeholder:"色を選択"})]})]},b.value||`option-${p}`))}),e.jsx("button",{type:"button",style:{padding:"6px 12px",border:"1px dashed #007bff",borderRadius:4,background:"none",color:"#007bff",fontSize:12,cursor:"pointer"},onClick:c,disabled:l,children:"+ 選択肢を追加"})]})};Mt.displayName="OptionsEditor";const $s="_root_111zo_7",Ls="_linkLabel_111zo_14",Ts="_allRow_111zo_31",Ps="_grid_111zo_38",As="_sideRow_111zo_45",Ms="_cell_111zo_53",Es="_spacer_111zo_59",Y={root:$s,linkLabel:Ls,allRow:Ts,grid:Ps,sideRow:As,cell:Ms,spacer:Es},Et=({bulk:t,onChange:n,readOnly:l=!1})=>e.jsxs("label",{className:Y.linkLabel,children:[e.jsx("input",{type:"checkbox",checked:t,disabled:l,onChange:s=>n(s.target.checked)}),"全辺を一括設定"]});Et.displayName="PaddingLinkCheckbox";const J={value:0,unit:"px"},Dt=({value:t,onChange:n,readOnly:l=!1})=>{const s=t??{},i=s.bulk??!1,a=h.useCallback(u=>{n(u?{bulk:!0,all:s.top??J}:{bulk:!1,top:s.top??s.all??J,right:s.right??s.all??J,bottom:s.bottom??s.all??J,left:s.left??s.all??J})},[s,n]),c=h.useCallback(u=>{u&&n({all:u})},[n]),r=h.useCallback(u=>{u&&n({top:u})},[n]),o=h.useCallback(u=>{u&&n({right:u})},[n]),d=h.useCallback(u=>{u&&n({bottom:u})},[n]),x=h.useCallback(u=>{u&&n({left:u})},[n]);return e.jsxs("div",{className:Y.root,children:[e.jsx(Et,{bulk:i,onChange:a,readOnly:l}),i?e.jsx("div",{className:Y.allRow,children:e.jsx("div",{className:Y.cell,children:e.jsx(W,{value:s.all??J,onChange:c,config:{allowedUnits:g.PADDING_UNITS,min:0},readOnly:l})})}):e.jsxs("div",{className:Y.grid,children:[e.jsx("div",{className:Y.cell,children:e.jsx(W,{value:s.top??J,onChange:r,config:{allowedUnits:g.PADDING_UNITS,min:0},readOnly:l})}),e.jsxs("div",{className:Y.sideRow,children:[e.jsx("div",{className:Y.cell,children:e.jsx(W,{value:s.left??J,onChange:x,config:{allowedUnits:g.PADDING_UNITS,min:0},readOnly:l})}),e.jsx("div",{className:Y.spacer}),e.jsx("div",{className:Y.cell,children:e.jsx(W,{value:s.right??J,onChange:o,config:{allowedUnits:g.PADDING_UNITS,min:0},readOnly:l})})]}),e.jsx("div",{className:Y.cell,children:e.jsx(W,{value:s.bottom??J,onChange:d,config:{allowedUnits:g.PADDING_UNITS,min:0},readOnly:l})})]})]})};Dt.displayName="PaddingEditor";const pe=g.textBehaviorProp.defaultProps,Ds=[{label:"標準",value:g.WordWrap.normal},{label:"単語で折り返し",value:g.WordWrap.breakWord},{label:"文字で折り返し",value:g.WordWrap.breakAll}],Ee={display:"flex",alignItems:"center",gap:6,marginBottom:4},De={fontSize:11,color:"#666",minWidth:72,flexShrink:0},zt=({multiline:t,lineHeight:n,wordWrap:l,onChange:s,readOnly:i=!1})=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs("div",{style:Ee,children:[e.jsx("span",{style:De,children:"複数行"}),e.jsx(ee,{value:t??pe.multiline,onChange:a=>s("multiline",a??!1),readOnly:i,label:"複数行入力を有効にする"})]}),e.jsxs("div",{style:Ee,children:[e.jsx("span",{style:De,children:"行間"}),e.jsx("div",{style:{flex:1},children:e.jsx(U,{value:n??pe.lineHeight,onChange:a=>s("lineHeight",a??pe.lineHeight),readOnly:i,min:.5,max:5,step:.1,height:24})})]}),e.jsxs("div",{style:Ee,children:[e.jsx("span",{style:De,children:"折り返し"}),e.jsx("div",{style:{flex:1},children:e.jsx(oe,{value:l??pe.wordWrap,onChange:a=>s("wordWrap",a??pe.wordWrap),options:Ds,readOnly:i,height:24})})]})]});zt.displayName="TextBehaviorEditor";const _e=[{label:"テキスト",inputType:"text"},{label:"数字のみ",inputType:"text",pattern:"[0-9]+"},{label:"半角英字のみ",inputType:"text",pattern:"[a-zA-Z]+"},{label:"半角英数字のみ",inputType:"text",pattern:"[a-zA-Z0-9]+"},{label:"ひらがなのみ",inputType:"text",pattern:"[ぁ-ん]+"},{label:"カタカナのみ",inputType:"text",pattern:"[ァ-ン]+"},{label:"郵便番号(123-4567)",inputType:"text",pattern:"[0-9]{3}-[0-9]{4}",hideLength:!0},{label:"電話番号",inputType:"tel",pattern:"[0-9]{2,4}-[0-9]{2,4}-[0-9]{4}",hideLength:!0},{label:"メールアドレス",inputType:"email",pattern:"^[a-zA-Z0-9_+\\-.]+@[a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]+)*\\.[a-zA-Z]{2,}$",hideLength:!0},{label:"URL",inputType:"url",pattern:"https?://[^\\s]+",hideLength:!0},{label:"日付",inputType:"date",pattern:"[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])",hideLength:!0},{label:"その他",inputType:"text",isCustom:!0}],zs=_e.map(t=>({label:t.label,value:t.label})),Bs=`[0-9] 数字のみ
|
|
1
|
+
"use strict";require('./PalettePanel.css');const e=require("react/jsx-runtime"),h=require("react"),g=require("./sidebarPortal-BCIVv4yO.cjs"),xt=require("react-dom"),Jt="_container_1xv5c_4",Xt="_section_1xv5c_16",Qt="_divider_1xv5c_23",en="_sectionLabel_1xv5c_31",tn="_select_1xv5c_38",nn="_numberInput_1xv5c_59",sn="_heightModeSwitch_1xv5c_87",ln="_switchLabel_1xv5c_93",an="_switchLabelActive_1xv5c_101",on="_toggle_1xv5c_105",rn="_thumb_1xv5c_122",M={container:Jt,section:Xt,divider:Qt,sectionLabel:en,select:tn,numberInput:nn,heightModeSwitch:sn,switchLabel:ln,switchLabelActive:an,toggle:on,thumb:rn},pt=t=>e.jsx("div",{className:M.divider,"aria-hidden":"true"});pt.displayName="ActionBarDivider";const Fe=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("path",{d:"M3 7.5a5 5 0 1 1 1.5 3.5"}),e.jsx("path",{d:"M3 3.5v4h4"})]});Fe.displayName="UndoIcon";const Oe=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("path",{d:"M13 7.5a5 5 0 1 0-1.5 3.5"}),e.jsx("path",{d:"M13 3.5v4h-4"})]});Oe.displayName="RedoIcon";const Ue=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("polyline",{points:"3,5 13,5"}),e.jsx("path",{d:"M6 5V3h4v2"}),e.jsx("path",{d:"M4 5l1 9h6l1-9"}),e.jsx("line",{x1:"6.5",y1:"7.5",x2:"6.5",y2:"11.5"}),e.jsx("line",{x1:"9.5",y1:"7.5",x2:"9.5",y2:"11.5"})]});Ue.displayName="TrashIcon";const Ve=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("rect",{x:"5",y:"5",width:"8",height:"9",rx:"1"}),e.jsx("path",{d:"M3 11V3h8"})]});Ve.displayName="CopyIcon";const Ce=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("rect",{x:"2",y:"6",width:"12",height:"9",rx:"1"}),e.jsx("path",{d:"M5 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"}),e.jsx("line",{x1:"8",y1:"9",x2:"8",y2:"12"}),e.jsx("line",{x1:"6.5",y1:"10.5",x2:"9.5",y2:"10.5"})]});Ce.displayName="PasteIcon";const Ge=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("rect",{x:"1",y:"4",width:"9",height:"9",rx:"1"}),e.jsx("path",{d:"M5 4V2h9v9h-2"})]});Ge.displayName="DuplicateIcon";const mt=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("rect",{x:"2",y:"5",width:"12",height:"8",rx:"1"}),e.jsx("path",{d:"M5 5V2h6v3"}),e.jsx("path",{d:"M5 12h6"}),e.jsx("path",{d:"M5 10h3"}),e.jsx("rect",{x:"4",y:"8",width:"2",height:"1.5",fill:"currentColor",stroke:"none"})]});mt.displayName="PrintIcon";const bt=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("circle",{cx:"5",cy:"5",r:"2.5"}),e.jsx("circle",{cx:"11",cy:"5",r:"2.5"}),e.jsx("circle",{cx:"5",cy:"11",r:"2.5"}),e.jsx("circle",{cx:"11",cy:"11",r:"2.5"})]});bt.displayName="StyleIcon";const vt=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("rect",{x:"1.5",y:"1.5",width:"13",height:"13",rx:"1"}),e.jsx("line",{x1:"1.5",y1:"5.5",x2:"14.5",y2:"5.5"}),e.jsx("line",{x1:"7",y1:"5.5",x2:"7",y2:"14.5"})]});vt.displayName="LayoutIcon";const ft=({size:t=16,...n})=>e.jsxs("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:[e.jsx("rect",{x:"2",y:"2",width:"5",height:"5",rx:"0.5"}),e.jsx("rect",{x:"9",y:"2",width:"5",height:"5",rx:"0.5"}),e.jsx("rect",{x:"2",y:"9",width:"5",height:"5",rx:"0.5"}),e.jsx("circle",{cx:"11.5",cy:"11.5",r:"2.5"}),e.jsx("line",{x1:"11.5",y1:"10",x2:"11.5",y2:"13"}),e.jsx("line",{x1:"10",y1:"11.5",x2:"13",y2:"11.5"})]});ft.displayName="BlockSettingsIcon";const jt=({size:t=16,...n})=>e.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"currentColor","aria-hidden":"true",...n,children:e.jsx("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})});jt.displayName="ChevronLeftIcon";const gt=({size:t=16,...n})=>e.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"currentColor","aria-hidden":"true",...n,children:e.jsx("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})});gt.displayName="ChevronRightIcon";const yt=({size:t=16,...n})=>e.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"currentColor","aria-hidden":"true",...n,children:e.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"})});yt.displayName="AddPageIcon";const _t=({size:t=16,...n})=>e.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"currentColor","aria-hidden":"true",...n,children:e.jsx("path",{d:"M19 13H5v-2h14v2z"})});_t.displayName="DeletePageIcon";const cn={undo:{actionId:"undo",message:"元に戻しました",shortcut:"Ctrl+Z / Cmd+Z"},redo:{actionId:"redo",message:"やり直しました",shortcut:"Ctrl+Y / Cmd+Y, Ctrl+Shift+Z / Cmd+Shift+Z"},delete:{actionId:"delete",message:"選択を削除しました",shortcut:"Delete / Backspace"},copy:{actionId:"copy",message:"選択をコピーしました",shortcut:"Ctrl+C / Cmd+C"},paste:{actionId:"paste",message:"貼り付けました",shortcut:"Ctrl+V / Cmd+V"},duplicate:{actionId:"duplicate",message:"選択を複製しました",shortcut:"Ctrl+D / Cmd+D"},select_all:{actionId:"select_all",message:"全て選択しました",shortcut:"Ctrl+A / Cmd+A"},deselect_all:{actionId:"deselect_all",message:"選択を解除しました",shortcut:null},prev_page:{actionId:"prev_page",message:"前のページへ移動しました",shortcut:null},next_page:{actionId:"next_page",message:"次のページへ移動しました",shortcut:null},add_page:{actionId:"add_page",message:"ページを追加しました",shortcut:null},delete_page:{actionId:"delete_page",message:"ページを削除しました",shortcut:null}},qe=t=>cn[t],dn="_container_1tnp6_5",un="_input_1tnp6_13",hn="_label_1tnp6_29",Le={container:dn,input:un,label:hn},ee=({value:t,onChange:n,readOnly:l=!1,label:s,config:i})=>{const a=s??(i==null?void 0:i.label),c=h.useCallback(r=>{n(r.target.checked)},[n]);return e.jsxs("label",{className:Le.container,children:[e.jsx("input",{type:"checkbox",className:Le.input,checked:!!t,onChange:c,disabled:l}),a&&e.jsx("span",{className:Le.label,children:a})]})};ee.displayName="Checkbox";const xn="_header_1c1mq_6",pn="_title_1c1mq_32",mn="_actions_1c1mq_43",bn="_titleGroup_1c1mq_49",vn="_infoIcon_1c1mq_60",fn="_chevron_1c1mq_84",jn="_chevronOpen_1c1mq_92",gn="_statusBadge_1c1mq_98",yn="_statusBadgeOn_1c1mq_108",_n="_statusBadgeOff_1c1mq_113",wn="_content_1c1mq_120",Cn="_contentNoPadding_1c1mq_127",B={header:xn,title:pn,actions:mn,titleGroup:bn,infoIcon:vn,chevron:fn,chevronOpen:jn,statusBadge:gn,statusBadgeOn:yn,statusBadgeOff:_n,content:wn,contentNoPadding:Cn},F=({title:t,children:n,collapsible:l=!1,defaultCollapsed:s=!0,isOpen:i,onOpenChange:a,description:c,actions:r,openLabel:o,closeLabel:d,noPadding:x=!1})=>{const[u,v]=h.useState(l?s:!1),b=i!==void 0,p=b?!i:u,f=()=>{const k=p;b||v(!k),a==null||a(k)},j=!l||!p,_=x?B.contentNoPadding:B.content,I=l?p?d:o:void 0;return e.jsxs("div",{className:B.section,children:[l?e.jsxs("button",{type:"button",className:B.header,onClick:f,"aria-expanded":!p,children:[e.jsxs("span",{className:B.titleGroup,children:[e.jsx("span",{className:B.title,children:t}),c&&e.jsx("span",{className:B.infoIcon,title:c,role:"img","aria-label":c,children:"i"})]}),r&&e.jsx("span",{role:"none",className:B.actions,onClick:k=>k.stopPropagation(),children:r}),I&&e.jsx("span",{className:`${B.statusBadge} ${p?B.statusBadgeOff:B.statusBadgeOn}`,"aria-hidden":"true",children:I}),e.jsx("span",{className:`${B.chevron} ${p?"":B.chevronOpen}`,"aria-hidden":!0,children:"▾"})]}):e.jsxs("div",{className:B.header,children:[e.jsxs("span",{className:B.titleGroup,children:[e.jsx("span",{className:B.title,children:t}),c&&e.jsx("span",{className:B.infoIcon,title:c,role:"img","aria-label":c,children:"i"})]}),r&&e.jsx("span",{className:B.actions,children:r})]}),j&&e.jsx("div",{className:_,children:n})]})};F.displayName="CollapsibleSection";function je(t){if(!t)return null;const n=t.match(/^#([0-9a-f]{6}|[0-9a-f]{8})$/i);if(n&&typeof n[1]=="string"){const s=n[1],i=Number.parseInt(s.slice(0,2),16),a=Number.parseInt(s.slice(2,4),16),c=Number.parseInt(s.slice(4,6),16),r=s.length===8?Number.parseInt(s.slice(6,8),16)/255:1;return{r:i,g:a,b:c,a:r}}const l=t.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)$/);if(l){const s=Number.parseInt(l[1]??"",10),i=Number.parseInt(l[2]??"",10),a=Number.parseInt(l[3]??"",10),c=l[4]?Number.parseFloat(l[4]):1;return{r:s,g:i,b:a,a:c}}return null}function Nn(t){const{r:n,g:l,b:s,a:i}=t;if(i===0)return;const a=n.toString(16).padStart(2,"0"),c=l.toString(16).padStart(2,"0"),r=s.toString(16).padStart(2,"0");if(i<1){const o=Math.round(i*255).toString(16).padStart(2,"0");return`#${a}${c}${r}${o}`}return`#${a}${c}${r}`}const Sn=[{label:"無色",value:void 0},{label:"白",value:"#ffffff"},{label:"グレー1",value:"#efefef"},{label:"グレー2",value:"#d9d9d9"},{label:"グレー3",value:"#cccccc"},{label:"グレー4",value:"#b7b7b7"},{label:"グレー5",value:"#999999"},{label:"グレー6",value:"#666666"},{label:"グレー7",value:"#434343"},{label:"黒",value:"#000000"},{label:"薄茶",value:"#E6B8AF"},{label:"薄赤",value:"#F4CCCC"},{label:"薄橙",value:"#FCE5CD"},{label:"薄黄",value:"#FFF2CC"},{label:"薄緑",value:"#D9EAD3"},{label:"薄青緑",value:"#D0E0E3"},{label:"薄青",value:"#C9DAF8"},{label:"薄青紫",value:"#CFE2F3"},{label:"薄紫",value:"#D9D2E9"},{label:"薄赤紫",value:"#EAD1DC"},{label:"茶",value:"#DD7E6B"},{label:"赤",value:"#EA9999"},{label:"橙",value:"#F9CB9C"},{label:"黄",value:"#FFE599"},{label:"緑",value:"#B6D7A8"},{label:"青緑",value:"#A2C4C9"},{label:"青",value:"#A4C2F4"},{label:"青紫",value:"#9FC5E8"},{label:"紫",value:"#B4A7D6"},{label:"赤紫",value:"#D5A6BD"}],kn="_container_1cdzu_5",In="_colorButton_1cdzu_13",$n="_textInputWrapper_1cdzu_40",Ln="_textInputPrefix_1cdzu_62",Tn="_textInput_1cdzu_40",Pn="_popover_1cdzu_96",An="_palette_1cdzu_112",Mn="_paletteButton_1cdzu_119",En="_selected_1cdzu_142",Dn="_transparentPaletteButton_1cdzu_148",zn="_rgbaInputs_1cdzu_154",Bn="_rgbaInputGroup_1cdzu_161",Rn="_rgbaLabel_1cdzu_175",z={container:kn,colorButton:In,textInputWrapper:$n,textInputPrefix:Ln,textInput:Tn,popover:Pn,palette:An,paletteButton:Mn,selected:En,transparentPaletteButton:Dn,rgbaInputs:zn,rgbaInputGroup:Bn,rgbaLabel:Rn},wt=({onColorSelect:t,selectedColor:n,readOnly:l=!1})=>e.jsx("div",{className:z.palette,children:Sn.map((s,i)=>{const a=s.value===void 0,c=s.value===n,r=a?{}:{backgroundColor:s.value};return e.jsx("button",{type:"button",className:`${z.paletteButton} ${a?z.transparentPaletteButton:""} ${c?z.selected:""}`,onClick:()=>t(s.value),disabled:l,title:s.label,"aria-label":s.label,style:r},s.value??`undefined-${i}`)})});wt.displayName="ColorPalette";const Wn="_input_14n56_5",Fn={input:Wn},U=({value:t,onChange:n,readOnly:l=!1,min:s,max:i,step:a,integer:c,placeholder:r,width:o,height:d,ariaLabel:x,config:u,onBlur:v})=>{const b=s??(u==null?void 0:u.min)??1,p=i??(u==null?void 0:u.max),f=a??(u==null?void 0:u.step)??1,j=c??(u==null?void 0:u.integer)??!1,_=r??(u==null?void 0:u.placeholder),I=o??(u==null?void 0:u.width),k=d??(u==null?void 0:u.height),$=h.useCallback(N=>{const m=N.target.value;if(m===""){n(void 0);return}let y=Number.parseFloat(m);Number.isNaN(y)||(j&&(y=Math.round(y)),b!==void 0&&y<b&&(y=b),p!==void 0&&y>p&&(y=p),n(y))},[n,b,p,j]),S={};return I!==void 0&&(S.width=`${I}px`),k!==void 0&&(S.height=`${k}px`,S.paddingTop=0,S.paddingBottom=0),e.jsx("input",{type:"number",className:Fn.input,style:S,value:t??"",onChange:$,onBlur:v,disabled:l,min:b,max:p,step:f,placeholder:_,"aria-label":x})};U.displayName="NumberInput";const Ct=({rgba:t,onChange:n,readOnly:l=!1})=>e.jsxs("div",{className:z.rgbaInputs,children:[e.jsxs("div",{className:z.rgbaInputGroup,children:[e.jsx("span",{className:z.rgbaLabel,children:"R"}),e.jsx(U,{value:t.r,onChange:s=>n("r",s),min:0,max:255,step:1,integer:!0,width:48,readOnly:l})]}),e.jsxs("div",{className:z.rgbaInputGroup,children:[e.jsx("span",{className:z.rgbaLabel,children:"G"}),e.jsx(U,{value:t.g,onChange:s=>n("g",s),min:0,max:255,step:1,integer:!0,width:48,readOnly:l})]}),e.jsxs("div",{className:z.rgbaInputGroup,children:[e.jsx("span",{className:z.rgbaLabel,children:"B"}),e.jsx(U,{value:t.b,onChange:s=>n("b",s),min:0,max:255,step:1,integer:!0,width:48,readOnly:l})]}),e.jsxs("div",{className:z.rgbaInputGroup,children:[e.jsx("span",{className:z.rgbaLabel,children:"A"}),e.jsx(U,{value:Math.round(t.a*100),onChange:s=>n("a",s!==void 0?s/100:void 0),min:0,max:100,step:1,integer:!0,width:48,readOnly:l})]})]});Ct.displayName="RGBAInputs";const Nt=({isOpen:t,onClose:n,rgba:l,onRgbaChange:s,onColorSelect:i,selectedColor:a,readOnly:c=!1})=>{const r=h.useRef(null);return h.useEffect(()=>{if(!t)return;const o=d=>{r.current&&!r.current.contains(d.target)&&n()};return document.addEventListener("mousedown",o),()=>{document.removeEventListener("mousedown",o)}},[t,n]),t?e.jsxs("div",{className:z.popover,ref:r,style:{zIndex:g.Z_INDEX.DROPDOWN},children:[e.jsx(wt,{onColorSelect:i,selectedColor:a,readOnly:c}),e.jsx(Ct,{rgba:l,onChange:s,readOnly:c})]}):null};Nt.displayName="ColorPickerPopover";const X=({value:t,onChange:n,readOnly:l=!1,showTextInput:s=!0,allowUndefined:i,placeholder:a,width:c,height:r,config:o})=>{const d=i??(o==null?void 0:o.allowUndefined)??!0,x=a??(d?"未設定":"#000000"),u=c??(o==null?void 0:o.width),v=r??(o==null?void 0:o.height),[b,p]=h.useState(!1),f=h.useRef(null),[j,_]=h.useState(()=>je(t)??{r:0,g:0,b:0,a:1});h.useEffect(()=>{const T=je(t);T&&_(T)},[t]);const I=h.useCallback(()=>{l||p(T=>!T)},[l]),[k,$]=h.useState(t?t.replace(/^#/,""):"");h.useEffect(()=>{$(t?t.replace(/^#/,""):"")},[t]);const S=h.useCallback(T=>{const D=T.target.value;/^[0-9A-Fa-f]*$/.test(D)&&$(D)},[]),N=h.useCallback(T=>{if(T===""&&d){n(void 0);return}if(/^[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/.test(T)){const D=`#${T}`,Z=je(D);Z&&_(Z),n(D)}else $(t?t.replace(/^#/,""):"")},[n,d,t]),m=h.useCallback(T=>{N(T.target.value)},[N]),y=h.useCallback(T=>{T.key==="Enter"&&(T.preventDefault(),N(T.currentTarget.value),T.currentTarget.blur())},[N]),w=h.useCallback(T=>{if(T){const D=je(T);D&&(_(D),$(T.replace(/^#/,"")))}else $("");n(T)},[n]),C=h.useCallback((T,D)=>{if(D===void 0)return;const Z={...j,[T]:D};_(Z),n(Nn(Z))},[j,n]),L=t??"未設定",E={};t&&(E.background=t);const P={};return u!==void 0?P.width=`${u}px`:P.width="100%",v!==void 0&&(P.height=`${v}px`),e.jsxs("div",{className:z.container,style:P,ref:f,children:[e.jsx("button",{type:"button",className:z.colorButton,onClick:I,disabled:l,title:L,"aria-label":"カラーピッカーを開く",style:E}),s&&e.jsxs("div",{className:z.textInputWrapper,children:[e.jsx("span",{className:z.textInputPrefix,children:"#"}),e.jsx("input",{type:"text",className:z.textInput,value:k,onChange:S,onKeyDown:y,onBlur:m,disabled:l,placeholder:x,maxLength:8})]}),e.jsx(Nt,{isOpen:b,onClose:()=>p(!1),rgba:j,onRgbaChange:C,onColorSelect:w,selectedColor:t,readOnly:l})]})};X.displayName="ColorPicker";const On="_container_1n9lj_5",Un="_valueInput_1n9lj_23",Vn="_unitSelect_1n9lj_45",Te={container:On,valueInput:Un,unitSelect:Vn},W=t=>{const{value:n,onChange:l,readOnly:s=!1,config:i}=t,a=t.allowedUnits??(i==null?void 0:i.allowedUnits),c=t.min??(i==null?void 0:i.min),r=t.max??(i==null?void 0:i.max),o=t.step??(i==null?void 0:i.step)??1,d=t.placeholder??(i==null?void 0:i.placeholder),x=t.width??(i==null?void 0:i.width),u=t.height??(i==null?void 0:i.height),v=t.ariaLabel,b=(n==null?void 0:n.unit)??(a==null?void 0:a[0]),p=h.useCallback($=>{const S=$.target.value,N=(n==null?void 0:n.unit)??b;if(N===void 0)return;let m=Number.parseFloat(S);if(Number.isNaN(m))return;const y=c??1;m<y&&(m=y),r!==void 0&&m>r&&(m=r),l({value:m,unit:N})},[n,l,b,c,r]),f=h.useCallback($=>{const S=$.target.value;if(S==="")return;const N=(n==null?void 0:n.unit)??b;if(N===void 0)return;let m=Number.parseFloat(S);if(Number.isNaN(m))return;const y=c??1;m<y&&(m=y,l({value:m,unit:N})),r!==void 0&&m>r&&(m=r,l({value:m,unit:N}))},[n,l,b,c,r]),j=h.useCallback($=>{const S=$.target.value;l({value:(n==null?void 0:n.value)??1,unit:S})},[n,l]),_=(n==null?void 0:n.value)??"",I=(n==null?void 0:n.unit)??b??"",k={};return x!==void 0?k.width=`${x}px`:k.width="100%",u!==void 0&&(k.height=`${u}px`),e.jsxs("div",{className:Te.container,style:k,children:[e.jsx("input",{type:"number",className:Te.valueInput,value:_,onChange:p,onBlur:f,placeholder:d,min:c??1,max:r,step:o,readOnly:s,disabled:s,"aria-label":v}),e.jsx("select",{className:Te.unitSelect,value:I,onChange:j,disabled:s||!a||a.length<=1,"aria-label":"単位",children:a?a.map($=>e.jsx("option",{value:$,children:$},$)):e.jsx("option",{value:I,children:I})})]})},Gn="_container_14f2v_5",qn="_select_14f2v_11",Hn="_placeholderOverlay_14f2v_44",Pe={container:Gn,select:qn,placeholderOverlay:Hn},oe=t=>{const{value:n,onChange:l,readOnly:s=!1,config:i}=t,a=t.options??(i==null?void 0:i.options)??[],c=t.placeholder??(i==null?void 0:i.placeholder)??"選択してください",r=t.width??(i==null?void 0:i.width),o=t.height??(i==null?void 0:i.height),d=t.allowEmpty??(i==null?void 0:i.allowEmpty)??!0,x=h.useCallback(f=>{const j=f.target.value;if(j==="")l(void 0);else{const _=a.find(I=>String(I.value)===j);l(_?_.value:j)}},[l,a]),u=n??"",v=n!==void 0&&n!=="",b={};r!==void 0?b.width=`${r}px`:b.width="100%";const p={width:"100%",height:o?`${o}px`:void 0};return e.jsxs("div",{className:Pe.container,style:b,children:[!v&&e.jsx("div",{className:Pe.placeholderOverlay,style:p,children:c}),e.jsxs("select",{className:Pe.select,style:p,value:u,onChange:x,disabled:s,"aria-label":t.ariaLabel,children:[d&&e.jsx("option",{value:"",style:{display:"none"}}),a.map(f=>e.jsx("option",{value:String(f.value),children:f.label},String(f.value)))]})]})};oe.displayName="Dropdown";const Zn="_button_16snt_1",Kn={button:Zn},q=({icon:t,label:n,onClick:l,onMouseEnter:s,disabled:i,title:a,preventFocusOnMouseDown:c=!1})=>e.jsx("button",{type:"button",className:Kn.button,onMouseDown:c?r=>r.preventDefault():void 0,onMouseEnter:s,onClick:l,disabled:i,title:a??n,"aria-label":n,children:t});q.displayName="IconActionButton";const Yn="_container_ytzac_4",Jn="_scrollArea_ytzac_21",Xn="_emptyState_ytzac_29",Ae={container:Yn,scrollArea:Jn,emptyState:Xn},He=({children:t,emptyMessage:n,className:l})=>e.jsx("div",{className:`${Ae.container} ${l||""}`,children:t?e.jsx("div",{className:Ae.scrollArea,children:t}):n&&e.jsx("div",{className:Ae.emptyState,children:n})}),Qn="_root_vttth_1",es="_list_vttth_9",ts="_trigger_vttth_24",ns="_content_vttth_69",Ne={root:Qn,list:es,trigger:ts,content:ns},Se=h.createContext(void 0),St=({defaultValue:t,value:n,onValueChange:l,children:s,variant:i="default",className:a=""})=>{const[c,r]=h.useState(t),o=n??c,d=x=>{r(x),l==null||l(x)};return e.jsx(Se.Provider,{value:{value:o,onChange:d,variant:i},children:e.jsx("div",{className:`${Ne.root} ${a}`,"data-variant":i,children:s})})},kt=({children:t,className:n="",width:l,height:s,style:i})=>{const a=h.useContext(Se);if(!a)throw new Error("TabsList must be used within a Tabs component");const{variant:c}=a,r={...i};return l!==void 0&&(r.width=`${l}px`),s!==void 0&&(r.height=`${s}px`),e.jsx("div",{className:`${Ne.list} ${n}`,"data-variant":c,style:r,children:t})},de=({value:t,children:n,className:l="",disabled:s=!1,width:i,height:a,style:c})=>{const r=h.useContext(Se);if(!r)throw new Error("TabsTrigger must be used within a Tabs component");const{value:o,onChange:d,variant:x}=r,u=o===t,v={...c};return i!==void 0&&(v.width=`${i}px`),a!==void 0&&(v.height=`${a}px`),e.jsx("button",{className:`${Ne.trigger} ${l}`,"data-state":u?"active":"inactive","data-variant":x,onClick:()=>d(t),disabled:s,type:"button",style:v,children:n})},ue=({value:t,children:n,className:l=""})=>{const s=h.useContext(Se);if(!s)throw new Error("TabsContent must be used within a Tabs component");const{value:i}=s;return i!==t?null:e.jsx("div",{className:`${Ne.content} ${l}`,children:n})},ss="_input_jxjyc_5",ls={input:ss},he=({value:t,onChange:n,readOnly:l=!1,placeholder:s,maxLength:i,multiline:a,rows:c,width:r,height:o,ariaLabel:d,config:x,onBlur:u})=>{const v=s??(x==null?void 0:x.placeholder),b=i??(x==null?void 0:x.maxLength),p=a??(x==null?void 0:x.multiline)??!1,f=c??(x==null?void 0:x.rows)??3,j=h.useCallback(k=>{n(k.target.value)},[n]),_={};r!==void 0?_.width=`${r}px`:_.width="100%",o!==void 0&&(_.height=`${o}px`);const I={className:ls.input,style:_,value:t??"",onChange:j,disabled:l,placeholder:v,maxLength:b,"aria-label":d};return p?e.jsx("textarea",{...I,rows:f}):e.jsx("input",{...I,type:"text",onBlur:u})};he.displayName="TextInput";const It=({actionContext:t,onActionFeedback:n,onPrint:l})=>{const s=t.isEnabled("undo"),i=t.isEnabled("redo"),a=t.isEnabled("paste"),c=h.useCallback(r=>{t.execute(r);const o=qe(r);o&&(n==null||n(o))},[t,n]);return e.jsxs(e.Fragment,{children:[e.jsx(q,{icon:e.jsx(Fe,{"aria-hidden":"true"}),label:"元に戻す",title:"元に戻す (Ctrl+Z / Cmd+Z)",onClick:()=>c("undo"),disabled:!s,preventFocusOnMouseDown:!0}),e.jsx(q,{icon:e.jsx(Oe,{"aria-hidden":"true"}),label:"やり直し",title:"やり直し (Ctrl+Y / Cmd+Y)",onClick:()=>c("redo"),disabled:!i,preventFocusOnMouseDown:!0}),e.jsx(q,{icon:e.jsx(Ce,{"aria-hidden":"true"}),label:"貼り付け",title:"貼り付け (Ctrl+V / Cmd+V)",onClick:()=>c("paste"),disabled:!a,preventFocusOnMouseDown:!0}),e.jsx(q,{icon:e.jsx(mt,{"aria-hidden":"true"}),label:"印刷",title:"印刷 (Ctrl+P)",onClick:()=>l?l():window.print(),preventFocusOnMouseDown:!0})]})};It.displayName="CanvasActionSection";const ot={value:1,unit:"fr"},$t=({grid:t,onGridChange:n})=>{const l=h.useCallback(i=>{const a=parseInt(i.target.value,10);if(!a||a<1||a>100)return;const c=g.expandSparseCols(t),r=t.colCount,o=[...c];if(a>r)for(let d=r;d<a;d++)o.push({...ot});else o.splice(a);n({...t,...g.colsToSparse(o)})},[t,n]),s=h.useCallback(i=>{const a=parseInt(i.target.value,10);if(!a||a<1||a>100)return;const c=g.expandSparseRows(t),r=t.rowCount,o=[...c];if(a>r)for(let d=r;d<a;d++)o.push({...ot});else o.splice(a);n({...t,...g.rowsToSparse(o)})},[t,n]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:M.sectionLabel,children:"列"}),e.jsx("input",{type:"number",className:M.numberInput,value:t.colCount,min:1,max:100,onChange:l,"aria-label":"列数",title:"列数"}),e.jsx("span",{className:M.sectionLabel,children:"行"}),e.jsx("input",{type:"number",className:M.numberInput,value:t.rowCount,min:1,max:100,onChange:s,"aria-label":"行数",title:"行数"})]})};$t.displayName="GridSettingsSection";function ge(t,n){switch(n){case"cm":return t/10;case"inch":return t/25.4;default:return t}}const is=[{value:g.PaperSizePreset.A4,label:"A4"},{value:g.PaperSizePreset.A3,label:"A3"},{value:g.PaperSizePreset.B5,label:"B5"},{value:g.PaperSizePreset.LETTER,label:"Letter"},{value:g.PaperSizePreset.LEGAL,label:"Legal"},{value:g.PaperSizePreset.CUSTOM,label:"カスタム"}],Lt=({paper:t,onPaperChange:n})=>{const l=t.size.preset===g.PaperSizePreset.CUSTOM,s=t.autoHeight===!0,i=t.autoWidth===!0,a=h.useCallback(u=>{const v=u.target.value;v&&n({...t,size:{...g.DEFAULT_PAPER_SIZES[v]}})},[t,n]),c=h.useCallback(({target:u})=>{const v=Number(u.value);if(!v||v<=0)return;const b=g.toMm.fromDim(t.margin.left)+g.toMm.fromDim(t.margin.right),p=ge(b,t.size.width.unit);if(v<p)return;const f={...t.size,width:{...t.size.width,value:v}};n({...t,size:f})},[t,n]),r=h.useCallback(({target:u})=>{const v=Number(u.value);if(!v||v<=0)return;const b=g.toMm.fromDim(t.margin.top)+g.toMm.fromDim(t.margin.bottom),p=ge(b,t.size.height.unit);if(v<p)return;const f={...t.size,height:{...t.size.height,value:v}};n({...t,size:f})},[t,n]),o=h.useCallback(({target:u})=>{const v=u.value,b={...t.size,width:{...t.size.width,unit:v},height:{...t.size.height,unit:v}};n({...t,size:b})},[t,n]),d=h.useCallback(()=>{n({...t,autoHeight:s?void 0:!0})},[t,s,n]),x=h.useCallback(()=>{n({...t,autoWidth:i?void 0:!0})},[t,i,n]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:M.sectionLabel,children:"用紙"}),e.jsx("select",{className:M.select,value:t.size.preset,onChange:a,"aria-label":"用紙サイズ",title:"用紙サイズ",children:is.map(u=>e.jsx("option",{value:u.value,children:u.label},u.value))}),e.jsxs("div",{className:M.heightModeSwitch,children:[e.jsx("span",{className:`${M.switchLabel} ${s?"":M.switchLabelActive}`,children:"固定"}),e.jsx("button",{type:"button",role:"switch","aria-checked":s,"aria-label":"高さモード",className:M.toggle,onClick:d,children:e.jsx("span",{className:M.thumb})}),e.jsx("span",{className:`${M.switchLabel} ${s?M.switchLabelActive:""}`,children:"自動"})]}),e.jsxs("div",{className:M.heightModeSwitch,children:[e.jsx("span",{className:`${M.switchLabel} ${i?"":M.switchLabelActive}`,children:"幅固定"}),e.jsx("button",{type:"button",role:"switch","aria-checked":i,"aria-label":"幅モード",className:M.toggle,onClick:x,children:e.jsx("span",{className:M.thumb})}),e.jsx("span",{className:`${M.switchLabel} ${i?M.switchLabelActive:""}`,children:"幅自動"})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"number",className:M.numberInput,value:t.size.width.value,min:ge(g.toMm.fromDim(t.margin.left)+g.toMm.fromDim(t.margin.right),t.size.width.unit),max:9999,step:.5,onChange:c,"aria-label":"用紙幅",title:"幅"}),e.jsx("span",{className:M.sectionLabel,children:"×"}),e.jsx("input",{type:"number",className:M.numberInput,value:t.size.height.value,min:ge(g.toMm.fromDim(t.margin.top)+g.toMm.fromDim(t.margin.bottom),t.size.height.unit),max:9999,step:.5,onChange:r,"aria-label":"用紙高さ",title:"高さ"}),e.jsxs("select",{className:M.select,value:t.size.width.unit,onChange:o,"aria-label":"用紙単位",title:"単位",children:[e.jsx("option",{value:"mm",children:"mm"}),e.jsx("option",{value:"cm",children:"cm"}),e.jsx("option",{value:"inch",children:"inch"})]})]})]})};Lt.displayName="PaperSettingsSection";function Q(t,n,l){const s=n.split("."),i=(a,c)=>{const r=s[c];if(c===s.length-1){if(l==null){const{[r]:x,...u}=a;return u}return{...a,[r]:l}}const o=(a==null?void 0:a[r])??{},d=i(o,c+1);if(Object.keys(d).length===0){const{[r]:x,...u}=a;return u}return{...a,[r]:d}};return i(t,0)}function H(t,n){if(t.length===0)return;const l=(c,r)=>{let o=c;for(const d of r){if(o==null||typeof o!="object"||Array.isArray(o))return;o=o[d]}return o},s=n.split("."),i=l(t[0],s);return t.every(c=>l(c,s)===i)?i:void 0}function as(t,n,l){var a,c;if(!t)return[];const s=[],i=[{key:"top",style:t.top,x1:0,y1:0,x2:n,y2:0},{key:"right",style:t.right,x1:n,y1:0,x2:n,y2:l},{key:"bottom",style:t.bottom,x1:0,y1:l,x2:n,y2:l},{key:"left",style:t.left,x1:0,y1:0,x2:0,y2:l}];for(const{key:r,style:o,x1:d,y1:x,x2:u,y2:v}of i){if(!(o!=null&&o.type))continue;const b=((a=o.width)==null?void 0:a.unit)==="px"?o.width.value:((c=o.width)==null?void 0:c.value)??1,p=o.type===g.LineType.DASHED?"8 4":o.type===g.LineType.DOTTED?"2 4":void 0;s.push(e.jsx("line",{x1:d,y1:x,x2:u,y2:v,stroke:o.color??"#000",strokeWidth:b,strokeDasharray:p},r))}return s}const ke=({selectedBlocks:t,onUpdateBlocks:n})=>{const l=x=>{const u={};for(const v of t)u[v.id]={style:{...v.style,backgroundColor:x}};n(u)},s=(x,u,v)=>{var f,j,_;const b={},p=x==="all"?["top","right","bottom","left"]:[x];for(const I of t){let k=I.style||{};for(const $ of p){if(k=Q(k,`border.${$}.${u}`,v),u==="type"&&v==null&&(k=Q(k,`border.${$}.width`,null),k=Q(k,`border.${$}.color`,null)),u==="type"&&v!==void 0&&v!==null){const S=(f=I.style)==null?void 0:f.border,N=S==null?void 0:S[$];N!=null&&N.width||(k=Q(k,`border.${$}.width`,{value:1,unit:"px"})),N!=null&&N.color||(k=Q(k,`border.${$}.color`,"#000000"))}if(u==="color"&&v!==void 0&&v!==null){const S=(j=I.style)==null?void 0:j.border,N=S==null?void 0:S[$];N!=null&&N.type||(k=Q(k,`border.${$}.type`,g.LineType.SOLID)),N!=null&&N.width||(k=Q(k,`border.${$}.width`,{value:1,unit:"px"}))}if(u==="width"&&v!==void 0&&v!==null){const S=(_=I.style)==null?void 0:_.border,N=S==null?void 0:S[$];N!=null&&N.type||(k=Q(k,`border.${$}.type`,g.LineType.SOLID)),N!=null&&N.color||(k=Q(k,`border.${$}.color`,"#000000"))}}b[I.id]={style:k}}n(b)},i=H(t,"style.backgroundColor"),a=h.useMemo(()=>{var u;if(t.length!==1)return;const x=t[0];return(u=x==null?void 0:x.style)==null?void 0:u.border},[t]),c=h.useMemo(()=>as(a,80,80),[a]);if(t.length===0)return null;const r=x=>x==="all"?"top":x,o=x=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[e.jsx(oe,{value:H(t,`style.border.${r(x)}.type`),onChange:u=>s(x,"type",u??null),placeholder:"スタイル",height:24,options:[{label:"",value:null},{label:"実線",value:g.LineType.SOLID},{label:"破線",value:g.LineType.DASHED},{label:"点線",value:g.LineType.DOTTED}]}),e.jsx(W,{value:H(t,`style.border.${r(x)}.width`),onChange:u=>s(x,"width",u),placeholder:"太さ",height:24,allowedUnits:g.BORDER_UNITS,min:1}),e.jsx(X,{value:H(t,`style.border.${r(x)}.color`)??void 0,onChange:u=>s(x,"color",u??null),showTextInput:!0,allowUndefined:!0,height:24})]}),d={flex:1,padding:"0 2px",fontSize:"12px",minWidth:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"};return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"88px 1fr",gridTemplateRows:"auto auto",gap:"4px",padding:"4px"},children:[e.jsx("div",{style:{gridRow:"1 / 3",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("div",{style:{width:"80px",height:"80px",borderRadius:"0.25rem",display:"flex",alignItems:"center",justifyContent:"center",position:"relative",backgroundColor:i??"transparent"},children:[e.jsxs("svg",{width:"80",height:"80",viewBox:"0 0 80 80",style:{position:"absolute",top:0,left:0,opacity:.3,pointerEvents:"none"},children:[e.jsx("title",{children:"枠線ガイド"}),e.jsx("line",{x1:"40",y1:"0",x2:"40",y2:"80",stroke:"#9ca3af",strokeWidth:"1",strokeDasharray:"4 2"}),e.jsx("line",{x1:"0",y1:"40",x2:"80",y2:"40",stroke:"#9ca3af",strokeWidth:"1",strokeDasharray:"4 2"})]}),c.length>0?e.jsxs("svg",{width:"80",height:"80",viewBox:"0 0 80 80",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[e.jsx("title",{children:"枠線プレビュー"}),c]}):e.jsxs("svg",{width:"80",height:"80",viewBox:"0 0 80 80",style:{position:"absolute",top:0,left:0,opacity:.3},children:[e.jsx("title",{children:"枠線未設定"}),e.jsx("rect",{x:"0",y:"0",width:"80",height:"80",fill:"none",stroke:"#9ca3af",strokeWidth:"1",strokeDasharray:"4 2"})]})]})}),e.jsx(X,{value:i,onChange:x=>l(x),showTextInput:!0,allowUndefined:!0}),e.jsx("div",{style:{minWidth:0},children:e.jsxs(St,{defaultValue:"all",variant:"segmented",children:[e.jsx("div",{style:{width:"100%"},children:e.jsxs(kt,{style:{width:"100%",display:"flex"},children:[e.jsx(de,{value:"all",height:24,style:d,children:"共通"}),e.jsx(de,{value:"top",height:24,style:d,children:"上"}),e.jsx(de,{value:"bottom",height:24,style:d,children:"下"}),e.jsx(de,{value:"left",height:24,style:d,children:"左"}),e.jsx(de,{value:"right",height:24,style:d,children:"右"})]})}),e.jsxs("div",{style:{marginTop:"4px"},children:[e.jsx(ue,{value:"all",children:o("all")}),e.jsx(ue,{value:"top",children:o("top")}),e.jsx(ue,{value:"bottom",children:o("bottom")}),e.jsx(ue,{value:"left",children:o("left")}),e.jsx(ue,{value:"right",children:o("right")})]})]})})]})};ke.displayName="BackgroundBorderPanel";const os="_container_1gf2q_1",rs="_grid_1gf2q_9",cs="_field_1gf2q_15",ds="_label_1gf2q_22",us="_inputWrapper_1gf2q_32",V={container:os,grid:rs,field:cs,label:ds,inputWrapper:us},Ie=({selectedBlocks:t,onUpdateBlocks:n,gridSize:l})=>{if(t.length===0)return null;const s=t.length>1,i=s?Math.min(...t.map(r=>r.layout.x)):void 0,a=s?Math.min(...t.map(r=>r.layout.y)):void 0,c=(r,o)=>{if(o===void 0)return;const d={};if(s&&(r==="x"||r==="y")){const x=r==="x"?i:a;if(x===void 0)return;const u=Math.max(...t.map(_=>_.layout.x+_.layout.w)),v=Math.max(...t.map(_=>_.layout.y+_.layout.h)),b=u-(i??0),p=v-(a??0);let f=o;r==="x"&&l?f=Math.max(0,Math.min(o,l.cols-b)):r==="y"&&l?f=Math.max(0,Math.min(o,l.rows-p)):f=Math.max(0,o);const j=f-x;t.forEach(_=>{const I=_.layout[r]+j;d[_.id]={layout:{..._.layout,[r]:I}}})}else t.forEach(x=>{let u=o;if(r==="x"&&l)u=Math.max(0,Math.min(o,l.cols-x.layout.w));else if(r==="y"&&l)u=Math.max(0,Math.min(o,l.rows-x.layout.h));else if(r==="w"&&l){const v=l.cols-x.layout.x;u=Math.max(1,Math.min(o,v))}else if(r==="h"&&l){const v=l.rows-x.layout.y;u=Math.max(1,Math.min(o,v))}else r==="w"||r==="h"?u=Math.max(1,o):u=Math.max(0,o);d[x.id]={layout:{...x.layout,[r]:u}}});n(d,{mergeKey:g.layoutPanelKey(r,t.map(x=>x.id))})};return e.jsx("div",{className:V.container,children:e.jsxs("div",{className:V.grid,children:[e.jsxs("div",{className:V.field,children:[e.jsx("span",{className:V.label,children:"X"}),e.jsx("div",{className:V.inputWrapper,children:e.jsx(U,{value:s?i:H(t,"layout.x"),onChange:r=>c("x",r),min:0,max:l?l.cols-1:void 0,integer:!0,height:22,placeholder:"-"})})]}),e.jsxs("div",{className:V.field,children:[e.jsx("span",{className:V.label,children:"Y"}),e.jsx("div",{className:V.inputWrapper,children:e.jsx(U,{value:s?a:H(t,"layout.y"),onChange:r=>c("y",r),min:0,max:l?l.rows-1:void 0,integer:!0,height:22,placeholder:"-"})})]}),e.jsxs("div",{className:V.field,children:[e.jsx("span",{className:V.label,children:"W"}),e.jsx("div",{className:V.inputWrapper,children:e.jsx(U,{value:H(t,"layout.w"),onChange:r=>c("w",r),min:1,max:l?l.cols:void 0,integer:!0,height:22,placeholder:"-"})})]}),e.jsxs("div",{className:V.field,children:[e.jsx("span",{className:V.label,children:"H"}),e.jsx("div",{className:V.inputWrapper,children:e.jsx(U,{value:H(t,"layout.h"),onChange:r=>c("h",r),min:1,max:l?l.rows:void 0,integer:!0,height:22,placeholder:"-"})})]})]})})};Ie.displayName="LayoutPanel";const hs="_group_xhfvf_1",xs="_btn_xhfvf_13",ps="_active_xhfvf_46",Me={group:hs,btn:xs,active:ps},Re=h.memo(({options:t,current:n,onChange:l})=>e.jsx("fieldset",{className:Me.group,children:t.map(s=>{const i=n===s.value;return e.jsx("button",{type:"button",className:[Me.btn,i?Me.active:""].filter(Boolean).join(" "),title:s.label,"aria-label":s.label,"aria-pressed":i,onClick:()=>l(s.value),children:s.icon},String(s.value))})}));Re.displayName="AlignmentToggle";const te=g.checkboxStyleProp.defaultProps.styleConfig,ne={fontSize:11,color:"#888",whiteSpace:"nowrap",width:62,flexShrink:0},se={display:"flex",gap:4,alignItems:"center"},Tt=({value:t,onChange:n,readOnly:l=!1})=>{const s=h.useMemo(()=>({checkboxSize:(t==null?void 0:t.checkboxSize)??te.checkboxSize,borderWidth:(t==null?void 0:t.borderWidth)??te.borderWidth,borderColor:(t==null?void 0:t.borderColor)??te.borderColor,checkWidth:(t==null?void 0:t.checkWidth)??te.checkWidth,checkColor:(t==null?void 0:t.checkColor)??te.checkColor,backgroundColor:(t==null?void 0:t.backgroundColor)??te.backgroundColor,checkedBackgroundColor:(t==null?void 0:t.checkedBackgroundColor)??te.checkedBackgroundColor}),[t]),i=h.useCallback((a,c)=>{n({...t??{},[a]:c})},[t,n]);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx("div",{style:{padding:8,backgroundColor:"#f5f5f5",borderRadius:4,display:"flex",justifyContent:"center",gap:24,marginBottom:4},children:[!1,!0].map(a=>e.jsxs("div",{style:{textAlign:"center"},children:[e.jsx("div",{style:{fontSize:11,color:"#888",marginBottom:4},children:a?"チェック":"未チェック"}),e.jsx("div",{style:{width:24,height:24},children:e.jsx(g.ClassicCheckboxVisual,{checked:a,styleConfig:s})})]},String(a)))}),e.jsxs("div",{style:se,children:[e.jsx("span",{style:ne,children:"サイズ"}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(W,{value:s.checkboxSize,onChange:a=>i("checkboxSize",a),readOnly:l,allowedUnits:["px","mm"],config:{min:8,max:64,step:1,placeholder:"16px"}})})]}),e.jsxs("div",{style:se,children:[e.jsx("span",{style:ne,children:"枠線 幅"}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(W,{value:s.borderWidth,onChange:a=>i("borderWidth",a),readOnly:l,allowedUnits:["px","%"],config:{min:0,step:.5,placeholder:"1px"}})})]}),e.jsxs("div",{style:se,children:[e.jsx("span",{style:ne,children:"枠線 色"}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(X,{value:s.borderColor,onChange:a=>i("borderColor",a),readOnly:l,showTextInput:!0})})]}),e.jsxs("div",{style:se,children:[e.jsx("span",{style:ne,children:"チェック 幅"}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(W,{value:s.checkWidth,onChange:a=>i("checkWidth",a),readOnly:l,allowedUnits:["px","%"],config:{min:0,step:.5,placeholder:"3.5px"}})})]}),e.jsxs("div",{style:se,children:[e.jsx("span",{style:ne,children:"チェック 色"}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(X,{value:s.checkColor,onChange:a=>i("checkColor",a),readOnly:l,showTextInput:!0})})]}),e.jsxs("div",{style:se,children:[e.jsx("span",{style:ne,children:"背景色"}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(X,{value:s.backgroundColor,onChange:a=>i("backgroundColor",a),readOnly:l,showTextInput:!0})})]}),e.jsxs("div",{style:se,children:[e.jsx("span",{style:ne,children:"チェック時 背景色"}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(X,{value:s.checkedBackgroundColor,onChange:a=>i("checkedBackgroundColor",a),readOnly:l,showTextInput:!0,allowUndefined:!0})})]})]})};Tt.displayName="CheckboxStyleEditor";const ms="_group_1uyid_1",bs="_btn_1uyid_13",vs="_active_1uyid_46",fs="_iconBold_1uyid_52",js="_iconItalic_1uyid_59",gs="_iconUnderline_1uyid_66",ys="_iconLineThrough_1uyid_73",ie={group:ms,btn:bs,active:vs,iconBold:fs,iconItalic:js,iconUnderline:gs,iconLineThrough:ys},_s=[{key:"fontWeight",label:"太字",icon:e.jsx("span",{className:ie.iconBold,"aria-hidden":"true",children:"B"})},{key:"italic",label:"斜体",icon:e.jsx("span",{className:ie.iconItalic,"aria-hidden":"true",children:"I"})},{key:"underline",label:"下線",icon:e.jsx("span",{className:ie.iconUnderline,"aria-hidden":"true",children:"U"})},{key:"lineThrough",label:"取り消し線",icon:e.jsx("span",{className:ie.iconLineThrough,"aria-hidden":"true",children:"S"})}],Pt=({value:t,onChange:n,readOnly:l=!1})=>{const s=t??{},i=a=>{l||n({...s,[a]:!s[a]})};return e.jsx("fieldset",{className:ie.group,children:_s.map(({key:a,label:c,icon:r})=>{const o=!!s[a];return e.jsx("button",{type:"button",className:[ie.btn,o?ie.active:""].filter(Boolean).join(" "),title:c,"aria-label":c,"aria-pressed":o,disabled:l,onClick:()=>i(a),children:r},a)})})};Pt.displayName="FontDecorationToggle";const ws="_root_12n4v_6",Cs="_fontFamilyCell_12n4v_13",Ns="_fontSizeCell_12n4v_14",Ss="_colorCell_12n4v_15",xe={root:ws,fontFamilyCell:Cs,fontSizeCell:Ns,colorCell:Ss},ks=[{label:"ゴシック体",value:"sans-serif"},{label:"明朝体",value:"serif"},{label:"等幅",value:"monospace"},{label:"Arial",value:"Arial, sans-serif"},{label:"Times New Roman",value:"'Times New Roman', serif"}],At=({value:t,onChange:n,readOnly:l=!1})=>{const s=t??{},i=h.useCallback(d=>n({...s,fontFamily:d}),[s,n]),a=h.useCallback(d=>n({...s,fontSize:d}),[s,n]),c=h.useCallback(d=>n({...s,color:d}),[s,n]),r=h.useCallback(d=>n({...s,fontWeight:d.fontWeight,italic:d.italic,underline:d.underline,lineThrough:d.lineThrough}),[s,n]),o={fontWeight:s.fontWeight,italic:s.italic,underline:s.underline,lineThrough:s.lineThrough};return e.jsxs("div",{className:xe.root,children:[e.jsx("div",{className:xe.fontFamilyCell,children:e.jsx(oe,{value:s.fontFamily,onChange:i,readOnly:l,options:ks,placeholder:"フォント"})}),e.jsx("div",{className:xe.fontSizeCell,children:e.jsx(W,{value:s.fontSize,onChange:a,readOnly:l,config:{allowedUnits:g.FONT_UNITS,min:1,step:1}})}),e.jsx("div",{className:xe.colorCell,children:e.jsx(X,{value:s.color,onChange:c,readOnly:l,allowUndefined:!0})}),e.jsx("div",{className:xe.decorationCell,children:e.jsx(Pt,{value:o,onChange:r,readOnly:l})})]})};At.displayName="FontStyleEditor";const Mt=({value:t,onChange:n,readOnly:l=!1})=>{const s=t.options??[],i=h.useId(),a=h.useMemo(()=>{const b=new Map,p=new Set;for(const[f,j]of s.entries())b.has(j.value)?(p.add(b.get(j.value)),p.add(f)):b.set(j.value,f);return p},[s]),c=h.useCallback(()=>{const b={label:`選択肢${s.length+1}`,value:`option${s.length+1}`};n({...t,options:[...s,b]})},[s,t,n]),r=h.useCallback(b=>{n({...t,options:s.filter((p,f)=>f!==b)})},[s,t,n]),o=h.useCallback((b,p)=>{n({...t,options:s.map((f,j)=>j===b?{...f,label:p}:f)})},[s,t,n]),d=h.useCallback((b,p)=>{n({...t,options:s.map((f,j)=>j===b?{...f,value:p}:f)})},[s,t,n]),x=h.useCallback((b,p)=>{n({...t,options:s.map((f,j)=>j===b?{...f,color:p}:f)})},[s,t,n]),u=h.useCallback(b=>{n({...t,allowEmpty:b})},[t,n]),v={padding:"4px 8px",border:"1px solid #ccc",borderRadius:4,fontSize:12,flex:1,boxSizing:"border-box",width:"100%"};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx(ee,{value:t.allowEmpty??!0,onChange:b=>u(b??!0),label:"空選択を許可",readOnly:l}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4,maxHeight:300,overflowY:"auto"},children:s.map((b,p)=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,padding:"2px 0",borderBottom:"1px solid #f0f0f0"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("span",{style:{fontSize:12,fontWeight:600,color:"#333"},children:["オプション",p+1]}),e.jsx("button",{type:"button",style:{fontSize:11,color:"#e53e3e",background:"none",border:"none",cursor:"pointer",padding:"2px 4px"},onClick:()=>r(p),disabled:l||s.length===1,children:"削除"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("label",{style:{fontSize:11,color:"#666",minWidth:32,flexShrink:0},htmlFor:`${i}-label-${p}`,children:"ラベル"}),e.jsx("input",{type:"text",id:`${i}-label-${p}`,style:v,value:b.label,onChange:f=>o(p,f.target.value),disabled:l,placeholder:"表示名"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("label",{style:{fontSize:11,color:"#666",minWidth:32,flexShrink:0},htmlFor:`${i}-value-${p}`,children:"値"}),e.jsxs("div",{style:{flex:1},children:[e.jsx("input",{type:"text",id:`${i}-value-${p}`,style:{...v,borderColor:a.has(p)?"#e53e3e":"#ccc"},value:b.value,onChange:f=>d(p,f.target.value),disabled:l,placeholder:"内部値"}),a.has(p)&&e.jsx("p",{style:{fontSize:11,color:"#e53e3e",margin:"2px 0 0"},children:"値が重複しています"})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("label",{style:{fontSize:11,color:"#666",minWidth:32,flexShrink:0},htmlFor:`${i}-color-${p}`,children:"色"}),e.jsx(X,{value:b.color,onChange:f=>x(p,f),allowUndefined:!0,placeholder:"色を選択"})]})]},b.value||`option-${p}`))}),e.jsx("button",{type:"button",style:{padding:"6px 12px",border:"1px dashed #007bff",borderRadius:4,background:"none",color:"#007bff",fontSize:12,cursor:"pointer"},onClick:c,disabled:l,children:"+ 選択肢を追加"})]})};Mt.displayName="OptionsEditor";const Is="_root_111zo_7",$s="_linkLabel_111zo_14",Ls="_allRow_111zo_31",Ts="_grid_111zo_38",Ps="_sideRow_111zo_45",As="_cell_111zo_53",Ms="_spacer_111zo_59",Y={root:Is,linkLabel:$s,allRow:Ls,grid:Ts,sideRow:Ps,cell:As,spacer:Ms},Et=({bulk:t,onChange:n,readOnly:l=!1})=>e.jsxs("label",{className:Y.linkLabel,children:[e.jsx("input",{type:"checkbox",checked:t,disabled:l,onChange:s=>n(s.target.checked)}),"全辺を一括設定"]});Et.displayName="PaddingLinkCheckbox";const J={value:0,unit:"px"},Dt=({value:t,onChange:n,readOnly:l=!1})=>{const s=t??{},i=s.bulk??!1,a=h.useCallback(u=>{n(u?{bulk:!0,all:s.top??J}:{bulk:!1,top:s.top??s.all??J,right:s.right??s.all??J,bottom:s.bottom??s.all??J,left:s.left??s.all??J})},[s,n]),c=h.useCallback(u=>{u&&n({all:u})},[n]),r=h.useCallback(u=>{u&&n({top:u})},[n]),o=h.useCallback(u=>{u&&n({right:u})},[n]),d=h.useCallback(u=>{u&&n({bottom:u})},[n]),x=h.useCallback(u=>{u&&n({left:u})},[n]);return e.jsxs("div",{className:Y.root,children:[e.jsx(Et,{bulk:i,onChange:a,readOnly:l}),i?e.jsx("div",{className:Y.allRow,children:e.jsx("div",{className:Y.cell,children:e.jsx(W,{value:s.all??J,onChange:c,config:{allowedUnits:g.PADDING_UNITS,min:0},readOnly:l})})}):e.jsxs("div",{className:Y.grid,children:[e.jsx("div",{className:Y.cell,children:e.jsx(W,{value:s.top??J,onChange:r,config:{allowedUnits:g.PADDING_UNITS,min:0},readOnly:l})}),e.jsxs("div",{className:Y.sideRow,children:[e.jsx("div",{className:Y.cell,children:e.jsx(W,{value:s.left??J,onChange:x,config:{allowedUnits:g.PADDING_UNITS,min:0},readOnly:l})}),e.jsx("div",{className:Y.spacer}),e.jsx("div",{className:Y.cell,children:e.jsx(W,{value:s.right??J,onChange:o,config:{allowedUnits:g.PADDING_UNITS,min:0},readOnly:l})})]}),e.jsx("div",{className:Y.cell,children:e.jsx(W,{value:s.bottom??J,onChange:d,config:{allowedUnits:g.PADDING_UNITS,min:0},readOnly:l})})]})]})};Dt.displayName="PaddingEditor";const pe=g.textBehaviorProp.defaultProps,Es=[{label:"標準",value:g.WordWrap.normal},{label:"単語で折り返し",value:g.WordWrap.breakWord},{label:"文字で折り返し",value:g.WordWrap.breakAll}],Ee={display:"flex",alignItems:"center",gap:6,marginBottom:4},De={fontSize:11,color:"#666",minWidth:72,flexShrink:0},zt=({multiline:t,lineHeight:n,wordWrap:l,onChange:s,readOnly:i=!1})=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs("div",{style:Ee,children:[e.jsx("span",{style:De,children:"複数行"}),e.jsx(ee,{value:t??pe.multiline,onChange:a=>s("multiline",a??!1),readOnly:i,label:"複数行入力を有効にする"})]}),e.jsxs("div",{style:Ee,children:[e.jsx("span",{style:De,children:"行間"}),e.jsx("div",{style:{flex:1},children:e.jsx(U,{value:n??pe.lineHeight,onChange:a=>s("lineHeight",a??pe.lineHeight),readOnly:i,min:.5,max:5,step:.1,height:24})})]}),e.jsxs("div",{style:Ee,children:[e.jsx("span",{style:De,children:"折り返し"}),e.jsx("div",{style:{flex:1},children:e.jsx(oe,{value:l??pe.wordWrap,onChange:a=>s("wordWrap",a??pe.wordWrap),options:Es,readOnly:i,height:24})})]})]});zt.displayName="TextBehaviorEditor";const _e=[{label:"テキスト",inputType:"text"},{label:"数字のみ",inputType:"text",pattern:"[0-9]+"},{label:"半角英字のみ",inputType:"text",pattern:"[a-zA-Z]+"},{label:"半角英数字のみ",inputType:"text",pattern:"[a-zA-Z0-9]+"},{label:"ひらがなのみ",inputType:"text",pattern:"[ぁ-ん]+"},{label:"カタカナのみ",inputType:"text",pattern:"[ァ-ン]+"},{label:"郵便番号(123-4567)",inputType:"text",pattern:"[0-9]{3}-[0-9]{4}",hideLength:!0},{label:"電話番号",inputType:"tel",pattern:"[0-9]{2,4}-[0-9]{2,4}-[0-9]{4}",hideLength:!0},{label:"メールアドレス",inputType:"email",pattern:"^[a-zA-Z0-9_+\\-.]+@[a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]+)*\\.[a-zA-Z]{2,}$",hideLength:!0},{label:"URL",inputType:"url",pattern:"https?://[^\\s]+",hideLength:!0},{label:"日付",inputType:"date",pattern:"[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])",hideLength:!0},{label:"その他",inputType:"text",isCustom:!0}],Ds=_e.map(t=>({label:t.label,value:t.label})),zs=`[0-9] 数字のみ
|
|
2
2
|
[a-z] 英小文字
|
|
3
3
|
[A-Z] 英大文字
|
|
4
4
|
[ぁ-ん] ひらがな
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* 0回以上繰り返し
|
|
7
7
|
{3} 3回繰り返し
|
|
8
8
|
{3,5} 3〜5回繰り返し
|
|
9
|
-
. 任意の1文字`,ze={display:"flex",alignItems:"center",gap:6,marginBottom:4},Be={fontSize:11,color:"#666",minWidth:72,flexShrink:0},Bt=({inputType:t,minLength:n,maxLength:l,pattern:s,onChange:i,onChangeBatch:a,readOnly:c=!1})=>{const[r,o]=h.useState(!1),[d,x]=h.useState({}),u=h.useRef(null),v=h.useCallback(()=>{var N;const S=(N=u.current)==null?void 0:N.getBoundingClientRect();S&&(x({position:"fixed",bottom:window.innerHeight-S.top+4,right:window.innerWidth-S.right}),o(!0))},[]),b=h.useCallback(()=>o(!1),[]),p=t??"text",f=s??void 0,j=(()=>{const S=_e.find(N=>N.isCustom||N.inputType!==p?!1:N.pattern===f);return(S==null?void 0:S.label)??"その他"})(),_=j==="その他",I=_e.find(S=>S.label===j),k=!(I!=null&&I.hideLength),$=h.useCallback(S=>{const N=_e.find(w=>w.label===S);if(!N)return;const m=N.isCustom?"":N.pattern??null,y={inputType:N.inputType,pattern:m};if(a)a(y);else for(const[w,C]of Object.entries(y))i(w,C)},[i,a]);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs("div",{style:ze,children:[e.jsx("span",{style:Be,children:"入力タイプ"}),e.jsx("div",{style:{flex:1},children:e.jsx(oe,{value:j,onChange:$,options:zs,readOnly:c,height:24})})]}),k&&e.jsxs("div",{style:ze,children:[e.jsx("span",{style:Be,children:"文字数"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,flex:1},children:[e.jsx("div",{style:{flex:1},children:e.jsx(U,{value:n,onChange:S=>i("minLength",S??null),readOnly:c,min:0,placeholder:"min",height:24})}),e.jsx("span",{style:{fontSize:11,color:"#666"},children:"〜"}),e.jsx("div",{style:{flex:1},children:e.jsx(U,{value:l,onChange:S=>i("maxLength",S??null),readOnly:c,min:0,placeholder:"max",height:24})}),e.jsx("span",{style:{fontSize:11,color:"#666"},children:"文字"})]})]}),_&&e.jsxs("div",{style:ze,children:[e.jsxs("span",{style:{...Be,display:"flex",alignItems:"center",gap:2},children:["パターン",e.jsx("button",{ref:u,type:"button",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:14,height:14,border:"none",padding:0,borderRadius:9999,backgroundColor:"#d1d5db",color:"#fff",fontSize:9,fontWeight:700,cursor:"help",outline:"none"},"aria-label":"入力パターンの使い方",onMouseEnter:v,onMouseLeave:b,onFocus:v,onBlur:b,children:"i"})]}),e.jsx("div",{style:{flex:1},children:e.jsx(he,{value:s??"",onChange:S=>{i("pattern",S??"")},readOnly:c,placeholder:"例: [0-9]+"})})]}),r&&xt.createPortal(e.jsx("pre",{style:{...d,zIndex:9999999,width:"max-content",margin:0,padding:"6px 10px",fontSize:11,fontFamily:"monospace",lineHeight:1.6,color:"#f3f4f6",backgroundColor:"rgba(30, 30, 30, 0.95)",borderRadius:6,boxShadow:"0 4px 12px rgba(0,0,0,0.4)",whiteSpace:"pre",pointerEvents:"none"},children:Bs}),document.body)]})};Bt.displayName="TextValidationEditor";const Rt={alignment:"配置",fontStyle:"フォントスタイル",padding:"パディング",required:"必須入力",placeholder:"プレースホルダー",textValidation:"入力検証",textBehavior:"テキスト動作",selectConfig:"選択肢設定",checkboxStyle:"チェックボックスデザイン"},Rs=[{value:g.HorizontalAlign.left,label:"左揃え",icon:e.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[e.jsx("rect",{x:"1",y:"2",width:"1.5",height:"12",rx:"0.5"}),e.jsx("rect",{x:"4",y:"3",width:"6",height:"2.5",rx:"0.5"}),e.jsx("rect",{x:"4",y:"7",width:"10",height:"2.5",rx:"0.5"}),e.jsx("rect",{x:"4",y:"11",width:"7",height:"2.5",rx:"0.5"})]})},{value:g.HorizontalAlign.center,label:"中央揃え",icon:e.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[e.jsx("rect",{x:"7.25",y:"2",width:"1.5",height:"12",rx:"0.5"}),e.jsx("rect",{x:"3.5",y:"3",width:"9",height:"2.5",rx:"0.5"}),e.jsx("rect",{x:"1",y:"7",width:"14",height:"2.5",rx:"0.5"}),e.jsx("rect",{x:"4.5",y:"11",width:"7",height:"2.5",rx:"0.5"})]})},{value:g.HorizontalAlign.right,label:"右揃え",icon:e.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[e.jsx("rect",{x:"13.5",y:"2",width:"1.5",height:"12",rx:"0.5"}),e.jsx("rect",{x:"6",y:"3",width:"6",height:"2.5",rx:"0.5"}),e.jsx("rect",{x:"2",y:"7",width:"10",height:"2.5",rx:"0.5"}),e.jsx("rect",{x:"5",y:"11",width:"7",height:"2.5",rx:"0.5"})]})}],Ws=[{value:g.VerticalAlign.top,label:"上揃え",icon:e.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[e.jsx("rect",{x:"1",y:"1",width:"14",height:"1"}),e.jsx("rect",{x:"2",y:"3",width:"4",height:"8",rx:"0.5"}),e.jsx("rect",{x:"10",y:"3",width:"4",height:"5",rx:"0.5"})]})},{value:g.VerticalAlign.center,label:"中央揃え",icon:e.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[e.jsx("rect",{x:"1",y:"7.5",width:"14",height:"1"}),e.jsx("rect",{x:"2",y:"3",width:"4",height:"10",rx:"0.5"}),e.jsx("rect",{x:"10",y:"4.5",width:"4",height:"7",rx:"0.5"})]})},{value:g.VerticalAlign.bottom,label:"下揃え",icon:e.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[e.jsx("rect",{x:"1",y:"14",width:"14",height:"1"}),e.jsx("rect",{x:"2",y:"5",width:"4",height:"8",rx:"0.5"}),e.jsx("rect",{x:"10",y:"8",width:"4",height:"5",rx:"0.5"})]})}];function re(t){return typeof t=="object"&&t!==null&&typeof t.value=="number"&&typeof t.unit=="string"}function Fs(t){return typeof t=="object"&&t!==null&&Array.isArray(t.options)}const Ze=h.memo(({kind:t,defaultProps:n,getVal:l,onChange:s,onChangeBatch:i,readOnly:a,component:c})=>{switch(t){case"alignment":{const r=l("horizontal")??g.HorizontalAlign.left,o=l("vertical")??g.VerticalAlign.center;return e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[e.jsx(Re,{options:Rs,current:r,onChange:d=>s("horizontal",d)}),e.jsx(Re,{options:Ws,current:o,onChange:d=>s("vertical",d)})]})}case"fontStyle":{const r=l("fontSize"),o={fontFamily:l("fontFamily"),fontSize:re(r)?r:void 0,color:l("color"),fontWeight:l("fontWeight"),italic:l("italic"),underline:l("underline"),lineThrough:l("lineThrough")};return e.jsx(At,{value:o,onChange:d=>{if(i)i(d);else for(const[x,u]of Object.entries(d))s(x,u)}})}case"padding":{const r=l("top"),o=l("right"),d=l("bottom"),x=l("left"),u=l("bulk"),v=l("all"),b={top:re(r)?r:void 0,right:re(o)?o:void 0,bottom:re(d)?d:void 0,left:re(x)?x:void 0,bulk:typeof u=="boolean"?u:!1,all:re(v)?v:void 0};return e.jsx(Dt,{value:b,onChange:p=>{if(i)i(p);else for(const[f,j]of Object.entries(p))s(f,j)}})}case"required":{const r=l("required");return e.jsx(ee,{value:r??!1,onChange:o=>s("required",o??!1),label:"必須"})}case"placeholder":{const r=l("placeholder");return e.jsx(he,{value:r??"",onChange:o=>s("placeholder",o??"")})}case"textValidation":return e.jsx(Bt,{inputType:l("inputType"),minLength:l("minLength")??void 0,maxLength:l("maxLength")??void 0,pattern:l("pattern")??void 0,onChange:s,onChangeBatch:i});case"textBehavior":return e.jsx(zt,{multiline:l("multiline"),lineHeight:l("lineHeight")??void 0,wordWrap:l("wordWrap"),onChange:s});case"checkboxStyle":{const r=l("styleConfig");return e.jsx(Tt,{value:r,onChange:o=>s("styleConfig",o)})}case"selectConfig":{const r=l("selectConfig"),o=Fs(r)?r:{options:[]};return e.jsx(Mt,{value:o,onChange:d=>s("selectConfig",d)})}default:{if(c){const x=c,u=Object.keys(n)[0]??t,v=l(u);return e.jsx(x,{value:v,onChange:b=>s(u,b),readOnly:a})}const r=Object.keys(n)[0]??t,o=l(r),d=o==null?"":typeof o=="object"?JSON.stringify(o):String(o);return e.jsx(he,{value:d,onChange:x=>s(r,x??"")})}}});Ze.displayName="PropDefEditor";const Ke=h.memo(({propDef:t,selectedBlocks:n,onChange:l,onChangeBatch:s,readOnly:i,blockDefaults:a,onResetToDefault:c})=>{const{kind:r,defaultProps:o}=t,d=n[0],x=(d==null?void 0:d.kind)??"",u=p=>{var j;const f=H(n,`props.${p}`);return f!==void 0?f:((j=a==null?void 0:a[x])==null?void 0:j[p])??o[p]??null},v=d!==void 0&&Object.keys(o).some(p=>p in((d==null?void 0:d.props)??{})),b=h.useCallback(p=>{var f;if(p){const j={};for(const[_,I]of Object.entries(o))j[_]=((f=a==null?void 0:a[x])==null?void 0:f[_])??I;if(s)s(j);else for(const[_,I]of Object.entries(j))l(_,I)}else c==null||c(Object.keys(o))},[l,s,c,o,a,x]);return e.jsx(F,{title:Rt[r]??r,collapsible:!0,isOpen:v,onOpenChange:b,openLabel:"カスタム",closeLabel:"標準",children:e.jsx(Ze,{kind:r,defaultProps:o,getVal:u,onChange:l,onChangeBatch:s,readOnly:i,component:t.component})})});Ke.displayName="PropertyField";const $e=({selectedBlocks:t,pluginRegistry:n,onUpdateBlocks:l,blockDefaults:s,showGroupHeader:i=!0})=>{const a=t[0],c=a?n[a.kind]:void 0;if(!a||!c||t.length===0)return null;const r=(u,v)=>{const b={};t.forEach(p=>{b[p.id]={props:{...p.props,[u]:v}}}),l(b)},o=u=>{const v={};t.forEach(b=>{v[b.id]={props:{...b.props,...u}}}),l(v)},d=u=>{const v={};t.forEach(b=>{const p={...b.props};for(const f of u)delete p[f];v[b.id]={props:p}}),l(v)},x=c.properties.map(u=>e.jsx(Ke,{propDef:u,selectedBlocks:t,onChange:r,onChangeBatch:o,blockDefaults:s,onResetToDefault:d},u.kind));return c.properties.length===0?null:i?e.jsx(F,{title:c.meta.displayName,children:x}):e.jsx("div",{children:x})};$e.displayName="PluginPanels";const Os="_bar_13lr1_4",Us="_divider_13lr1_18",Vs="_barWrapper_13lr1_26",Gs="_popover_13lr1_31",ve={bar:Os,divider:Us,barWrapper:Vs,popover:Gs},ae=({icon:t,label:n,onClick:l,onMouseEnter:s,title:i,disabled:a})=>e.jsx(q,{icon:t,label:n,title:i,onClick:l,onMouseEnter:s,disabled:a,preventFocusOnMouseDown:!0});ae.displayName="SelectionActionBarButton";const Wt=h.createContext(null);function Ft(){const t=h.useContext(Wt);if(t===null)throw new Error("useSelectionActionBar must be used inside SelectionActionBar");return t}const Ot=({items:t=[],className:n,style:l,onPointerDown:s})=>{const[i,a]=h.useState(null),[c,r]=h.useState(null),o=h.useRef(null),d=h.useCallback(()=>{o.current!==null&&(window.clearTimeout(o.current),o.current=null)},[]),x=h.useCallback(()=>{d()},[d]),u=h.useCallback(()=>{d(),o.current=window.setTimeout(()=>{a(null)},120)},[d]);h.useEffect(()=>{if(i===null)return;const p=f=>{c&&!c.contains(f.target)&&a(null)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[i,c]),h.useEffect(()=>()=>{d()},[d]);const v=h.useCallback(p=>{d(),a(p)},[d]),b=h.useCallback(p=>{d(),a(p)},[d]);return e.jsx(Wt.Provider,{value:{openPanel:i,openPanelByHover:v,openPanelByClick:b,onPointerDown:s,wrapperEl:c},children:e.jsx("div",{ref:r,className:ve.barWrapper,style:l,onMouseEnter:x,onMouseLeave:u,onPointerDown:s,role:"toolbar","aria-label":"Selection Action Bar","data-testid":"selection-action-bar",children:e.jsx("div",{className:`${ve.bar}${n?` ${n}`:""}`,onPointerDown:s,children:t})})})};Ot.displayName="SelectionActionBar";const me=({id:t,icon:n,label:l,children:s})=>{const{openPanel:i,openPanelByHover:a,openPanelByClick:c,onPointerDown:r,wrapperEl:o}=Ft(),d=i===t;return e.jsxs(e.Fragment,{children:[e.jsx(ae,{icon:n,label:l,onMouseEnter:()=>a(t),onClick:()=>c(t)}),d&&o&&xt.createPortal(e.jsx("div",{className:ve.popover,"data-testid":`popover-${t}`,onPointerDown:r,children:s}),o)]})};me.displayName="SelectionActionBarPanel";function qs({context:t,gridSize:n,onActionFeedback:l}){var j;const{actionContext:s,pluginRegistry:i}=t,a=t.editorState,c=a.selectedBlockIds??[],r=s.isEnabled("paste"),o=a.pageIdx,d=(((j=t.book.pages[o])==null?void 0:j.blocks)??[]).filter(_=>c.includes(_.id)),x=c.length>0,u=d.length>0,v=u&&Object.keys(i).length>0,b=(_,I)=>s.execute("updateBlocks",{updates:_,options:I}),p=(_,I)=>{I();const k=qe(_);k&&(l==null||l(k))},f=[e.jsx(ae,{icon:e.jsx(Ue,{"aria-hidden":"true"}),label:"選択を削除",title:"削除 (Delete / Backspace)",onClick:()=>p("delete",()=>s.execute("delete")),disabled:!x},"delete"),e.jsx(ae,{icon:e.jsx(Ve,{"aria-hidden":"true"}),label:"選択をコピー",title:"コピー (Ctrl+C / Cmd+C)",onClick:()=>p("copy",()=>s.execute("copy")),disabled:!x},"copy"),e.jsx(ae,{icon:e.jsx(Ge,{"aria-hidden":"true"}),label:"選択を複製",title:"複製 (Ctrl+D / Cmd+D)",onClick:()=>p("duplicate",()=>s.execute("duplicate")),disabled:!x},"duplicate"),e.jsx("div",{className:ve.divider,"aria-hidden":"true"},"divider-paste"),e.jsx(ae,{icon:e.jsx(Ce,{"aria-hidden":"true"}),label:"貼り付け",title:"貼り付け (Ctrl+V / Cmd+V)",onClick:()=>p("paste",()=>s.execute("paste")),disabled:!r},"paste")];return(u||v)&&f.push(e.jsx("div",{className:ve.divider,"aria-hidden":"true"},"divider-panels")),u&&f.push(e.jsx(me,{id:"style",icon:e.jsx(bt,{"aria-hidden":"true"}),label:"スタイル設定",children:e.jsx(ke,{selectedBlocks:d,onUpdateBlocks:b})},"style"),e.jsx(me,{id:"layout",icon:e.jsx(vt,{"aria-hidden":"true"}),label:"レイアウト設定",children:e.jsx(Ie,{selectedBlocks:d,onUpdateBlocks:b,gridSize:n})},"layout")),v&&f.push(e.jsx(me,{id:"plugin",icon:e.jsx(ft,{"aria-hidden":"true"}),label:"ブロック設定",children:e.jsx($e,{selectedBlocks:d,pluginRegistry:i,onUpdateBlocks:b,showGroupHeader:!1})},"plugin")),f}const rt=8,Hs=36,Zs=({selectionBoundingBox:t,isDragging:n,zIndex:l=g.Z_INDEX.SELECTION_ACTION_BAR,children:s})=>{if(t==null||n)return null;const i=t,a=i.top-rt-Hs,c=a>=0?a:i.bottom+rt,r={position:"absolute",inset:0,pointerEvents:"none",zIndex:l},o={position:"absolute",top:`${c}px`,left:`${i.right}px`,transform:"translateX(-100%)",pointerEvents:"auto"};return e.jsx("div",{style:r,"data-testid":"selection-action-bar-overlay","data-selection-action-bar":"true",children:e.jsx("div",{style:o,onPointerDown:d=>d.stopPropagation(),"data-testid":"selection-action-bar-container",children:s})})};function Ks(t,n){const[l,s]=h.useState(null);return h.useEffect(()=>{if(n.length===0){s(null);return}const i=requestAnimationFrame(()=>{const a=t.current;if(!a){s(null);return}const c=a.getBoundingClientRect();let r=1/0,o=1/0,d=-1/0,x=-1/0,u=!1;for(const v of n){const b=a.querySelector(`[data-block-id="${v}"]`);if(!b)continue;const p=b.getBoundingClientRect();r=Math.min(r,p.left-c.left),o=Math.min(o,p.top-c.top),d=Math.max(d,p.right-c.left),x=Math.max(x,p.bottom-c.top),u=!0}if(!u){s(null);return}s({left:r,top:o,right:d,bottom:x,width:d-r,height:x-o})});return()=>cancelAnimationFrame(i)},[t,n]),l}const Ys="_container_3lvww_1",Js="_row_3lvww_9",Xs="_label_3lvww_15",Qs="_inputWrapper_3lvww_24",el="_error_3lvww_31",K={container:Ys,row:Js,label:Xs,inputWrapper:Qs,error:el};function ct(t,n,l){const s=t.trim();return s?/\s/.test(s)?"スペースは使用できません":s!==n&&(l!=null&&l.has(s))?"このIDは既に使用されています":null:"IDを入力してください"}const Ye=({selectedBlocks:t,onUpdateBlocks:n,allBlockIds:l})=>{const[s,i]=h.useState(""),[a,c]=h.useState(null),r=t[0];h.useEffect(()=>{t.length===1&&r&&(i(r.id),c(null))},[t,r]);const o=()=>{if(!r)return;const b=r.id,p=s.trim();if(p===b||!p){i(b),c(null);return}if(ct(p,b,l)){i(b),c(null);return}n({[b]:{id:p}})},d=b=>{const p=b??"";i(p),r&&c(ct(p,r.id,l))},x=b=>{const p={};t.forEach(f=>{p[f.id]={behavior:{...f.behavior,readOnly:!!b||void 0}}}),n(p)},u=b=>{const p={};t.forEach(f=>{p[f.id]={behavior:{...f.behavior,heightFit:b||void 0}}}),n(p)},v=b=>{const p={};t.forEach(f=>{p[f.id]={behavior:{...f.behavior,widthFit:b||void 0}}}),n(p)};return e.jsxs("div",{className:K.container,children:[t.length===1&&e.jsxs("div",{className:K.row,children:[e.jsx("span",{className:K.label,children:"ID"}),e.jsxs("div",{className:K.inputWrapper,children:[e.jsx(he,{value:s,onChange:d,onBlur:o,placeholder:"IDを入力"}),a&&e.jsx("span",{className:K.error,children:a})]})]}),t.length>0&&e.jsx("div",{className:K.row,children:e.jsx("div",{className:K.inputWrapper,children:e.jsx(ee,{label:"読み取り専用",value:!!H(t,"behavior.readOnly"),onChange:x})})}),t.length>0&&e.jsx("div",{className:K.row,children:e.jsx("div",{className:K.inputWrapper,children:e.jsx(ee,{label:"高さ自動フィット",value:!!H(t,"behavior.heightFit"),onChange:u})})}),t.length>0&&e.jsx("div",{className:K.row,children:e.jsx("div",{className:K.inputWrapper,children:e.jsx(ee,{label:"幅自動フィット",value:!!H(t,"behavior.widthFit"),onChange:v})})})]})};Ye.displayName="MetaPanel";const tl="_container_2zb6l_1",nl="_scrollArea_2zb6l_18",sl="_emptyState_2zb6l_33",We={container:tl,scrollArea:nl,emptyState:sl},we=({children:t,className:n=""})=>e.jsx("div",{className:`${We.container}${n?` ${n}`:""}`,children:t});we.displayName="BlockPropertyPanel";const Ut=h.memo(({context:t,gridSize:n,className:l=""})=>{const{pluginRegistry:s,actionContext:i}=t,a=t.editorState.pageIdx,c=t.book.pages[a],r=t.editorState.selectedBlockIds??[],o=(c==null?void 0:c.blocks.filter(f=>r.includes(f.id)))??[],d=c==null?void 0:c.blockDefaults,x=(f,j)=>i.execute("updateBlocks",{updates:f,options:j}),u=new Set((c==null?void 0:c.blocks.map(f=>f.id))??[]),v=o[0],b=v?s[v.kind]:void 0,p=h.useMemo(()=>{var j;if(o.length===0)return!1;const f=(j=o[0])==null?void 0:j.kind;return o.every(_=>_.kind===f)},[o]);return o.length===0?e.jsx(we,{className:l,children:e.jsxs("div",{className:We.emptyState,children:["ブロックを選択すると",e.jsx("br",{}),"プロパティが表示されます"]})}):e.jsx(we,{className:l,children:e.jsxs("div",{className:We.scrollArea,children:[e.jsx(F,{title:"配置・サイズ",description:"ブロックの位置(X・Y座標)と大きさ(幅・高さ)をグリッド単位で設定します",children:e.jsx(Ie,{selectedBlocks:o,onUpdateBlocks:x,gridSize:n})}),e.jsx(F,{title:"背景・枠線",description:"ブロックの背景色と枠線(線の種類・色・太さ)を設定します",children:e.jsx(ke,{selectedBlocks:o,onUpdateBlocks:x})}),b&&p&&b.properties.length>0&&e.jsx($e,{selectedBlocks:o,pluginRegistry:s,onUpdateBlocks:x,blockDefaults:d}),e.jsx(F,{title:"基本設定",description:"ブロックのID(識別子)や読み取り専用にするかどうかなど、動作に関わる設定をします",children:e.jsx(Ye,{selectedBlocks:o,onUpdateBlocks:x,allBlockIds:u})})]})})});Ut.displayName="DefaultBlockPropertyPanel";const ll="_kindSelector_qrad9_1",il="_kindTab_qrad9_9",al="_kindTabActive_qrad9_30",ol="_propertyList_qrad9_46",rl="_emptyState_qrad9_131",ce={kindSelector:ll,kindTab:il,kindTabActive:al,propertyList:ol,emptyState:rl},Vt=h.memo(({propDef:t,kindDefaults:n,onKindDefaultsChange:l})=>{const{kind:s,defaultProps:i}=t,a=Object.keys(i).some(d=>d in n),c=d=>n[d]??i[d]??null,r=(d,x)=>l({...n,[d]:x}),o=d=>{if(d){const x={...n};for(const[u,v]of Object.entries(i))x[u]=n[u]??v;l(x)}else{const x={...n};for(const u of Object.keys(i))delete x[u];l(x)}};return e.jsx(F,{title:Rt[s]??s,collapsible:!0,isOpen:a,onOpenChange:o,openLabel:"カスタム",closeLabel:"標準",children:e.jsx(Ze,{kind:s,defaultProps:i,getVal:c,onChange:r})})});Vt.displayName="DefaultsPropField";const Je=h.memo(({blockDefaults:t,pluginRegistry:n,onChange:l})=>{const s=Object.keys(n),[i,a]=h.useState(s[0]??""),c=i?n[i]:void 0,r=h.useCallback(o=>{const d={...t};Object.keys(o).length===0?delete d[i]:d[i]=o,l(d)},[t,i,l]);return s.length===0?e.jsx("div",{className:ce.emptyState,children:"プラグインが登録されていません"}):e.jsxs(F,{title:"ブロック共通デフォルト",collapsible:!0,noPadding:!0,description:"各ブロック種類に共通して適用されるデフォルト値です",children:[e.jsx("div",{className:ce.kindSelector,children:s.map(o=>{const d=n[o];return e.jsx("button",{type:"button",className:`${ce.kindTab} ${i===o?ce.kindTabActive:""}`,onClick:()=>a(o),children:(d==null?void 0:d.meta.displayName)??o},o)})}),c&&e.jsx("div",{className:ce.propertyList,children:c.properties.length===0?e.jsx("div",{className:ce.emptyState,children:"カスタマイズ可能なプロパティがありません"}):c.properties.map(o=>e.jsx(Vt,{propDef:o,kindDefaults:t[i]??{},onKindDefaultsChange:r},o.kind))})]})});Je.displayName="BlockDefaultsPanel";const cl="_list_12dfx_10",dl="_item_12dfx_19",ul="_selected_12dfx_41",hl="_dragHandle_12dfx_46",xl="_ghost_12dfx_57",pl="_itemInfo_12dfx_68",ml="_itemId_12dfx_75",bl="_itemMeta_12dfx_80",vl="_itemKind_12dfx_87",fl="_itemActions_12dfx_95",jl="_actionButton_12dfx_100",gl="_empty_12dfx_136",O={list:cl,item:dl,selected:ul,dragHandle:hl,ghost:xl,itemInfo:pl,itemId:ml,itemMeta:bl,itemKind:vl,itemActions:fl,actionButton:jl,empty:gl},Xe=({blocks:t,onBlocksChange:n,selectedBlockIds:l,onBlockHover:s,onBlockDragChange:i})=>{const[a,c]=h.useState(null),[r,o]=h.useState(null),d=h.useRef(null),x=h.useRef(null),u=[...t].reverse(),v=(()=>{if(a===null)return null;const m=u.findIndex(y=>y.id===a);return m===-1?null:m})(),b=h.useMemo(()=>{if(v===null||r===null)return u;const m=u[v];if(!m)return u;const w=[...u.filter((L,E)=>E!==v)],C=Math.max(0,Math.min(r,w.length));return w.splice(C,0,m),w},[u,v,r]),p=h.useCallback(m=>{const y=t.findIndex(L=>L.id===m);if(y===-1||y===t.length-1)return;const w=[...t],[C]=w.splice(y,1);C&&(w.push(C),n(w))},[t,n]),f=h.useCallback(m=>{const y=t.findIndex(L=>L.id===m);if(y===-1||y===0)return;const w=[...t],[C]=w.splice(y,1);C&&(w.unshift(C),n(w))},[t,n]),j=h.useCallback(m=>{const y=t.findIndex(E=>E.id===m);if(y===-1||y===t.length-1)return;const w=[...t],C=w[y],L=w[y+1];!C||!L||(w[y]=L,w[y+1]=C,n(w))},[t,n]),_=h.useCallback(m=>{const y=t.findIndex(E=>E.id===m);if(y===-1||y===0)return;const w=[...t],C=w[y],L=w[y-1];!C||!L||(w[y]=L,w[y-1]=C,n(w))},[t,n]),I=h.useCallback((m,y)=>{var L;m.dataTransfer.effectAllowed="move";const w=t.length-1-y,C=((L=t[w])==null?void 0:L.id)??"";m.dataTransfer.setData("text/plain",C),d.current=[...t],x.current=y,requestAnimationFrame(()=>{c(C),o(y),i==null||i(C)})},[t,i]),k=h.useCallback(()=>{d.current&&(n(d.current),d.current=null),c(null),o(null),s==null||s(null),i==null||i(null)},[n,s,i]),$=h.useCallback((m,y,w)=>{if(m.preventDefault(),m.dataTransfer.dropEffect="move",a===null||w===a)return;const C=r??x.current??0,L=y<C?y:y-1,E=m.currentTarget.getBoundingClientRect(),P=E.top+E.height/2,T=m.clientY<P?L:L+1;if(T===r)return;o(T);const D=d.current;if(D){const Z=[...D].reverse(),it=Z.find(fe=>fe.id===a);if(it){const fe=Z.filter(Yt=>Yt.id!==a),Kt=Math.max(0,Math.min(T,fe.length)),at=[...fe];at.splice(Kt,0,it),n([...at].reverse())}}},[a,r,n]),S=h.useCallback(m=>{m.currentTarget.contains(m.relatedTarget)||o(v)},[v]),N=h.useCallback(m=>{if(m.preventDefault(),d.current=null,v!==null&&r!==null){const y=u[v];if(y){const w=u.filter((T,D)=>D!==v),C=Math.max(0,Math.min(r,w.length)),L=[...w];L.splice(C,0,y);const E=[...L].reverse();E.every((T,D)=>{var Z;return T.id===((Z=t[D])==null?void 0:Z.id)})||n(E)}}c(null),o(null)},[t,v,r,u,n]);return e.jsxs(F,{title:"ブロック順序",collapsible:!0,description:"ブロックの重なり順序を管理します。上にあるほど最前面、下にあるほど最背面に表示されます。ドラッグして並び替えができます",children:[e.jsx("ul",{className:O.list,onMouseLeave:()=>{a===null&&(s==null||s(null))},onDragLeave:S,onDrop:N,onDragOver:m=>m.preventDefault(),children:b.map((m,y)=>{const w=u.findIndex(P=>P.id===m.id),C=m.id===a,L=t.length-1-w,E=(l==null?void 0:l.includes(m.id))??!1;return e.jsxs("li",{className:`${O.item} ${C?O.ghost:""} ${E?O.selected:""}`,draggable:!C,onDragStart:C?void 0:P=>I(P,w),onDragEnd:k,onDragOver:C?void 0:P=>$(P,y,m.id),onMouseEnter:C?void 0:()=>s==null?void 0:s(m.id),children:[e.jsx("span",{className:O.dragHandle,"aria-hidden":"true",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("title",{children:"ドラッグハンドル"}),e.jsx("circle",{cx:"6",cy:"4",r:"1",fill:"currentColor"}),e.jsx("circle",{cx:"10",cy:"4",r:"1",fill:"currentColor"}),e.jsx("circle",{cx:"6",cy:"8",r:"1",fill:"currentColor"}),e.jsx("circle",{cx:"10",cy:"8",r:"1",fill:"currentColor"}),e.jsx("circle",{cx:"6",cy:"12",r:"1",fill:"currentColor"}),e.jsx("circle",{cx:"10",cy:"12",r:"1",fill:"currentColor"})]})}),e.jsxs("div",{className:O.itemInfo,children:[e.jsx("div",{className:O.itemId,children:m.id}),e.jsx("div",{className:O.itemMeta,children:e.jsx("span",{className:O.itemKind,children:m.kind})})]}),e.jsxs("div",{className:O.itemActions,children:[e.jsx("button",{type:"button",className:O.actionButton,onClick:()=>p(m.id),title:"最前面へ","aria-label":"最前面へ移動",disabled:C||L===t.length-1,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("title",{children:"最前面へ"}),e.jsx("path",{d:"M4 12v-8M8 12v-8M12 12v-8",stroke:"currentColor"}),e.jsx("path",{d:"M12 4h-8",stroke:"currentColor",strokeWidth:"2"})]})}),e.jsx("button",{type:"button",className:O.actionButton,onClick:()=>j(m.id),title:"前面へ","aria-label":"前面へ移動",disabled:C||L===t.length-1,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("title",{children:"前面へ"}),e.jsx("path",{d:"M8 4v8",stroke:"currentColor"}),e.jsx("path",{d:"M5 7l3-3 3 3",stroke:"currentColor"})]})}),e.jsx("button",{type:"button",className:O.actionButton,onClick:()=>_(m.id),title:"背面へ","aria-label":"背面へ移動",disabled:C||L===0,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("title",{children:"背面へ"}),e.jsx("path",{d:"M8 12v-8",stroke:"currentColor"}),e.jsx("path",{d:"M5 9l3 3 3-3",stroke:"currentColor"})]})}),e.jsx("button",{type:"button",className:O.actionButton,onClick:()=>f(m.id),title:"最背面へ","aria-label":"最背面へ移動",disabled:C||L===0,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("title",{children:"最背面へ"}),e.jsx("path",{d:"M4 12v-8M8 12v-8M12 12v-8",stroke:"currentColor"}),e.jsx("path",{d:"M12 12h-8",stroke:"currentColor",strokeWidth:"2"})]})})]})]},m.id)})}),t.length===0&&e.jsx("div",{className:O.empty,children:"ブロックがありません"})]})};Xe.displayName="BlockOrderPanel";const yl="_container_1x0zd_4",_l="_group_1x0zd_16",wl="_divider_1x0zd_22",ye={container:yl,group:_l,divider:wl},Qe=({context:t,onActionFeedback:n})=>{const{actionContext:l}=t,s=t.editorState.selectedBlockIds,i=((s==null?void 0:s.length)??0)>0,a=l.isEnabled("undo"),c=l.isEnabled("redo"),r=l.isEnabled("paste"),o=d=>{l.execute(d);const x=qe(d);x&&(n==null||n(x))};return e.jsxs("div",{className:ye.container,"data-testid":"canvas-action-panel",children:[e.jsxs("div",{className:ye.group,children:[e.jsx(q,{icon:e.jsx(Fe,{"aria-hidden":"true"}),label:"元に戻す",title:"元に戻す (Ctrl+Z / Cmd+Z)",onClick:()=>o("undo"),disabled:!a}),e.jsx(q,{icon:e.jsx(Oe,{"aria-hidden":"true"}),label:"やり直し",title:"やり直し (Ctrl+Y / Cmd+Y)",onClick:()=>o("redo"),disabled:!c})]}),e.jsx("div",{className:ye.divider,"aria-hidden":"true"}),e.jsxs("div",{className:ye.group,children:[e.jsx(q,{icon:e.jsx(Ue,{"aria-hidden":"true"}),label:"選択を削除",title:"削除 (Delete / Backspace)",onClick:()=>o("delete"),disabled:!i}),e.jsx(q,{icon:e.jsx(Ve,{"aria-hidden":"true"}),label:"選択をコピー",title:"コピー (Ctrl+C / Cmd+C)",onClick:()=>o("copy"),disabled:!i}),e.jsx(q,{icon:e.jsx(Ce,{"aria-hidden":"true"}),label:"貼り付け",title:"貼り付け (Ctrl+V / Cmd+V)",onClick:()=>o("paste"),disabled:!r}),e.jsx(q,{icon:e.jsx(Ge,{"aria-hidden":"true"}),label:"選択を複製",title:"複製 (Ctrl+D / Cmd+D)",onClick:()=>o("duplicate"),disabled:!i})]})]})};Qe.displayName="CanvasActionPanel";const et=({children:t,className:n})=>e.jsx(He,{className:n,children:t});et.displayName="CanvasPanel";const Cl="_field_69k7e_6",Nl="_horizontal_69k7e_12",Sl="_label_69k7e_18",kl="_gridSizeRow_69k7e_29",le={field:Cl,horizontal:Nl,label:Sl,gridSizeRow:kl},dt={value:1,unit:"fr"},tt=({grid:t,onGridChange:n})=>{const l=h.useCallback(i=>{if(!i||i<1||i>100)return;const a=g.expandSparseCols(t),c=t.colCount,r=[...a];if(i>c)for(let o=c;o<i;o++)r.push({...dt});else r.splice(i);n({...t,...g.colsToSparse(r)})},[t,n]),s=h.useCallback(i=>{if(!i||i<1||i>100)return;const a=g.expandSparseRows(t),c=t.rowCount,r=[...a];if(i>c)for(let o=c;o<i;o++)r.push({...dt});else r.splice(i);n({...t,...g.rowsToSparse(r)})},[t,n]);return e.jsx(F,{title:"グリッドサイズ",collapsible:!0,defaultCollapsed:!1,description:"ブロックを配置するグリッドの列数と行数を設定します",children:e.jsxs("div",{className:le.gridSizeRow,children:[e.jsxs("div",{className:`${le.field} ${le.horizontal}`,children:[e.jsx("span",{className:le.label,children:"列数"}),e.jsx(U,{value:t.colCount,onChange:l,min:1,max:100,step:1})]}),e.jsxs("div",{className:`${le.field} ${le.horizontal}`,children:[e.jsx("span",{className:le.label,children:"行数"}),e.jsx(U,{value:t.rowCount,onChange:s,min:1,max:100,step:1})]})]})})};tt.displayName="GridSizePanel";const Il="_topRow_2ni80_6",$l="_linkSwitch_2ni80_15",Ll="_switchLabel_2ni80_23",Tl="_switchLabelActive_2ni80_31",Pl="_toggle_2ni80_35",Al="_thumb_2ni80_52",Ml="_topCell_2ni80_70",El="_sideCell_2ni80_75",Dl="_bottomCell_2ni80_81",zl="_sideMargins_2ni80_88",G={topRow:Il,linkSwitch:$l,switchLabel:Ll,switchLabelActive:Tl,toggle:Pl,thumb:Al,topCell:Ml,sideCell:El,bottomCell:Dl,sideMargins:zl},nt=({paper:t,onPaperChange:n})=>{const[l,s]=h.useState(!1),i=h.useCallback(o=>{if(!o)return;const d=l?{top:o,right:o,bottom:o,left:o}:{...t.margin,top:o};n({...t,margin:d})},[t,n,l]),a=h.useCallback(o=>{o&&n({...t,margin:{...t.margin,right:o}})},[t,n]),c=h.useCallback(o=>{o&&n({...t,margin:{...t.margin,bottom:o}})},[t,n]),r=h.useCallback(o=>{o&&n({...t,margin:{...t.margin,left:o}})},[t,n]);return e.jsxs(F,{title:"マージン",collapsible:!0,defaultCollapsed:!1,description:"印刷時にコンテンツが配置されない余白(マージン)を設定します",children:[e.jsxs("div",{className:G.topRow,children:[e.jsxs("div",{className:G.linkSwitch,children:[e.jsx("span",{className:`${G.switchLabel} ${l?"":G.switchLabelActive}`,children:"個別"}),e.jsx("button",{type:"button",role:"switch","aria-checked":l,className:G.toggle,onClick:()=>s(o=>!o),children:e.jsx("span",{className:G.thumb})}),e.jsx("span",{className:`${G.switchLabel} ${l?G.switchLabelActive:""}`,children:"一括"})]}),e.jsx("div",{className:G.topCell,children:e.jsx(W,{value:t.margin.top,onChange:i,allowedUnits:["mm","cm","inch"],min:0,max:1e3})})]}),!l&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:G.sideMargins,children:[e.jsx("div",{className:G.sideCell,children:e.jsx(W,{value:t.margin.left,onChange:r,allowedUnits:["mm","cm","inch"],min:0,max:1e3})}),e.jsx("div",{className:G.sideCell,children:e.jsx(W,{value:t.margin.right,onChange:a,allowedUnits:["mm","cm","inch"],min:0,max:1e3})})]}),e.jsx("div",{className:G.bottomCell,children:e.jsx(W,{value:t.margin.bottom,onChange:c,allowedUnits:["mm","cm","inch"],min:0,max:1e3})})]})]})};nt.displayName="MarginPanel";const Bl="_grid_ddemj_5",Rl="_colSpan2_ddemj_13",Wl="_colSpan3_ddemj_18",Fl="_label_ddemj_23",Ol="_modeLabel_ddemj_32",Ul="_modeToggle_ddemj_40",Vl="_switchLabel_ddemj_47",Gl="_switchLabelActive_ddemj_55",ql="_toggle_ddemj_59",Hl="_thumb_ddemj_76",Zl="_checkboxCell_ddemj_92",A={grid:Bl,colSpan2:Rl,colSpan3:Wl,label:Fl,modeLabel:Ol,modeToggle:Ul,switchLabel:Vl,switchLabelActive:Gl,toggle:ql,thumb:Hl,checkboxCell:Zl};function ut(t,n){switch(n){case"cm":return t/10;case"inch":return t/25.4;default:return t}}const st=({paper:t,onPaperChange:n})=>{const l=h.useMemo(()=>[{value:g.PaperSizePreset.A4,label:"A4 (210 × 297 mm)"},{value:g.PaperSizePreset.A3,label:"A3 (297 × 420 mm)"},{value:g.PaperSizePreset.B5,label:"B5 (182 × 257 mm)"},{value:g.PaperSizePreset.LETTER,label:"Letter (8.5 × 11 inch)"},{value:g.PaperSizePreset.LEGAL,label:"Legal (8.5 × 14 inch)"},{value:g.PaperSizePreset.CUSTOM,label:"カスタム"}],[]),s=h.useCallback(j=>{n({...t,orientation:j||void 0})},[t,n]),i=h.useCallback(j=>{j&&n({...t,size:g.DEFAULT_PAPER_SIZES[j]})},[t,n]),a=h.useCallback(j=>{if(!j)return;const _={...t.size,preset:g.PaperSizePreset.CUSTOM,width:j};n({...t,size:_})},[t,n]),c=h.useCallback(j=>{if(!j)return;const _={...t.size,preset:g.PaperSizePreset.CUSTOM,height:j};n({...t,size:_})},[t,n]),r=t.size.preset===g.PaperSizePreset.CUSTOM,o=t.autoHeight===!0,d=t.autoWidth===!0,x=h.useCallback(()=>{n({...t,autoHeight:o?void 0:!0})},[t,o,n]),u=h.useCallback(()=>{n({...t,autoWidth:d?void 0:!0})},[t,d,n]),v=o?"最小高さ":"高さ",b=d?"最小幅":"幅",p=h.useMemo(()=>{const j=g.toMm.fromDim(t.margin.left)+g.toMm.fromDim(t.margin.right);return ut(j,t.size.width.unit)},[t.margin.left,t.margin.right,t.size.width.unit]),f=h.useMemo(()=>{const j=g.toMm.fromDim(t.margin.top)+g.toMm.fromDim(t.margin.bottom);return ut(j,t.size.height.unit)},[t.margin.top,t.margin.bottom,t.size.height.unit]);return e.jsx(F,{title:"用紙設定",collapsible:!0,defaultCollapsed:!1,description:"用紙のサイズと向きを設定します",children:e.jsxs("div",{className:A.grid,children:[e.jsx("span",{className:`${A.label} ${A.colSpan2}`,children:"用紙サイズ"}),e.jsx("div",{className:A.colSpan3,children:e.jsx(oe,{value:t.size.preset,options:l,onChange:i})}),e.jsx("span",{className:`${A.label} ${A.colSpan2}`,children:"横向き"}),e.jsx("div",{className:A.checkboxCell,children:e.jsx(ee,{value:t.orientation===!0,onChange:s})}),e.jsx("span",{className:A.modeLabel,children:"幅"}),e.jsxs("div",{className:A.modeToggle,children:[e.jsx("span",{className:`${A.switchLabel} ${d?A.switchLabelActive:""}`,children:"自動"}),e.jsx("button",{type:"button",role:"switch","aria-checked":d,"aria-label":"幅モード",className:A.toggle,onClick:u,children:e.jsx("span",{className:A.thumb})}),e.jsx("span",{className:`${A.switchLabel} ${d?"":A.switchLabelActive}`,children:"固定"})]}),e.jsx("span",{className:A.modeLabel,children:"高さ"}),e.jsxs("div",{className:A.modeToggle,children:[e.jsx("span",{className:`${A.switchLabel} ${o?A.switchLabelActive:""}`,children:"自動"}),e.jsx("button",{type:"button",role:"switch","aria-checked":o,"aria-label":"高さモード",className:A.toggle,onClick:x,children:e.jsx("span",{className:A.thumb})}),e.jsx("span",{className:`${A.switchLabel} ${o?"":A.switchLabelActive}`,children:"固定"})]}),r&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:A.label,children:b}),e.jsx("div",{className:A.colSpan3,children:e.jsx(W,{value:t.size.width,onChange:a,allowedUnits:["mm","cm","inch"],min:p,max:500})}),e.jsx("span",{className:A.label,children:v}),e.jsx("div",{className:A.colSpan3,children:e.jsx(W,{value:t.size.height,onChange:c,allowedUnits:["mm","cm","inch"],min:f,max:500})})]})]})})};st.displayName="PaperSizePanel";const Gt=({context:t,onBlockHover:n,onBlockDragChange:l,onActionFeedback:s})=>{const{book:i,onBookChange:a,pluginRegistry:c}=t,r=t.editorState.pageIdx,o=t.editorState.selectedBlockIds,d=i.pages[r]??i.pages[0],x=h.useCallback(p=>{a({...i,paper:p})},[i,a]),u=h.useCallback(p=>{const f=i.pages.map((j,_)=>_===r?{...j,grid:p}:j);a({...i,pages:f},{mergeKey:g.gridSizeKey(r)})},[i,a,r]),v=h.useCallback(p=>{const f=i.pages.map((j,_)=>_===r?{...j,blocks:p}:j);a({...i,pages:f})},[i,a,r]),b=h.useCallback(p=>{const f=i.pages.map((j,_)=>_===r?{...j,blockDefaults:p}:j);a({...i,pages:f})},[i,a,r]);return e.jsxs(et,{children:[e.jsx(Qe,{context:t,onActionFeedback:s}),e.jsx(st,{paper:i.paper,onPaperChange:x}),e.jsx(nt,{paper:i.paper,onPaperChange:x}),e.jsx(tt,{grid:d.grid,onGridChange:u}),c&&Object.keys(c).length>0&&e.jsx(Je,{blockDefaults:d.blockDefaults??{},pluginRegistry:c,onChange:b}),e.jsx(Xe,{blocks:d.blocks,onBlocksChange:v,selectedBlockIds:o,onBlockHover:n,onBlockDragChange:l})]})};Gt.displayName="DefaultCanvasPanel";const Kl="_buttonGroup_5h1ft_1",Yl="_button_5h1ft_1",Jl="_error_5h1ft_33",R={buttonGroup:Kl,button:Yl,error:Jl},ht=(t,n)=>{const l=[];for(const s of Object.keys(t))s in n||l.push({id:s,value:void 0});for(const[s,i]of Object.entries(n))l.push({id:s,value:i});return l},lt=({book:t,values:n,onBookChange:l,onValuesChange:s})=>{const[i,a]=h.useState(""),c=h.useRef(null),r=h.useRef(null),o=h.useCallback(()=>{try{const m=g.serializeBook(t),y=new Blob([m],{type:"application/json"}),w=URL.createObjectURL(y),C=document.createElement("a");C.href=w,C.download="book.json",C.click(),URL.revokeObjectURL(w),a("")}catch(m){a(`エクスポートエラー: ${m instanceof Error?m.message:String(m)}`)}},[t]),d=h.useCallback(async()=>{try{const m=g.serializeBook(t);await navigator.clipboard.writeText(m),a(""),alert("ブックをクリップボードにコピーしました")}catch(m){a(`クリップボードエラー: ${m instanceof Error?m.message:String(m)}`)}},[t]),x=h.useCallback(m=>{const y=g.deserializeBook(m);l(y)},[l]),u=h.useCallback(()=>{var m;(m=c.current)==null||m.click()},[]),v=h.useCallback(m=>{var C;const y=(C=m.target.files)==null?void 0:C[0];if(!y)return;const w=new FileReader;w.onload=L=>{var E;try{x((E=L.target)==null?void 0:E.result),a(""),alert("インポートしました")}catch(P){a(`インポートエラー: ${P instanceof Error?P.message:String(P)}`)}},w.readAsText(y),m.target.value=""},[x]),b=h.useCallback(async()=>{try{const m=await navigator.clipboard.readText();x(m),a(""),alert("インポートしました")}catch(m){a(`インポートエラー: ${m instanceof Error?m.message:String(m)}`)}},[x]),p=h.useCallback(()=>{try{const m=JSON.stringify(n,null,2),y=new Blob([m],{type:"application/json"}),w=URL.createObjectURL(y),C=document.createElement("a");C.href=w,C.download="values.json",C.click(),URL.revokeObjectURL(w),a("")}catch(m){a(`エクスポートエラー: ${m instanceof Error?m.message:String(m)}`)}},[n]),f=h.useCallback(async()=>{try{const m=JSON.stringify(n,null,2);await navigator.clipboard.writeText(m),a(""),alert("値をクリップボードにコピーしました")}catch(m){a(`クリップボードエラー: ${m instanceof Error?m.message:String(m)}`)}},[n]),j=h.useCallback(()=>{var m;(m=r.current)==null||m.click()},[]),_=h.useCallback(m=>{var C;const y=(C=m.target.files)==null?void 0:C[0];if(!y)return;const w=new FileReader;w.onload=L=>{var E;try{const P=g.deserializeValues((E=L.target)==null?void 0:E.result),T=ht(n,P);s(T),a(""),alert("値をインポートしました")}catch(P){a(`インポートエラー: ${P instanceof Error?P.message:String(P)}`)}},w.readAsText(y),m.target.value=""},[s,n]),I=h.useCallback(async()=>{try{const m=await navigator.clipboard.readText(),y=g.deserializeValues(m),w=ht(n,y);s(w),a(""),alert("値をインポートしました")}catch(m){a(`クリップボードエラー: ${m instanceof Error?m.message:String(m)}`)}},[s,n]),k=h.useRef(null),$=h.useCallback(()=>{try{const m=t.pages[0],y=JSON.stringify({grid:m.grid,blocks:m.blocks},null,2),w=new Blob([y],{type:"application/json"}),C=URL.createObjectURL(w),L=document.createElement("a");L.href=C,L.download="schema.json",L.click(),URL.revokeObjectURL(C),a("")}catch(m){a(`エクスポートエラー: ${m instanceof Error?m.message:String(m)}`)}},[t]),S=h.useCallback(()=>{var m;(m=k.current)==null||m.click()},[]),N=h.useCallback(m=>{var C;const y=(C=m.target.files)==null?void 0:C[0];if(!y)return;const w=new FileReader;w.onload=L=>{var E;try{const P=JSON.parse((E=L.target)==null?void 0:E.result),T={grid:P.grid,blocks:P.blocks},D=[...t.pages];D[0]=T,l({...t,pages:D}),a(""),alert("スキーマをインポートしました")}catch(P){a(`インポートエラー: ${P instanceof Error?P.message:String(P)}`)}},w.readAsText(y),m.target.value=""},[t,l]);return e.jsxs(e.Fragment,{children:[e.jsxs(F,{title:"ブック",children:[e.jsxs("div",{className:R.buttonGroup,children:[e.jsx("button",{type:"button",className:R.button,"data-testid":"export-book-file",onClick:o,children:"📥 ファイルにエクスポート"}),e.jsx("button",{type:"button",className:R.button,"data-testid":"export-book-clipboard",onClick:d,children:"📋 クリップボードにコピー"})]}),e.jsxs("div",{className:R.buttonGroup,children:[e.jsx("button",{type:"button",className:R.button,"data-testid":"import-book-file",onClick:u,children:"📤 ファイルからインポート"}),e.jsx("button",{type:"button",className:R.button,"data-testid":"import-book-clipboard",onClick:b,children:"📋 クリップボードからペースト"})]}),e.jsx("input",{ref:c,type:"file",accept:".json",style:{display:"none"},onChange:v})]}),e.jsxs(F,{title:"値",children:[e.jsxs("div",{className:R.buttonGroup,children:[e.jsx("button",{type:"button",className:R.button,"data-testid":"export-values-file",onClick:p,children:"📥 ファイルにエクスポート"}),e.jsx("button",{type:"button",className:R.button,"data-testid":"export-values-clipboard",onClick:f,children:"📋 クリップボードにコピー"})]}),e.jsxs("div",{className:R.buttonGroup,children:[e.jsx("button",{type:"button",className:R.button,"data-testid":"import-values-file",onClick:j,children:"📤 ファイルからインポート"}),e.jsx("button",{type:"button",className:R.button,"data-testid":"import-values-clipboard",onClick:I,children:"📋 クリップボードからペースト"})]}),e.jsx("input",{ref:r,type:"file",accept:".json",style:{display:"none"},onChange:_})]}),e.jsxs(F,{title:"スキーマ",children:[e.jsx("div",{className:R.buttonGroup,children:e.jsx("button",{type:"button",className:R.button,"data-testid":"export-schema-file",onClick:$,children:"📥 スキーマをエクスポート"})}),e.jsx("div",{className:R.buttonGroup,children:e.jsx("button",{type:"button",className:R.button,"data-testid":"import-schema-file",onClick:S,children:"📤 スキーマをインポート"})}),e.jsx("input",{ref:k,type:"file",accept:".json",style:{display:"none"},onChange:N})]}),i&&e.jsx("div",{className:R.error,role:"alert",children:i})]})};lt.displayName="ImportExportPanel";const qt=({context:t,sections:n})=>{const l=[e.jsx(lt,{book:t.book,values:t.values,onBookChange:t.onBookChange,onValuesChange:t.onValuesChange??(()=>{})},"import-export")],s=n??l;return e.jsx(He,{children:s})};qt.displayName="OtherPanel";const Xl="_container_16a0l_1",Ql="_paletteItems_16a0l_11",ei="_item_16a0l_23",ti="_itemName_16a0l_49",ni="_itemPreview_16a0l_77",be={container:Xl,paletteItems:Ql,item:ei,itemName:ti,itemPreview:ni},Ht=({context:t,className:n})=>{const l=Object.values(t.pluginRegistry).filter(a=>a!==void 0),s=t.book.pages[t.editorState.pageIdx],{getBlockRectPx:i}=g.useGridCalc(t.book.paper,(s==null?void 0:s.grid)??g.DEFAULT_GRID);return e.jsx("div",{className:`${be.container} ${n||""}`,children:e.jsx("div",{className:be.paletteItems,children:l.map(a=>{const c=a.meta.defaultSize??{w:1,h:1},r=i({id:"ghost",kind:a.kind,layout:{x:0,y:0,w:c.w,h:c.h},props:{}});return e.jsx(Zt,{plugin:a,ghostWidth:r.width,ghostHeight:r.height},a.kind)})})})};Ht.displayName="PalettePanel";const Zt=({plugin:t,ghostWidth:n,ghostHeight:l})=>{const s=h.useMemo(()=>{var c,r;return{id:`preview-${t.kind}`,kind:t.kind,layout:{x:0,y:0,w:((c=t.meta.defaultSize)==null?void 0:c.w)??1,h:((r=t.meta.defaultSize)==null?void 0:r.h)??1},props:{}}},[t]),i=null,a=h.useCallback(c=>{g.startBlockDrag(c,t.kind,t.meta.defaultSize??{w:1,h:1});const r=Math.round(n),o=Math.round(l),d=document.createElement("div");d.style.cssText=`position:fixed;top:-9999px;left:-9999px;width:${r}px;height:${o}px;background:rgba(147,197,253,0.45);border-radius:4px;`,document.body.appendChild(d),c.dataTransfer.setDragImage(d,r/2,o/2),requestAnimationFrame(()=>document.body.removeChild(d))},[t,n,l]);return e.jsxs("div",{className:be.item,"data-testid":`palette-item-${t.kind}`,children:[e.jsx("button",{type:"button",draggable:!0,onDragStart:a,className:be.itemName,"aria-label":`${t.meta.displayName}ブロックを追加`,children:t.meta.displayName}),e.jsx("div",{className:be.itemPreview,draggable:!0,onDragStart:a,"aria-hidden":"true",children:e.jsx(t.Renderer,{id:s.id,props:s.props,value:i,onChange:()=>{},readOnly:!0,mode:g.NoteMode.FORM})})]})};Zt.displayName="PaletteItem";exports.ActionBarDivider=pt;exports.AddPageIcon=yt;exports.BackgroundBorderPanel=ke;exports.BlockDefaultsPanel=Je;exports.BlockOrderPanel=Xe;exports.BlockPropertyPanel=we;exports.CanvasActionPanel=Qe;exports.CanvasActionSection=It;exports.CanvasPanel=et;exports.Checkbox=ee;exports.ChevronLeftIcon=jt;exports.ChevronRightIcon=gt;exports.CollapsibleSection=F;exports.ColorPicker=X;exports.DefaultBlockPropertyPanel=Ut;exports.DefaultCanvasPanel=Gt;exports.DeletePageIcon=_t;exports.DimensionInput=W;exports.Dropdown=oe;exports.GridSettingsSection=$t;exports.GridSizePanel=tt;exports.IconActionButton=q;exports.ImportExportPanel=lt;exports.LayoutPanel=Ie;exports.MarginPanel=nt;exports.MetaPanel=Ye;exports.NumberInput=U;exports.OtherPanel=qt;exports.PalettePanel=Ht;exports.PaperSettingsSection=Lt;exports.PaperSizePanel=st;exports.PluginPanels=$e;exports.PropertyField=Ke;exports.SelectionActionBar=Ot;exports.SelectionActionBarButton=ae;exports.SelectionActionBarOverlay=Zs;exports.SelectionActionBarPanel=me;exports.TabPanel=He;exports.Tabs=St;exports.TabsContent=ue;exports.TabsList=kt;exports.TabsTrigger=de;exports.TextInput=he;exports.getDefaultSelectionActionBarItems=qs;exports.styles=M;exports.useSelectionActionBar=Ft;exports.useSelectionBounds=Ks;
|
|
9
|
+
. 任意の1文字`,ze={display:"flex",alignItems:"center",gap:6,marginBottom:4},Be={fontSize:11,color:"#666",minWidth:72,flexShrink:0},Bt=({inputType:t,minLength:n,maxLength:l,pattern:s,onChange:i,onChangeBatch:a,readOnly:c=!1})=>{const[r,o]=h.useState(!1),[d,x]=h.useState({}),u=h.useRef(null),v=h.useCallback(()=>{var N;const S=(N=u.current)==null?void 0:N.getBoundingClientRect();S&&(x({position:"fixed",bottom:window.innerHeight-S.top+4,right:window.innerWidth-S.right}),o(!0))},[]),b=h.useCallback(()=>o(!1),[]),p=t??"text",f=s??void 0,j=(()=>{const S=_e.find(N=>N.isCustom||N.inputType!==p?!1:N.pattern===f);return(S==null?void 0:S.label)??"その他"})(),_=j==="その他",I=_e.find(S=>S.label===j),k=!(I!=null&&I.hideLength),$=h.useCallback(S=>{const N=_e.find(w=>w.label===S);if(!N)return;const m=N.isCustom?"":N.pattern??null,y={inputType:N.inputType,pattern:m};if(a)a(y);else for(const[w,C]of Object.entries(y))i(w,C)},[i,a]);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs("div",{style:ze,children:[e.jsx("span",{style:Be,children:"入力タイプ"}),e.jsx("div",{style:{flex:1},children:e.jsx(oe,{value:j,onChange:$,options:Ds,readOnly:c,height:24})})]}),k&&e.jsxs("div",{style:ze,children:[e.jsx("span",{style:Be,children:"文字数"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,flex:1},children:[e.jsx("div",{style:{flex:1},children:e.jsx(U,{value:n,onChange:S=>i("minLength",S??null),readOnly:c,min:0,placeholder:"min",height:24})}),e.jsx("span",{style:{fontSize:11,color:"#666"},children:"〜"}),e.jsx("div",{style:{flex:1},children:e.jsx(U,{value:l,onChange:S=>i("maxLength",S??null),readOnly:c,min:0,placeholder:"max",height:24})}),e.jsx("span",{style:{fontSize:11,color:"#666"},children:"文字"})]})]}),_&&e.jsxs("div",{style:ze,children:[e.jsxs("span",{style:{...Be,display:"flex",alignItems:"center",gap:2},children:["パターン",e.jsx("button",{ref:u,type:"button",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:14,height:14,border:"none",padding:0,borderRadius:9999,backgroundColor:"#d1d5db",color:"#fff",fontSize:9,fontWeight:700,cursor:"help",outline:"none"},"aria-label":"入力パターンの使い方",onMouseEnter:v,onMouseLeave:b,onFocus:v,onBlur:b,children:"i"})]}),e.jsx("div",{style:{flex:1},children:e.jsx(he,{value:s??"",onChange:S=>{i("pattern",S??"")},readOnly:c,placeholder:"例: [0-9]+"})})]}),r&&xt.createPortal(e.jsx("pre",{style:{...d,zIndex:9999999,width:"max-content",margin:0,padding:"6px 10px",fontSize:11,fontFamily:"monospace",lineHeight:1.6,color:"#f3f4f6",backgroundColor:"rgba(30, 30, 30, 0.95)",borderRadius:6,boxShadow:"0 4px 12px rgba(0,0,0,0.4)",whiteSpace:"pre",pointerEvents:"none"},children:zs}),document.body)]})};Bt.displayName="TextValidationEditor";const Rt={alignment:"配置",fontStyle:"フォントスタイル",padding:"パディング",required:"必須入力",placeholder:"プレースホルダー",textValidation:"入力検証",textBehavior:"テキスト動作",selectConfig:"選択肢設定",checkboxStyle:"チェックボックスデザイン"},Bs=[{value:g.HorizontalAlign.left,label:"左揃え",icon:e.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[e.jsx("rect",{x:"1",y:"2",width:"1.5",height:"12",rx:"0.5"}),e.jsx("rect",{x:"4",y:"3",width:"6",height:"2.5",rx:"0.5"}),e.jsx("rect",{x:"4",y:"7",width:"10",height:"2.5",rx:"0.5"}),e.jsx("rect",{x:"4",y:"11",width:"7",height:"2.5",rx:"0.5"})]})},{value:g.HorizontalAlign.center,label:"中央揃え",icon:e.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[e.jsx("rect",{x:"7.25",y:"2",width:"1.5",height:"12",rx:"0.5"}),e.jsx("rect",{x:"3.5",y:"3",width:"9",height:"2.5",rx:"0.5"}),e.jsx("rect",{x:"1",y:"7",width:"14",height:"2.5",rx:"0.5"}),e.jsx("rect",{x:"4.5",y:"11",width:"7",height:"2.5",rx:"0.5"})]})},{value:g.HorizontalAlign.right,label:"右揃え",icon:e.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[e.jsx("rect",{x:"13.5",y:"2",width:"1.5",height:"12",rx:"0.5"}),e.jsx("rect",{x:"6",y:"3",width:"6",height:"2.5",rx:"0.5"}),e.jsx("rect",{x:"2",y:"7",width:"10",height:"2.5",rx:"0.5"}),e.jsx("rect",{x:"5",y:"11",width:"7",height:"2.5",rx:"0.5"})]})}],Rs=[{value:g.VerticalAlign.top,label:"上揃え",icon:e.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[e.jsx("rect",{x:"1",y:"1",width:"14",height:"1"}),e.jsx("rect",{x:"2",y:"3",width:"4",height:"8",rx:"0.5"}),e.jsx("rect",{x:"10",y:"3",width:"4",height:"5",rx:"0.5"})]})},{value:g.VerticalAlign.center,label:"中央揃え",icon:e.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[e.jsx("rect",{x:"1",y:"7.5",width:"14",height:"1"}),e.jsx("rect",{x:"2",y:"3",width:"4",height:"10",rx:"0.5"}),e.jsx("rect",{x:"10",y:"4.5",width:"4",height:"7",rx:"0.5"})]})},{value:g.VerticalAlign.bottom,label:"下揃え",icon:e.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[e.jsx("rect",{x:"1",y:"14",width:"14",height:"1"}),e.jsx("rect",{x:"2",y:"5",width:"4",height:"8",rx:"0.5"}),e.jsx("rect",{x:"10",y:"8",width:"4",height:"5",rx:"0.5"})]})}];function re(t){return typeof t=="object"&&t!==null&&typeof t.value=="number"&&typeof t.unit=="string"}function Ws(t){return typeof t=="object"&&t!==null&&Array.isArray(t.options)}const Ze=h.memo(({kind:t,defaultProps:n,getVal:l,onChange:s,onChangeBatch:i,readOnly:a,component:c})=>{switch(t){case"alignment":{const r=l("horizontal")??g.HorizontalAlign.left,o=l("vertical")??g.VerticalAlign.center;return e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[e.jsx(Re,{options:Bs,current:r,onChange:d=>s("horizontal",d)}),e.jsx(Re,{options:Rs,current:o,onChange:d=>s("vertical",d)})]})}case"fontStyle":{const r=l("fontSize"),o={fontFamily:l("fontFamily"),fontSize:re(r)?r:void 0,color:l("color"),fontWeight:l("fontWeight"),italic:l("italic"),underline:l("underline"),lineThrough:l("lineThrough")};return e.jsx(At,{value:o,onChange:d=>{if(i)i(d);else for(const[x,u]of Object.entries(d))s(x,u)}})}case"padding":{const r=l("top"),o=l("right"),d=l("bottom"),x=l("left"),u=l("bulk"),v=l("all"),b={top:re(r)?r:void 0,right:re(o)?o:void 0,bottom:re(d)?d:void 0,left:re(x)?x:void 0,bulk:typeof u=="boolean"?u:!1,all:re(v)?v:void 0};return e.jsx(Dt,{value:b,onChange:p=>{if(i)i(p);else for(const[f,j]of Object.entries(p))s(f,j)}})}case"required":{const r=l("required");return e.jsx(ee,{value:r??!1,onChange:o=>s("required",o??!1),label:"必須"})}case"placeholder":{const r=l("placeholder");return e.jsx(he,{value:r??"",onChange:o=>s("placeholder",o??"")})}case"textValidation":return e.jsx(Bt,{inputType:l("inputType"),minLength:l("minLength")??void 0,maxLength:l("maxLength")??void 0,pattern:l("pattern")??void 0,onChange:s,onChangeBatch:i});case"textBehavior":return e.jsx(zt,{multiline:l("multiline"),lineHeight:l("lineHeight")??void 0,wordWrap:l("wordWrap"),onChange:s});case"checkboxStyle":{const r=l("styleConfig");return e.jsx(Tt,{value:r,onChange:o=>s("styleConfig",o)})}case"selectConfig":{const r=l("selectConfig"),o=Ws(r)?r:{options:[]};return e.jsx(Mt,{value:o,onChange:d=>s("selectConfig",d)})}default:{if(c){const x=c,u=Object.keys(n)[0]??t,v=l(u);return e.jsx(x,{value:v,onChange:b=>s(u,b),readOnly:a})}const r=Object.keys(n)[0]??t,o=l(r),d=o==null?"":typeof o=="object"?JSON.stringify(o):String(o);return e.jsx(he,{value:d,onChange:x=>s(r,x??"")})}}});Ze.displayName="PropDefEditor";const Ke=h.memo(({propDef:t,selectedBlocks:n,onChange:l,onChangeBatch:s,readOnly:i,blockDefaults:a,onResetToDefault:c})=>{const{kind:r,defaultProps:o}=t,d=n[0],x=(d==null?void 0:d.kind)??"",u=p=>{var j;const f=H(n,`props.${p}`);return f!==void 0?f:((j=a==null?void 0:a[x])==null?void 0:j[p])??o[p]??null},v=d!==void 0&&Object.keys(o).some(p=>p in((d==null?void 0:d.props)??{})),b=h.useCallback(p=>{var f;if(p){const j={};for(const[_,I]of Object.entries(o))j[_]=((f=a==null?void 0:a[x])==null?void 0:f[_])??I;if(s)s(j);else for(const[_,I]of Object.entries(j))l(_,I)}else c==null||c(Object.keys(o))},[l,s,c,o,a,x]);return e.jsx(F,{title:Rt[r]??r,collapsible:!0,isOpen:v,onOpenChange:b,openLabel:"カスタム",closeLabel:"標準",children:e.jsx(Ze,{kind:r,defaultProps:o,getVal:u,onChange:l,onChangeBatch:s,readOnly:i,component:t.component})})});Ke.displayName="PropertyField";const $e=({selectedBlocks:t,pluginRegistry:n,onUpdateBlocks:l,blockDefaults:s,showGroupHeader:i=!0})=>{const a=t[0],c=a?n[a.kind]:void 0;if(!a||!c||t.length===0)return null;const r=(u,v)=>{const b={};t.forEach(p=>{b[p.id]={props:{...p.props,[u]:v}}}),l(b)},o=u=>{const v={};t.forEach(b=>{v[b.id]={props:{...b.props,...u}}}),l(v)},d=u=>{const v={};t.forEach(b=>{const p={...b.props};for(const f of u)delete p[f];v[b.id]={props:p}}),l(v)},x=c.properties.map(u=>e.jsx(Ke,{propDef:u,selectedBlocks:t,onChange:r,onChangeBatch:o,blockDefaults:s,onResetToDefault:d},u.kind));return c.properties.length===0?null:i?e.jsx(F,{title:c.meta.displayName,children:x}):e.jsx("div",{children:x})};$e.displayName="PluginPanels";const Fs="_bar_13lr1_4",Os="_divider_13lr1_18",Us="_barWrapper_13lr1_26",Vs="_popover_13lr1_31",ve={bar:Fs,divider:Os,barWrapper:Us,popover:Vs},ae=({icon:t,label:n,onClick:l,onMouseEnter:s,title:i,disabled:a})=>e.jsx(q,{icon:t,label:n,title:i,onClick:l,onMouseEnter:s,disabled:a,preventFocusOnMouseDown:!0});ae.displayName="SelectionActionBarButton";const Wt=h.createContext(null);function Ft(){const t=h.useContext(Wt);if(t===null)throw new Error("useSelectionActionBar must be used inside SelectionActionBar");return t}const Ot=({items:t=[],className:n,style:l,onPointerDown:s})=>{const[i,a]=h.useState(null),[c,r]=h.useState(null),o=h.useRef(null),d=h.useCallback(()=>{o.current!==null&&(window.clearTimeout(o.current),o.current=null)},[]),x=h.useCallback(()=>{d()},[d]),u=h.useCallback(()=>{d(),o.current=window.setTimeout(()=>{a(null)},120)},[d]);h.useEffect(()=>{if(i===null)return;const p=f=>{c&&!c.contains(f.target)&&a(null)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[i,c]),h.useEffect(()=>()=>{d()},[d]);const v=h.useCallback(p=>{d(),a(p)},[d]),b=h.useCallback(p=>{d(),a(p)},[d]);return e.jsx(Wt.Provider,{value:{openPanel:i,openPanelByHover:v,openPanelByClick:b,onPointerDown:s,wrapperEl:c},children:e.jsx("div",{ref:r,className:ve.barWrapper,style:l,onMouseEnter:x,onMouseLeave:u,onPointerDown:s,role:"toolbar","aria-label":"Selection Action Bar","data-testid":"selection-action-bar",children:e.jsx("div",{className:`${ve.bar}${n?` ${n}`:""}`,onPointerDown:s,children:t})})})};Ot.displayName="SelectionActionBar";const me=({id:t,icon:n,label:l,children:s})=>{const{openPanel:i,openPanelByHover:a,openPanelByClick:c,onPointerDown:r,wrapperEl:o}=Ft(),d=i===t;return e.jsxs(e.Fragment,{children:[e.jsx(ae,{icon:n,label:l,onMouseEnter:()=>a(t),onClick:()=>c(t)}),d&&o&&xt.createPortal(e.jsx("div",{className:ve.popover,"data-testid":`popover-${t}`,onPointerDown:r,children:s}),o)]})};me.displayName="SelectionActionBarPanel";function Gs({context:t,gridSize:n,onActionFeedback:l}){var j;const{actionContext:s,pluginRegistry:i}=t,a=t.editorState,c=a.selectedBlockIds??[],r=s.isEnabled("paste"),o=a.pageIdx,d=(((j=t.book.pages[o])==null?void 0:j.blocks)??[]).filter(_=>c.includes(_.id)),x=c.length>0,u=d.length>0,v=u&&Object.keys(i).length>0,b=(_,I)=>s.execute("updateBlocks",{updates:_,options:I}),p=(_,I)=>{I();const k=qe(_);k&&(l==null||l(k))},f=[e.jsx(ae,{icon:e.jsx(Ue,{"aria-hidden":"true"}),label:"選択を削除",title:"削除 (Delete / Backspace)",onClick:()=>p("delete",()=>s.execute("delete")),disabled:!x},"delete"),e.jsx(ae,{icon:e.jsx(Ve,{"aria-hidden":"true"}),label:"選択をコピー",title:"コピー (Ctrl+C / Cmd+C)",onClick:()=>p("copy",()=>s.execute("copy")),disabled:!x},"copy"),e.jsx(ae,{icon:e.jsx(Ge,{"aria-hidden":"true"}),label:"選択を複製",title:"複製 (Ctrl+D / Cmd+D)",onClick:()=>p("duplicate",()=>s.execute("duplicate")),disabled:!x},"duplicate"),e.jsx("div",{className:ve.divider,"aria-hidden":"true"},"divider-paste"),e.jsx(ae,{icon:e.jsx(Ce,{"aria-hidden":"true"}),label:"貼り付け",title:"貼り付け (Ctrl+V / Cmd+V)",onClick:()=>p("paste",()=>s.execute("paste")),disabled:!r},"paste")];return(u||v)&&f.push(e.jsx("div",{className:ve.divider,"aria-hidden":"true"},"divider-panels")),u&&f.push(e.jsx(me,{id:"style",icon:e.jsx(bt,{"aria-hidden":"true"}),label:"スタイル設定",children:e.jsx(ke,{selectedBlocks:d,onUpdateBlocks:b})},"style"),e.jsx(me,{id:"layout",icon:e.jsx(vt,{"aria-hidden":"true"}),label:"レイアウト設定",children:e.jsx(Ie,{selectedBlocks:d,onUpdateBlocks:b,gridSize:n})},"layout")),v&&f.push(e.jsx(me,{id:"plugin",icon:e.jsx(ft,{"aria-hidden":"true"}),label:"ブロック設定",children:e.jsx($e,{selectedBlocks:d,pluginRegistry:i,onUpdateBlocks:b,showGroupHeader:!1})},"plugin")),f}const rt=8,qs=36,Hs=({selectionBoundingBox:t,isDragging:n,zIndex:l=g.Z_INDEX.SELECTION_ACTION_BAR,children:s})=>{if(t==null||n)return null;const i=t,a=i.top-rt-qs,c=a>=0?a:i.bottom+rt,r={position:"absolute",inset:0,pointerEvents:"none",zIndex:l},o={position:"absolute",top:`${c}px`,left:`${i.right}px`,transform:"translateX(-100%)",pointerEvents:"auto"};return e.jsx("div",{style:r,"data-testid":"selection-action-bar-overlay","data-selection-action-bar":"true",children:e.jsx("div",{style:o,onPointerDown:d=>d.stopPropagation(),"data-testid":"selection-action-bar-container",children:s})})};function Zs(t,n){const[l,s]=h.useState(null);return h.useEffect(()=>{if(n.length===0){s(null);return}const i=requestAnimationFrame(()=>{const a=t.current;if(!a){s(null);return}const c=a.getBoundingClientRect();let r=1/0,o=1/0,d=-1/0,x=-1/0,u=!1;for(const v of n){const b=a.querySelector(`[data-block-id="${v}"]`);if(!b)continue;const p=b.getBoundingClientRect();r=Math.min(r,p.left-c.left),o=Math.min(o,p.top-c.top),d=Math.max(d,p.right-c.left),x=Math.max(x,p.bottom-c.top),u=!0}if(!u){s(null);return}s({left:r,top:o,right:d,bottom:x,width:d-r,height:x-o})});return()=>cancelAnimationFrame(i)},[t,n]),l}const Ks="_container_3lvww_1",Ys="_row_3lvww_9",Js="_label_3lvww_15",Xs="_inputWrapper_3lvww_24",Qs="_error_3lvww_31",K={container:Ks,row:Ys,label:Js,inputWrapper:Xs,error:Qs};function ct(t,n,l){const s=t.trim();return s?/\s/.test(s)?"スペースは使用できません":s!==n&&(l!=null&&l.has(s))?"このIDは既に使用されています":null:"IDを入力してください"}const Ye=({selectedBlocks:t,onUpdateBlocks:n,allBlockIds:l})=>{const[s,i]=h.useState(""),[a,c]=h.useState(null),r=t[0];h.useEffect(()=>{t.length===1&&r&&(i(r.id),c(null))},[t,r]);const o=()=>{if(!r)return;const b=r.id,p=s.trim();if(p===b||!p){i(b),c(null);return}if(ct(p,b,l)){i(b),c(null);return}n({[b]:{id:p}})},d=b=>{const p=b??"";i(p),r&&c(ct(p,r.id,l))},x=b=>{const p={};t.forEach(f=>{p[f.id]={behavior:{...f.behavior,readOnly:!!b||void 0}}}),n(p)},u=b=>{const p={};t.forEach(f=>{p[f.id]={behavior:{...f.behavior,heightFit:b||void 0}}}),n(p)},v=b=>{const p={};t.forEach(f=>{p[f.id]={behavior:{...f.behavior,widthFit:b||void 0}}}),n(p)};return e.jsxs("div",{className:K.container,children:[t.length===1&&e.jsxs("div",{className:K.row,children:[e.jsx("span",{className:K.label,children:"ID"}),e.jsxs("div",{className:K.inputWrapper,children:[e.jsx(he,{value:s,onChange:d,onBlur:o,placeholder:"IDを入力"}),a&&e.jsx("span",{className:K.error,children:a})]})]}),t.length>0&&e.jsx("div",{className:K.row,children:e.jsx("div",{className:K.inputWrapper,children:e.jsx(ee,{label:"読み取り専用",value:!!H(t,"behavior.readOnly"),onChange:x})})}),t.length>0&&e.jsx("div",{className:K.row,children:e.jsx("div",{className:K.inputWrapper,children:e.jsx(ee,{label:"高さ自動フィット",value:!!H(t,"behavior.heightFit"),onChange:u})})}),t.length>0&&e.jsx("div",{className:K.row,children:e.jsx("div",{className:K.inputWrapper,children:e.jsx(ee,{label:"幅自動フィット",value:!!H(t,"behavior.widthFit"),onChange:v})})})]})};Ye.displayName="MetaPanel";const el="_container_2zb6l_1",tl="_scrollArea_2zb6l_18",nl="_emptyState_2zb6l_33",We={container:el,scrollArea:tl,emptyState:nl},we=({children:t,className:n=""})=>e.jsx("div",{className:`${We.container}${n?` ${n}`:""}`,children:t});we.displayName="BlockPropertyPanel";const Ut=h.memo(({context:t,gridSize:n,className:l=""})=>{const{pluginRegistry:s,actionContext:i}=t,a=t.editorState.pageIdx,c=t.book.pages[a],r=t.editorState.selectedBlockIds??[],o=(c==null?void 0:c.blocks.filter(f=>r.includes(f.id)))??[],d=c==null?void 0:c.blockDefaults,x=(f,j)=>i.execute("updateBlocks",{updates:f,options:j}),u=new Set((c==null?void 0:c.blocks.map(f=>f.id))??[]),v=o[0],b=v?s[v.kind]:void 0,p=h.useMemo(()=>{var j;if(o.length===0)return!1;const f=(j=o[0])==null?void 0:j.kind;return o.every(_=>_.kind===f)},[o]);return o.length===0?e.jsx(we,{className:l,children:e.jsxs("div",{className:We.emptyState,children:["ブロックを選択すると",e.jsx("br",{}),"プロパティが表示されます"]})}):e.jsx(we,{className:l,children:e.jsxs("div",{className:We.scrollArea,children:[e.jsx(F,{title:"配置・サイズ",description:"ブロックの位置(X・Y座標)と大きさ(幅・高さ)をグリッド単位で設定します",children:e.jsx(Ie,{selectedBlocks:o,onUpdateBlocks:x,gridSize:n})}),e.jsx(F,{title:"背景・枠線",description:"ブロックの背景色と枠線(線の種類・色・太さ)を設定します",children:e.jsx(ke,{selectedBlocks:o,onUpdateBlocks:x})}),b&&p&&b.properties.length>0&&e.jsx($e,{selectedBlocks:o,pluginRegistry:s,onUpdateBlocks:x,blockDefaults:d}),e.jsx(F,{title:"基本設定",description:"ブロックのID(識別子)や読み取り専用にするかどうかなど、動作に関わる設定をします",children:e.jsx(Ye,{selectedBlocks:o,onUpdateBlocks:x,allBlockIds:u})})]})})});Ut.displayName="DefaultBlockPropertyPanel";const sl="_kindSelector_qrad9_1",ll="_kindTab_qrad9_9",il="_kindTabActive_qrad9_30",al="_propertyList_qrad9_46",ol="_emptyState_qrad9_131",ce={kindSelector:sl,kindTab:ll,kindTabActive:il,propertyList:al,emptyState:ol},Vt=h.memo(({propDef:t,kindDefaults:n,onKindDefaultsChange:l})=>{const{kind:s,defaultProps:i}=t,a=Object.keys(i).some(d=>d in n),c=d=>n[d]??i[d]??null,r=(d,x)=>l({...n,[d]:x}),o=d=>{if(d){const x={...n};for(const[u,v]of Object.entries(i))x[u]=n[u]??v;l(x)}else{const x={...n};for(const u of Object.keys(i))delete x[u];l(x)}};return e.jsx(F,{title:Rt[s]??s,collapsible:!0,isOpen:a,onOpenChange:o,openLabel:"カスタム",closeLabel:"標準",children:e.jsx(Ze,{kind:s,defaultProps:i,getVal:c,onChange:r})})});Vt.displayName="DefaultsPropField";const Je=h.memo(({blockDefaults:t,pluginRegistry:n,onChange:l})=>{const s=Object.keys(n),[i,a]=h.useState(s[0]??""),c=i?n[i]:void 0,r=h.useCallback(o=>{const d={...t};Object.keys(o).length===0?delete d[i]:d[i]=o,l(d)},[t,i,l]);return s.length===0?e.jsx("div",{className:ce.emptyState,children:"プラグインが登録されていません"}):e.jsxs(F,{title:"ブロック共通デフォルト",collapsible:!0,noPadding:!0,description:"各ブロック種類に共通して適用されるデフォルト値です",children:[e.jsx("div",{className:ce.kindSelector,children:s.map(o=>{const d=n[o];return e.jsx("button",{type:"button",className:`${ce.kindTab} ${i===o?ce.kindTabActive:""}`,onClick:()=>a(o),children:(d==null?void 0:d.meta.displayName)??o},o)})}),c&&e.jsx("div",{className:ce.propertyList,children:c.properties.length===0?e.jsx("div",{className:ce.emptyState,children:"カスタマイズ可能なプロパティがありません"}):c.properties.map(o=>e.jsx(Vt,{propDef:o,kindDefaults:t[i]??{},onKindDefaultsChange:r},o.kind))})]})});Je.displayName="BlockDefaultsPanel";const rl="_list_12dfx_10",cl="_item_12dfx_19",dl="_selected_12dfx_41",ul="_dragHandle_12dfx_46",hl="_ghost_12dfx_57",xl="_itemInfo_12dfx_68",pl="_itemId_12dfx_75",ml="_itemMeta_12dfx_80",bl="_itemKind_12dfx_87",vl="_itemActions_12dfx_95",fl="_actionButton_12dfx_100",jl="_empty_12dfx_136",O={list:rl,item:cl,selected:dl,dragHandle:ul,ghost:hl,itemInfo:xl,itemId:pl,itemMeta:ml,itemKind:bl,itemActions:vl,actionButton:fl,empty:jl},Xe=({blocks:t,onBlocksChange:n,selectedBlockIds:l,onBlockHover:s,onBlockDragChange:i})=>{const[a,c]=h.useState(null),[r,o]=h.useState(null),d=h.useRef(null),x=h.useRef(null),u=[...t].reverse(),v=(()=>{if(a===null)return null;const m=u.findIndex(y=>y.id===a);return m===-1?null:m})(),b=h.useMemo(()=>{if(v===null||r===null)return u;const m=u[v];if(!m)return u;const w=[...u.filter((L,E)=>E!==v)],C=Math.max(0,Math.min(r,w.length));return w.splice(C,0,m),w},[u,v,r]),p=h.useCallback(m=>{const y=t.findIndex(L=>L.id===m);if(y===-1||y===t.length-1)return;const w=[...t],[C]=w.splice(y,1);C&&(w.push(C),n(w))},[t,n]),f=h.useCallback(m=>{const y=t.findIndex(L=>L.id===m);if(y===-1||y===0)return;const w=[...t],[C]=w.splice(y,1);C&&(w.unshift(C),n(w))},[t,n]),j=h.useCallback(m=>{const y=t.findIndex(E=>E.id===m);if(y===-1||y===t.length-1)return;const w=[...t],C=w[y],L=w[y+1];!C||!L||(w[y]=L,w[y+1]=C,n(w))},[t,n]),_=h.useCallback(m=>{const y=t.findIndex(E=>E.id===m);if(y===-1||y===0)return;const w=[...t],C=w[y],L=w[y-1];!C||!L||(w[y]=L,w[y-1]=C,n(w))},[t,n]),I=h.useCallback((m,y)=>{var L;m.dataTransfer.effectAllowed="move";const w=t.length-1-y,C=((L=t[w])==null?void 0:L.id)??"";m.dataTransfer.setData("text/plain",C),d.current=[...t],x.current=y,requestAnimationFrame(()=>{c(C),o(y),i==null||i(C)})},[t,i]),k=h.useCallback(()=>{d.current&&(n(d.current),d.current=null),c(null),o(null),s==null||s(null),i==null||i(null)},[n,s,i]),$=h.useCallback((m,y,w)=>{if(m.preventDefault(),m.dataTransfer.dropEffect="move",a===null||w===a)return;const C=r??x.current??0,L=y<C?y:y-1,E=m.currentTarget.getBoundingClientRect(),P=E.top+E.height/2,T=m.clientY<P?L:L+1;if(T===r)return;o(T);const D=d.current;if(D){const Z=[...D].reverse(),it=Z.find(fe=>fe.id===a);if(it){const fe=Z.filter(Yt=>Yt.id!==a),Kt=Math.max(0,Math.min(T,fe.length)),at=[...fe];at.splice(Kt,0,it),n([...at].reverse())}}},[a,r,n]),S=h.useCallback(m=>{m.currentTarget.contains(m.relatedTarget)||o(v)},[v]),N=h.useCallback(m=>{if(m.preventDefault(),d.current=null,v!==null&&r!==null){const y=u[v];if(y){const w=u.filter((T,D)=>D!==v),C=Math.max(0,Math.min(r,w.length)),L=[...w];L.splice(C,0,y);const E=[...L].reverse();E.every((T,D)=>{var Z;return T.id===((Z=t[D])==null?void 0:Z.id)})||n(E)}}c(null),o(null)},[t,v,r,u,n]);return e.jsxs(F,{title:"ブロック順序",collapsible:!0,description:"ブロックの重なり順序を管理します。上にあるほど最前面、下にあるほど最背面に表示されます。ドラッグして並び替えができます",children:[e.jsx("ul",{className:O.list,onMouseLeave:()=>{a===null&&(s==null||s(null))},onDragLeave:S,onDrop:N,onDragOver:m=>m.preventDefault(),children:b.map((m,y)=>{const w=u.findIndex(P=>P.id===m.id),C=m.id===a,L=t.length-1-w,E=(l==null?void 0:l.includes(m.id))??!1;return e.jsxs("li",{className:`${O.item} ${C?O.ghost:""} ${E?O.selected:""}`,draggable:!C,onDragStart:C?void 0:P=>I(P,w),onDragEnd:k,onDragOver:C?void 0:P=>$(P,y,m.id),onMouseEnter:C?void 0:()=>s==null?void 0:s(m.id),children:[e.jsx("span",{className:O.dragHandle,"aria-hidden":"true",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("title",{children:"ドラッグハンドル"}),e.jsx("circle",{cx:"6",cy:"4",r:"1",fill:"currentColor"}),e.jsx("circle",{cx:"10",cy:"4",r:"1",fill:"currentColor"}),e.jsx("circle",{cx:"6",cy:"8",r:"1",fill:"currentColor"}),e.jsx("circle",{cx:"10",cy:"8",r:"1",fill:"currentColor"}),e.jsx("circle",{cx:"6",cy:"12",r:"1",fill:"currentColor"}),e.jsx("circle",{cx:"10",cy:"12",r:"1",fill:"currentColor"})]})}),e.jsxs("div",{className:O.itemInfo,children:[e.jsx("div",{className:O.itemId,children:m.id}),e.jsx("div",{className:O.itemMeta,children:e.jsx("span",{className:O.itemKind,children:m.kind})})]}),e.jsxs("div",{className:O.itemActions,children:[e.jsx("button",{type:"button",className:O.actionButton,onClick:()=>p(m.id),title:"最前面へ","aria-label":"最前面へ移動",disabled:C||L===t.length-1,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("title",{children:"最前面へ"}),e.jsx("path",{d:"M4 12v-8M8 12v-8M12 12v-8",stroke:"currentColor"}),e.jsx("path",{d:"M12 4h-8",stroke:"currentColor",strokeWidth:"2"})]})}),e.jsx("button",{type:"button",className:O.actionButton,onClick:()=>j(m.id),title:"前面へ","aria-label":"前面へ移動",disabled:C||L===t.length-1,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("title",{children:"前面へ"}),e.jsx("path",{d:"M8 4v8",stroke:"currentColor"}),e.jsx("path",{d:"M5 7l3-3 3 3",stroke:"currentColor"})]})}),e.jsx("button",{type:"button",className:O.actionButton,onClick:()=>_(m.id),title:"背面へ","aria-label":"背面へ移動",disabled:C||L===0,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("title",{children:"背面へ"}),e.jsx("path",{d:"M8 12v-8",stroke:"currentColor"}),e.jsx("path",{d:"M5 9l3 3 3-3",stroke:"currentColor"})]})}),e.jsx("button",{type:"button",className:O.actionButton,onClick:()=>f(m.id),title:"最背面へ","aria-label":"最背面へ移動",disabled:C||L===0,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("title",{children:"最背面へ"}),e.jsx("path",{d:"M4 12v-8M8 12v-8M12 12v-8",stroke:"currentColor"}),e.jsx("path",{d:"M12 12h-8",stroke:"currentColor",strokeWidth:"2"})]})})]})]},m.id)})}),t.length===0&&e.jsx("div",{className:O.empty,children:"ブロックがありません"})]})};Xe.displayName="BlockOrderPanel";const gl="_container_1x0zd_4",yl="_group_1x0zd_16",_l="_divider_1x0zd_22",ye={container:gl,group:yl,divider:_l},Qe=({context:t,onActionFeedback:n})=>{const{actionContext:l}=t,s=t.editorState.selectedBlockIds,i=((s==null?void 0:s.length)??0)>0,a=l.isEnabled("undo"),c=l.isEnabled("redo"),r=l.isEnabled("paste"),o=d=>{l.execute(d);const x=qe(d);x&&(n==null||n(x))};return e.jsxs("div",{className:ye.container,"data-testid":"canvas-action-panel",children:[e.jsxs("div",{className:ye.group,children:[e.jsx(q,{icon:e.jsx(Fe,{"aria-hidden":"true"}),label:"元に戻す",title:"元に戻す (Ctrl+Z / Cmd+Z)",onClick:()=>o("undo"),disabled:!a}),e.jsx(q,{icon:e.jsx(Oe,{"aria-hidden":"true"}),label:"やり直し",title:"やり直し (Ctrl+Y / Cmd+Y)",onClick:()=>o("redo"),disabled:!c})]}),e.jsx("div",{className:ye.divider,"aria-hidden":"true"}),e.jsxs("div",{className:ye.group,children:[e.jsx(q,{icon:e.jsx(Ue,{"aria-hidden":"true"}),label:"選択を削除",title:"削除 (Delete / Backspace)",onClick:()=>o("delete"),disabled:!i}),e.jsx(q,{icon:e.jsx(Ve,{"aria-hidden":"true"}),label:"選択をコピー",title:"コピー (Ctrl+C / Cmd+C)",onClick:()=>o("copy"),disabled:!i}),e.jsx(q,{icon:e.jsx(Ce,{"aria-hidden":"true"}),label:"貼り付け",title:"貼り付け (Ctrl+V / Cmd+V)",onClick:()=>o("paste"),disabled:!r}),e.jsx(q,{icon:e.jsx(Ge,{"aria-hidden":"true"}),label:"選択を複製",title:"複製 (Ctrl+D / Cmd+D)",onClick:()=>o("duplicate"),disabled:!i})]})]})};Qe.displayName="CanvasActionPanel";const et=({children:t,className:n})=>e.jsx(He,{className:n,children:t});et.displayName="CanvasPanel";const wl="_field_69k7e_6",Cl="_horizontal_69k7e_12",Nl="_label_69k7e_18",Sl="_gridSizeRow_69k7e_29",le={field:wl,horizontal:Cl,label:Nl,gridSizeRow:Sl},dt={value:1,unit:"fr"},tt=({grid:t,onGridChange:n})=>{const l=h.useCallback(i=>{if(!i||i<1||i>100)return;const a=g.expandSparseCols(t),c=t.colCount,r=[...a];if(i>c)for(let o=c;o<i;o++)r.push({...dt});else r.splice(i);n({...t,...g.colsToSparse(r)})},[t,n]),s=h.useCallback(i=>{if(!i||i<1||i>100)return;const a=g.expandSparseRows(t),c=t.rowCount,r=[...a];if(i>c)for(let o=c;o<i;o++)r.push({...dt});else r.splice(i);n({...t,...g.rowsToSparse(r)})},[t,n]);return e.jsx(F,{title:"グリッドサイズ",collapsible:!0,defaultCollapsed:!1,description:"ブロックを配置するグリッドの列数と行数を設定します",children:e.jsxs("div",{className:le.gridSizeRow,children:[e.jsxs("div",{className:`${le.field} ${le.horizontal}`,children:[e.jsx("span",{className:le.label,children:"列数"}),e.jsx(U,{value:t.colCount,onChange:l,min:1,max:100,step:1})]}),e.jsxs("div",{className:`${le.field} ${le.horizontal}`,children:[e.jsx("span",{className:le.label,children:"行数"}),e.jsx(U,{value:t.rowCount,onChange:s,min:1,max:100,step:1})]})]})})};tt.displayName="GridSizePanel";const kl="_topRow_2ni80_6",Il="_linkSwitch_2ni80_15",$l="_switchLabel_2ni80_23",Ll="_switchLabelActive_2ni80_31",Tl="_toggle_2ni80_35",Pl="_thumb_2ni80_52",Al="_topCell_2ni80_70",Ml="_sideCell_2ni80_75",El="_bottomCell_2ni80_81",Dl="_sideMargins_2ni80_88",G={topRow:kl,linkSwitch:Il,switchLabel:$l,switchLabelActive:Ll,toggle:Tl,thumb:Pl,topCell:Al,sideCell:Ml,bottomCell:El,sideMargins:Dl},nt=({paper:t,onPaperChange:n})=>{const[l,s]=h.useState(!1),i=h.useCallback(o=>{if(!o)return;const d=l?{top:o,right:o,bottom:o,left:o}:{...t.margin,top:o};n({...t,margin:d})},[t,n,l]),a=h.useCallback(o=>{o&&n({...t,margin:{...t.margin,right:o}})},[t,n]),c=h.useCallback(o=>{o&&n({...t,margin:{...t.margin,bottom:o}})},[t,n]),r=h.useCallback(o=>{o&&n({...t,margin:{...t.margin,left:o}})},[t,n]);return e.jsxs(F,{title:"マージン",collapsible:!0,defaultCollapsed:!1,description:"印刷時にコンテンツが配置されない余白(マージン)を設定します",children:[e.jsxs("div",{className:G.topRow,children:[e.jsxs("div",{className:G.linkSwitch,children:[e.jsx("span",{className:`${G.switchLabel} ${l?"":G.switchLabelActive}`,children:"個別"}),e.jsx("button",{type:"button",role:"switch","aria-checked":l,className:G.toggle,onClick:()=>s(o=>!o),children:e.jsx("span",{className:G.thumb})}),e.jsx("span",{className:`${G.switchLabel} ${l?G.switchLabelActive:""}`,children:"一括"})]}),e.jsx("div",{className:G.topCell,children:e.jsx(W,{value:t.margin.top,onChange:i,allowedUnits:["mm","cm","inch"],min:0,max:1e3})})]}),!l&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:G.sideMargins,children:[e.jsx("div",{className:G.sideCell,children:e.jsx(W,{value:t.margin.left,onChange:r,allowedUnits:["mm","cm","inch"],min:0,max:1e3})}),e.jsx("div",{className:G.sideCell,children:e.jsx(W,{value:t.margin.right,onChange:a,allowedUnits:["mm","cm","inch"],min:0,max:1e3})})]}),e.jsx("div",{className:G.bottomCell,children:e.jsx(W,{value:t.margin.bottom,onChange:c,allowedUnits:["mm","cm","inch"],min:0,max:1e3})})]})]})};nt.displayName="MarginPanel";const zl="_grid_ddemj_5",Bl="_colSpan2_ddemj_13",Rl="_colSpan3_ddemj_18",Wl="_label_ddemj_23",Fl="_modeLabel_ddemj_32",Ol="_modeToggle_ddemj_40",Ul="_switchLabel_ddemj_47",Vl="_switchLabelActive_ddemj_55",Gl="_toggle_ddemj_59",ql="_thumb_ddemj_76",Hl="_checkboxCell_ddemj_92",A={grid:zl,colSpan2:Bl,colSpan3:Rl,label:Wl,modeLabel:Fl,modeToggle:Ol,switchLabel:Ul,switchLabelActive:Vl,toggle:Gl,thumb:ql,checkboxCell:Hl};function ut(t,n){switch(n){case"cm":return t/10;case"inch":return t/25.4;default:return t}}const st=({paper:t,onPaperChange:n})=>{const l=h.useMemo(()=>[{value:g.PaperSizePreset.A4,label:"A4 (210 × 297 mm)"},{value:g.PaperSizePreset.A3,label:"A3 (297 × 420 mm)"},{value:g.PaperSizePreset.B5,label:"B5 (182 × 257 mm)"},{value:g.PaperSizePreset.LETTER,label:"Letter (8.5 × 11 inch)"},{value:g.PaperSizePreset.LEGAL,label:"Legal (8.5 × 14 inch)"},{value:g.PaperSizePreset.CUSTOM,label:"カスタム"}],[]),s=h.useCallback(j=>{n({...t,orientation:j||void 0})},[t,n]),i=h.useCallback(j=>{j&&n({...t,size:g.DEFAULT_PAPER_SIZES[j]})},[t,n]),a=h.useCallback(j=>{if(!j)return;const _={...t.size,preset:g.PaperSizePreset.CUSTOM,width:j};n({...t,size:_})},[t,n]),c=h.useCallback(j=>{if(!j)return;const _={...t.size,preset:g.PaperSizePreset.CUSTOM,height:j};n({...t,size:_})},[t,n]),r=t.size.preset===g.PaperSizePreset.CUSTOM,o=t.autoHeight===!0,d=t.autoWidth===!0,x=h.useCallback(()=>{n({...t,autoHeight:o?void 0:!0})},[t,o,n]),u=h.useCallback(()=>{n({...t,autoWidth:d?void 0:!0})},[t,d,n]),v=o?"最小高さ":"高さ",b=d?"最小幅":"幅",p=h.useMemo(()=>{const j=g.toMm.fromDim(t.margin.left)+g.toMm.fromDim(t.margin.right);return ut(j,t.size.width.unit)},[t.margin.left,t.margin.right,t.size.width.unit]),f=h.useMemo(()=>{const j=g.toMm.fromDim(t.margin.top)+g.toMm.fromDim(t.margin.bottom);return ut(j,t.size.height.unit)},[t.margin.top,t.margin.bottom,t.size.height.unit]);return e.jsx(F,{title:"用紙設定",collapsible:!0,defaultCollapsed:!1,description:"用紙のサイズと向きを設定します",children:e.jsxs("div",{className:A.grid,children:[e.jsx("span",{className:`${A.label} ${A.colSpan2}`,children:"用紙サイズ"}),e.jsx("div",{className:A.colSpan3,children:e.jsx(oe,{value:t.size.preset,options:l,onChange:i})}),e.jsx("span",{className:`${A.label} ${A.colSpan2}`,children:"横向き"}),e.jsx("div",{className:A.checkboxCell,children:e.jsx(ee,{value:t.orientation===!0,onChange:s})}),e.jsx("span",{className:A.modeLabel,children:"幅"}),e.jsxs("div",{className:A.modeToggle,children:[e.jsx("span",{className:`${A.switchLabel} ${d?A.switchLabelActive:""}`,children:"自動"}),e.jsx("button",{type:"button",role:"switch","aria-checked":d,"aria-label":"幅モード",className:A.toggle,onClick:u,children:e.jsx("span",{className:A.thumb})}),e.jsx("span",{className:`${A.switchLabel} ${d?"":A.switchLabelActive}`,children:"固定"})]}),e.jsx("span",{className:A.modeLabel,children:"高さ"}),e.jsxs("div",{className:A.modeToggle,children:[e.jsx("span",{className:`${A.switchLabel} ${o?A.switchLabelActive:""}`,children:"自動"}),e.jsx("button",{type:"button",role:"switch","aria-checked":o,"aria-label":"高さモード",className:A.toggle,onClick:x,children:e.jsx("span",{className:A.thumb})}),e.jsx("span",{className:`${A.switchLabel} ${o?"":A.switchLabelActive}`,children:"固定"})]}),r&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:A.label,children:b}),e.jsx("div",{className:A.colSpan3,children:e.jsx(W,{value:t.size.width,onChange:a,allowedUnits:["mm","cm","inch"],min:p,max:500})}),e.jsx("span",{className:A.label,children:v}),e.jsx("div",{className:A.colSpan3,children:e.jsx(W,{value:t.size.height,onChange:c,allowedUnits:["mm","cm","inch"],min:f,max:500})})]})]})})};st.displayName="PaperSizePanel";const Gt=({context:t,onBlockHover:n,onBlockDragChange:l,onActionFeedback:s})=>{const{book:i,onBookChange:a,pluginRegistry:c}=t,r=t.editorState.pageIdx,o=t.editorState.selectedBlockIds,d=i.pages[r]??i.pages[0],x=h.useCallback(p=>{a({...i,paper:p})},[i,a]),u=h.useCallback(p=>{const f=i.pages.map((j,_)=>_===r?{...j,grid:p}:j);a({...i,pages:f},{mergeKey:g.gridSizeKey(r)})},[i,a,r]),v=h.useCallback(p=>{const f=i.pages.map((j,_)=>_===r?{...j,blocks:p}:j);a({...i,pages:f})},[i,a,r]),b=h.useCallback(p=>{const f=i.pages.map((j,_)=>_===r?{...j,blockDefaults:p}:j);a({...i,pages:f})},[i,a,r]);return e.jsxs(et,{children:[e.jsx(Qe,{context:t,onActionFeedback:s}),e.jsx(st,{paper:i.paper,onPaperChange:x}),e.jsx(nt,{paper:i.paper,onPaperChange:x}),e.jsx(tt,{grid:d.grid,onGridChange:u}),c&&Object.keys(c).length>0&&e.jsx(Je,{blockDefaults:d.blockDefaults??{},pluginRegistry:c,onChange:b}),e.jsx(Xe,{blocks:d.blocks,onBlocksChange:v,selectedBlockIds:o,onBlockHover:n,onBlockDragChange:l})]})};Gt.displayName="DefaultCanvasPanel";const Zl="_buttonGroup_5h1ft_1",Kl="_button_5h1ft_1",Yl="_error_5h1ft_33",R={buttonGroup:Zl,button:Kl,error:Yl},ht=(t,n)=>{const l=[];for(const s of Object.keys(t))s in n||l.push({id:s,value:void 0});for(const[s,i]of Object.entries(n))l.push({id:s,value:i});return l},lt=({book:t,values:n,onBookChange:l,onValuesChange:s})=>{const[i,a]=h.useState(""),c=h.useRef(null),r=h.useRef(null),o=h.useCallback(()=>{try{const m=g.serializeBook(t),y=new Blob([m],{type:"application/json"}),w=URL.createObjectURL(y),C=document.createElement("a");C.href=w,C.download="book.json",C.click(),URL.revokeObjectURL(w),a("")}catch(m){a(`エクスポートエラー: ${m instanceof Error?m.message:String(m)}`)}},[t]),d=h.useCallback(async()=>{try{const m=g.serializeBook(t);await navigator.clipboard.writeText(m),a(""),alert("ブックをクリップボードにコピーしました")}catch(m){a(`クリップボードエラー: ${m instanceof Error?m.message:String(m)}`)}},[t]),x=h.useCallback(m=>{const y=g.deserializeBook(m);l(y)},[l]),u=h.useCallback(()=>{var m;(m=c.current)==null||m.click()},[]),v=h.useCallback(m=>{var C;const y=(C=m.target.files)==null?void 0:C[0];if(!y)return;const w=new FileReader;w.onload=L=>{var E;try{x((E=L.target)==null?void 0:E.result),a(""),alert("インポートしました")}catch(P){a(`インポートエラー: ${P instanceof Error?P.message:String(P)}`)}},w.readAsText(y),m.target.value=""},[x]),b=h.useCallback(async()=>{try{const m=await navigator.clipboard.readText();x(m),a(""),alert("インポートしました")}catch(m){a(`インポートエラー: ${m instanceof Error?m.message:String(m)}`)}},[x]),p=h.useCallback(()=>{try{const m=JSON.stringify(n,null,2),y=new Blob([m],{type:"application/json"}),w=URL.createObjectURL(y),C=document.createElement("a");C.href=w,C.download="values.json",C.click(),URL.revokeObjectURL(w),a("")}catch(m){a(`エクスポートエラー: ${m instanceof Error?m.message:String(m)}`)}},[n]),f=h.useCallback(async()=>{try{const m=JSON.stringify(n,null,2);await navigator.clipboard.writeText(m),a(""),alert("値をクリップボードにコピーしました")}catch(m){a(`クリップボードエラー: ${m instanceof Error?m.message:String(m)}`)}},[n]),j=h.useCallback(()=>{var m;(m=r.current)==null||m.click()},[]),_=h.useCallback(m=>{var C;const y=(C=m.target.files)==null?void 0:C[0];if(!y)return;const w=new FileReader;w.onload=L=>{var E;try{const P=g.deserializeValues((E=L.target)==null?void 0:E.result),T=ht(n,P);s(T),a(""),alert("値をインポートしました")}catch(P){a(`インポートエラー: ${P instanceof Error?P.message:String(P)}`)}},w.readAsText(y),m.target.value=""},[s,n]),I=h.useCallback(async()=>{try{const m=await navigator.clipboard.readText(),y=g.deserializeValues(m),w=ht(n,y);s(w),a(""),alert("値をインポートしました")}catch(m){a(`クリップボードエラー: ${m instanceof Error?m.message:String(m)}`)}},[s,n]),k=h.useRef(null),$=h.useCallback(()=>{try{const m=t.pages[0],y=JSON.stringify({grid:m.grid,blocks:m.blocks},null,2),w=new Blob([y],{type:"application/json"}),C=URL.createObjectURL(w),L=document.createElement("a");L.href=C,L.download="schema.json",L.click(),URL.revokeObjectURL(C),a("")}catch(m){a(`エクスポートエラー: ${m instanceof Error?m.message:String(m)}`)}},[t]),S=h.useCallback(()=>{var m;(m=k.current)==null||m.click()},[]),N=h.useCallback(m=>{var C;const y=(C=m.target.files)==null?void 0:C[0];if(!y)return;const w=new FileReader;w.onload=L=>{var E;try{const P=JSON.parse((E=L.target)==null?void 0:E.result),T=g.migratePage({grid:P.grid,blocks:P.blocks??[],...P.metaData!==void 0?{metaData:P.metaData}:{},...P.blockDefaults!==void 0?{blockDefaults:P.blockDefaults}:{}}),D=[...t.pages];D[0]=T,l({...t,pages:D}),a(""),alert("スキーマをインポートしました")}catch(P){a(`インポートエラー: ${P instanceof Error?P.message:String(P)}`)}},w.readAsText(y),m.target.value=""},[t,l]);return e.jsxs(e.Fragment,{children:[e.jsxs(F,{title:"ブック",children:[e.jsxs("div",{className:R.buttonGroup,children:[e.jsx("button",{type:"button",className:R.button,"data-testid":"export-book-file",onClick:o,children:"📥 ファイルにエクスポート"}),e.jsx("button",{type:"button",className:R.button,"data-testid":"export-book-clipboard",onClick:d,children:"📋 クリップボードにコピー"})]}),e.jsxs("div",{className:R.buttonGroup,children:[e.jsx("button",{type:"button",className:R.button,"data-testid":"import-book-file",onClick:u,children:"📤 ファイルからインポート"}),e.jsx("button",{type:"button",className:R.button,"data-testid":"import-book-clipboard",onClick:b,children:"📋 クリップボードからペースト"})]}),e.jsx("input",{ref:c,type:"file",accept:".json",style:{display:"none"},onChange:v})]}),e.jsxs(F,{title:"値",children:[e.jsxs("div",{className:R.buttonGroup,children:[e.jsx("button",{type:"button",className:R.button,"data-testid":"export-values-file",onClick:p,children:"📥 ファイルにエクスポート"}),e.jsx("button",{type:"button",className:R.button,"data-testid":"export-values-clipboard",onClick:f,children:"📋 クリップボードにコピー"})]}),e.jsxs("div",{className:R.buttonGroup,children:[e.jsx("button",{type:"button",className:R.button,"data-testid":"import-values-file",onClick:j,children:"📤 ファイルからインポート"}),e.jsx("button",{type:"button",className:R.button,"data-testid":"import-values-clipboard",onClick:I,children:"📋 クリップボードからペースト"})]}),e.jsx("input",{ref:r,type:"file",accept:".json",style:{display:"none"},onChange:_})]}),e.jsxs(F,{title:"スキーマ",children:[e.jsx("div",{className:R.buttonGroup,children:e.jsx("button",{type:"button",className:R.button,"data-testid":"export-schema-file",onClick:$,children:"📥 スキーマをエクスポート"})}),e.jsx("div",{className:R.buttonGroup,children:e.jsx("button",{type:"button",className:R.button,"data-testid":"import-schema-file",onClick:S,children:"📤 スキーマをインポート"})}),e.jsx("input",{ref:k,type:"file",accept:".json",style:{display:"none"},onChange:N})]}),i&&e.jsx("div",{className:R.error,role:"alert",children:i})]})};lt.displayName="ImportExportPanel";const qt=({context:t,sections:n})=>{const l=[e.jsx(lt,{book:t.book,values:t.values,onBookChange:t.onBookChange,onValuesChange:t.onValuesChange??(()=>{})},"import-export")],s=n??l;return e.jsx(He,{children:s})};qt.displayName="OtherPanel";const Jl="_container_16a0l_1",Xl="_paletteItems_16a0l_11",Ql="_item_16a0l_23",ei="_itemName_16a0l_49",ti="_itemPreview_16a0l_77",be={container:Jl,paletteItems:Xl,item:Ql,itemName:ei,itemPreview:ti},Ht=({context:t,className:n})=>{const l=Object.values(t.pluginRegistry).filter(a=>a!==void 0),s=t.book.pages[t.editorState.pageIdx],{getBlockRectPx:i}=g.useGridCalc(t.book.paper,(s==null?void 0:s.grid)??g.DEFAULT_GRID);return e.jsx("div",{className:`${be.container} ${n||""}`,children:e.jsx("div",{className:be.paletteItems,children:l.map(a=>{const c=a.meta.defaultSize??{w:1,h:1},r=i({id:"ghost",kind:a.kind,layout:{x:0,y:0,w:c.w,h:c.h},props:{}});return e.jsx(Zt,{plugin:a,ghostWidth:r.width,ghostHeight:r.height},a.kind)})})})};Ht.displayName="PalettePanel";const Zt=({plugin:t,ghostWidth:n,ghostHeight:l})=>{const s=h.useMemo(()=>{var c,r;return{id:`preview-${t.kind}`,kind:t.kind,layout:{x:0,y:0,w:((c=t.meta.defaultSize)==null?void 0:c.w)??1,h:((r=t.meta.defaultSize)==null?void 0:r.h)??1},props:{}}},[t]),i=null,a=h.useCallback(c=>{g.startBlockDrag(c,t.kind,t.meta.defaultSize??{w:1,h:1});const r=Math.round(n),o=Math.round(l),d=document.createElement("div");d.style.cssText=`position:fixed;top:-9999px;left:-9999px;width:${r}px;height:${o}px;background:rgba(147,197,253,0.45);border-radius:4px;`,document.body.appendChild(d),c.dataTransfer.setDragImage(d,r/2,o/2),requestAnimationFrame(()=>document.body.removeChild(d))},[t,n,l]);return e.jsxs("div",{className:be.item,"data-testid":`palette-item-${t.kind}`,children:[e.jsx("button",{type:"button",draggable:!0,onDragStart:a,className:be.itemName,"aria-label":`${t.meta.displayName}ブロックを追加`,children:t.meta.displayName}),e.jsx("div",{className:be.itemPreview,draggable:!0,onDragStart:a,"aria-hidden":"true",children:e.jsx(t.Renderer,{id:s.id,props:s.props,value:i,onChange:()=>{},readOnly:!0,mode:g.NoteMode.FORM})})]})};Zt.displayName="PaletteItem";exports.ActionBarDivider=pt;exports.AddPageIcon=yt;exports.BackgroundBorderPanel=ke;exports.BlockDefaultsPanel=Je;exports.BlockOrderPanel=Xe;exports.BlockPropertyPanel=we;exports.CanvasActionPanel=Qe;exports.CanvasActionSection=It;exports.CanvasPanel=et;exports.Checkbox=ee;exports.ChevronLeftIcon=jt;exports.ChevronRightIcon=gt;exports.CollapsibleSection=F;exports.ColorPicker=X;exports.DefaultBlockPropertyPanel=Ut;exports.DefaultCanvasPanel=Gt;exports.DeletePageIcon=_t;exports.DimensionInput=W;exports.Dropdown=oe;exports.GridSettingsSection=$t;exports.GridSizePanel=tt;exports.IconActionButton=q;exports.ImportExportPanel=lt;exports.LayoutPanel=Ie;exports.MarginPanel=nt;exports.MetaPanel=Ye;exports.NumberInput=U;exports.OtherPanel=qt;exports.PalettePanel=Ht;exports.PaperSettingsSection=Lt;exports.PaperSizePanel=st;exports.PluginPanels=$e;exports.PropertyField=Ke;exports.SelectionActionBar=Ot;exports.SelectionActionBarButton=ae;exports.SelectionActionBarOverlay=Hs;exports.SelectionActionBarPanel=me;exports.TabPanel=He;exports.Tabs=St;exports.TabsContent=ue;exports.TabsList=kt;exports.TabsTrigger=de;exports.TextInput=he;exports.getDefaultSelectionActionBarItems=Gs;exports.styles=M;exports.useSelectionActionBar=Ft;exports.useSelectionBounds=Zs;
|