@tatamicks/core 1.0.3 → 1.0.4

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.
Files changed (35) hide show
  1. package/dist/PalettePanel-BTB1LkgU.cjs +9 -0
  2. package/dist/PalettePanel-BTB1LkgU.cjs.map +1 -0
  3. package/dist/{PalettePanel-N5Y1TJAk.js → PalettePanel-CrA2BGLq.js} +959 -942
  4. package/dist/PalettePanel-CrA2BGLq.js.map +1 -0
  5. package/dist/PalettePanel.css +1 -1
  6. package/dist/canvas.cjs +1 -1
  7. package/dist/canvas.mjs +4 -4
  8. package/dist/index.cjs +2 -2
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.css +1 -1
  11. package/dist/index.mjs +352 -343
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/{paperSettingsWidget-d93s3Gsr.js → paperSettingsWidget-CAIw_Ofm.js} +1582 -1535
  14. package/dist/paperSettingsWidget-CAIw_Ofm.js.map +1 -0
  15. package/dist/paperSettingsWidget-CIRKgnz4.cjs +2 -0
  16. package/dist/paperSettingsWidget-CIRKgnz4.cjs.map +1 -0
  17. package/dist/shell.cjs +1 -1
  18. package/dist/shell.mjs +2 -2
  19. package/dist/{sidebarPortal-B2Mk9Aba.js → sidebarPortal-Bigm11qq.js} +156 -151
  20. package/dist/sidebarPortal-Bigm11qq.js.map +1 -0
  21. package/dist/sidebarPortal-Dit8f3sD.cjs +3 -0
  22. package/dist/sidebarPortal-Dit8f3sD.cjs.map +1 -0
  23. package/dist/src/canvas.d.ts +4 -0
  24. package/dist/src/index.d.ts +5 -3
  25. package/dist/src/shell.d.ts +3 -1
  26. package/package.json +1 -1
  27. package/dist/PalettePanel-0cFP3tbA.cjs +0 -9
  28. package/dist/PalettePanel-0cFP3tbA.cjs.map +0 -1
  29. package/dist/PalettePanel-N5Y1TJAk.js.map +0 -1
  30. package/dist/paperSettingsWidget-CJ4QFjYK.cjs +0 -2
  31. package/dist/paperSettingsWidget-CJ4QFjYK.cjs.map +0 -1
  32. package/dist/paperSettingsWidget-d93s3Gsr.js.map +0 -1
  33. package/dist/sidebarPortal-B2Mk9Aba.js.map +0 -1
  34. package/dist/sidebarPortal-BCIVv4yO.cjs +0 -3
  35. package/dist/sidebarPortal-BCIVv4yO.cjs.map +0 -1
@@ -0,0 +1,9 @@
1
+ "use strict";require('./PalettePanel.css');const e=require("react/jsx-runtime"),h=require("react"),j=require("./sidebarPortal-Dit8f3sD.cjs"),mt=require("react-dom"),Qt="_container_zau2f_4",en="_section_zau2f_17",tn="_divider_zau2f_24",nn="_sectionLabel_zau2f_32",sn="_select_zau2f_39",ln="_numberInput_zau2f_60",an="_heightModeSwitch_zau2f_88",on="_switchLabel_zau2f_94",rn="_switchLabelActive_zau2f_102",cn="_toggle_zau2f_106",dn="_thumb_zau2f_123",M={container:Qt,section:en,divider:tn,sectionLabel:nn,select:sn,numberInput:ln,heightModeSwitch:an,switchLabel:on,switchLabelActive:rn,toggle:cn,thumb:dn},bt=t=>e.jsx("div",{className:M.divider,"aria-hidden":"true"});bt.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 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("path",{d:"M13 7.5a5 5 0 1 0-1.5 3.5"}),e.jsx("path",{d:"M13 3.5v4h-4"})]});Ue.displayName="RedoIcon";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("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"})]});Ve.displayName="TrashIcon";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:"5",y:"5",width:"8",height:"9",rx:"1"}),e.jsx("path",{d:"M3 11V3h8"})]});Ge.displayName="CopyIcon";const Ne=({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"})]});Ne.displayName="PasteIcon";const qe=({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"})]});qe.displayName="DuplicateIcon";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:"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"})]});ft.displayName="PrintIcon";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("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"})]});vt.displayName="StyleIcon";const jt=({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"})]});jt.displayName="LayoutIcon";const gt=({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"})]});gt.displayName="BlockSettingsIcon";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:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})});yt.displayName="ChevronLeftIcon";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:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})});_t.displayName="ChevronRightIcon";const wt=({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"})});wt.displayName="AddPageIcon";const Ct=({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"})});Ct.displayName="DeletePageIcon";const un={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}},He=t=>un[t],hn="_container_1tnp6_5",xn="_input_1tnp6_13",pn="_label_1tnp6_29",Te={container:hn,input:xn,label:pn},te=({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:Te.container,children:[e.jsx("input",{type:"checkbox",className:Te.input,checked:!!t,onChange:c,disabled:l}),a&&e.jsx("span",{className:Te.label,children:a})]})};te.displayName="Checkbox";const mn="_header_1c1mq_6",bn="_title_1c1mq_32",fn="_actions_1c1mq_43",vn="_titleGroup_1c1mq_49",jn="_infoIcon_1c1mq_60",gn="_chevron_1c1mq_84",yn="_chevronOpen_1c1mq_92",_n="_statusBadge_1c1mq_98",wn="_statusBadgeOn_1c1mq_108",Cn="_statusBadgeOff_1c1mq_113",Nn="_content_1c1mq_120",Sn="_contentNoPadding_1c1mq_127",B={header:mn,title:bn,actions:fn,titleGroup:vn,infoIcon:jn,chevron:gn,chevronOpen:yn,statusBadge:_n,statusBadgeOn:wn,statusBadgeOff:Cn,content:Nn,contentNoPadding:Sn},O=({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,f]=h.useState(l?s:!1),b=i!==void 0,p=b?!i:u,v=()=>{const k=p;b||f(!k),a==null||a(k)},g=!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:v,"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})]}),g&&e.jsx("div",{className:_,children:n})]})};O.displayName="CollapsibleSection";function ge(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 kn(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 In=[{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"}],$n="_container_1cdzu_5",Ln="_colorButton_1cdzu_13",Tn="_textInputWrapper_1cdzu_40",Pn="_textInputPrefix_1cdzu_62",An="_textInput_1cdzu_40",Mn="_popover_1cdzu_96",En="_palette_1cdzu_112",Dn="_paletteButton_1cdzu_119",zn="_selected_1cdzu_142",Bn="_transparentPaletteButton_1cdzu_148",Rn="_rgbaInputs_1cdzu_154",Wn="_rgbaInputGroup_1cdzu_161",On="_rgbaLabel_1cdzu_175",z={container:$n,colorButton:Ln,textInputWrapper:Tn,textInputPrefix:Pn,textInput:An,popover:Mn,palette:En,paletteButton:Dn,selected:zn,transparentPaletteButton:Bn,rgbaInputs:Rn,rgbaInputGroup:Wn,rgbaLabel:On},Nt=({onColorSelect:t,selectedColor:n,readOnly:l=!1})=>e.jsx("div",{className:z.palette,children:In.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}`)})});Nt.displayName="ColorPalette";const Fn="_input_14n56_5",Un={input:Fn},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:f})=>{const b=s??(u==null?void 0:u.min)??1,p=i??(u==null?void 0:u.max),v=a??(u==null?void 0:u.step)??1,g=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)||(g&&(y=Math.round(y)),b!==void 0&&y<b&&(y=b),p!==void 0&&y>p&&(y=p),n(y))},[n,b,p,g]),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:Un.input,style:S,value:t??"",onChange:$,onBlur:f,disabled:l,min:b,max:p,step:v,placeholder:_,"aria-label":x})};U.displayName="NumberInput";const St=({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})]})]});St.displayName="RGBAInputs";const kt=({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:j.Z_INDEX.DROPDOWN},children:[e.jsx(Nt,{onColorSelect:i,selectedColor:a,readOnly:c}),e.jsx(St,{rgba:l,onChange:s,readOnly:c})]}):null};kt.displayName="ColorPickerPopover";const Q=({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),f=r??(o==null?void 0:o.height),[b,p]=h.useState(!1),v=h.useRef(null),[g,_]=h.useState(()=>ge(t)??{r:0,g:0,b:0,a:1});h.useEffect(()=>{const T=ge(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=ge(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=ge(T);D&&(_(D),$(T.replace(/^#/,"")))}else $("");n(T)},[n]),C=h.useCallback((T,D)=>{if(D===void 0)return;const Z={...g,[T]:D};_(Z),n(kn(Z))},[g,n]),L=t??"未設定",E={};t&&(E.background=t);const P={};return u!==void 0?P.width=`${u}px`:P.width="100%",f!==void 0&&(P.height=`${f}px`),e.jsxs("div",{className:z.container,style:P,ref:v,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(kt,{isOpen:b,onClose:()=>p(!1),rgba:g,onRgbaChange:C,onColorSelect:w,selectedColor:t,readOnly:l})]})};Q.displayName="ColorPicker";const Vn="_container_1n9lj_5",Gn="_valueInput_1n9lj_23",qn="_unitSelect_1n9lj_45",Pe={container:Vn,valueInput:Gn,unitSelect:qn},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),f=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]),v=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]),g=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:Pe.container,style:k,children:[e.jsx("input",{type:"number",className:Pe.valueInput,value:_,onChange:p,onBlur:v,placeholder:d,min:c??1,max:r,step:o,readOnly:s,disabled:s,"aria-label":f}),e.jsx("select",{className:Pe.unitSelect,value:I,onChange:g,disabled:s||!a||a.length<=1,"aria-label":"単位",children:a?a.map($=>e.jsx("option",{value:$,children:$},$)):e.jsx("option",{value:I,children:I})})]})},Hn="_container_14f2v_5",Zn="_select_14f2v_11",Kn="_placeholderOverlay_14f2v_44",Ae={container:Hn,select:Zn,placeholderOverlay:Kn},re=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(v=>{const g=v.target.value;if(g==="")l(void 0);else{const _=a.find(I=>String(I.value)===g);l(_?_.value:g)}},[l,a]),u=n??"",f=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:Ae.container,style:b,children:[!f&&e.jsx("div",{className:Ae.placeholderOverlay,style:p,children:c}),e.jsxs("select",{className:Ae.select,style:p,value:u,onChange:x,disabled:s,"aria-label":t.ariaLabel,children:[d&&e.jsx("option",{value:"",style:{display:"none"}}),a.map(v=>e.jsx("option",{value:String(v.value),children:v.label},String(v.value)))]})]})};re.displayName="Dropdown";const Yn="_button_16snt_1",Jn={button:Yn},q=({icon:t,label:n,onClick:l,onMouseEnter:s,disabled:i,title:a,preventFocusOnMouseDown:c=!1})=>e.jsx("button",{type:"button",className:Jn.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 Xn="_container_ytzac_4",Qn="_scrollArea_ytzac_21",es="_emptyState_ytzac_29",Me={container:Xn,scrollArea:Qn,emptyState:es},Ze=({children:t,emptyMessage:n,className:l})=>e.jsx("div",{className:`${Me.container} ${l||""}`,children:t?e.jsx("div",{className:Me.scrollArea,children:t}):n&&e.jsx("div",{className:Me.emptyState,children:n})}),ts="_root_vttth_1",ns="_list_vttth_9",ss="_trigger_vttth_24",ls="_content_vttth_69",Se={root:ts,list:ns,trigger:ss,content:ls},ke=h.createContext(void 0),It=({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(ke.Provider,{value:{value:o,onChange:d,variant:i},children:e.jsx("div",{className:`${Se.root} ${a}`,"data-variant":i,children:s})})},$t=({children:t,className:n="",width:l,height:s,style:i})=>{const a=h.useContext(ke);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:`${Se.list} ${n}`,"data-variant":c,style:r,children:t})},ue=({value:t,children:n,className:l="",disabled:s=!1,width:i,height:a,style:c})=>{const r=h.useContext(ke);if(!r)throw new Error("TabsTrigger must be used within a Tabs component");const{value:o,onChange:d,variant:x}=r,u=o===t,f={...c};return i!==void 0&&(f.width=`${i}px`),a!==void 0&&(f.height=`${a}px`),e.jsx("button",{className:`${Se.trigger} ${l}`,"data-state":u?"active":"inactive","data-variant":x,onClick:()=>d(t),disabled:s,type:"button",style:f,children:n})},he=({value:t,children:n,className:l=""})=>{const s=h.useContext(ke);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:`${Se.content} ${l}`,children:n})},is="_input_jxjyc_5",as={input:is},xe=({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 f=s??(x==null?void 0:x.placeholder),b=i??(x==null?void 0:x.maxLength),p=a??(x==null?void 0:x.multiline)??!1,v=c??(x==null?void 0:x.rows)??3,g=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:as.input,style:_,value:t??"",onChange:g,disabled:l,placeholder:f,maxLength:b,"aria-label":d};return p?e.jsx("textarea",{...I,rows:v}):e.jsx("input",{...I,type:"text",onBlur:u})};xe.displayName="TextInput";const Lt=({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=He(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(Ue,{"aria-hidden":"true"}),label:"やり直し",title:"やり直し (Ctrl+Y / Cmd+Y)",onClick:()=>c("redo"),disabled:!i,preventFocusOnMouseDown:!0}),e.jsx(q,{icon:e.jsx(Ne,{"aria-hidden":"true"}),label:"貼り付け",title:"貼り付け (Ctrl+V / Cmd+V)",onClick:()=>c("paste"),disabled:!a,preventFocusOnMouseDown:!0}),e.jsx(q,{icon:e.jsx(ft,{"aria-hidden":"true"}),label:"印刷",title:"印刷 (Ctrl+P)",onClick:()=>l?l():window.print(),preventFocusOnMouseDown:!0})]})};Lt.displayName="CanvasActionSection";const rt={value:1,unit:"fr"},Tt=({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=j.expandSparseCols(t),r=t.colCount,o=[...c];if(a>r)for(let d=r;d<a;d++)o.push({...rt});else o.splice(a);n({...t,...j.colsToSparse(o)})},[t,n]),s=h.useCallback(i=>{const a=parseInt(i.target.value,10);if(!a||a<1||a>100)return;const c=j.expandSparseRows(t),r=t.rowCount,o=[...c];if(a>r)for(let d=r;d<a;d++)o.push({...rt});else o.splice(a);n({...t,...j.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:"行数"})]})};Tt.displayName="GridSettingsSection";function ye(t,n){switch(n){case"cm":return t/10;case"inch":return t/25.4;default:return t}}const os=[{value:j.PaperSizePreset.A4,label:"A4"},{value:j.PaperSizePreset.A3,label:"A3"},{value:j.PaperSizePreset.B5,label:"B5"},{value:j.PaperSizePreset.LETTER,label:"Letter"},{value:j.PaperSizePreset.LEGAL,label:"Legal"},{value:j.PaperSizePreset.CUSTOM,label:"カスタム"}],Pt=({paper:t,onPaperChange:n})=>{const l=t.size.preset===j.PaperSizePreset.CUSTOM,s=t.autoHeight===!0,i=t.autoWidth===!0,a=h.useCallback(u=>{const f=u.target.value;f&&n({...t,size:{...j.DEFAULT_PAPER_SIZES[f]}})},[t,n]),c=h.useCallback(({target:u})=>{const f=Number(u.value);if(!f||f<=0)return;const b=j.toMm.fromDim(t.margin.left)+j.toMm.fromDim(t.margin.right),p=ye(b,t.size.width.unit);if(f<p)return;const v={...t.size,width:{...t.size.width,value:f}};n({...t,size:v})},[t,n]),r=h.useCallback(({target:u})=>{const f=Number(u.value);if(!f||f<=0)return;const b=j.toMm.fromDim(t.margin.top)+j.toMm.fromDim(t.margin.bottom),p=ye(b,t.size.height.unit);if(f<p)return;const v={...t.size,height:{...t.size.height,value:f}};n({...t,size:v})},[t,n]),o=h.useCallback(({target:u})=>{const f=u.value,b={...t.size,width:{...t.size.width,unit:f},height:{...t.size.height,unit:f}};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:os.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:ye(j.toMm.fromDim(t.margin.left)+j.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:ye(j.toMm.fromDim(t.margin.top)+j.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"})]})]})]})};Pt.displayName="PaperSettingsSection";function ee(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 rs(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:f}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===j.LineType.DASHED?"8 4":o.type===j.LineType.DOTTED?"2 4":void 0;s.push(e.jsx("line",{x1:d,y1:x,x2:u,y2:f,stroke:o.color??"#000",strokeWidth:b,strokeDasharray:p},r))}return s}const Ie=({selectedBlocks:t,onUpdateBlocks:n})=>{const l=x=>{const u={};for(const f of t)u[f.id]={style:{...f.style,backgroundColor:x}};n(u)},s=(x,u,f)=>{var v,g,_;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=ee(k,`border.${$}.${u}`,f),u==="type"&&f==null&&(k=ee(k,`border.${$}.width`,null),k=ee(k,`border.${$}.color`,null)),u==="type"&&f!==void 0&&f!==null){const S=(v=I.style)==null?void 0:v.border,N=S==null?void 0:S[$];N!=null&&N.width||(k=ee(k,`border.${$}.width`,{value:1,unit:"px"})),N!=null&&N.color||(k=ee(k,`border.${$}.color`,"#000000"))}if(u==="color"&&f!==void 0&&f!==null){const S=(g=I.style)==null?void 0:g.border,N=S==null?void 0:S[$];N!=null&&N.type||(k=ee(k,`border.${$}.type`,j.LineType.SOLID)),N!=null&&N.width||(k=ee(k,`border.${$}.width`,{value:1,unit:"px"}))}if(u==="width"&&f!==void 0&&f!==null){const S=(_=I.style)==null?void 0:_.border,N=S==null?void 0:S[$];N!=null&&N.type||(k=ee(k,`border.${$}.type`,j.LineType.SOLID)),N!=null&&N.color||(k=ee(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(()=>rs(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(re,{value:H(t,`style.border.${r(x)}.type`),onChange:u=>s(x,"type",u??null),placeholder:"スタイル",height:24,options:[{label:"",value:null},{label:"実線",value:j.LineType.SOLID},{label:"破線",value:j.LineType.DASHED},{label:"点線",value:j.LineType.DOTTED}]}),e.jsx(W,{value:H(t,`style.border.${r(x)}.width`),onChange:u=>s(x,"width",u),placeholder:"太さ",height:24,allowedUnits:j.BORDER_UNITS,min:1}),e.jsx(Q,{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(Q,{value:i,onChange:x=>l(x),showTextInput:!0,allowUndefined:!0}),e.jsx("div",{style:{minWidth:0},children:e.jsxs(It,{defaultValue:"all",variant:"segmented",children:[e.jsx("div",{style:{width:"100%"},children:e.jsxs($t,{style:{width:"100%",display:"flex"},children:[e.jsx(ue,{value:"all",height:24,style:d,children:"共通"}),e.jsx(ue,{value:"top",height:24,style:d,children:"上"}),e.jsx(ue,{value:"bottom",height:24,style:d,children:"下"}),e.jsx(ue,{value:"left",height:24,style:d,children:"左"}),e.jsx(ue,{value:"right",height:24,style:d,children:"右"})]})}),e.jsxs("div",{style:{marginTop:"4px"},children:[e.jsx(he,{value:"all",children:o("all")}),e.jsx(he,{value:"top",children:o("top")}),e.jsx(he,{value:"bottom",children:o("bottom")}),e.jsx(he,{value:"left",children:o("left")}),e.jsx(he,{value:"right",children:o("right")})]})]})})]})};Ie.displayName="BackgroundBorderPanel";const cs="_container_1gf2q_1",ds="_grid_1gf2q_9",us="_field_1gf2q_15",hs="_label_1gf2q_22",xs="_inputWrapper_1gf2q_32",V={container:cs,grid:ds,field:us,label:hs,inputWrapper:xs},$e=({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)),f=Math.max(...t.map(_=>_.layout.y+_.layout.h)),b=u-(i??0),p=f-(a??0);let v=o;r==="x"&&l?v=Math.max(0,Math.min(o,l.cols-b)):r==="y"&&l?v=Math.max(0,Math.min(o,l.rows-p)):v=Math.max(0,o);const g=v-x;t.forEach(_=>{const I=_.layout[r]+g;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 f=l.cols-x.layout.x;u=Math.max(1,Math.min(o,f))}else if(r==="h"&&l){const f=l.rows-x.layout.y;u=Math.max(1,Math.min(o,f))}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:j.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:"-"})})]})]})})};$e.displayName="LayoutPanel";const ps="_group_xhfvf_1",ms="_btn_xhfvf_13",bs="_active_xhfvf_46",Ee={group:ps,btn:ms,active:bs},We=h.memo(({options:t,current:n,onChange:l})=>e.jsx("fieldset",{className:Ee.group,children:t.map(s=>{const i=n===s.value;return e.jsx("button",{type:"button",className:[Ee.btn,i?Ee.active:""].filter(Boolean).join(" "),title:s.label,"aria-label":s.label,"aria-pressed":i,onClick:()=>l(s.value),children:s.icon},String(s.value))})}));We.displayName="AlignmentToggle";const ne=j.checkboxStyleProp.defaultProps.styleConfig,se={fontSize:11,color:"#888",whiteSpace:"nowrap",width:62,flexShrink:0},le={display:"flex",gap:4,alignItems:"center"},At=({value:t,onChange:n,readOnly:l=!1})=>{const s=h.useMemo(()=>({checkboxSize:(t==null?void 0:t.checkboxSize)??ne.checkboxSize,borderWidth:(t==null?void 0:t.borderWidth)??ne.borderWidth,borderColor:(t==null?void 0:t.borderColor)??ne.borderColor,checkWidth:(t==null?void 0:t.checkWidth)??ne.checkWidth,checkColor:(t==null?void 0:t.checkColor)??ne.checkColor,backgroundColor:(t==null?void 0:t.backgroundColor)??ne.backgroundColor,checkedBackgroundColor:(t==null?void 0:t.checkedBackgroundColor)??ne.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(j.ClassicCheckboxVisual,{checked:a,styleConfig:s})})]},String(a)))}),e.jsxs("div",{style:le,children:[e.jsx("span",{style:se,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:le,children:[e.jsx("span",{style:se,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:le,children:[e.jsx("span",{style:se,children:"枠線 色"}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(Q,{value:s.borderColor,onChange:a=>i("borderColor",a),readOnly:l,showTextInput:!0})})]}),e.jsxs("div",{style:le,children:[e.jsx("span",{style:se,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:le,children:[e.jsx("span",{style:se,children:"チェック 色"}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(Q,{value:s.checkColor,onChange:a=>i("checkColor",a),readOnly:l,showTextInput:!0})})]}),e.jsxs("div",{style:le,children:[e.jsx("span",{style:se,children:"背景色"}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(Q,{value:s.backgroundColor,onChange:a=>i("backgroundColor",a),readOnly:l,showTextInput:!0})})]}),e.jsxs("div",{style:le,children:[e.jsx("span",{style:se,children:"チェック時 背景色"}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(Q,{value:s.checkedBackgroundColor,onChange:a=>i("checkedBackgroundColor",a),readOnly:l,showTextInput:!0,allowUndefined:!0})})]})]})};At.displayName="CheckboxStyleEditor";const fs="_group_1uyid_1",vs="_btn_1uyid_13",js="_active_1uyid_46",gs="_iconBold_1uyid_52",ys="_iconItalic_1uyid_59",_s="_iconUnderline_1uyid_66",ws="_iconLineThrough_1uyid_73",ae={group:fs,btn:vs,active:js,iconBold:gs,iconItalic:ys,iconUnderline:_s,iconLineThrough:ws},Cs=[{key:"fontWeight",label:"太字",icon:e.jsx("span",{className:ae.iconBold,"aria-hidden":"true",children:"B"})},{key:"italic",label:"斜体",icon:e.jsx("span",{className:ae.iconItalic,"aria-hidden":"true",children:"I"})},{key:"underline",label:"下線",icon:e.jsx("span",{className:ae.iconUnderline,"aria-hidden":"true",children:"U"})},{key:"lineThrough",label:"取り消し線",icon:e.jsx("span",{className:ae.iconLineThrough,"aria-hidden":"true",children:"S"})}],Mt=({value:t,onChange:n,readOnly:l=!1})=>{const s=t??{},i=a=>{l||n({...s,[a]:!s[a]})};return e.jsx("fieldset",{className:ae.group,children:Cs.map(({key:a,label:c,icon:r})=>{const o=!!s[a];return e.jsx("button",{type:"button",className:[ae.btn,o?ae.active:""].filter(Boolean).join(" "),title:c,"aria-label":c,"aria-pressed":o,disabled:l,onClick:()=>i(a),children:r},a)})})};Mt.displayName="FontDecorationToggle";const Ns="_root_12n4v_6",Ss="_fontFamilyCell_12n4v_13",ks="_fontSizeCell_12n4v_14",Is="_colorCell_12n4v_15",pe={root:Ns,fontFamilyCell:Ss,fontSizeCell:ks,colorCell:Is},$s=[{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"}],Et=({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:pe.root,children:[e.jsx("div",{className:pe.fontFamilyCell,children:e.jsx(re,{value:s.fontFamily,onChange:i,readOnly:l,options:$s,placeholder:"フォント"})}),e.jsx("div",{className:pe.fontSizeCell,children:e.jsx(W,{value:s.fontSize,onChange:a,readOnly:l,config:{allowedUnits:j.FONT_UNITS,min:1,step:1}})}),e.jsx("div",{className:pe.colorCell,children:e.jsx(Q,{value:s.color,onChange:c,readOnly:l,allowUndefined:!0})}),e.jsx("div",{className:pe.decorationCell,children:e.jsx(Mt,{value:o,onChange:r,readOnly:l})})]})};Et.displayName="FontStyleEditor";const Dt=({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[v,g]of s.entries())b.has(g.value)?(p.add(b.get(g.value)),p.add(v)):b.set(g.value,v);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,v)=>v!==b)})},[s,t,n]),o=h.useCallback((b,p)=>{n({...t,options:s.map((v,g)=>g===b?{...v,label:p}:v)})},[s,t,n]),d=h.useCallback((b,p)=>{n({...t,options:s.map((v,g)=>g===b?{...v,value:p}:v)})},[s,t,n]),x=h.useCallback((b,p)=>{n({...t,options:s.map((v,g)=>g===b?{...v,color:p}:v)})},[s,t,n]),u=h.useCallback(b=>{n({...t,allowEmpty:b})},[t,n]),f={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(te,{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:f,value:b.label,onChange:v=>o(p,v.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:{...f,borderColor:a.has(p)?"#e53e3e":"#ccc"},value:b.value,onChange:v=>d(p,v.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(Q,{value:b.color,onChange:v=>x(p,v),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:"+ 選択肢を追加"})]})};Dt.displayName="OptionsEditor";const Ls="_root_111zo_7",Ts="_linkLabel_111zo_14",Ps="_allRow_111zo_31",As="_grid_111zo_38",Ms="_sideRow_111zo_45",Es="_cell_111zo_53",Ds="_spacer_111zo_59",Y={root:Ls,linkLabel:Ts,allRow:Ps,grid:As,sideRow:Ms,cell:Es,spacer:Ds},zt=({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)}),"全辺を一括設定"]});zt.displayName="PaddingLinkCheckbox";const J={value:0,unit:"px"},Bt=({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(zt,{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:j.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:j.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:j.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:j.PADDING_UNITS,min:0},readOnly:l})})]}),e.jsx("div",{className:Y.cell,children:e.jsx(W,{value:s.bottom??J,onChange:d,config:{allowedUnits:j.PADDING_UNITS,min:0},readOnly:l})})]})]})};Bt.displayName="PaddingEditor";const me=j.textBehaviorProp.defaultProps,zs=[{label:"標準",value:j.WordWrap.normal},{label:"単語で折り返し",value:j.WordWrap.breakWord},{label:"文字で折り返し",value:j.WordWrap.breakAll}],De={display:"flex",alignItems:"center",gap:6,marginBottom:4},ze={fontSize:11,color:"#666",minWidth:72,flexShrink:0},Rt=({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:De,children:[e.jsx("span",{style:ze,children:"複数行"}),e.jsx(te,{value:t??me.multiline,onChange:a=>s("multiline",a??!1),readOnly:i,label:"複数行入力を有効にする"})]}),e.jsxs("div",{style:De,children:[e.jsx("span",{style:ze,children:"行間"}),e.jsx("div",{style:{flex:1},children:e.jsx(U,{value:n??me.lineHeight,onChange:a=>s("lineHeight",a??me.lineHeight),readOnly:i,min:.5,max:5,step:.1,height:24})})]}),e.jsxs("div",{style:De,children:[e.jsx("span",{style:ze,children:"折り返し"}),e.jsx("div",{style:{flex:1},children:e.jsx(re,{value:l??me.wordWrap,onChange:a=>s("wordWrap",a??me.wordWrap),options:zs,readOnly:i,height:24})})]})]});Rt.displayName="TextBehaviorEditor";const ct="data-tatamicks-portal-root";let X=null;function Bs(){if(typeof document>"u")throw new Error("getTatamicksPortalRoot requires a DOM environment");if(X&&document.body.contains(X))return X;const t=document.querySelector(`[${ct}]`);return t instanceof HTMLElement?(X=t,X):(X=document.createElement("div"),X.setAttribute(ct,"true"),Object.assign(X.style,{position:"fixed",inset:"0",pointerEvents:"none",isolation:"isolate",zIndex:"auto"}),document.body.appendChild(X),X)}const we=[{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}],Rs=we.map(t=>({label:t.label,value:t.label})),Ws=`[0-9] 数字のみ
2
+ [a-z] 英小文字
3
+ [A-Z] 英大文字
4
+ [ぁ-ん] ひらがな
5
+ + 1回以上繰り返し
6
+ * 0回以上繰り返し
7
+ {3} 3回繰り返し
8
+ {3,5} 3〜5回繰り返し
9
+ . 任意の1文字`,Be={display:"flex",alignItems:"center",gap:6,marginBottom:4},Re={fontSize:11,color:"#666",minWidth:72,flexShrink:0},Wt=({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),f=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",v=s??void 0,g=(()=>{const S=we.find(N=>N.isCustom||N.inputType!==p?!1:N.pattern===v);return(S==null?void 0:S.label)??"その他"})(),_=g==="その他",I=we.find(S=>S.label===g),k=!(I!=null&&I.hideLength),$=h.useCallback(S=>{const N=we.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:Be,children:[e.jsx("span",{style:Re,children:"入力タイプ"}),e.jsx("div",{style:{flex:1},children:e.jsx(re,{value:g,onChange:$,options:Rs,readOnly:c,height:24})})]}),k&&e.jsxs("div",{style:Be,children:[e.jsx("span",{style:Re,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:Be,children:[e.jsxs("span",{style:{...Re,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:f,onMouseLeave:b,onFocus:f,onBlur:b,children:"i"})]}),e.jsx("div",{style:{flex:1},children:e.jsx(xe,{value:s??"",onChange:S=>{i("pattern",S??"")},readOnly:c,placeholder:"例: [0-9]+"})})]}),r&&mt.createPortal(e.jsx("pre",{style:{...d,zIndex:j.Z_INDEX.TOOLTIP,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:Ws}),Bs())]})};Wt.displayName="TextValidationEditor";const Ot={alignment:"配置",fontStyle:"フォントスタイル",padding:"パディング",required:"必須入力",placeholder:"プレースホルダー",textValidation:"入力検証",textBehavior:"テキスト動作",selectConfig:"選択肢設定",checkboxStyle:"チェックボックスデザイン"},Os=[{value:j.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:j.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:j.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"})]})}],Fs=[{value:j.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:j.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:j.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 ce(t){return typeof t=="object"&&t!==null&&typeof t.value=="number"&&typeof t.unit=="string"}function Us(t){return typeof t=="object"&&t!==null&&Array.isArray(t.options)}const Ke=h.memo(({kind:t,defaultProps:n,getVal:l,onChange:s,onChangeBatch:i,readOnly:a,component:c})=>{switch(t){case"alignment":{const r=l("horizontal")??j.HorizontalAlign.left,o=l("vertical")??j.VerticalAlign.center;return e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[e.jsx(We,{options:Os,current:r,onChange:d=>s("horizontal",d)}),e.jsx(We,{options:Fs,current:o,onChange:d=>s("vertical",d)})]})}case"fontStyle":{const r=l("fontSize"),o={fontFamily:l("fontFamily"),fontSize:ce(r)?r:void 0,color:l("color"),fontWeight:l("fontWeight"),italic:l("italic"),underline:l("underline"),lineThrough:l("lineThrough")};return e.jsx(Et,{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"),f=l("all"),b={top:ce(r)?r:void 0,right:ce(o)?o:void 0,bottom:ce(d)?d:void 0,left:ce(x)?x:void 0,bulk:typeof u=="boolean"?u:!1,all:ce(f)?f:void 0};return e.jsx(Bt,{value:b,onChange:p=>{if(i)i(p);else for(const[v,g]of Object.entries(p))s(v,g)}})}case"required":{const r=l("required");return e.jsx(te,{value:r??!1,onChange:o=>s("required",o??!1),label:"必須"})}case"placeholder":{const r=l("placeholder");return e.jsx(xe,{value:r??"",onChange:o=>s("placeholder",o??"")})}case"textValidation":return e.jsx(Wt,{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(Rt,{multiline:l("multiline"),lineHeight:l("lineHeight")??void 0,wordWrap:l("wordWrap"),onChange:s});case"checkboxStyle":{const r=l("styleConfig");return e.jsx(At,{value:r,onChange:o=>s("styleConfig",o)})}case"selectConfig":{const r=l("selectConfig"),o=Us(r)?r:{options:[]};return e.jsx(Dt,{value:o,onChange:d=>s("selectConfig",d)})}default:{if(c){const x=c,u=Object.keys(n)[0]??t,f=l(u);return e.jsx(x,{value:f,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(xe,{value:d,onChange:x=>s(r,x??"")})}}});Ke.displayName="PropDefEditor";const Ye=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 g;const v=H(n,`props.${p}`);return v!==void 0?v:((g=a==null?void 0:a[x])==null?void 0:g[p])??o[p]??null},f=d!==void 0&&Object.keys(o).some(p=>p in((d==null?void 0:d.props)??{})),b=h.useCallback(p=>{var v;if(p){const g={};for(const[_,I]of Object.entries(o))g[_]=((v=a==null?void 0:a[x])==null?void 0:v[_])??I;if(s)s(g);else for(const[_,I]of Object.entries(g))l(_,I)}else c==null||c(Object.keys(o))},[l,s,c,o,a,x]);return e.jsx(O,{title:Ot[r]??r,collapsible:!0,isOpen:f,onOpenChange:b,openLabel:"カスタム",closeLabel:"標準",children:e.jsx(Ke,{kind:r,defaultProps:o,getVal:u,onChange:l,onChangeBatch:s,readOnly:i,component:t.component})})});Ye.displayName="PropertyField";const Le=({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,f)=>{const b={};t.forEach(p=>{b[p.id]={props:{...p.props,[u]:f}}}),l(b)},o=u=>{const f={};t.forEach(b=>{f[b.id]={props:{...b.props,...u}}}),l(f)},d=u=>{const f={};t.forEach(b=>{const p={...b.props};for(const v of u)delete p[v];f[b.id]={props:p}}),l(f)},x=c.properties.map(u=>e.jsx(Ye,{propDef:u,selectedBlocks:t,onChange:r,onChangeBatch:o,blockDefaults:s,onResetToDefault:d},u.kind));return c.properties.length===0?null:i?e.jsx(O,{title:c.meta.displayName,children:x}):e.jsx("div",{children:x})};Le.displayName="PluginPanels";const Vs="_bar_13lr1_4",Gs="_divider_13lr1_18",qs="_barWrapper_13lr1_26",Hs="_popover_13lr1_31",ve={bar:Vs,divider:Gs,barWrapper:qs,popover:Hs},oe=({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});oe.displayName="SelectionActionBarButton";const Ft=h.createContext(null);function Ut(){const t=h.useContext(Ft);if(t===null)throw new Error("useSelectionActionBar must be used inside SelectionActionBar");return t}const Vt=({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=v=>{c&&!c.contains(v.target)&&a(null)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[i,c]),h.useEffect(()=>()=>{d()},[d]);const f=h.useCallback(p=>{d(),a(p)},[d]),b=h.useCallback(p=>{d(),a(p)},[d]);return e.jsx(Ft.Provider,{value:{openPanel:i,openPanelByHover:f,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})})})};Vt.displayName="SelectionActionBar";const be=({id:t,icon:n,label:l,children:s})=>{const{openPanel:i,openPanelByHover:a,openPanelByClick:c,onPointerDown:r,wrapperEl:o}=Ut(),d=i===t;return e.jsxs(e.Fragment,{children:[e.jsx(oe,{icon:n,label:l,onMouseEnter:()=>a(t),onClick:()=>c(t)}),d&&o&&mt.createPortal(e.jsx("div",{className:ve.popover,"data-testid":`popover-${t}`,onPointerDown:r,children:s}),o)]})};be.displayName="SelectionActionBarPanel";function Zs({context:t,gridSize:n,onActionFeedback:l}){var g;const{actionContext:s,pluginRegistry:i}=t,a=t.editorState,c=a.selectedBlockIds??[],r=s.isEnabled("paste"),o=a.pageIdx,d=(((g=t.book.pages[o])==null?void 0:g.blocks)??[]).filter(_=>c.includes(_.id)),x=c.length>0,u=d.length>0,f=u&&Object.keys(i).length>0,b=(_,I)=>s.execute("updateBlocks",{updates:_,options:I}),p=(_,I)=>{I();const k=He(_);k&&(l==null||l(k))},v=[e.jsx(oe,{icon:e.jsx(Ve,{"aria-hidden":"true"}),label:"選択を削除",title:"削除 (Delete / Backspace)",onClick:()=>p("delete",()=>s.execute("delete")),disabled:!x},"delete"),e.jsx(oe,{icon:e.jsx(Ge,{"aria-hidden":"true"}),label:"選択をコピー",title:"コピー (Ctrl+C / Cmd+C)",onClick:()=>p("copy",()=>s.execute("copy")),disabled:!x},"copy"),e.jsx(oe,{icon:e.jsx(qe,{"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(oe,{icon:e.jsx(Ne,{"aria-hidden":"true"}),label:"貼り付け",title:"貼り付け (Ctrl+V / Cmd+V)",onClick:()=>p("paste",()=>s.execute("paste")),disabled:!r},"paste")];return(u||f)&&v.push(e.jsx("div",{className:ve.divider,"aria-hidden":"true"},"divider-panels")),u&&v.push(e.jsx(be,{id:"style",icon:e.jsx(vt,{"aria-hidden":"true"}),label:"スタイル設定",children:e.jsx(Ie,{selectedBlocks:d,onUpdateBlocks:b})},"style"),e.jsx(be,{id:"layout",icon:e.jsx(jt,{"aria-hidden":"true"}),label:"レイアウト設定",children:e.jsx($e,{selectedBlocks:d,onUpdateBlocks:b,gridSize:n})},"layout")),f&&v.push(e.jsx(be,{id:"plugin",icon:e.jsx(gt,{"aria-hidden":"true"}),label:"ブロック設定",children:e.jsx(Le,{selectedBlocks:d,pluginRegistry:i,onUpdateBlocks:b,showGroupHeader:!1})},"plugin")),v}const dt=8,Ks=36,Ys=({selectionBoundingBox:t,isDragging:n,zIndex:l=1,children:s})=>{if(t==null||n)return null;const i=t,a=i.top-dt-Ks,c=a>=0?a:i.bottom+dt,r={position:"absolute",inset:0,pointerEvents:"none",zIndex:l,...j.STACKING_ISOLATION_STYLE},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 Js(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 f of n){const b=a.querySelector(`[data-block-id="${f}"]`);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 Xs="_container_3lvww_1",Qs="_row_3lvww_9",el="_label_3lvww_15",tl="_inputWrapper_3lvww_24",nl="_error_3lvww_31",K={container:Xs,row:Qs,label:el,inputWrapper:tl,error:nl};function ut(t,n,l){const s=t.trim();return s?/\s/.test(s)?"スペースは使用できません":s!==n&&(l!=null&&l.has(s))?"このIDは既に使用されています":null:"IDを入力してください"}const Je=({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(ut(p,b,l)){i(b),c(null);return}n({[b]:{id:p}})},d=b=>{const p=b??"";i(p),r&&c(ut(p,r.id,l))},x=b=>{const p={};t.forEach(v=>{p[v.id]={behavior:{...v.behavior,readOnly:!!b||void 0}}}),n(p)},u=b=>{const p={};t.forEach(v=>{p[v.id]={behavior:{...v.behavior,heightFit:b||void 0}}}),n(p)},f=b=>{const p={};t.forEach(v=>{p[v.id]={behavior:{...v.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(xe,{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(te,{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(te,{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(te,{label:"幅自動フィット",value:!!H(t,"behavior.widthFit"),onChange:f})})})]})};Je.displayName="MetaPanel";const sl="_container_2zb6l_1",ll="_scrollArea_2zb6l_18",il="_emptyState_2zb6l_33",Oe={container:sl,scrollArea:ll,emptyState:il},Ce=({children:t,className:n=""})=>e.jsx("div",{className:`${Oe.container}${n?` ${n}`:""}`,children:t});Ce.displayName="BlockPropertyPanel";const Gt=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(v=>r.includes(v.id)))??[],d=c==null?void 0:c.blockDefaults,x=(v,g)=>i.execute("updateBlocks",{updates:v,options:g}),u=new Set((c==null?void 0:c.blocks.map(v=>v.id))??[]),f=o[0],b=f?s[f.kind]:void 0,p=h.useMemo(()=>{var g;if(o.length===0)return!1;const v=(g=o[0])==null?void 0:g.kind;return o.every(_=>_.kind===v)},[o]);return o.length===0?e.jsx(Ce,{className:l,children:e.jsxs("div",{className:Oe.emptyState,children:["ブロックを選択すると",e.jsx("br",{}),"プロパティが表示されます"]})}):e.jsx(Ce,{className:l,children:e.jsxs("div",{className:Oe.scrollArea,children:[e.jsx(O,{title:"配置・サイズ",description:"ブロックの位置(X・Y座標)と大きさ(幅・高さ)をグリッド単位で設定します",children:e.jsx($e,{selectedBlocks:o,onUpdateBlocks:x,gridSize:n})}),e.jsx(O,{title:"背景・枠線",description:"ブロックの背景色と枠線(線の種類・色・太さ)を設定します",children:e.jsx(Ie,{selectedBlocks:o,onUpdateBlocks:x})}),b&&p&&b.properties.length>0&&e.jsx(Le,{selectedBlocks:o,pluginRegistry:s,onUpdateBlocks:x,blockDefaults:d}),e.jsx(O,{title:"基本設定",description:"ブロックのID(識別子)や読み取り専用にするかどうかなど、動作に関わる設定をします",children:e.jsx(Je,{selectedBlocks:o,onUpdateBlocks:x,allBlockIds:u})})]})})});Gt.displayName="DefaultBlockPropertyPanel";const al="_kindSelector_qrad9_1",ol="_kindTab_qrad9_9",rl="_kindTabActive_qrad9_30",cl="_propertyList_qrad9_46",dl="_emptyState_qrad9_131",de={kindSelector:al,kindTab:ol,kindTabActive:rl,propertyList:cl,emptyState:dl},qt=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,f]of Object.entries(i))x[u]=n[u]??f;l(x)}else{const x={...n};for(const u of Object.keys(i))delete x[u];l(x)}};return e.jsx(O,{title:Ot[s]??s,collapsible:!0,isOpen:a,onOpenChange:o,openLabel:"カスタム",closeLabel:"標準",children:e.jsx(Ke,{kind:s,defaultProps:i,getVal:c,onChange:r})})});qt.displayName="DefaultsPropField";const Xe=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:de.emptyState,children:"プラグインが登録されていません"}):e.jsxs(O,{title:"ブロック共通デフォルト",collapsible:!0,noPadding:!0,description:"各ブロック種類に共通して適用されるデフォルト値です",children:[e.jsx("div",{className:de.kindSelector,children:s.map(o=>{const d=n[o];return e.jsx("button",{type:"button",className:`${de.kindTab} ${i===o?de.kindTabActive:""}`,onClick:()=>a(o),children:(d==null?void 0:d.meta.displayName)??o},o)})}),c&&e.jsx("div",{className:de.propertyList,children:c.properties.length===0?e.jsx("div",{className:de.emptyState,children:"カスタマイズ可能なプロパティがありません"}):c.properties.map(o=>e.jsx(qt,{propDef:o,kindDefaults:t[i]??{},onKindDefaultsChange:r},o.kind))})]})});Xe.displayName="BlockDefaultsPanel";const ul="_list_12dfx_10",hl="_item_12dfx_19",xl="_selected_12dfx_41",pl="_dragHandle_12dfx_46",ml="_ghost_12dfx_57",bl="_itemInfo_12dfx_68",fl="_itemId_12dfx_75",vl="_itemMeta_12dfx_80",jl="_itemKind_12dfx_87",gl="_itemActions_12dfx_95",yl="_actionButton_12dfx_100",_l="_empty_12dfx_136",F={list:ul,item:hl,selected:xl,dragHandle:pl,ghost:ml,itemInfo:bl,itemId:fl,itemMeta:vl,itemKind:jl,itemActions:gl,actionButton:yl,empty:_l},Qe=({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(),f=(()=>{if(a===null)return null;const m=u.findIndex(y=>y.id===a);return m===-1?null:m})(),b=h.useMemo(()=>{if(f===null||r===null)return u;const m=u[f];if(!m)return u;const w=[...u.filter((L,E)=>E!==f)],C=Math.max(0,Math.min(r,w.length));return w.splice(C,0,m),w},[u,f,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]),v=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]),g=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(),at=Z.find(je=>je.id===a);if(at){const je=Z.filter(Xt=>Xt.id!==a),Jt=Math.max(0,Math.min(T,je.length)),ot=[...je];ot.splice(Jt,0,at),n([...ot].reverse())}}},[a,r,n]),S=h.useCallback(m=>{m.currentTarget.contains(m.relatedTarget)||o(f)},[f]),N=h.useCallback(m=>{if(m.preventDefault(),d.current=null,f!==null&&r!==null){const y=u[f];if(y){const w=u.filter((T,D)=>D!==f),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,f,r,u,n]);return e.jsxs(O,{title:"ブロック順序",collapsible:!0,description:"ブロックの重なり順序を管理します。上にあるほど最前面、下にあるほど最背面に表示されます。ドラッグして並び替えができます",children:[e.jsx("ul",{className:F.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:`${F.item} ${C?F.ghost:""} ${E?F.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:F.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:F.itemInfo,children:[e.jsx("div",{className:F.itemId,children:m.id}),e.jsx("div",{className:F.itemMeta,children:e.jsx("span",{className:F.itemKind,children:m.kind})})]}),e.jsxs("div",{className:F.itemActions,children:[e.jsx("button",{type:"button",className:F.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:F.actionButton,onClick:()=>g(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:F.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:F.actionButton,onClick:()=>v(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:F.empty,children:"ブロックがありません"})]})};Qe.displayName="BlockOrderPanel";const wl="_container_1x0zd_4",Cl="_group_1x0zd_16",Nl="_divider_1x0zd_22",_e={container:wl,group:Cl,divider:Nl},et=({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=He(d);x&&(n==null||n(x))};return e.jsxs("div",{className:_e.container,"data-testid":"canvas-action-panel",children:[e.jsxs("div",{className:_e.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(Ue,{"aria-hidden":"true"}),label:"やり直し",title:"やり直し (Ctrl+Y / Cmd+Y)",onClick:()=>o("redo"),disabled:!c})]}),e.jsx("div",{className:_e.divider,"aria-hidden":"true"}),e.jsxs("div",{className:_e.group,children:[e.jsx(q,{icon:e.jsx(Ve,{"aria-hidden":"true"}),label:"選択を削除",title:"削除 (Delete / Backspace)",onClick:()=>o("delete"),disabled:!i}),e.jsx(q,{icon:e.jsx(Ge,{"aria-hidden":"true"}),label:"選択をコピー",title:"コピー (Ctrl+C / Cmd+C)",onClick:()=>o("copy"),disabled:!i}),e.jsx(q,{icon:e.jsx(Ne,{"aria-hidden":"true"}),label:"貼り付け",title:"貼り付け (Ctrl+V / Cmd+V)",onClick:()=>o("paste"),disabled:!r}),e.jsx(q,{icon:e.jsx(qe,{"aria-hidden":"true"}),label:"選択を複製",title:"複製 (Ctrl+D / Cmd+D)",onClick:()=>o("duplicate"),disabled:!i})]})]})};et.displayName="CanvasActionPanel";const tt=({children:t,className:n})=>e.jsx(Ze,{className:n,children:t});tt.displayName="CanvasPanel";const Sl="_field_69k7e_6",kl="_horizontal_69k7e_12",Il="_label_69k7e_18",$l="_gridSizeRow_69k7e_29",ie={field:Sl,horizontal:kl,label:Il,gridSizeRow:$l},ht={value:1,unit:"fr"},nt=({grid:t,onGridChange:n})=>{const l=h.useCallback(i=>{if(!i||i<1||i>100)return;const a=j.expandSparseCols(t),c=t.colCount,r=[...a];if(i>c)for(let o=c;o<i;o++)r.push({...ht});else r.splice(i);n({...t,...j.colsToSparse(r)})},[t,n]),s=h.useCallback(i=>{if(!i||i<1||i>100)return;const a=j.expandSparseRows(t),c=t.rowCount,r=[...a];if(i>c)for(let o=c;o<i;o++)r.push({...ht});else r.splice(i);n({...t,...j.rowsToSparse(r)})},[t,n]);return e.jsx(O,{title:"グリッドサイズ",collapsible:!0,defaultCollapsed:!1,description:"ブロックを配置するグリッドの列数と行数を設定します",children:e.jsxs("div",{className:ie.gridSizeRow,children:[e.jsxs("div",{className:`${ie.field} ${ie.horizontal}`,children:[e.jsx("span",{className:ie.label,children:"列数"}),e.jsx(U,{value:t.colCount,onChange:l,min:1,max:100,step:1})]}),e.jsxs("div",{className:`${ie.field} ${ie.horizontal}`,children:[e.jsx("span",{className:ie.label,children:"行数"}),e.jsx(U,{value:t.rowCount,onChange:s,min:1,max:100,step:1})]})]})})};nt.displayName="GridSizePanel";const Ll="_topRow_2ni80_6",Tl="_linkSwitch_2ni80_15",Pl="_switchLabel_2ni80_23",Al="_switchLabelActive_2ni80_31",Ml="_toggle_2ni80_35",El="_thumb_2ni80_52",Dl="_topCell_2ni80_70",zl="_sideCell_2ni80_75",Bl="_bottomCell_2ni80_81",Rl="_sideMargins_2ni80_88",G={topRow:Ll,linkSwitch:Tl,switchLabel:Pl,switchLabelActive:Al,toggle:Ml,thumb:El,topCell:Dl,sideCell:zl,bottomCell:Bl,sideMargins:Rl},st=({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(O,{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})})]})]})};st.displayName="MarginPanel";const Wl="_grid_ddemj_5",Ol="_colSpan2_ddemj_13",Fl="_colSpan3_ddemj_18",Ul="_label_ddemj_23",Vl="_modeLabel_ddemj_32",Gl="_modeToggle_ddemj_40",ql="_switchLabel_ddemj_47",Hl="_switchLabelActive_ddemj_55",Zl="_toggle_ddemj_59",Kl="_thumb_ddemj_76",Yl="_checkboxCell_ddemj_92",A={grid:Wl,colSpan2:Ol,colSpan3:Fl,label:Ul,modeLabel:Vl,modeToggle:Gl,switchLabel:ql,switchLabelActive:Hl,toggle:Zl,thumb:Kl,checkboxCell:Yl};function xt(t,n){switch(n){case"cm":return t/10;case"inch":return t/25.4;default:return t}}const lt=({paper:t,onPaperChange:n})=>{const l=h.useMemo(()=>[{value:j.PaperSizePreset.A4,label:"A4 (210 × 297 mm)"},{value:j.PaperSizePreset.A3,label:"A3 (297 × 420 mm)"},{value:j.PaperSizePreset.B5,label:"B5 (182 × 257 mm)"},{value:j.PaperSizePreset.LETTER,label:"Letter (8.5 × 11 inch)"},{value:j.PaperSizePreset.LEGAL,label:"Legal (8.5 × 14 inch)"},{value:j.PaperSizePreset.CUSTOM,label:"カスタム"}],[]),s=h.useCallback(g=>{n({...t,orientation:g||void 0})},[t,n]),i=h.useCallback(g=>{g&&n({...t,size:j.DEFAULT_PAPER_SIZES[g]})},[t,n]),a=h.useCallback(g=>{if(!g)return;const _={...t.size,preset:j.PaperSizePreset.CUSTOM,width:g};n({...t,size:_})},[t,n]),c=h.useCallback(g=>{if(!g)return;const _={...t.size,preset:j.PaperSizePreset.CUSTOM,height:g};n({...t,size:_})},[t,n]),r=t.size.preset===j.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]),f=o?"最小高さ":"高さ",b=d?"最小幅":"幅",p=h.useMemo(()=>{const g=j.toMm.fromDim(t.margin.left)+j.toMm.fromDim(t.margin.right);return xt(g,t.size.width.unit)},[t.margin.left,t.margin.right,t.size.width.unit]),v=h.useMemo(()=>{const g=j.toMm.fromDim(t.margin.top)+j.toMm.fromDim(t.margin.bottom);return xt(g,t.size.height.unit)},[t.margin.top,t.margin.bottom,t.size.height.unit]);return e.jsx(O,{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(re,{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(te,{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:f}),e.jsx("div",{className:A.colSpan3,children:e.jsx(W,{value:t.size.height,onChange:c,allowedUnits:["mm","cm","inch"],min:v,max:500})})]})]})})};lt.displayName="PaperSizePanel";const Ht=({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 v=i.pages.map((g,_)=>_===r?{...g,grid:p}:g);a({...i,pages:v},{mergeKey:j.gridSizeKey(r)})},[i,a,r]),f=h.useCallback(p=>{const v=i.pages.map((g,_)=>_===r?{...g,blocks:p}:g);a({...i,pages:v})},[i,a,r]),b=h.useCallback(p=>{const v=i.pages.map((g,_)=>_===r?{...g,blockDefaults:p}:g);a({...i,pages:v})},[i,a,r]);return e.jsxs(tt,{children:[e.jsx(et,{context:t,onActionFeedback:s}),e.jsx(lt,{paper:i.paper,onPaperChange:x}),e.jsx(st,{paper:i.paper,onPaperChange:x}),e.jsx(nt,{grid:d.grid,onGridChange:u}),c&&Object.keys(c).length>0&&e.jsx(Xe,{blockDefaults:d.blockDefaults??{},pluginRegistry:c,onChange:b}),e.jsx(Qe,{blocks:d.blocks,onBlocksChange:f,selectedBlockIds:o,onBlockHover:n,onBlockDragChange:l})]})};Ht.displayName="DefaultCanvasPanel";const Jl="_buttonGroup_5h1ft_1",Xl="_button_5h1ft_1",Ql="_error_5h1ft_33",R={buttonGroup:Jl,button:Xl,error:Ql},pt=(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},it=({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=j.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=j.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=j.deserializeBook(m);l(y)},[l]),u=h.useCallback(()=>{var m;(m=c.current)==null||m.click()},[]),f=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]),v=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]),g=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=j.deserializeValues((E=L.target)==null?void 0:E.result),T=pt(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=j.deserializeValues(m),w=pt(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=j.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(O,{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:f})]}),e.jsxs(O,{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:v,children:"📋 クリップボードにコピー"})]}),e.jsxs("div",{className:R.buttonGroup,children:[e.jsx("button",{type:"button",className:R.button,"data-testid":"import-values-file",onClick:g,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(O,{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})]})};it.displayName="ImportExportPanel";const Zt=({context:t,sections:n})=>{const l=[e.jsx(it,{book:t.book,values:t.values,onBookChange:t.onBookChange,onValuesChange:t.onValuesChange??(()=>{})},"import-export")],s=n??l;return e.jsx(Ze,{children:s})};Zt.displayName="OtherPanel";const ei="_container_16a0l_1",ti="_paletteItems_16a0l_11",ni="_item_16a0l_23",si="_itemName_16a0l_49",li="_itemPreview_16a0l_77",fe={container:ei,paletteItems:ti,item:ni,itemName:si,itemPreview:li},Kt=({context:t,className:n})=>{const l=Object.values(t.pluginRegistry).filter(a=>a!==void 0),s=t.book.pages[t.editorState.pageIdx],{getBlockRectPx:i}=j.useGridCalc(t.book.paper,(s==null?void 0:s.grid)??j.DEFAULT_GRID);return e.jsx("div",{className:`${fe.container} ${n||""}`,children:e.jsx("div",{className:fe.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(Yt,{plugin:a,ghostWidth:r.width,ghostHeight:r.height},a.kind)})})})};Kt.displayName="PalettePanel";const Yt=({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=>{j.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:fe.item,"data-testid":`palette-item-${t.kind}`,children:[e.jsx("button",{type:"button",draggable:!0,onDragStart:a,className:fe.itemName,"aria-label":`${t.meta.displayName}ブロックを追加`,children:t.meta.displayName}),e.jsx("div",{className:fe.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:j.NoteMode.FORM})})]})};Yt.displayName="PaletteItem";exports.ActionBarDivider=bt;exports.AddPageIcon=wt;exports.BackgroundBorderPanel=Ie;exports.BlockDefaultsPanel=Xe;exports.BlockOrderPanel=Qe;exports.BlockPropertyPanel=Ce;exports.CanvasActionPanel=et;exports.CanvasActionSection=Lt;exports.CanvasPanel=tt;exports.Checkbox=te;exports.ChevronLeftIcon=yt;exports.ChevronRightIcon=_t;exports.CollapsibleSection=O;exports.ColorPicker=Q;exports.DefaultBlockPropertyPanel=Gt;exports.DefaultCanvasPanel=Ht;exports.DeletePageIcon=Ct;exports.DimensionInput=W;exports.Dropdown=re;exports.GridSettingsSection=Tt;exports.GridSizePanel=nt;exports.IconActionButton=q;exports.ImportExportPanel=it;exports.LayoutPanel=$e;exports.MarginPanel=st;exports.MetaPanel=Je;exports.NumberInput=U;exports.OtherPanel=Zt;exports.PalettePanel=Kt;exports.PaperSettingsSection=Pt;exports.PaperSizePanel=lt;exports.PluginPanels=Le;exports.PropertyField=Ye;exports.SelectionActionBar=Vt;exports.SelectionActionBarButton=oe;exports.SelectionActionBarOverlay=Ys;exports.SelectionActionBarPanel=be;exports.TabPanel=Ze;exports.Tabs=It;exports.TabsContent=he;exports.TabsList=$t;exports.TabsTrigger=ue;exports.TextInput=xe;exports.getDefaultSelectionActionBarItems=Zs;exports.styles=M;exports.useSelectionActionBar=Ut;exports.useSelectionBounds=Js;