@pubwave/editor 0.5.2 → 0.5.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.
package/dist/index.cjs CHANGED
@@ -1,24 +1,24 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const re=require("@tiptap/core"),Fo=require("@tiptap/extension-placeholder"),Wo=require("@tiptap/extension-history"),Vo=require("@tiptap/extension-dropcursor"),Go=require("@tiptap/extension-gapcursor"),Yo=require("@tiptap/extension-document"),Ko=require("@tiptap/extension-paragraph"),Xo=require("@tiptap/extension-text"),Jo=require("@tiptap/extension-heading"),Zo=require("@tiptap/extension-bullet-list"),Qo=require("@tiptap/extension-ordered-list"),er=require("@tiptap/extension-list-item"),tr=require("@tiptap/extension-task-list"),nr=require("@tiptap/extension-task-item"),or=require("@tiptap/extension-table"),rr=require("@tiptap/extension-table-row"),ar=require("@tiptap/extension-table-header"),ir=require("@tiptap/extension-table-cell"),sr=require("@tiptap/extension-blockquote"),lr=require("@tiptap/extension-code-block"),cr=require("@tiptap/extension-horizontal-rule"),ur=require("@tiptap/extension-hard-break"),dr=require("@tiptap/extension-image"),ye=require("@tiptap/react"),i=require("react/jsx-runtime"),x=require("react"),pr=require("react-dom"),Pt=require("@tiptap/pm/state"),fr=require("@tiptap/extension-bold"),hr=require("@tiptap/extension-italic"),br=require("@tiptap/extension-underline"),vr=require("@tiptap/extension-strike"),gr=require("@tiptap/extension-code"),mr=require("@tiptap/extension-link"),xr=require("@tiptap/suggestion"),yr=[{value:"bar",label:"bar"},{value:"line",label:"line"},{value:"pie",label:"pie"},{value:"doughnut",label:"doughnut"},{value:"radar",label:"radar"},{value:"polarArea",label:"polarArea"}];function wr(e){return{backgroundColor:`rgba(59, 130, 246, ${.5+e%3*.2})`,borderColor:"rgba(59, 130, 246, 1)"}}function kr({initialData:e,onSave:t,onCancel:n,locale:o}){var B,v,L,A,_,H,z,F,U;const[r,a]=x.useState(e.type),[s,l]=x.useState(((L=(v=(B=e.options)==null?void 0:B.plugins)==null?void 0:v.title)==null?void 0:L.text)??""),[c,p]=x.useState(((H=(_=(A=e.options)==null?void 0:A.plugins)==null?void 0:_.legend)==null?void 0:H.display)??!0),[u,m]=x.useState(((U=(F=(z=e.options)==null?void 0:z.plugins)==null?void 0:F.legend)==null?void 0:U.position)??"bottom"),[h,b]=x.useState(e.data.labels),[f,g]=x.useState(e.data.datasets),T=x.useRef(null),k=(o==null?void 0:o.chart)||{modal:{title:"Edit Chart",close:"Close",save:"Save",cancel:"Cancel",fields:{chartType:"Chart Type",title:"Title",titlePlaceholder:"Chart title...",showLegend:"Show Legend",legendPosition:"Position",position:{top:"Top",bottom:"Bottom",left:"Left",right:"Right"},labels:"Labels",labelsPlaceholder:"Jan, Feb, Mar, Apr...",datasets:{title:"Datasets",add:"+ Add Dataset",remove:"Remove",datasetLabel:"Label",datasetLabelPlaceholder:"Dataset label...",data:"Data",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"Bar Chart",line:"Line Chart",pie:"Pie Chart",doughnut:"Doughnut Chart",radar:"Radar Chart",polarArea:"Polar Area Chart"}};x.useEffect(()=>{const I=N=>{N.key==="Escape"&&n()};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[n]),x.useEffect(()=>{const I=W=>{T.current&&T.current.contains(W.target)},N=setTimeout(()=>{document.addEventListener("mousedown",I)},100);return()=>{clearTimeout(N),document.removeEventListener("mousedown",I)}},[]);const M=x.useCallback((I,N)=>{g(W=>W.map((V,K)=>K===I?{...V,label:N}:V))},[]),C=x.useCallback((I,N)=>{g(W=>W.map((V,K)=>K===I?{...V,data:N.split(",").map(Q=>parseFloat(Q.trim())||0)}:V))},[]),d=x.useCallback(()=>{const I=wr(f.length);g(N=>[...N,{label:`${k.modal.fields.datasets.title} ${N.length+1}`,data:h.map(()=>Math.floor(Math.random()*100)),backgroundColor:I.backgroundColor,borderColor:I.borderColor,borderWidth:2}])},[f.length,h,k]),j=x.useCallback(I=>{g(N=>N.filter((W,V)=>V!==I))},[]),w=x.useCallback(I=>{b(I.split(",").map(N=>N.trim()).filter(Boolean))},[]),S=x.useCallback(()=>{const I={type:r,data:{labels:h,datasets:f},options:{...e.options,responsive:!0,maintainAspectRatio:!1,plugins:{title:{display:!!s,text:s,color:"var(--pubwave-text, #37352f)",font:{size:16,weight:"bold"}},legend:{display:c,position:u}}}};t(I)},[r,s,c,u,h,f,e.options,t]),P=x.useCallback(I=>{I.target===I.currentTarget&&n()},[n]),R=i.jsx("div",{className:"pubwave-modal__overlay",onClick:P,children:i.jsxs("div",{ref:T,className:"pubwave-modal__container",role:"dialog","aria-modal":"true","aria-labelledby":"chart-modal-title",children:[i.jsxs("div",{className:"pubwave-modal__header",children:[i.jsx("h2",{id:"chart-modal-title",className:"pubwave-modal__title",children:k.modal.title}),i.jsx("button",{type:"button",className:"pubwave-modal__close",onClick:n,"aria-label":k.modal.close,children:i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),i.jsxs("div",{className:"pubwave-modal__body",children:[i.jsxs("div",{className:"pubwave-form__field",children:[i.jsx("label",{htmlFor:"chart-type",className:"pubwave-form__label",children:k.modal.fields.chartType}),i.jsx("select",{id:"chart-type",className:"pubwave-form__select",value:r,onChange:I=>a(I.target.value),children:yr.map(I=>i.jsx("option",{value:I.value,children:k.chartTypes[I.value]},I.value))})]}),i.jsxs("div",{className:"pubwave-form__field",children:[i.jsx("label",{htmlFor:"chart-title",className:"pubwave-form__label",children:k.modal.fields.title}),i.jsx("input",{id:"chart-title",type:"text",className:"pubwave-form__input",value:s,onChange:I=>l(I.target.value),placeholder:k.modal.fields.titlePlaceholder})]}),i.jsxs("div",{className:"pubwave-form__row",children:[i.jsx("div",{className:"pubwave-form__field",children:i.jsxs("label",{className:"pubwave-form__checkbox-label",children:[i.jsx("input",{type:"checkbox",className:"pubwave-form__checkbox",checked:c,onChange:I=>p(I.target.checked)}),k.modal.fields.showLegend]})}),c&&i.jsxs("div",{className:"pubwave-form__field",children:[i.jsx("label",{htmlFor:"legend-position",className:"pubwave-form__label",children:k.modal.fields.legendPosition}),i.jsxs("select",{id:"legend-position",className:"pubwave-form__select",value:u,onChange:I=>m(I.target.value),children:[i.jsx("option",{value:"top",children:k.modal.fields.position.top}),i.jsx("option",{value:"bottom",children:k.modal.fields.position.bottom}),i.jsx("option",{value:"left",children:k.modal.fields.position.left}),i.jsx("option",{value:"right",children:k.modal.fields.position.right})]})]})]}),i.jsxs("div",{className:"pubwave-form__field",children:[i.jsx("label",{htmlFor:"chart-labels",className:"pubwave-form__label",children:k.modal.fields.labels}),i.jsx("input",{id:"chart-labels",type:"text",className:"pubwave-form__input",value:h.join(", "),onChange:I=>w(I.target.value),placeholder:k.modal.fields.labelsPlaceholder})]}),i.jsxs("div",{className:"pubwave-form__section",children:[i.jsxs("div",{className:"pubwave-form__section-header",children:[i.jsx("h3",{className:"pubwave-form__section-title",children:k.modal.fields.datasets.title}),i.jsx("button",{type:"button",className:"pubwave-button pubwave-button--secondary pubwave-button--small",onClick:d,children:k.modal.fields.datasets.add})]}),f.map((I,N)=>i.jsxs("div",{className:"pubwave-form__dataset",children:[i.jsxs("div",{className:"pubwave-form__dataset-header",children:[i.jsxs("span",{className:"pubwave-form__dataset-title",children:[k.modal.fields.datasets.datasetLabel," ",N+1]}),f.length>1&&i.jsx("button",{type:"button",className:"pubwave-button pubwave-button--danger pubwave-button--small",onClick:()=>j(N),"aria-label":`${k.modal.fields.datasets.remove} ${N+1}`,children:k.modal.fields.datasets.remove})]}),i.jsxs("div",{className:"pubwave-form__field",children:[i.jsx("label",{htmlFor:`dataset-label-${N}`,className:"pubwave-form__label",children:k.modal.fields.datasets.datasetLabel}),i.jsx("input",{id:`dataset-label-${N}`,type:"text",className:"pubwave-form__input",value:I.label??"",onChange:W=>M(N,W.target.value),placeholder:k.modal.fields.datasets.datasetLabelPlaceholder})]}),i.jsxs("div",{className:"pubwave-form__field",children:[i.jsx("label",{htmlFor:`dataset-data-${N}`,className:"pubwave-form__label",children:k.modal.fields.datasets.data}),i.jsx("input",{id:`dataset-data-${N}`,type:"text",className:"pubwave-form__input",value:I.data.join(", "),onChange:W=>C(N,W.target.value),placeholder:k.modal.fields.datasets.dataPlaceholder})]})]},N))]})]}),i.jsxs("div",{className:"pubwave-modal__footer",children:[i.jsx("button",{type:"button",className:"pubwave-button pubwave-button--secondary",onClick:n,children:k.modal.cancel}),i.jsx("button",{type:"button",className:"pubwave-button pubwave-button--primary",onClick:S,children:k.modal.save})]})]})});return pr.createPortal(R,document.body)}const Cr={groups:{basic:"Basic",list:"Lists",media:"Media",advanced:"Advanced",layout:"Layout"},commands:{paragraph:{title:"Text",description:"Plain text block"},heading1:{title:"Heading 1",description:"Large section heading"},heading2:{title:"Heading 2",description:"Medium section heading"},heading3:{title:"Heading 3",description:"Small section heading"},bulletList:{title:"Bullet List",description:"Create a bulleted list"},orderedList:{title:"Numbered List",description:"Create a numbered list"},taskList:{title:"To-do list",description:"Create a todo list with checkboxes"},image:{title:"Image",description:"Upload or paste an image"},blockquote:{title:"Blockquote",description:"Create a quote block"},codeBlock:{title:"Code",description:"Create a code snippet"},horizontalRule:{title:"Divider",description:"Create a horizontal line"},table:{title:"Table",description:"Insert a table"},layoutTwoColumn:{title:"Two Column Layout",description:"Split content into two side-by-side columns"},layoutThreeColumn:{title:"Three Column Layout",description:"Split content into three side-by-side columns"}}},Tr={bold:"Bold",italic:"Italic",underline:"Underline",strike:"Strikethrough",code:"Inline Code",link:"Link",turnInto:"Turn Into",colorPicker:"Text and background color",textColor:"Text color",backgroundColor:"Background color",recentlyUsed:"Recently used",openLink:"Open link",removeLink:"Remove link",confirmLink:"Confirm link",clearLink:"Clear link",blockTypes:{text:"Text",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",bulletedList:"Bulleted list",numberedList:"Numbered list"}},Lr={editor:"Rich text editor",editorContent:"Editor content area",toolbar:"Text formatting toolbar",boldButton:"Toggle bold formatting",italicButton:"Toggle italic formatting",underlineButton:"Toggle underline formatting",strikeButton:"Toggle strikethrough formatting",codeButton:"Toggle inline code formatting",linkButton:"Add or edit link",turnIntoButton:"Turn into",colorPickerButton:"Text and background color",headingButton:"Set heading level",paragraphButton:"Convert to paragraph",dragHandle:"Drag to reorder block",dropIndicator:"Drop here to move block",blockMenu:"Block options menu",addBlock:"Add new block",deleteBlock:"Delete this block",linkDialog:"Link editor dialog",linkUrlInput:"Link URL input",linkSaveButton:"Save link",linkRemoveButton:"Remove link",linkCancelButton:"Cancel link editing",addBlockBelow:"Add block below",dragToMove:"Drag to reorder block",openLinkInNewTab:"Open link in new tab",linkConfirmButton:"Confirm link",linkOpenButton:"Open link in new tab",linkClearButton:"Clear link input"},Br='Write, type "/" for commands...',Ar="Paste a link...",jr={modal:{title:"Edit Chart",close:"Close",save:"Save",cancel:"Cancel",fields:{chartType:"Chart Type",title:"Title",titlePlaceholder:"Chart title...",showLegend:"Show Legend",legendPosition:"Position",position:{top:"Top",bottom:"Bottom",left:"Left",right:"Right"},labels:"Labels (comma-separated)",labelsPlaceholder:"Jan, Feb, Mar, Apr...",datasets:{title:"Datasets",add:"+ Add Dataset",remove:"Remove",datasetLabel:"Dataset",datasetLabelPlaceholder:"Dataset label...",data:"Data (comma-separated numbers)",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"Bar Chart",line:"Line Chart",pie:"Pie Chart",doughnut:"Doughnut Chart",radar:"Radar Chart",polarArea:"Polar Area Chart"}},zn={slashMenu:Cr,toolbar:Tr,aria:Lr,placeholder:Br,linkPlaceholder:Ar,chart:jr},Sr={groups:{basic:"基礎",list:"列表",media:"媒體",advanced:"高級",layout:"版面配置"},commands:{paragraph:{title:"文本",description:"普通文本塊"},heading1:{title:"標題 1",description:"大標題"},heading2:{title:"標題 2",description:"中標題"},heading3:{title:"標題 3",description:"小標題"},bulletList:{title:"無序列表",description:"創建無序列表"},orderedList:{title:"有序列表",description:"創建有序列表"},taskList:{title:"待辦清單",description:"創建帶複選框的待辦清單"},image:{title:"圖片",description:"上傳或粘貼圖片"},blockquote:{title:"引用",description:"創建引用塊"},codeBlock:{title:"代碼",description:"創建代碼片段"},horizontalRule:{title:"分割線",description:"創建水平分割線"},table:{title:"表格",description:"插入表格"},layoutTwoColumn:{title:"兩欄版面配置",description:"將內容分成兩個並排的欄"},layoutThreeColumn:{title:"三欄版面配置",description:"將內容分成三個並排的欄"}}},Mr={bold:"粗體",italic:"斜體",underline:"下劃線",strike:"刪除線",code:"行內代碼",link:"鏈接",turnInto:"轉換為",colorPicker:"文字和背景顏色",textColor:"文字顏色",backgroundColor:"背景顏色",recentlyUsed:"最近使用",openLink:"打開鏈接",removeLink:"移除鏈接",confirmLink:"確認鏈接",clearLink:"清空鏈接",blockTypes:{text:"文本",heading1:"標題 1",heading2:"標題 2",heading3:"標題 3",bulletedList:"無序列表",numberedList:"有序列表"}},Pr={editor:"富文本編輯器",editorContent:"編輯器內容區域",toolbar:"文本格式化工具欄",boldButton:"切換粗體格式",italicButton:"切換斜體格式",underlineButton:"切換下劃線格式",strikeButton:"切換刪除線格式",codeButton:"切換行內代碼格式",linkButton:"添加或編輯鏈接",turnIntoButton:"轉換為",colorPickerButton:"文字和背景顏色",headingButton:"設置標題級別",paragraphButton:"轉換為段落",dragHandle:"拖拽以重新排序塊",dropIndicator:"放置此處以移動塊",blockMenu:"塊選項菜單",addBlock:"添加新塊",deleteBlock:"刪除此塊",linkDialog:"鏈接編輯對話框",linkUrlInput:"鏈接 URL 輸入",linkSaveButton:"保存鏈接",linkRemoveButton:"移除鏈接",linkCancelButton:"取消鏈接編輯",addBlockBelow:"在下方添加塊",dragToMove:"拖拽以重新排序塊",openLinkInNewTab:"在新標籤頁中打開鏈接",linkConfirmButton:"確認鏈接",linkOpenButton:"在新標籤頁中打開鏈接",linkClearButton:"清空鏈接輸入"},Dr='開始寫作,輸入 "/" 顯示命令...',Ir="粘貼鏈接...",Rr={modal:{title:"編輯圖表",close:"關閉",save:"保存",cancel:"取消",fields:{chartType:"圖表類型",title:"標題",titlePlaceholder:"圖表標題...",showLegend:"顯示圖例",legendPosition:"位置",position:{top:"頂部",bottom:"底部",left:"左側",right:"右側"},labels:"標籤(逗號分隔)",labelsPlaceholder:"一月, 二月, 三月, 四月...",datasets:{title:"數據集",add:"+ 添加數據集",remove:"移除",datasetLabel:"標籤",datasetLabelPlaceholder:"數據集標籤...",data:"數據(逗號分隔的數字)",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"柱狀圖",line:"折線圖",pie:"餅圖",doughnut:"環形圖",radar:"雷達圖",polarArea:"極地圖"}},Or={slashMenu:Sr,toolbar:Mr,aria:Pr,placeholder:Dr,linkPlaceholder:Ir,chart:Rr},Er={groups:{basic:"基础",list:"列表",media:"媒体",advanced:"高级",layout:"版面布局"},commands:{paragraph:{title:"文本",description:"普通文本块"},heading1:{title:"标题 1",description:"大标题"},heading2:{title:"标题 2",description:"中标题"},heading3:{title:"标题 3",description:"小标题"},bulletList:{title:"无序列表",description:"创建无序列表"},orderedList:{title:"有序列表",description:"创建有序列表"},taskList:{title:"待办清单",description:"创建带复选框的待办清单"},image:{title:"图片",description:"上传或粘贴图片"},blockquote:{title:"引用",description:"创建引用块"},codeBlock:{title:"代码",description:"创建代码片段"},horizontalRule:{title:"分割线",description:"创建水平分割线"},table:{title:"表格",description:"插入表格"},layoutTwoColumn:{title:"两栏布局",description:"将内容分成两个并排的栏"},layoutThreeColumn:{title:"三栏布局",description:"将内容分成三个并排的栏"}}},_r={bold:"粗体",italic:"斜体",underline:"下划线",strike:"删除线",code:"行内代码",link:"链接",turnInto:"转换为",colorPicker:"文字和背景颜色",textColor:"文字颜色",backgroundColor:"背景颜色",recentlyUsed:"最近使用",openLink:"打开链接",removeLink:"移除链接",confirmLink:"确认链接",clearLink:"清空链接",blockTypes:{text:"文本",heading1:"标题 1",heading2:"标题 2",heading3:"标题 3",bulletedList:"无序列表",numberedList:"有序列表"}},Nr={editor:"富文本编辑器",editorContent:"编辑器内容区域",toolbar:"文本格式化工具栏",boldButton:"切换粗体格式",italicButton:"切换斜体格式",underlineButton:"切换下划线格式",strikeButton:"切换删除线格式",codeButton:"切换行内代码格式",linkButton:"添加或编辑链接",turnIntoButton:"转换为",colorPickerButton:"文字和背景颜色",headingButton:"设置标题级别",paragraphButton:"转换为段落",dragHandle:"拖拽以重新排序块",dropIndicator:"放置此处以移动块",blockMenu:"块选项菜单",addBlock:"添加新块",deleteBlock:"删除此块",linkDialog:"链接编辑对话框",linkUrlInput:"链接 URL 输入",linkSaveButton:"保存链接",linkRemoveButton:"移除链接",linkCancelButton:"取消链接编辑",addBlockBelow:"在下方添加块",dragToMove:"拖拽以重新排序块",openLinkInNewTab:"在新标签页中打开链接",linkConfirmButton:"确认链接",linkOpenButton:"在新标签页中打开链接",linkClearButton:"清空链接输入"},Hr='开始写作,输入 "/" 显示命令...',$r="粘贴链接...",zr={modal:{title:"编辑图表",close:"关闭",save:"保存",cancel:"取消",fields:{chartType:"图表类型",title:"标题",titlePlaceholder:"图表标题...",showLegend:"显示图例",legendPosition:"位置",position:{top:"顶部",bottom:"底部",left:"左侧",right:"右侧"},labels:"标签(逗号分隔)",labelsPlaceholder:"一月, 二月, 三月, 四月...",datasets:{title:"数据集",add:"+ 添加数据集",remove:"移除",datasetLabel:"标签",datasetLabelPlaceholder:"数据集标签...",data:"数据(逗号分隔的数字)",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"柱状图",line:"折线图",pie:"饼图",doughnut:"环形图",radar:"雷达图",polarArea:"极地图"}},qr={slashMenu:Er,toolbar:_r,aria:Nr,placeholder:Hr,linkPlaceholder:$r,chart:zr},Ur={groups:{basic:"基本",list:"リスト",media:"メディア",advanced:"高度",layout:"レイアウト"},commands:{paragraph:{title:"テキスト",description:"プレーンテキストブロック"},heading1:{title:"見出し1",description:"大きなセクション見出し"},heading2:{title:"見出し2",description:"中サイズのセクション見出し"},heading3:{title:"見出し3",description:"小さなセクション見出し"},bulletList:{title:"箇条書きリスト",description:"箇条書きリストを作成"},orderedList:{title:"番号付きリスト",description:"番号付きリストを作成"},taskList:{title:"To-doリスト",description:"チェックボックス付きのTo-doリストを作成"},image:{title:"画像",description:"画像をアップロードまたは貼り付け"},blockquote:{title:"引用",description:"引用ブロックを作成"},codeBlock:{title:"コード",description:"コードスニペットを作成"},horizontalRule:{title:"区切り線",description:"水平線を作成"},table:{title:"テーブル",description:"テーブルを挿入"},layoutTwoColumn:{title:"2カラムレイアウト",description:"コンテンツを2つの横並びカラムに分割"},layoutThreeColumn:{title:"3カラムレイアウト",description:"コンテンツを3つの横並びカラムに分割"}}},Fr={bold:"太字",italic:"斜体",underline:"下線",strike:"取り消し線",code:"インラインコード",link:"リンク",turnInto:"変換",colorPicker:"テキストと背景色",textColor:"文字色",backgroundColor:"背景色",recentlyUsed:"最近使用",openLink:"リンクを開く",removeLink:"リンクを削除",confirmLink:"リンクを確認",clearLink:"リンクをクリア",blockTypes:{text:"テキスト",heading1:"見出し1",heading2:"見出し2",heading3:"見出し3",bulletedList:"箇条書きリスト",numberedList:"番号付きリスト"}},Wr={editor:"リッチテキストエディタ",editorContent:"エディタコンテンツ領域",toolbar:"テキスト書式設定ツールバー",boldButton:"太字書式を切り替え",italicButton:"斜体書式を切り替え",underlineButton:"下線書式を切り替え",strikeButton:"取り消し線書式を切り替え",codeButton:"インラインコード書式を切り替え",linkButton:"リンクを追加または編集",turnIntoButton:"変換",colorPickerButton:"テキストと背景色",headingButton:"見出しレベルを設定",paragraphButton:"段落に変換",dragHandle:"ブロックを並び替えるためにドラッグ",dropIndicator:"ブロックを移動するためにここにドロップ",blockMenu:"ブロックオプションメニュー",addBlock:"新しいブロックを追加",deleteBlock:"このブロックを削除",linkDialog:"リンク編集ダイアログ",linkUrlInput:"リンクURL入力",linkSaveButton:"リンクを保存",linkRemoveButton:"リンクを削除",linkCancelButton:"リンク編集をキャンセル",addBlockBelow:"下にブロックを追加",dragToMove:"ブロックを並び替えるためにドラッグ",openLinkInNewTab:"新しいタブでリンクを開く",linkConfirmButton:"リンクを確認",linkOpenButton:"新しいタブでリンクを開く",linkClearButton:"リンク入力をクリア"},Vr='書き始めましょう、コマンドを表示するには "/" を入力...',Gr="リンクを貼り付け...",Yr={modal:{title:"チャート編集",close:"閉じる",save:"保存",cancel:"キャンセル",fields:{chartType:"チャートタイプ",title:"タイトル",titlePlaceholder:"チャートタイトル...",showLegend:"凡例を表示",legendPosition:"位置",position:{top:"上",bottom:"下",left:"左",right:"右"},labels:"ラベル(カンマ区切り)",labelsPlaceholder:"1月, 2月, 3月, 4月...",datasets:{title:"データセット",add:"+ データセットを追加",remove:"削除",datasetLabel:"ラベル",datasetLabelPlaceholder:"データセットラベル...",data:"データ(カンマ区切りの数値)",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"棒グラフ",line:"折れ線グラフ",pie:"円グラフ",doughnut:"ドーナツグラフ",radar:"レーダーチャート",polarArea:"極座標グラフ"}},Kr={slashMenu:Ur,toolbar:Fr,aria:Wr,placeholder:Vr,linkPlaceholder:Gr,chart:Yr},Xr={groups:{basic:"기본",list:"목록",media:"미디어",advanced:"고급",layout:"레이아웃"},commands:{paragraph:{title:"텍스트",description:"일반 텍스트 블록"},heading1:{title:"제목 1",description:"큰 섹션 제목"},heading2:{title:"제목 2",description:"중간 섹션 제목"},heading3:{title:"제목 3",description:"작은 섹션 제목"},bulletList:{title:"글머리 기호 목록",description:"글머리 기호 목록 만들기"},orderedList:{title:"번호 매기기 목록",description:"번호 매기기 목록 만들기"},taskList:{title:"할 일 목록",description:"확인란 있는 할 일 목록 만들기"},image:{title:"이미지",description:"이미지 업로드 또는 붙여넣기"},blockquote:{title:"인용",description:"인용 블록 만들기"},codeBlock:{title:"코드",description:"코드 스니펫 만들기"},horizontalRule:{title:"구분선",description:"수평선 만들기"},table:{title:"표",description:"표를 삽입"},layoutTwoColumn:{title:"2열 레이아웃",description:"콘텐츠를 두 개의 나란히 있는 열로 분할"},layoutThreeColumn:{title:"3열 레이아웃",description:"콘텐츠를 세 개의 나란히 있는 열로 분할"}}},Jr={bold:"굵게",italic:"기울임",underline:"밑줄",strike:"취소선",code:"인라인 코드",link:"링크",turnInto:"변환",colorPicker:"텍스트 및 배경색",textColor:"텍스트 색상",backgroundColor:"배경 색상",recentlyUsed:"최근 사용",openLink:"링크 열기",removeLink:"링크 제거",confirmLink:"링크 확인",clearLink:"링크 지우기",blockTypes:{text:"텍스트",heading1:"제목 1",heading2:"제목 2",heading3:"제목 3",bulletedList:"글머리 기호 목록",numberedList:"번호 매기기 목록"}},Zr={editor:"리치 텍스트 에디터",editorContent:"에디터 내용 영역",toolbar:"텍스트 서식 도구 모음",boldButton:"굵게 서식 전환",italicButton:"기울임 서식 전환",underlineButton:"밑줄 서식 전환",strikeButton:"취소선 서식 전환",codeButton:"인라인 코드 서식 전환",linkButton:"링크 추가 또는 편집",turnIntoButton:"변환",colorPickerButton:"텍스트 및 배경색",headingButton:"제목 수준 설정",paragraphButton:"단락으로 변환",dragHandle:"블록 재정렬을 위해 드래그",dropIndicator:"블록 이동을 위해 여기에 놓기",blockMenu:"블록 옵션 메뉴",addBlock:"새 블록 추가",deleteBlock:"이 블록 삭제",linkDialog:"링크 편집 대화 상자",linkUrlInput:"링크 URL 입력",linkSaveButton:"링크 저장",linkRemoveButton:"링크 제거",linkCancelButton:"링크 편집 취소",addBlockBelow:"아래에 블록 추가",dragToMove:"블록 재정렬을 위해 드래그",openLinkInNewTab:"새 탭에서 링크 열기",linkConfirmButton:"링크 확인",linkOpenButton:"새 탭에서 링크 열기",linkClearButton:"링크 입력 지우기"},Qr='작성 시작, 명령을 표시하려면 "/" 입력...',ea="링크 붙여넣기...",ta={modal:{title:"차트 편집",close:"닫기",save:"저장",cancel:"취소",fields:{chartType:"차트 유형",title:"제목",titlePlaceholder:"차트 제목...",showLegend:"범례 표시",legendPosition:"위치",position:{top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"},labels:"레이블(쉼표로 구분)",labelsPlaceholder:"1월, 2월, 3월, 4월...",datasets:{title:"데이터 세트",add:"+ 데이터 세트 추가",remove:"제거",datasetLabel:"레이블",datasetLabelPlaceholder:"데이터 세트 레이블...",data:"데이터(쉼표로 구분된 숫자)",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"막대형 차트",line:"선형 차트",pie:"원형 차트",doughnut:"도넛형 차트",radar:"레이더 차트",polarArea:"극좌표형 차트"}},na={slashMenu:Xr,toolbar:Jr,aria:Zr,placeholder:Qr,linkPlaceholder:ea,chart:ta},oa={groups:{basic:"De base",list:"Listes",media:"Médias",advanced:"Avancé",layout:"Mise en page"},commands:{paragraph:{title:"Texte",description:"Bloc de texte simple"},heading1:{title:"Titre 1",description:"Grand titre de section"},heading2:{title:"Titre 2",description:"Titre de section moyen"},heading3:{title:"Titre 3",description:"Petit titre de section"},bulletList:{title:"Liste à puces",description:"Créer une liste à puces"},orderedList:{title:"Liste numérotée",description:"Créer une liste numérotée"},taskList:{title:"Liste de tâches",description:"Créer une liste de tâches avec cases à cocher"},image:{title:"Image",description:"Télécharger ou coller une image"},blockquote:{title:"Citation",description:"Créer un bloc de citation"},codeBlock:{title:"Code",description:"Créer un extrait de code"},horizontalRule:{title:"Séparateur",description:"Créer une ligne horizontale"},table:{title:"Tableau",description:"Insérer un tableau"},layoutTwoColumn:{title:"Mise en page à deux colonnes",description:"Diviser le contenu en deux colonnes côte à côte"},layoutThreeColumn:{title:"Mise en page à trois colonnes",description:"Diviser le contenu en trois colonnes côte à côte"}}},ra={bold:"Gras",italic:"Italique",underline:"Souligné",strike:"Barré",code:"Code en ligne",link:"Lien",turnInto:"Convertir en",colorPicker:"Couleur du texte et du fond",textColor:"Couleur du texte",backgroundColor:"Couleur de fond",recentlyUsed:"Récemment utilisés",openLink:"Ouvrir le lien",removeLink:"Supprimer le lien",confirmLink:"Confirmer le lien",clearLink:"Effacer le lien",blockTypes:{text:"Texte",heading1:"Titre 1",heading2:"Titre 2",heading3:"Titre 3",bulletedList:"Liste à puces",numberedList:"Liste numérotée"}},aa={editor:"Éditeur de texte riche",editorContent:"Zone de contenu de l'éditeur",toolbar:"Barre d'outils de formatage de texte",boldButton:"Activer/désactiver le formatage en gras",italicButton:"Activer/désactiver le formatage en italique",underlineButton:"Activer/désactiver le soulignement",strikeButton:"Activer/désactiver le texte barré",codeButton:"Activer/désactiver le code en ligne",linkButton:"Ajouter ou modifier un lien",turnIntoButton:"Convertir en",colorPickerButton:"Couleur du texte et du fond",headingButton:"Définir le niveau de titre",paragraphButton:"Convertir en paragraphe",dragHandle:"Glisser pour réorganiser le bloc",dropIndicator:"Déposer ici pour déplacer le bloc",blockMenu:"Menu des options de bloc",addBlock:"Ajouter un nouveau bloc",deleteBlock:"Supprimer ce bloc",linkDialog:"Boîte de dialogue d'édition de lien",linkUrlInput:"Entrée d'URL de lien",linkSaveButton:"Enregistrer le lien",linkRemoveButton:"Supprimer le lien",linkCancelButton:"Annuler l'édition du lien",addBlockBelow:"Ajouter un bloc en dessous",dragToMove:"Glisser pour réorganiser le bloc",openLinkInNewTab:"Ouvrir le lien dans un nouvel onglet",linkConfirmButton:"Confirmer le lien",linkOpenButton:"Ouvrir le lien dans un nouvel onglet",linkClearButton:"Effacer la saisie du lien"},ia='Écrivez, tapez "/" pour afficher les commandes...',sa="Collez un lien...",la={modal:{title:"Modifier le graphique",close:"Fermer",save:"Enregistrer",cancel:"Annuler",fields:{chartType:"Type de graphique",title:"Titre",titlePlaceholder:"Titre du graphique...",showLegend:"Afficher la légende",legendPosition:"Position",position:{top:"Haut",bottom:"Bas",left:"Gauche",right:"Droite"},labels:"Étiquettes (séparées par des virgules)",labelsPlaceholder:"Jan, Fév, Mar, Avr...",datasets:{title:"Jeux de données",add:"+ Ajouter un jeu de données",remove:"Supprimer",datasetLabel:"Étiquette",datasetLabelPlaceholder:"Étiquette du jeu de données...",data:"Données (nombres séparés par des virgules)",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"Graphique à barres",line:"Graphique linéaire",pie:"Graphique circulaire",doughnut:"Graphique en anneau",radar:"Graphique radar",polarArea:"Graphique en coordonnées polaires"}},ca={slashMenu:oa,toolbar:ra,aria:aa,placeholder:ia,linkPlaceholder:sa,chart:la},ua={groups:{basic:"Basis",list:"Listen",media:"Medien",advanced:"Erweitert",layout:"Layout"},commands:{paragraph:{title:"Text",description:"Einfacher Textblock"},heading1:{title:"Überschrift 1",description:"Große Abschnittsüberschrift"},heading2:{title:"Überschrift 2",description:"Mittlere Abschnittsüberschrift"},heading3:{title:"Überschrift 3",description:"Kleine Abschnittsüberschrift"},bulletList:{title:"Aufzählungsliste",description:"Aufzählungsliste erstellen"},orderedList:{title:"Nummerierte Liste",description:"Nummerierte Liste erstellen"},taskList:{title:"To-do-Liste",description:"To-do-Liste mit Kontrollkästchen erstellen"},image:{title:"Bild",description:"Bild hochladen oder einfügen"},blockquote:{title:"Zitat",description:"Zitatblock erstellen"},codeBlock:{title:"Code",description:"Codeausschnitt erstellen"},horizontalRule:{title:"Trennlinie",description:"Horizontale Linie erstellen"},table:{title:"Tabelle",description:"Eine Tabelle einfügen"},layoutTwoColumn:{title:"Zweispaltiges Layout",description:"Inhalt in zwei nebeneinander liegende Spalten aufteilen"},layoutThreeColumn:{title:"Dreispaltiges Layout",description:"Inhalt in drei nebeneinander liegende Spalten aufteilen"}}},da={bold:"Fett",italic:"Kursiv",underline:"Unterstrichen",strike:"Durchgestrichen",code:"Inline-Code",link:"Link",turnInto:"Umwandeln in",colorPicker:"Text- und Hintergrundfarbe",textColor:"Textfarbe",backgroundColor:"Hintergrundfarbe",recentlyUsed:"Zuletzt verwendet",openLink:"Link öffnen",removeLink:"Link entfernen",confirmLink:"Link bestätigen",clearLink:"Link löschen",blockTypes:{text:"Text",heading1:"Überschrift 1",heading2:"Überschrift 2",heading3:"Überschrift 3",bulletedList:"Aufzählungsliste",numberedList:"Nummerierte Liste"}},pa={editor:"Rich-Text-Editor",editorContent:"Editor-Inhaltsbereich",toolbar:"Textformatierungs-Symbolleiste",boldButton:"Fettformatierung ein/aus",italicButton:"Kursivformatierung ein/aus",underlineButton:"Unterstreichung ein/aus",strikeButton:"Durchstreichung ein/aus",codeButton:"Inline-Code-Formatierung ein/aus",linkButton:"Link hinzufügen oder bearbeiten",turnIntoButton:"Umwandeln in",colorPickerButton:"Text- und Hintergrundfarbe",headingButton:"Überschriftsebene festlegen",paragraphButton:"In Absatz umwandeln",dragHandle:"Zum Neuordnen des Blocks ziehen",dropIndicator:"Hier ablegen, um Block zu verschieben",blockMenu:"Block-Optionsmenü",addBlock:"Neuen Block hinzufügen",deleteBlock:"Diesen Block löschen",linkDialog:"Link-Bearbeitungsdialog",linkUrlInput:"Link-URL-Eingabe",linkSaveButton:"Link speichern",linkRemoveButton:"Link entfernen",linkCancelButton:"Link-Bearbeitung abbrechen",addBlockBelow:"Block darunter hinzufügen",dragToMove:"Zum Neuordnen des Blocks ziehen",openLinkInNewTab:"Link in neuem Tab öffnen",linkConfirmButton:"Link bestätigen",linkOpenButton:"Link in neuem Tab öffnen",linkClearButton:"Link-Eingabe löschen"},fa='Schreiben, tippen Sie "/" für Befehle...',ha="Link einfügen...",ba={modal:{title:"Chart bearbeiten",close:"Schließen",save:"Speichern",cancel:"Abbrechen",fields:{chartType:"Chart-Typ",title:"Titel",titlePlaceholder:"Chart-Titel...",showLegend:"Legende anzeigen",legendPosition:"Position",position:{top:"Oben",bottom:"Unten",left:"Links",right:"Rechts"},labels:"Beschriftungen (kommagetrennt)",labelsPlaceholder:"Jan, Feb, Mär, Apr...",datasets:{title:"Datensätze",add:"+ Datensatz hinzufügen",remove:"Entfernen",datasetLabel:"Datensatz",datasetLabelPlaceholder:"Datensatz-Beschriftung...",data:"Daten (kommagetrennte Zahlen)",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"Balkendiagramm",line:"Liniendiagramm",pie:"Kreisdiagramm",doughnut:"Ringdiagramm",radar:"Netzdiagramm",polarArea:"Polärfächen-Diagramm"}},va={slashMenu:ua,toolbar:da,aria:pa,placeholder:fa,linkPlaceholder:ha,chart:ba},ga={groups:{basic:"Básico",list:"Listas",media:"Medios",advanced:"Avanzado",layout:"Diseño"},commands:{paragraph:{title:"Texto",description:"Bloque de texto plano"},heading1:{title:"Título 1",description:"Título de sección grande"},heading2:{title:"Título 2",description:"Título de sección mediano"},heading3:{title:"Título 3",description:"Título de sección pequeño"},bulletList:{title:"Lista con viñetas",description:"Crear una lista con viñetas"},orderedList:{title:"Lista numerada",description:"Crear una lista numerada"},taskList:{title:"Lista de tareas",description:"Crear una lista de tareas con casillas"},image:{title:"Imagen",description:"Subir o pegar una imagen"},blockquote:{title:"Cita",description:"Crear un bloque de cita"},codeBlock:{title:"Código",description:"Crear un fragmento de código"},horizontalRule:{title:"Divisor",description:"Crear una línea horizontal"},table:{title:"Tabla",description:"Insertar una tabla"},layoutTwoColumn:{title:"Diseño de dos columnas",description:"Dividir el contenido en dos columnas una al lado de la otra"},layoutThreeColumn:{title:"Diseño de tres columnas",description:"Dividir el contenido en tres columnas una al lado de la otra"}}},ma={bold:"Negrita",italic:"Cursiva",underline:"Subrayado",strike:"Tachado",code:"Código en línea",link:"Enlace",turnInto:"Convertir en",colorPicker:"Color de texto y fondo",textColor:"Color del texto",backgroundColor:"Color de fondo",recentlyUsed:"Recientemente usados",openLink:"Abrir enlace",removeLink:"Eliminar enlace",confirmLink:"Confirmar enlace",clearLink:"Limpiar enlace",blockTypes:{text:"Texto",heading1:"Título 1",heading2:"Título 2",heading3:"Título 3",bulletedList:"Lista con viñetas",numberedList:"Lista numerada"}},xa={editor:"Editor de texto enriquecido",editorContent:"Área de contenido del editor",toolbar:"Barra de herramientas de formato de texto",boldButton:"Activar/desactivar formato en negrita",italicButton:"Activar/desactivar formato en cursiva",underlineButton:"Activar/desactivar subrayado",strikeButton:"Activar/desactivar tachado",codeButton:"Activar/desactivar código en línea",linkButton:"Añadir o editar enlace",turnIntoButton:"Convertir en",colorPickerButton:"Color de texto y fondo",headingButton:"Establecer nivel de título",paragraphButton:"Convertir a párrafo",dragHandle:"Arrastrar para reorganizar el bloque",dropIndicator:"Soltar aquí para mover el bloque",blockMenu:"Menú de opciones del bloque",addBlock:"Añadir nuevo bloque",deleteBlock:"Eliminar este bloque",linkDialog:"Diálogo de edición de enlace",linkUrlInput:"Entrada de URL del enlace",linkSaveButton:"Guardar enlace",linkRemoveButton:"Eliminar enlace",linkCancelButton:"Cancelar edición de enlace",addBlockBelow:"Añadir bloque debajo",dragToMove:"Arrastrar para reorganizar el bloque",openLinkInNewTab:"Abrir enlace en nueva pestaña",linkConfirmButton:"Confirmar enlace",linkOpenButton:"Abrir enlace en nueva pestaña",linkClearButton:"Limpiar entrada de enlace"},ya='Escribe, escribe "/" para comandos...',wa="Pegue un enlace...",ka={modal:{title:"Editar gráfico",close:"Cerrar",save:"Guardar",cancel:"Cancelar",fields:{chartType:"Tipo de gráfico",title:"Título",titlePlaceholder:"Título del gráfico...",showLegend:"Mostrar leyenda",legendPosition:"Posición",position:{top:"Arriba",bottom:"Abajo",left:"Izquierda",right:"Derecha"},labels:"Etiquetas (separadas por comas)",labelsPlaceholder:"Ene, Feb, Mar, Abr...",datasets:{title:"Conjuntos de datos",add:"+ Añadir conjunto de datos",remove:"Eliminar",datasetLabel:"Etiqueta",datasetLabelPlaceholder:"Etiqueta del conjunto de datos...",data:"Datos (números separados por comas)",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"Gráfico de barras",line:"Gráfico de líneas",pie:"Gráfico circular",doughnut:"Gráfico de anillo",radar:"Gráfico radar",polarArea:"Gráfico de área polar"}},Ca={slashMenu:ga,toolbar:ma,aria:xa,placeholder:ya,linkPlaceholder:wa,chart:ka},Ta={groups:{basic:"Básico",list:"Listas",media:"Mídia",advanced:"Avançado",layout:"Layout"},commands:{paragraph:{title:"Texto",description:"Bloco de texto simples"},heading1:{title:"Título 1",description:"Título de seção grande"},heading2:{title:"Título 2",description:"Título de seção médio"},heading3:{title:"Título 3",description:"Título de seção pequeno"},bulletList:{title:"Lista com marcadores",description:"Criar uma lista com marcadores"},orderedList:{title:"Lista numerada",description:"Criar uma lista numerada"},taskList:{title:"Lista de tarefas",description:"Criar uma lista de tarefas com caixas de seleção"},image:{title:"Imagem",description:"Enviar ou colar uma imagem"},blockquote:{title:"Citação",description:"Criar um bloco de citação"},codeBlock:{title:"Código",description:"Criar um trecho de código"},horizontalRule:{title:"Divisor",description:"Criar uma linha horizontal"},table:{title:"Tabela",description:"Inserir uma tabela"},layoutTwoColumn:{title:"Layout de duas colunas",description:"Dividir o conteúdo em duas colunas lado a lado"},layoutThreeColumn:{title:"Layout de três colunas",description:"Dividir o conteúdo em três colunas lado a lado"}}},La={bold:"Negrito",italic:"Itálico",underline:"Sublinhado",strike:"Tachado",code:"Código inline",link:"Link",turnInto:"Converter em",colorPicker:"Cor do texto e fundo",textColor:"Cor do texto",backgroundColor:"Cor de fundo",recentlyUsed:"Usados recentemente",openLink:"Abrir link",removeLink:"Remover link",confirmLink:"Confirmar link",clearLink:"Limpar link",blockTypes:{text:"Texto",heading1:"Título 1",heading2:"Título 2",heading3:"Título 3",bulletedList:"Lista com marcadores",numberedList:"Lista numerada"}},Ba={editor:"Editor de texto rico",editorContent:"Área de conteúdo do editor",toolbar:"Barra de ferramentas de formatação de texto",boldButton:"Alternar formatação em negrito",italicButton:"Alternar formatação em itálico",underlineButton:"Alternar sublinhado",strikeButton:"Alternar tachado",codeButton:"Alternar código inline",linkButton:"Adicionar ou editar link",turnIntoButton:"Converter em",colorPickerButton:"Cor do texto e fundo",headingButton:"Definir nível de título",paragraphButton:"Converter em parágrafo",dragHandle:"Arrastar para reorganizar o bloco",dropIndicator:"Soltar aqui para mover o bloco",blockMenu:"Menu de opções do bloco",addBlock:"Adicionar novo bloco",deleteBlock:"Excluir este bloco",linkDialog:"Diálogo de edição de link",linkUrlInput:"Entrada de URL do link",linkSaveButton:"Salvar link",linkRemoveButton:"Remover link",linkCancelButton:"Cancelar edição de link",addBlockBelow:"Adicionar bloco abaixo",dragToMove:"Arrastar para reorganizar o bloco",openLinkInNewTab:"Abrir link em nova aba",linkConfirmButton:"Confirmar link",linkOpenButton:"Abrir link em nova aba",linkClearButton:"Limpar entrada de link"},Aa='Escreva, digite "/" para comandos...',ja="Cole um link...",Sa={modal:{title:"Editar gráfico",close:"Fechar",save:"Salvar",cancel:"Cancelar",fields:{chartType:"Tipo de gráfico",title:"Título",titlePlaceholder:"Título do gráfico...",showLegend:"Mostrar legenda",legendPosition:"Posição",position:{top:"Superior",bottom:"Inferior",left:"Esquerda",right:"Direita"},labels:"Rótulos (separados por vírgula)",labelsPlaceholder:"Jan, Fev, Mar, Abr...",datasets:{title:"Conjuntos de dados",add:"+ Adicionar conjunto de dados",remove:"Remover",datasetLabel:"Rótulo",datasetLabelPlaceholder:"Rótulo do conjunto de dados...",data:"Dados (números separados por vírgula)",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"Gráfico de barras",line:"Gráfico de linhas",pie:"Gráfico de pizza",doughnut:"Gráfico de rosca",radar:"Gráfico de radar",polarArea:"Gráfico de área polar"}},Ma={slashMenu:Ta,toolbar:La,aria:Ba,placeholder:Aa,linkPlaceholder:ja,chart:Sa},Wt=zn,Pa={en:zn,zh:Or,"zh-CN":qr,ja:Kr,ko:na,fr:ca,de:va,es:Ca,pt:Ma};function At(e){return e&&Pa[e]||Wt}const qn=x.createContext({locale:Wt}),pn=qn.Provider;function Oe(){return x.useContext(qn).locale}const Da=async()=>Promise.resolve().then(()=>require("./auto-BaSO-_S9.cjs"));function $e(e,t,n){const o=getComputedStyle(e),r=t.replace(/^var\(/,"").replace(/\)$/,"");return o.getPropertyValue(r).trim()||n}function Ia(e){var S;const{node:t,updateAttributes:n,editor:o,selected:r}=e,a=t.attrs.data,[s,l]=x.useState(!1),[c,p]=x.useState(!1),[u,m]=x.useState(null),h=x.useRef(null),b=x.useRef(null),f=x.useRef(null),g=Oe(),T=((S=o==null?void 0:o.options)==null?void 0:S.editable)??!0,k=T?r:!1,M=x.useCallback(()=>{if(!u||!f.current||!b.current)return;const P=b.current,R=$e(P,"--pubwave-text","#37352f"),B=$e(P,"--pubwave-text-muted","#9b9a97"),v=$e(P,"--pubwave-border","#e3e2e0"),L=u.options.plugins||{},A=u.options.scales;if(L.legend){const _=L.legend;_.labels?_.labels.color=R:L.legend.labels={color:R},_.onHover=()=>{const H=h.current;H&&(H.style.cursor="pointer")},_.onLeave=()=>{const H=h.current;H&&(H.style.cursor="default")}}L.title&&(L.title.color=R),A&&(A.x&&(A.x.ticks&&(A.x.ticks.color=B),A.x.grid&&(A.x.grid.color=v)),A.y&&(A.y.ticks&&(A.y.ticks.color=B),A.y.grid&&(A.y.grid.color=v))),u.update("none")},[u]);x.useEffect(()=>!h.current||!a?void 0:((async()=>{var R,B,v,L,A,_,H,z,F,U,I,N,W;try{const K=(await Da()).default;if(f.current=K,h.current){const X=K.getChart(h.current);X&&X.destroy()}u&&u.destroy();const Q=(R=h.current)==null?void 0:R.getContext("2d");if(!Q){console.warn("Failed to get 2D context for chart");return}const G=b.current,ne=G?$e(G,"--pubwave-text","#37352f"):"#37352f",ve=G?$e(G,"--pubwave-text-muted","#9b9a97"):"#9b9a97",ie=G?$e(G,"--pubwave-border","#e3e2e0"):"#e3e2e0",ke={...a.options,responsive:!0,maintainAspectRatio:!1,plugins:{...(B=a.options)==null?void 0:B.plugins,legend:{display:((A=(L=(v=a.options)==null?void 0:v.plugins)==null?void 0:L.legend)==null?void 0:A.display)??!0,position:((z=(H=(_=a.options)==null?void 0:_.plugins)==null?void 0:H.legend)==null?void 0:z.position)??"top",...(I=(U=(F=a.options)==null?void 0:F.plugins)==null?void 0:U.legend)!=null&&I.labels?{labels:{...a.options.plugins.legend.labels,color:ne}}:{labels:{color:ne}},onHover:()=>{const X=h.current;X&&(X.style.cursor="pointer")},onLeave:()=>{const X=h.current;X&&(X.style.cursor="default")}},title:(W=(N=a.options)==null?void 0:N.plugins)!=null&&W.title?{...a.options.plugins.title,color:ne,...a.options.plugins.title.font?{font:{...a.options.plugins.title.font}}:{}}:void 0},scales:C(a.type)?{x:{ticks:{color:ve},grid:{color:ie}},y:{ticks:{color:ve},grid:{color:ie}}}:void 0},de=new K(Q,{type:a.type,data:a.data,options:ke});m(de)}catch(V){console.error("Failed to load Chart.js:",V)}})(),()=>{u&&u.destroy()}),[a,T]),x.useEffect(()=>{if(!u||!b.current)return;const P=()=>{setTimeout(()=>{M()},0)},R=new MutationObserver(v=>{v.forEach(L=>{(L.attributeName==="style"||L.attributeName==="class")&&P()})});let B=b.current;for(;B&&(R.observe(B,{attributes:!0}),!(B.classList.contains("pubwave-editor")||B===document.body));)B=B.parentElement;return R.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>{R.disconnect()}},[u,M]);function C(P){return["bar","line","radar"].includes(P)}const d=x.useCallback(P=>{n({data:P}),l(!1)},[n]),j=x.useCallback(()=>{l(!1)},[]),w=x.useCallback(()=>{l(!0)},[]);return a?i.jsxs(ye.NodeViewWrapper,{ref:b,className:"pubwave-editor__chart","data-selected":k,"data-chart-type":a.type,children:[i.jsxs("div",{className:"pubwave-chart__container",onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:[i.jsx("div",{className:"pubwave-chart__canvas-wrapper",children:i.jsx("canvas",{ref:h,className:"pubwave-chart__canvas"})}),T&&(c||k)&&i.jsx("button",{type:"button",className:"pubwave-chart__edit-button",onClick:w,"aria-label":"Edit chart",title:"Edit chart",children:i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),i.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})})]}),s&&a&&i.jsx(kr,{initialData:a,onSave:d,onCancel:j,locale:g})]}):i.jsx(ye.NodeViewWrapper,{className:"pubwave-editor__chart",children:i.jsx("div",{className:"pubwave-chart__placeholder",children:"Invalid chart data"})})}const Ra=re.Node.create({name:"chart",priority:1e3,group:"block",atom:!0,draggable:!0,addAttributes(){return{data:{default:null,parseHTML:e=>{const t=e.getAttribute("data-chart-data");if(t)try{return JSON.parse(t)}catch{return null}return null},renderHTML:e=>e.data?{"data-chart-data":JSON.stringify(e.data)}:{}}}},parseHTML(){return[{tag:'div[data-type="chart"]'}]},renderHTML({HTMLAttributes:e}){return["div",re.mergeAttributes({"data-type":"chart"},e)]},addNodeView(){return ye.ReactNodeViewRenderer(Ia)}});function Oa(e){return i.jsx(ye.NodeViewWrapper,{className:"pubwave-layout__column","data-type":"layoutColumn",children:i.jsx(ye.NodeViewContent,{as:"div",className:"pubwave-layout__column-content"})})}const Ea=re.Node.create({name:"layout",priority:1e3,group:"block",draggable:!0,content:"layoutColumn+",addAttributes(){return{columns:{default:2,parseHTML:e=>{const t=e.getAttribute("data-layout-columns");return t?parseInt(t,10):2},renderHTML:e=>({"data-layout-columns":String(e.columns)})}}},parseHTML(){return[{tag:'div[data-type="layout"]',getAttrs:e=>{const t=e.getAttribute("data-layout-columns"),n=t?parseInt(t,10):2;return n!==2&&n!==3?!1:{columns:n}}}]},renderHTML({node:e,HTMLAttributes:t}){const n=e.attrs.columns,o=["pubwave-editor__layout",`pubwave-layout--${n}-cols`];return["div",re.mergeAttributes({"data-type":"layout","data-layout-columns":String(n),class:o.join(" ")},t),0]}}),_a=re.Node.create({name:"layoutColumn",priority:1e3,group:"block",isolating:!0,content:"block+",parseHTML(){return[{tag:'div[data-type="layoutColumn"]'},{tag:"div.pubwave-layout__column"}]},renderHTML({HTMLAttributes:e}){return["div",re.mergeAttributes({"data-type":"layoutColumn",class:"pubwave-layout__column"},e),0]},addNodeView(){return ye.ReactNodeViewRenderer(Oa)}});async function Na(e,t){const n=(t==null?void 0:t.maxSize)??10485760;if(e.size>n)throw new Error(`Image file is too large. Maximum size is ${n/1024/1024}MB`);if(t!=null&&t.handler)try{return await t.handler(e)}catch(o){console.warn("Custom image upload failed, falling back to base64:",o)}return new Promise((o,r)=>{const a=new FileReader;a.onload=s=>{var c;const l=(c=s.target)==null?void 0:c.result;l?o(l):r(new Error("Failed to read image file"))},a.onerror=()=>{r(new Error("Failed to read image file"))},a.readAsDataURL(e)})}function Ha(e={}){const{headingLevels:t=[1,2,3],imageUpload:n}=e;return[Yo,Ko.configure({HTMLAttributes:{class:"pubwave-editor__paragraph"}}),Xo,ur,Jo.configure({levels:t,HTMLAttributes:{class:"pubwave-editor__heading"}}),Zo.configure({HTMLAttributes:{class:"pubwave-editor__bullet-list"}}),Qo.configure({HTMLAttributes:{class:"pubwave-editor__ordered-list"}}),er.configure({HTMLAttributes:{class:"pubwave-editor__list-item"}}),tr.configure({HTMLAttributes:{class:"pubwave-editor__task-list"}}),nr.configure({nested:!0,HTMLAttributes:{class:"pubwave-editor__task-item"}}),or.configure({resizable:!0,HTMLAttributes:{class:"pubwave-editor__table"}}),rr.configure({HTMLAttributes:{class:"pubwave-editor__table-row"}}),ar.configure({HTMLAttributes:{class:"pubwave-editor__table-header"}}),ir.configure({HTMLAttributes:{class:"pubwave-editor__table-cell"}}),sr.configure({HTMLAttributes:{class:"pubwave-editor__blockquote"}}),lr.configure({HTMLAttributes:{class:"pubwave-editor__code-block"}}),cr.configure({HTMLAttributes:{class:"pubwave-editor__divider"}}),dr.extend({addProseMirrorPlugins(){return[new Pt.Plugin({key:new Pt.PluginKey("imagePasteHandler"),props:{handlePaste:(o,r)=>{var s;const a=Array.from(((s=r.clipboardData)==null?void 0:s.items)||[]);for(const l of a)if(l.type.indexOf("image")===0){r.preventDefault();const c=l.getAsFile();if(c)return Na(c,n).then(p=>{const{state:u,dispatch:m}=o,h=u.schema.nodes.image;if(h){const b=h.create({src:p}),f=u.tr.replaceSelectionWith(b);m(f)}}).catch(p=>{console.error("Failed to upload image:",p)}),!0}return!1}}})]}}).configure({inline:!1,allowBase64:!0,HTMLAttributes:{class:"pubwave-editor__image"}}),Ra.configure({HTMLAttributes:{class:"pubwave-editor__chart"}}),Ea.configure({HTMLAttributes:{class:"pubwave-editor__layout"}}),_a.configure({HTMLAttributes:{class:"pubwave-editor__layout-column"}})]}const $a=re.Mark.create({name:"textColor",excludes:"",addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{color:{default:null,parseHTML:e=>{if(typeof e=="string")return null;const t=e;return t.style.color||t.getAttribute("data-color")||null},renderHTML:e=>e.color?{style:`color: ${e.color}`,"data-color":e.color}:{}}}},parseHTML(){return[{tag:'span[style*="color"]',getAttrs:e=>{if(typeof e=="string")return!1;const t=e,n=t.style.color||t.getAttribute("data-color");return n?{color:n}:!1}}]},renderHTML({HTMLAttributes:e}){return["span",re.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setColor:e=>({chain:t,state:n})=>{var r,a,s;const o=((a=(r=n.storedMarks)==null?void 0:r.find(l=>l.type.name===this.name))==null?void 0:a.attrs)||((s=n.selection.$from.marks().find(l=>l.type.name===this.name))==null?void 0:s.attrs);return(o==null?void 0:o.color)===e?!0:n.selection.empty?t().focus().unsetMark(this.name).setMark(this.name,{color:e}).run():t().focus().unsetMark(this.name).setMark(this.name,{color:e}).run()},unsetColor:()=>({chain:e})=>e().unsetMark(this.name).run()}}}),za=re.Mark.create({name:"backgroundColor",excludes:"",addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{backgroundColor:{default:null,parseHTML:e=>{if(typeof e=="string")return null;const t=e;return t.style.backgroundColor||t.getAttribute("data-background-color")||null},renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`,"data-background-color":e.backgroundColor}:{}}}},parseHTML(){return[{tag:'span[style*="background-color"]',getAttrs:e=>{if(typeof e=="string")return!1;const t=e,n=t.style.backgroundColor||t.getAttribute("data-background-color");return n?{backgroundColor:n}:!1}}]},renderHTML({HTMLAttributes:e}){return["span",re.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setBackgroundColor:e=>({chain:t,state:n})=>{var r,a,s;const o=((a=(r=n.storedMarks)==null?void 0:r.find(l=>l.type.name===this.name))==null?void 0:a.attrs)||((s=n.selection.$from.marks().find(l=>l.type.name===this.name))==null?void 0:s.attrs);return(o==null?void 0:o.backgroundColor)===e?!0:n.selection.empty?t().focus().unsetMark(this.name).setMark(this.name,{backgroundColor:e}).run():t().focus().unsetMark(this.name).setMark(this.name,{backgroundColor:e}).run()},unsetBackgroundColor:()=>({chain:e})=>e().unsetMark(this.name).run()}}});function qa(e={}){const{linkOpenInNewTab:t=!0,linkOpenOnClick:n=!0}=e;return[fr.configure({HTMLAttributes:{class:"pubwave-editor__mark--bold"}}),hr.configure({HTMLAttributes:{class:"pubwave-editor__mark--italic"}}),br.configure({HTMLAttributes:{class:"pubwave-editor__mark--underline"}}),vr.configure({HTMLAttributes:{class:"pubwave-editor__mark--strike"}}),gr.configure({HTMLAttributes:{class:"pubwave-editor__mark--code"}}),mr.configure({openOnClick:n,HTMLAttributes:{class:"pubwave-editor__mark--link",rel:t?"noopener noreferrer":void 0,target:t?"_blank":void 0},validate:o=>{try{return new URL(o),!0}catch{return o.startsWith("/")||o.startsWith("#")}}}),$a.configure({HTMLAttributes:{class:"pubwave-editor__mark--text-color"}}),za.configure({HTMLAttributes:{class:"pubwave-editor__mark--background-color"}})]}function Ua(e,t,n){x.useEffect(()=>{if(e>=0&&n.current&&t.current){const o=t.current,r=n.current,a=o.scrollTop,s=o.clientHeight,l=o.scrollHeight,c=r.offsetTop,p=r.offsetHeight,u=o.querySelector(".pubwave-slash-menu__group"),m=o.querySelector(".pubwave-slash-menu__item"),h=Array.from(o.querySelectorAll(".pubwave-slash-menu__item")).pop(),b=c-a,f=b+p;let g=a;if(b<0)g=c-4,u&&g>u.offsetTop&&(g=Math.max(0,u.offsetTop)),m&&g>m.offsetTop-2&&(g=Math.max(0,m.offsetTop-2));else if(f>s){if(g=c-s+p+4,h){const k=h.offsetTop+h.offsetHeight-s+2;g>k&&(g=k)}g=Math.min(l-s,g)}Math.abs(g-a)>.5&&(o.scrollTop=g)}},[e,t,n])}const Fa={backgroundColor:"var(--pubwave-bg, #ffffff)",border:"1px solid var(--pubwave-border, #e5e7eb)",borderRadius:"var(--pubwave-radius-lg, 8px)",boxShadow:"var(--pubwave-shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05))",maxHeight:"280px",overflowY:"auto",minWidth:"240px",maxWidth:"300px",padding:"var(--pubwave-spacing-1, 4px)",display:"flex",flexDirection:"column"},Wa={marginBottom:"0"},Va={padding:"var(--pubwave-spacing-2, 8px) var(--pubwave-spacing-3, 12px) var(--pubwave-spacing-1, 4px)",fontSize:"var(--pubwave-font-size-xs, 11px)",fontWeight:600,color:"var(--pubwave-text-muted, #6b7280)",textTransform:"uppercase",letterSpacing:"0.5px"},Ga={display:"flex",alignItems:"center",gap:"var(--pubwave-spacing-3, 12px)",width:"100%",padding:"var(--pubwave-spacing-2, 8px) var(--pubwave-spacing-3, 12px)",border:"none",background:"none",cursor:"pointer",textAlign:"left",borderRadius:"var(--pubwave-radius-md, 6px)",transition:"background-color 0.1s ease",fontSize:"var(--pubwave-font-size-base, 14px)",color:"var(--pubwave-text, #1a1a1a)"},Ya={display:"flex",alignItems:"center",justifyContent:"center",width:"var(--pubwave-icon-size, 20px)",height:"var(--pubwave-icon-size, 20px)",color:"var(--pubwave-text-tertiary, #4b5563)",flexShrink:0},Ka={fontSize:"var(--pubwave-font-size-base, 14px)",fontWeight:400,color:"var(--pubwave-text, #1a1a1a)"},Xa=typeof window>"u",_t=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement=="function";function Y(e){return _t?window.requestAnimationFrame(e):0}function ut(){if(!_t)return!1;const e="ontouchstart"in window||navigator.maxTouchPoints>0,t=window.matchMedia("(pointer: coarse)").matches,n=window.matchMedia("(hover: hover)").matches;return e&&t||e&&!n}function Un(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("path",{d:"M4 7V4h16v3M9 20h6M12 4v16"})})}function Fn(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("path",{d:"M4 12h8M4 18V6M12 18V6M17 10l3-2v12"})})}function Wn(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("path",{d:"M4 12h8M4 18V6M12 18V6M21 18h-5c0-2.5 5-2.5 5-5 0-1.5-1-3-3-3s-3 1.5-3 3"})})}function Vn(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("path",{d:"M4 12h8M4 18V6M12 18V6M17 12h3M17 18c2.5 0 4-1 4-3s-1.5-3-4-3"})})}function Gn(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"9",y1:"6",x2:"20",y2:"6"}),i.jsx("line",{x1:"9",y1:"12",x2:"20",y2:"12"}),i.jsx("line",{x1:"9",y1:"18",x2:"20",y2:"18"}),i.jsx("circle",{cx:"4",cy:"6",r:"1.5",fill:"currentColor"}),i.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),i.jsx("circle",{cx:"4",cy:"18",r:"1.5",fill:"currentColor"})]})}function Yn(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"10",y1:"6",x2:"21",y2:"6"}),i.jsx("line",{x1:"10",y1:"12",x2:"21",y2:"12"}),i.jsx("line",{x1:"10",y1:"18",x2:"21",y2:"18"}),i.jsx("text",{x:"3",y:"8",fontSize:"8",fill:"currentColor",stroke:"none",children:"1"}),i.jsx("text",{x:"3",y:"14",fontSize:"8",fill:"currentColor",stroke:"none",children:"2"}),i.jsx("text",{x:"3",y:"20",fontSize:"8",fill:"currentColor",stroke:"none",children:"3"})]})}function Ja(){return i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("polyline",{points:"6,9 12,15 18,9"})})}function Za(){return i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M4 2h5a3 3 0 0 1 0 6H4V2z"}),i.jsx("path",{d:"M4 8h6a3 3 0 0 1 0 6H4V8z"})]})}function Qa(){return i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("line",{x1:"11",y1:"2",x2:"5",y2:"14"}),i.jsx("line",{x1:"6",y1:"2",x2:"12",y2:"2"}),i.jsx("line",{x1:"4",y1:"14",x2:"10",y2:"14"})]})}function ei(){return i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M4 2v6a4 4 0 0 0 8 0V2"}),i.jsx("line",{x1:"2",y1:"14",x2:"14",y2:"14"})]})}function ti(){return i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("line",{x1:"2",y1:"8",x2:"14",y2:"8"}),i.jsx("path",{d:"M5 4c0-1 1.5-2 3-2s3 .5 3 2c0 1-1 2-3 2"}),i.jsx("path",{d:"M5 12c0 1 1.5 2 3 2s3-.5 3-2c0-1-1-2-3-2"})]})}function ni(){return i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polyline",{points:"5 4 1 8 5 12"}),i.jsx("polyline",{points:"11 4 15 8 11 12"})]})}function oi(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"1.87 0 12.19 16",fill:"currentColor",children:[i.jsx("path",{d:"M12.848 2.8a3.145 3.145 0 0 0-4.448 0L6.918 4.283a.625.625 0 0 0 .884.883l1.482-1.482c.74-.74 1.94-.74 2.68 0l.294.294c.74.74.74 1.94 0 2.68l-1.482 1.483a.625.625 0 1 0 .884.884l1.482-1.482a3.145 3.145 0 0 0 0-4.449z"}),i.jsx("path",{d:"M10.472 5.47a.625.625 0 0 0-.884 0L5.229 9.83a.625.625 0 1 0 .884.883l4.359-4.359a.625.625 0 0 0 0-.883"}),i.jsx("path",{d:"M5.167 6.918a.625.625 0 0 0-.884 0L2.8 8.4a3.146 3.146 0 0 0 0 4.448l.294.294a3.145 3.145 0 0 0 4.449 0l1.482-1.482a.625.625 0 0 0-.884-.884L6.66 12.258c-.74.74-1.94.74-2.68 0l-.295-.294c-.74-.74-.74-1.94 0-2.68L5.167 7.8a.625.625 0 0 0 0-.883"})]})}function ri(){return i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M10 3h4v4M14 3l-7 7M14 11v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h3"})})}function ai(){return i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M13 4L6 11l-3-3"})})}function ii(){return i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("line",{x1:"4",y1:"4",x2:"12",y2:"12"}),i.jsx("line",{x1:"12",y1:"4",x2:"4",y2:"12"})]})}function si({textColor:e,backgroundColor:t}){const n=t||"transparent",o=!t;return i.jsx("div",{style:{width:"20px",height:"20px",borderRadius:"50%",backgroundColor:n,border:o?"1px solid var(--pubwave-border)":"none",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:e,lineHeight:1},children:"A"})})}function li(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"3",y:"5",width:"4",height:"4",rx:"0.5"}),i.jsx("rect",{x:"3",y:"14",width:"4",height:"4",rx:"0.5"}),i.jsx("path",{d:"M4 16l1.5 1.5L7 15"}),i.jsx("line",{x1:"10",y1:"7",x2:"21",y2:"7"}),i.jsx("line",{x1:"10",y1:"16",x2:"21",y2:"16"})]})}function ci(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M3 21c3 0 7-1 7-8V5c0-1.25-.75-2-2-2H4c-1.25 0-2 .75-2 2v6c0 1.25.75 2 2 2h4"}),i.jsx("path",{d:"M15 21c3 0 7-1 7-8V5c0-1.25-.75-2-2-2h-4c-1.25 0-2 .75-2 2v6c0 1.25.75 2 2 2h4"})]})}function ui(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("polyline",{points:"16,18 22,12 16,6"}),i.jsx("polyline",{points:"8,6 2,12 8,18"})]})}function di(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"})})}function pi(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),i.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"}),i.jsx("line",{x1:"9",y1:"4",x2:"9",y2:"20"}),i.jsx("line",{x1:"15",y1:"4",x2:"15",y2:"20"})]})}function fi(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),i.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),i.jsx("polyline",{points:"21,15 16,10 5,21"})]})}function hi(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"2",y:"3",width:"20",height:"18",rx:"2"}),i.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function bi(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"2",y:"3",width:"20",height:"18",rx:"2"}),i.jsx("line",{x1:"8",y1:"3",x2:"8",y2:"21"}),i.jsx("line",{x1:"16",y1:"3",x2:"16",y2:"21"})]})}async function vi(e,t){const n=(t==null?void 0:t.maxSize)??10485760;if(e.size>n)throw new Error(`Image file is too large. Maximum size is ${n/1024/1024}MB`);if(t!=null&&t.handler)try{return await t.handler(e)}catch(o){console.warn("Custom image upload failed, falling back to base64:",o)}return new Promise((o,r)=>{const a=new FileReader;a.onload=s=>{var c;const l=(c=s.target)==null?void 0:c.result;l?o(l):r(new Error("Failed to read image file"))},a.onerror=()=>{r(new Error("Failed to read image file"))},a.readAsDataURL(e)})}function gi(e,t,n){if(!((n==null?void 0:n.accept)??["image/*"]).some(a=>a==="image/*"?t.type.startsWith("image/"):t.type===a)){console.warn("Selected file is not an image");return}vi(t,n).then(a=>{e.chain().focus().setImage({src:a}).run()}).catch(a=>{console.error("Failed to upload image:",a)})}function fn(e,t){const{state:n,dispatch:o}=e.view,r=n.schema.nodes.layout,a=n.schema.nodes.layoutColumn;if(!r||!a){console.warn("Layout node type not found in schema");return}const s=n.schema.nodes.paragraph;if(!s){console.warn("Paragraph node type not found in schema");return}const l=Array.from({length:t},()=>a.create(null,s.create())),c=r.create({columns:t},l),p=n.tr.replaceSelectionWith(c);o(p);const u=p.selection.$from.before();e.chain().focus().setTextSelection(u+2).run()}function Kn(e,t){var r,a,s,l,c,p;const o=(t||{slashMenu:{commands:{paragraph:{title:"Text",description:"Plain text block"},heading1:{title:"Heading 1",description:"Large section heading"},heading2:{title:"Heading 2",description:"Medium section heading"},heading3:{title:"Heading 3",description:"Small section heading"},bulletList:{title:"Bullet List",description:"Create a bulleted list"},orderedList:{title:"Numbered List",description:"Create a numbered list"},taskList:{title:"To-do list",description:"Create a todo list with checkboxes"},image:{title:"Image",description:"Upload or paste an image"},blockquote:{title:"Blockquote",description:"Create a quote block"},codeBlock:{title:"Code",description:"Create a code snippet"},horizontalRule:{title:"Divider",description:"Create a horizontal line"},table:{title:"Table",description:"Insert a table"},layoutTwoColumn:{title:"Two Column Layout",description:"Split content into two side-by-side columns"},layoutThreeColumn:{title:"Three Column Layout",description:"Split content into three side-by-side columns"}}}}).slashMenu.commands;return[{id:"paragraph",title:o.paragraph.title,description:o.paragraph.description,icon:i.jsx(Un,{}),aliases:["p","text","paragraph"],group:"basic",action:u=>u.chain().focus().setParagraph().run()},{id:"heading1",title:o.heading1.title,description:o.heading1.description,icon:i.jsx(Fn,{}),aliases:["h1","title"],group:"basic",action:u=>u.chain().focus().toggleHeading({level:1}).run()},{id:"heading2",title:o.heading2.title,description:o.heading2.description,icon:i.jsx(Wn,{}),aliases:["h2","subtitle"],group:"basic",action:u=>u.chain().focus().toggleHeading({level:2}).run()},{id:"heading3",title:o.heading3.title,description:o.heading3.description,icon:i.jsx(Vn,{}),aliases:["h3"],group:"basic",action:u=>u.chain().focus().toggleHeading({level:3}).run()},{id:"bulletList",title:o.bulletList.title,description:o.bulletList.description,icon:i.jsx(Gn,{}),aliases:["ul","bullet","unordered","-"],group:"list",action:u=>u.chain().focus().toggleBulletList().run()},{id:"orderedList",title:o.orderedList.title,description:o.orderedList.description,icon:i.jsx(Yn,{}),aliases:["ol","numbered","ordered","1."],group:"list",action:u=>u.chain().focus().toggleOrderedList().run()},{id:"taskList",title:o.taskList.title,description:o.taskList.description,icon:i.jsx(li,{}),aliases:["todo","task","checkbox","[]"],group:"list",action:u=>u.chain().focus().toggleTaskList().run()},{id:"image",title:o.image.title,description:o.image.description,icon:i.jsx(fi,{}),aliases:["img","picture","photo","pic"],group:"media",action:u=>{const m=document.createElement("input");m.type="file";const h=(e==null?void 0:e.accept)??["image/*"];m.accept=h.join(","),m.style.display="none",m.onchange=b=>{var g;const f=(g=b.target.files)==null?void 0:g[0];f&&gi(u,f,e),document.body.removeChild(m)},document.body.appendChild(m),m.click()}},{id:"blockquote",title:o.blockquote.title,description:o.blockquote.description,icon:i.jsx(ci,{}),aliases:["quote","blockquote",">"],group:"advanced",action:u=>u.chain().focus().toggleBlockquote().run()},{id:"codeBlock",title:o.codeBlock.title,description:o.codeBlock.description,icon:i.jsx(ui,{}),aliases:["code","pre","snippet","```"],group:"advanced",action:u=>u.chain().focus().toggleCodeBlock().run()},{id:"horizontalRule",title:o.horizontalRule.title,description:o.horizontalRule.description,icon:i.jsx(di,{}),aliases:["hr","divider","line","---"],group:"advanced",action:u=>{u.chain().focus().setHorizontalRule().run(),Y(()=>{const{state:m}=u.view,{$from:h}=m.selection;let b=-1;const f=h.pos;if(m.doc.descendants((g,T)=>{if(g.type.name==="horizontalRule"){const k=Math.abs(T-f);(b===-1||Math.abs(b-f)>k)&&(b=T)}}),b!==-1){const g=m.doc.nodeAt(b);if(g){const T=b+g.nodeSize;u.chain().setTextSelection(T).insertContent({type:"paragraph"}).focus().run()}}else u.chain().focus().createParagraphNear().run()})}},{id:"table",title:((r=o.table)==null?void 0:r.title)??"Table",description:((a=o.table)==null?void 0:a.description)??"Insert a table",icon:i.jsx(pi,{}),aliases:["table","grid","tbl"],group:"advanced",action:u=>u.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()},{id:"layoutTwoColumn",title:((s=o.layoutTwoColumn)==null?void 0:s.title)??"Two Column Layout",description:((l=o.layoutTwoColumn)==null?void 0:l.description)??"Split content into two side-by-side columns",icon:i.jsx(hi,{}),aliases:["layout2","two columns","2 col","columns"],group:"layout",action:u=>fn(u,2)},{id:"layoutThreeColumn",title:((c=o.layoutThreeColumn)==null?void 0:c.title)??"Three Column Layout",description:((p=o.layoutThreeColumn)==null?void 0:p.description)??"Split content into three side-by-side columns",icon:i.jsx(bi,{}),aliases:["layout3","three columns","3 col"],group:"layout",action:u=>fn(u,3)}]}const Dt=Kn();function mi(e,t){if(!t)return e;const n=t.toLowerCase();return e.filter(o=>{var l;const r=o.title.toLowerCase(),a=r.startsWith(n)||r.includes(` ${n}`),s=((l=o.aliases)==null?void 0:l.some(c=>c.toLowerCase().startsWith(n)))??!1;return a||s})}var ee="top",ce="bottom",ue="right",te="left",Zt="auto",dt=[ee,ce,ue,te],Ue="start",at="end",xi="clippingParents",Xn="viewport",Ze="popper",yi="reference",hn=dt.reduce(function(e,t){return e.concat([t+"-"+Ue,t+"-"+at])},[]),Jn=[].concat(dt,[Zt]).reduce(function(e,t){return e.concat([t,t+"-"+Ue,t+"-"+at])},[]),wi="beforeRead",ki="read",Ci="afterRead",Ti="beforeMain",Li="main",Bi="afterMain",Ai="beforeWrite",ji="write",Si="afterWrite",Mi=[wi,ki,Ci,Ti,Li,Bi,Ai,ji,Si];function he(e){return e?(e.nodeName||"").toLowerCase():null}function ae(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Re(e){var t=ae(e).Element;return e instanceof t||e instanceof Element}function le(e){var t=ae(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Qt(e){if(typeof ShadowRoot>"u")return!1;var t=ae(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function Pi(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var o=t.styles[n]||{},r=t.attributes[n]||{},a=t.elements[n];!le(a)||!he(a)||(Object.assign(a.style,o),Object.keys(r).forEach(function(s){var l=r[s];l===!1?a.removeAttribute(s):a.setAttribute(s,l===!0?"":l)}))})}function Di(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(o){var r=t.elements[o],a=t.attributes[o]||{},s=Object.keys(t.styles.hasOwnProperty(o)?t.styles[o]:n[o]),l=s.reduce(function(c,p){return c[p]="",c},{});!le(r)||!he(r)||(Object.assign(r.style,l),Object.keys(a).forEach(function(c){r.removeAttribute(c)}))})}}const Zn={name:"applyStyles",enabled:!0,phase:"write",fn:Pi,effect:Di,requires:["computeStyles"]};function fe(e){return e.split("-")[0]}var Ie=Math.max,It=Math.min,Fe=Math.round;function Vt(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function Qn(){return!/^((?!chrome|android).)*safari/i.test(Vt())}function We(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var o=e.getBoundingClientRect(),r=1,a=1;t&&le(e)&&(r=e.offsetWidth>0&&Fe(o.width)/e.offsetWidth||1,a=e.offsetHeight>0&&Fe(o.height)/e.offsetHeight||1);var s=Re(e)?ae(e):window,l=s.visualViewport,c=!Qn()&&n,p=(o.left+(c&&l?l.offsetLeft:0))/r,u=(o.top+(c&&l?l.offsetTop:0))/a,m=o.width/r,h=o.height/a;return{width:m,height:h,top:u,right:p+m,bottom:u+h,left:p,x:p,y:u}}function en(e){var t=We(e),n=e.offsetWidth,o=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-o)<=1&&(o=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:o}}function eo(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Qt(n)){var o=t;do{if(o&&e.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function we(e){return ae(e).getComputedStyle(e)}function Ii(e){return["table","td","th"].indexOf(he(e))>=0}function Le(e){return((Re(e)?e.ownerDocument:e.document)||window.document).documentElement}function Nt(e){return he(e)==="html"?e:e.assignedSlot||e.parentNode||(Qt(e)?e.host:null)||Le(e)}function bn(e){return!le(e)||we(e).position==="fixed"?null:e.offsetParent}function Ri(e){var t=/firefox/i.test(Vt()),n=/Trident/i.test(Vt());if(n&&le(e)){var o=we(e);if(o.position==="fixed")return null}var r=Nt(e);for(Qt(r)&&(r=r.host);le(r)&&["html","body"].indexOf(he(r))<0;){var a=we(r);if(a.transform!=="none"||a.perspective!=="none"||a.contain==="paint"||["transform","perspective"].indexOf(a.willChange)!==-1||t&&a.willChange==="filter"||t&&a.filter&&a.filter!=="none")return r;r=r.parentNode}return null}function pt(e){for(var t=ae(e),n=bn(e);n&&Ii(n)&&we(n).position==="static";)n=bn(n);return n&&(he(n)==="html"||he(n)==="body"&&we(n).position==="static")?t:n||Ri(e)||t}function tn(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function nt(e,t,n){return Ie(e,It(t,n))}function Oi(e,t,n){var o=nt(e,t,n);return o>n?n:o}function to(){return{top:0,right:0,bottom:0,left:0}}function no(e){return Object.assign({},to(),e)}function oo(e,t){return t.reduce(function(n,o){return n[o]=e,n},{})}var Ei=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,no(typeof t!="number"?t:oo(t,dt))};function _i(e){var t,n=e.state,o=e.name,r=e.options,a=n.elements.arrow,s=n.modifiersData.popperOffsets,l=fe(n.placement),c=tn(l),p=[te,ue].indexOf(l)>=0,u=p?"height":"width";if(!(!a||!s)){var m=Ei(r.padding,n),h=en(a),b=c==="y"?ee:te,f=c==="y"?ce:ue,g=n.rects.reference[u]+n.rects.reference[c]-s[c]-n.rects.popper[u],T=s[c]-n.rects.reference[c],k=pt(a),M=k?c==="y"?k.clientHeight||0:k.clientWidth||0:0,C=g/2-T/2,d=m[b],j=M-h[u]-m[f],w=M/2-h[u]/2+C,S=nt(d,w,j),P=c;n.modifiersData[o]=(t={},t[P]=S,t.centerOffset=S-w,t)}}function Ni(e){var t=e.state,n=e.options,o=n.element,r=o===void 0?"[data-popper-arrow]":o;r!=null&&(typeof r=="string"&&(r=t.elements.popper.querySelector(r),!r)||eo(t.elements.popper,r)&&(t.elements.arrow=r))}const Hi={name:"arrow",enabled:!0,phase:"main",fn:_i,effect:Ni,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ve(e){return e.split("-")[1]}var $i={top:"auto",right:"auto",bottom:"auto",left:"auto"};function zi(e,t){var n=e.x,o=e.y,r=t.devicePixelRatio||1;return{x:Fe(n*r)/r||0,y:Fe(o*r)/r||0}}function vn(e){var t,n=e.popper,o=e.popperRect,r=e.placement,a=e.variation,s=e.offsets,l=e.position,c=e.gpuAcceleration,p=e.adaptive,u=e.roundOffsets,m=e.isFixed,h=s.x,b=h===void 0?0:h,f=s.y,g=f===void 0?0:f,T=typeof u=="function"?u({x:b,y:g}):{x:b,y:g};b=T.x,g=T.y;var k=s.hasOwnProperty("x"),M=s.hasOwnProperty("y"),C=te,d=ee,j=window;if(p){var w=pt(n),S="clientHeight",P="clientWidth";if(w===ae(n)&&(w=Le(n),we(w).position!=="static"&&l==="absolute"&&(S="scrollHeight",P="scrollWidth")),w=w,r===ee||(r===te||r===ue)&&a===at){d=ce;var R=m&&w===j&&j.visualViewport?j.visualViewport.height:w[S];g-=R-o.height,g*=c?1:-1}if(r===te||(r===ee||r===ce)&&a===at){C=ue;var B=m&&w===j&&j.visualViewport?j.visualViewport.width:w[P];b-=B-o.width,b*=c?1:-1}}var v=Object.assign({position:l},p&&$i),L=u===!0?zi({x:b,y:g},ae(n)):{x:b,y:g};if(b=L.x,g=L.y,c){var A;return Object.assign({},v,(A={},A[d]=M?"0":"",A[C]=k?"0":"",A.transform=(j.devicePixelRatio||1)<=1?"translate("+b+"px, "+g+"px)":"translate3d("+b+"px, "+g+"px, 0)",A))}return Object.assign({},v,(t={},t[d]=M?g+"px":"",t[C]=k?b+"px":"",t.transform="",t))}function qi(e){var t=e.state,n=e.options,o=n.gpuAcceleration,r=o===void 0?!0:o,a=n.adaptive,s=a===void 0?!0:a,l=n.roundOffsets,c=l===void 0?!0:l,p={placement:fe(t.placement),variation:Ve(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:r,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,vn(Object.assign({},p,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:s,roundOffsets:c})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,vn(Object.assign({},p,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const Ui={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:qi,data:{}};var Lt={passive:!0};function Fi(e){var t=e.state,n=e.instance,o=e.options,r=o.scroll,a=r===void 0?!0:r,s=o.resize,l=s===void 0?!0:s,c=ae(t.elements.popper),p=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&p.forEach(function(u){u.addEventListener("scroll",n.update,Lt)}),l&&c.addEventListener("resize",n.update,Lt),function(){a&&p.forEach(function(u){u.removeEventListener("scroll",n.update,Lt)}),l&&c.removeEventListener("resize",n.update,Lt)}}const Wi={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Fi,data:{}};var Vi={left:"right",right:"left",bottom:"top",top:"bottom"};function jt(e){return e.replace(/left|right|bottom|top/g,function(t){return Vi[t]})}var Gi={start:"end",end:"start"};function gn(e){return e.replace(/start|end/g,function(t){return Gi[t]})}function nn(e){var t=ae(e),n=t.pageXOffset,o=t.pageYOffset;return{scrollLeft:n,scrollTop:o}}function on(e){return We(Le(e)).left+nn(e).scrollLeft}function Yi(e,t){var n=ae(e),o=Le(e),r=n.visualViewport,a=o.clientWidth,s=o.clientHeight,l=0,c=0;if(r){a=r.width,s=r.height;var p=Qn();(p||!p&&t==="fixed")&&(l=r.offsetLeft,c=r.offsetTop)}return{width:a,height:s,x:l+on(e),y:c}}function Ki(e){var t,n=Le(e),o=nn(e),r=(t=e.ownerDocument)==null?void 0:t.body,a=Ie(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=Ie(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),l=-o.scrollLeft+on(e),c=-o.scrollTop;return we(r||n).direction==="rtl"&&(l+=Ie(n.clientWidth,r?r.clientWidth:0)-a),{width:a,height:s,x:l,y:c}}function rn(e){var t=we(e),n=t.overflow,o=t.overflowX,r=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+o)}function ro(e){return["html","body","#document"].indexOf(he(e))>=0?e.ownerDocument.body:le(e)&&rn(e)?e:ro(Nt(e))}function ot(e,t){var n;t===void 0&&(t=[]);var o=ro(e),r=o===((n=e.ownerDocument)==null?void 0:n.body),a=ae(o),s=r?[a].concat(a.visualViewport||[],rn(o)?o:[]):o,l=t.concat(s);return r?l:l.concat(ot(Nt(s)))}function Gt(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Xi(e,t){var n=We(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function mn(e,t,n){return t===Xn?Gt(Yi(e,n)):Re(t)?Xi(t,n):Gt(Ki(Le(e)))}function Ji(e){var t=ot(Nt(e)),n=["absolute","fixed"].indexOf(we(e).position)>=0,o=n&&le(e)?pt(e):e;return Re(o)?t.filter(function(r){return Re(r)&&eo(r,o)&&he(r)!=="body"}):[]}function Zi(e,t,n,o){var r=t==="clippingParents"?Ji(e):[].concat(t),a=[].concat(r,[n]),s=a[0],l=a.reduce(function(c,p){var u=mn(e,p,o);return c.top=Ie(u.top,c.top),c.right=It(u.right,c.right),c.bottom=It(u.bottom,c.bottom),c.left=Ie(u.left,c.left),c},mn(e,s,o));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function ao(e){var t=e.reference,n=e.element,o=e.placement,r=o?fe(o):null,a=o?Ve(o):null,s=t.x+t.width/2-n.width/2,l=t.y+t.height/2-n.height/2,c;switch(r){case ee:c={x:s,y:t.y-n.height};break;case ce:c={x:s,y:t.y+t.height};break;case ue:c={x:t.x+t.width,y:l};break;case te:c={x:t.x-n.width,y:l};break;default:c={x:t.x,y:t.y}}var p=r?tn(r):null;if(p!=null){var u=p==="y"?"height":"width";switch(a){case Ue:c[p]=c[p]-(t[u]/2-n[u]/2);break;case at:c[p]=c[p]+(t[u]/2-n[u]/2);break}}return c}function it(e,t){t===void 0&&(t={});var n=t,o=n.placement,r=o===void 0?e.placement:o,a=n.strategy,s=a===void 0?e.strategy:a,l=n.boundary,c=l===void 0?xi:l,p=n.rootBoundary,u=p===void 0?Xn:p,m=n.elementContext,h=m===void 0?Ze:m,b=n.altBoundary,f=b===void 0?!1:b,g=n.padding,T=g===void 0?0:g,k=no(typeof T!="number"?T:oo(T,dt)),M=h===Ze?yi:Ze,C=e.rects.popper,d=e.elements[f?M:h],j=Zi(Re(d)?d:d.contextElement||Le(e.elements.popper),c,u,s),w=We(e.elements.reference),S=ao({reference:w,element:C,placement:r}),P=Gt(Object.assign({},C,S)),R=h===Ze?P:w,B={top:j.top-R.top+k.top,bottom:R.bottom-j.bottom+k.bottom,left:j.left-R.left+k.left,right:R.right-j.right+k.right},v=e.modifiersData.offset;if(h===Ze&&v){var L=v[r];Object.keys(B).forEach(function(A){var _=[ue,ce].indexOf(A)>=0?1:-1,H=[ee,ce].indexOf(A)>=0?"y":"x";B[A]+=L[H]*_})}return B}function Qi(e,t){t===void 0&&(t={});var n=t,o=n.placement,r=n.boundary,a=n.rootBoundary,s=n.padding,l=n.flipVariations,c=n.allowedAutoPlacements,p=c===void 0?Jn:c,u=Ve(o),m=u?l?hn:hn.filter(function(f){return Ve(f)===u}):dt,h=m.filter(function(f){return p.indexOf(f)>=0});h.length===0&&(h=m);var b=h.reduce(function(f,g){return f[g]=it(e,{placement:g,boundary:r,rootBoundary:a,padding:s})[fe(g)],f},{});return Object.keys(b).sort(function(f,g){return b[f]-b[g]})}function es(e){if(fe(e)===Zt)return[];var t=jt(e);return[gn(e),t,gn(t)]}function ts(e){var t=e.state,n=e.options,o=e.name;if(!t.modifiersData[o]._skip){for(var r=n.mainAxis,a=r===void 0?!0:r,s=n.altAxis,l=s===void 0?!0:s,c=n.fallbackPlacements,p=n.padding,u=n.boundary,m=n.rootBoundary,h=n.altBoundary,b=n.flipVariations,f=b===void 0?!0:b,g=n.allowedAutoPlacements,T=t.options.placement,k=fe(T),M=k===T,C=c||(M||!f?[jt(T)]:es(T)),d=[T].concat(C).reduce(function(Q,G){return Q.concat(fe(G)===Zt?Qi(t,{placement:G,boundary:u,rootBoundary:m,padding:p,flipVariations:f,allowedAutoPlacements:g}):G)},[]),j=t.rects.reference,w=t.rects.popper,S=new Map,P=!0,R=d[0],B=0;B<d.length;B++){var v=d[B],L=fe(v),A=Ve(v)===Ue,_=[ee,ce].indexOf(L)>=0,H=_?"width":"height",z=it(t,{placement:v,boundary:u,rootBoundary:m,altBoundary:h,padding:p}),F=_?A?ue:te:A?ce:ee;j[H]>w[H]&&(F=jt(F));var U=jt(F),I=[];if(a&&I.push(z[L]<=0),l&&I.push(z[F]<=0,z[U]<=0),I.every(function(Q){return Q})){R=v,P=!1;break}S.set(v,I)}if(P)for(var N=f?3:1,W=function(G){var ne=d.find(function(ve){var ie=S.get(ve);if(ie)return ie.slice(0,G).every(function(ke){return ke})});if(ne)return R=ne,"break"},V=N;V>0;V--){var K=W(V);if(K==="break")break}t.placement!==R&&(t.modifiersData[o]._skip=!0,t.placement=R,t.reset=!0)}}const ns={name:"flip",enabled:!0,phase:"main",fn:ts,requiresIfExists:["offset"],data:{_skip:!1}};function xn(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function yn(e){return[ee,ue,ce,te].some(function(t){return e[t]>=0})}function os(e){var t=e.state,n=e.name,o=t.rects.reference,r=t.rects.popper,a=t.modifiersData.preventOverflow,s=it(t,{elementContext:"reference"}),l=it(t,{altBoundary:!0}),c=xn(s,o),p=xn(l,r,a),u=yn(c),m=yn(p);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:p,isReferenceHidden:u,hasPopperEscaped:m},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":m})}const rs={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:os};function as(e,t,n){var o=fe(e),r=[te,ee].indexOf(o)>=0?-1:1,a=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,s=a[0],l=a[1];return s=s||0,l=(l||0)*r,[te,ue].indexOf(o)>=0?{x:l,y:s}:{x:s,y:l}}function is(e){var t=e.state,n=e.options,o=e.name,r=n.offset,a=r===void 0?[0,0]:r,s=Jn.reduce(function(u,m){return u[m]=as(m,t.rects,a),u},{}),l=s[t.placement],c=l.x,p=l.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=p),t.modifiersData[o]=s}const ss={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:is};function ls(e){var t=e.state,n=e.name;t.modifiersData[n]=ao({reference:t.rects.reference,element:t.rects.popper,placement:t.placement})}const cs={name:"popperOffsets",enabled:!0,phase:"read",fn:ls,data:{}};function us(e){return e==="x"?"y":"x"}function ds(e){var t=e.state,n=e.options,o=e.name,r=n.mainAxis,a=r===void 0?!0:r,s=n.altAxis,l=s===void 0?!1:s,c=n.boundary,p=n.rootBoundary,u=n.altBoundary,m=n.padding,h=n.tether,b=h===void 0?!0:h,f=n.tetherOffset,g=f===void 0?0:f,T=it(t,{boundary:c,rootBoundary:p,padding:m,altBoundary:u}),k=fe(t.placement),M=Ve(t.placement),C=!M,d=tn(k),j=us(d),w=t.modifiersData.popperOffsets,S=t.rects.reference,P=t.rects.popper,R=typeof g=="function"?g(Object.assign({},t.rects,{placement:t.placement})):g,B=typeof R=="number"?{mainAxis:R,altAxis:R}:Object.assign({mainAxis:0,altAxis:0},R),v=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,L={x:0,y:0};if(w){if(a){var A,_=d==="y"?ee:te,H=d==="y"?ce:ue,z=d==="y"?"height":"width",F=w[d],U=F+T[_],I=F-T[H],N=b?-P[z]/2:0,W=M===Ue?S[z]:P[z],V=M===Ue?-P[z]:-S[z],K=t.elements.arrow,Q=b&&K?en(K):{width:0,height:0},G=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:to(),ne=G[_],ve=G[H],ie=nt(0,S[z],Q[z]),ke=C?S[z]/2-N-ie-ne-B.mainAxis:W-ie-ne-B.mainAxis,de=C?-S[z]/2+N+ie+ve+B.mainAxis:V+ie+ve+B.mainAxis,X=t.elements.arrow&&pt(t.elements.arrow),ht=X?d==="y"?X.clientTop||0:X.clientLeft||0:0,Ge=(A=v==null?void 0:v[d])!=null?A:0,bt=F+ke-Ge-ht,vt=F+de-Ge,Ye=nt(b?It(U,bt):U,F,b?Ie(I,vt):I);w[d]=Ye,L[d]=Ye-F}if(l){var Ke,gt=d==="x"?ee:te,mt=d==="x"?ce:ue,ge=w[j],Ce=j==="y"?"height":"width",Xe=ge+T[gt],je=ge-T[mt],Je=[ee,te].indexOf(k)!==-1,xt=(Ke=v==null?void 0:v[j])!=null?Ke:0,yt=Je?Xe:ge-S[Ce]-P[Ce]-xt+B.altAxis,wt=Je?ge+S[Ce]+P[Ce]-xt-B.altAxis:je,kt=b&&Je?Oi(yt,ge,wt):nt(b?yt:Xe,ge,b?wt:je);w[j]=kt,L[j]=kt-ge}t.modifiersData[o]=L}}const ps={name:"preventOverflow",enabled:!0,phase:"main",fn:ds,requiresIfExists:["offset"]};function fs(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function hs(e){return e===ae(e)||!le(e)?nn(e):fs(e)}function bs(e){var t=e.getBoundingClientRect(),n=Fe(t.width)/e.offsetWidth||1,o=Fe(t.height)/e.offsetHeight||1;return n!==1||o!==1}function vs(e,t,n){n===void 0&&(n=!1);var o=le(t),r=le(t)&&bs(t),a=Le(t),s=We(e,r,n),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(o||!o&&!n)&&((he(t)!=="body"||rn(a))&&(l=hs(t)),le(t)?(c=We(t,!0),c.x+=t.clientLeft,c.y+=t.clientTop):a&&(c.x=on(a))),{x:s.left+l.scrollLeft-c.x,y:s.top+l.scrollTop-c.y,width:s.width,height:s.height}}function gs(e){var t=new Map,n=new Set,o=[];e.forEach(function(a){t.set(a.name,a)});function r(a){n.add(a.name);var s=[].concat(a.requires||[],a.requiresIfExists||[]);s.forEach(function(l){if(!n.has(l)){var c=t.get(l);c&&r(c)}}),o.push(a)}return e.forEach(function(a){n.has(a.name)||r(a)}),o}function ms(e){var t=gs(e);return Mi.reduce(function(n,o){return n.concat(t.filter(function(r){return r.phase===o}))},[])}function xs(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function ys(e){var t=e.reduce(function(n,o){var r=n[o.name];return n[o.name]=r?Object.assign({},r,o,{options:Object.assign({},r.options,o.options),data:Object.assign({},r.data,o.data)}):o,n},{});return Object.keys(t).map(function(n){return t[n]})}var wn={placement:"bottom",modifiers:[],strategy:"absolute"};function kn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(o){return!(o&&typeof o.getBoundingClientRect=="function")})}function ws(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,o=n===void 0?[]:n,r=t.defaultOptions,a=r===void 0?wn:r;return function(l,c,p){p===void 0&&(p=a);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},wn,a),modifiersData:{},elements:{reference:l,popper:c},attributes:{},styles:{}},m=[],h=!1,b={state:u,setOptions:function(k){var M=typeof k=="function"?k(u.options):k;g(),u.options=Object.assign({},a,u.options,M),u.scrollParents={reference:Re(l)?ot(l):l.contextElement?ot(l.contextElement):[],popper:ot(c)};var C=ms(ys([].concat(o,u.options.modifiers)));return u.orderedModifiers=C.filter(function(d){return d.enabled}),f(),b.update()},forceUpdate:function(){if(!h){var k=u.elements,M=k.reference,C=k.popper;if(kn(M,C)){u.rects={reference:vs(M,pt(C),u.options.strategy==="fixed"),popper:en(C)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(B){return u.modifiersData[B.name]=Object.assign({},B.data)});for(var d=0;d<u.orderedModifiers.length;d++){if(u.reset===!0){u.reset=!1,d=-1;continue}var j=u.orderedModifiers[d],w=j.fn,S=j.options,P=S===void 0?{}:S,R=j.name;typeof w=="function"&&(u=w({state:u,options:P,name:R,instance:b})||u)}}}},update:xs(function(){return new Promise(function(T){b.forceUpdate(),T(u)})}),destroy:function(){g(),h=!0}};if(!kn(l,c))return b;b.setOptions(p).then(function(T){!h&&p.onFirstUpdate&&p.onFirstUpdate(T)});function f(){u.orderedModifiers.forEach(function(T){var k=T.name,M=T.options,C=M===void 0?{}:M,d=T.effect;if(typeof d=="function"){var j=d({state:u,name:k,instance:b,options:C}),w=function(){};m.push(j||w)}})}function g(){m.forEach(function(T){return T()}),m=[]}return b}}var ks=[Wi,cs,Ui,Zn,ss,ns,ps,Hi,rs],Cs=ws({defaultModifiers:ks}),Ts="tippy-box",io="tippy-content",Ls="tippy-backdrop",so="tippy-arrow",lo="tippy-svg-arrow",Pe={passive:!0,capture:!0},co=function(){return document.body};function Bs(e,t){return{}.hasOwnProperty.call(e,t)}function zt(e,t,n){if(Array.isArray(e)){var o=e[t];return o??(Array.isArray(n)?n[t]:n)}return e}function an(e,t){var n={}.toString.call(e);return n.indexOf("[object")===0&&n.indexOf(t+"]")>-1}function uo(e,t){return typeof e=="function"?e.apply(void 0,t):e}function Cn(e,t){if(t===0)return e;var n;return function(o){clearTimeout(n),n=setTimeout(function(){e(o)},t)}}function As(e,t){var n=Object.assign({},e);return t.forEach(function(o){delete n[o]}),n}function js(e){return e.split(/\s+/).filter(Boolean)}function qe(e){return[].concat(e)}function Tn(e,t){e.indexOf(t)===-1&&e.push(t)}function Ss(e){return e.filter(function(t,n){return e.indexOf(t)===n})}function Ms(e){return e.split("-")[0]}function Rt(e){return[].slice.call(e)}function Ln(e){return Object.keys(e).reduce(function(t,n){return e[n]!==void 0&&(t[n]=e[n]),t},{})}function rt(){return document.createElement("div")}function st(e){return["Element","Fragment"].some(function(t){return an(e,t)})}function Ps(e){return an(e,"NodeList")}function Ds(e){return an(e,"MouseEvent")}function Is(e){return!!(e&&e._tippy&&e._tippy.reference===e)}function Rs(e){return st(e)?[e]:Ps(e)?Rt(e):Array.isArray(e)?e:Rt(document.querySelectorAll(e))}function qt(e,t){e.forEach(function(n){n&&(n.style.transitionDuration=t+"ms")})}function Bn(e,t){e.forEach(function(n){n&&n.setAttribute("data-state",t)})}function Os(e){var t,n=qe(e),o=n[0];return o!=null&&(t=o.ownerDocument)!=null&&t.body?o.ownerDocument:document}function Es(e,t){var n=t.clientX,o=t.clientY;return e.every(function(r){var a=r.popperRect,s=r.popperState,l=r.props,c=l.interactiveBorder,p=Ms(s.placement),u=s.modifiersData.offset;if(!u)return!0;var m=p==="bottom"?u.top.y:0,h=p==="top"?u.bottom.y:0,b=p==="right"?u.left.x:0,f=p==="left"?u.right.x:0,g=a.top-o+m>c,T=o-a.bottom-h>c,k=a.left-n+b>c,M=n-a.right-f>c;return g||T||k||M})}function Ut(e,t,n){var o=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){e[o](r,n)})}function An(e,t){for(var n=t;n;){var o;if(e.contains(n))return!0;n=n.getRootNode==null||(o=n.getRootNode())==null?void 0:o.host}return!1}var pe={isTouch:!1},jn=0;function _s(){pe.isTouch||(pe.isTouch=!0,window.performance&&document.addEventListener("mousemove",po))}function po(){var e=performance.now();e-jn<20&&(pe.isTouch=!1,document.removeEventListener("mousemove",po)),jn=e}function Ns(){var e=document.activeElement;if(Is(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}function Hs(){document.addEventListener("touchstart",_s,Pe),window.addEventListener("blur",Ns)}var $s=typeof window<"u"&&typeof document<"u",zs=$s?!!window.msCrypto:!1;function ze(e){var t=e==="destroy"?"n already-":" ";return[e+"() was called on a"+t+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function Sn(e){var t=/[ \t]{2,}/g,n=/^[ \t]*/gm;return e.replace(t," ").replace(n,"").trim()}function qs(e){return Sn(`
1
+ "use strict";var Wo=Object.create;var pn=Object.defineProperty;var Vo=Object.getOwnPropertyDescriptor;var Go=Object.getOwnPropertyNames;var Yo=Object.getPrototypeOf,Ko=Object.prototype.hasOwnProperty;var Xo=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Go(t))!Ko.call(e,r)&&r!==n&&pn(e,r,{get:()=>t[r],enumerable:!(o=Vo(t,r))||o.enumerable});return e};var Jo=(e,t,n)=>(n=e!=null?Wo(Yo(e)):{},Xo(t||!e||!e.__esModule?pn(n,"default",{value:e,enumerable:!0}):n,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ne=require("@tiptap/core"),Zo=require("@tiptap/extension-placeholder"),Qo=require("@tiptap/extension-history"),er=require("@tiptap/extension-dropcursor"),tr=require("@tiptap/extension-gapcursor"),nr=require("@tiptap/extension-document"),or=require("@tiptap/extension-paragraph"),rr=require("@tiptap/extension-text"),ar=require("@tiptap/extension-heading"),ir=require("@tiptap/extension-bullet-list"),sr=require("@tiptap/extension-ordered-list"),lr=require("@tiptap/extension-list-item"),cr=require("@tiptap/extension-task-list"),ur=require("@tiptap/extension-task-item"),dr=require("@tiptap/extension-table"),pr=require("@tiptap/extension-table-row"),fr=require("@tiptap/extension-table-header"),hr=require("@tiptap/extension-table-cell"),br=require("@tiptap/extension-blockquote"),vr=require("@tiptap/extension-code-block"),gr=require("@tiptap/extension-horizontal-rule"),mr=require("@tiptap/extension-hard-break"),Ae=require("@tiptap/react"),i=require("react/jsx-runtime"),x=require("react"),xr=require("react-dom"),yr=require("@tiptap/extension-image"),je=require("@tiptap/pm/state"),wr=require("@tiptap/extension-bold"),kr=require("@tiptap/extension-italic"),Cr=require("@tiptap/extension-underline"),Tr=require("@tiptap/extension-strike"),Lr=require("@tiptap/extension-code"),Br=require("@tiptap/extension-link"),Ar=require("@tiptap/suggestion"),jr=[{value:"bar",label:"bar"},{value:"line",label:"line"},{value:"pie",label:"pie"},{value:"doughnut",label:"doughnut"},{value:"radar",label:"radar"},{value:"polarArea",label:"polarArea"}];function Sr(e){return{backgroundColor:`rgba(59, 130, 246, ${.5+e%3*.2})`,borderColor:"rgba(59, 130, 246, 1)"}}function Mr({initialData:e,onSave:t,onCancel:n,locale:o}){var B,_,b,L,M,E,$,q,H;const[r,a]=x.useState(e.type),[s,l]=x.useState(((b=(_=(B=e.options)==null?void 0:B.plugins)==null?void 0:_.title)==null?void 0:b.text)??""),[c,f]=x.useState(((E=(M=(L=e.options)==null?void 0:L.plugins)==null?void 0:M.legend)==null?void 0:E.display)??!0),[u,m]=x.useState(((H=(q=($=e.options)==null?void 0:$.plugins)==null?void 0:q.legend)==null?void 0:H.position)??"bottom"),[h,v]=x.useState(e.data.labels),[p,g]=x.useState(e.data.datasets),C=x.useRef(null),y=(o==null?void 0:o.chart)||{modal:{title:"Edit Chart",close:"Close",save:"Save",cancel:"Cancel",fields:{chartType:"Chart Type",title:"Title",titlePlaceholder:"Chart title...",showLegend:"Show Legend",legendPosition:"Position",position:{top:"Top",bottom:"Bottom",left:"Left",right:"Right"},labels:"Labels",labelsPlaceholder:"Jan, Feb, Mar, Apr...",datasets:{title:"Datasets",add:"+ Add Dataset",remove:"Remove",datasetLabel:"Label",datasetLabelPlaceholder:"Dataset label...",data:"Data",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"Bar Chart",line:"Line Chart",pie:"Pie Chart",doughnut:"Doughnut Chart",radar:"Radar Chart",polarArea:"Polar Area Chart"}};x.useEffect(()=>{const P=R=>{R.key==="Escape"&&n()};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[n]),x.useEffect(()=>{const P=W=>{C.current&&C.current.contains(W.target)},R=setTimeout(()=>{document.addEventListener("mousedown",P)},100);return()=>{clearTimeout(R),document.removeEventListener("mousedown",P)}},[]);const S=x.useCallback((P,R)=>{g(W=>W.map((V,J)=>J===P?{...V,label:R}:V))},[]),T=x.useCallback((P,R)=>{g(W=>W.map((V,J)=>J===P?{...V,data:R.split(",").map(Z=>parseFloat(Z.trim())||0)}:V))},[]),d=x.useCallback(()=>{const P=Sr(p.length);g(R=>[...R,{label:`${y.modal.fields.datasets.title} ${R.length+1}`,data:h.map(()=>Math.floor(Math.random()*100)),backgroundColor:P.backgroundColor,borderColor:P.borderColor,borderWidth:2}])},[p.length,h,y]),A=x.useCallback(P=>{g(R=>R.filter((W,V)=>V!==P))},[]),k=x.useCallback(P=>{v(P.split(",").map(R=>R.trim()).filter(Boolean))},[]),j=x.useCallback(()=>{const P={type:r,data:{labels:h,datasets:p},options:{...e.options,responsive:!0,maintainAspectRatio:!1,plugins:{title:{display:!!s,text:s,color:"var(--pubwave-text, #37352f)",font:{size:16,weight:"bold"}},legend:{display:c,position:u}}}};t(P)},[r,s,c,u,h,p,e.options,t]),I=x.useCallback(P=>{P.target===P.currentTarget&&n()},[n]),N=i.jsx("div",{className:"pubwave-modal__overlay",onClick:I,children:i.jsxs("div",{ref:C,className:"pubwave-modal__container",role:"dialog","aria-modal":"true","aria-labelledby":"chart-modal-title",children:[i.jsxs("div",{className:"pubwave-modal__header",children:[i.jsx("h2",{id:"chart-modal-title",className:"pubwave-modal__title",children:y.modal.title}),i.jsx("button",{type:"button",className:"pubwave-modal__close",onClick:n,"aria-label":y.modal.close,children:i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),i.jsxs("div",{className:"pubwave-modal__body",children:[i.jsxs("div",{className:"pubwave-form__field",children:[i.jsx("label",{htmlFor:"chart-type",className:"pubwave-form__label",children:y.modal.fields.chartType}),i.jsx("select",{id:"chart-type",className:"pubwave-form__select",value:r,onChange:P=>a(P.target.value),children:jr.map(P=>i.jsx("option",{value:P.value,children:y.chartTypes[P.value]},P.value))})]}),i.jsxs("div",{className:"pubwave-form__field",children:[i.jsx("label",{htmlFor:"chart-title",className:"pubwave-form__label",children:y.modal.fields.title}),i.jsx("input",{id:"chart-title",type:"text",className:"pubwave-form__input",value:s,onChange:P=>l(P.target.value),placeholder:y.modal.fields.titlePlaceholder})]}),i.jsxs("div",{className:"pubwave-form__row",children:[i.jsx("div",{className:"pubwave-form__field",children:i.jsxs("label",{className:"pubwave-form__checkbox-label",children:[i.jsx("input",{type:"checkbox",className:"pubwave-form__checkbox",checked:c,onChange:P=>f(P.target.checked)}),y.modal.fields.showLegend]})}),c&&i.jsxs("div",{className:"pubwave-form__field",children:[i.jsx("label",{htmlFor:"legend-position",className:"pubwave-form__label",children:y.modal.fields.legendPosition}),i.jsxs("select",{id:"legend-position",className:"pubwave-form__select",value:u,onChange:P=>m(P.target.value),children:[i.jsx("option",{value:"top",children:y.modal.fields.position.top}),i.jsx("option",{value:"bottom",children:y.modal.fields.position.bottom}),i.jsx("option",{value:"left",children:y.modal.fields.position.left}),i.jsx("option",{value:"right",children:y.modal.fields.position.right})]})]})]}),i.jsxs("div",{className:"pubwave-form__field",children:[i.jsx("label",{htmlFor:"chart-labels",className:"pubwave-form__label",children:y.modal.fields.labels}),i.jsx("input",{id:"chart-labels",type:"text",className:"pubwave-form__input",value:h.join(", "),onChange:P=>k(P.target.value),placeholder:y.modal.fields.labelsPlaceholder})]}),i.jsxs("div",{className:"pubwave-form__section",children:[i.jsxs("div",{className:"pubwave-form__section-header",children:[i.jsx("h3",{className:"pubwave-form__section-title",children:y.modal.fields.datasets.title}),i.jsx("button",{type:"button",className:"pubwave-button pubwave-button--secondary pubwave-button--small",onClick:d,children:y.modal.fields.datasets.add})]}),p.map((P,R)=>i.jsxs("div",{className:"pubwave-form__dataset",children:[i.jsxs("div",{className:"pubwave-form__dataset-header",children:[i.jsxs("span",{className:"pubwave-form__dataset-title",children:[y.modal.fields.datasets.datasetLabel," ",R+1]}),p.length>1&&i.jsx("button",{type:"button",className:"pubwave-button pubwave-button--danger pubwave-button--small",onClick:()=>A(R),"aria-label":`${y.modal.fields.datasets.remove} ${R+1}`,children:y.modal.fields.datasets.remove})]}),i.jsxs("div",{className:"pubwave-form__field",children:[i.jsx("label",{htmlFor:`dataset-label-${R}`,className:"pubwave-form__label",children:y.modal.fields.datasets.datasetLabel}),i.jsx("input",{id:`dataset-label-${R}`,type:"text",className:"pubwave-form__input",value:P.label??"",onChange:W=>S(R,W.target.value),placeholder:y.modal.fields.datasets.datasetLabelPlaceholder})]}),i.jsxs("div",{className:"pubwave-form__field",children:[i.jsx("label",{htmlFor:`dataset-data-${R}`,className:"pubwave-form__label",children:y.modal.fields.datasets.data}),i.jsx("input",{id:`dataset-data-${R}`,type:"text",className:"pubwave-form__input",value:P.data.join(", "),onChange:W=>T(R,W.target.value),placeholder:y.modal.fields.datasets.dataPlaceholder})]})]},R))]})]}),i.jsxs("div",{className:"pubwave-modal__footer",children:[i.jsx("button",{type:"button",className:"pubwave-button pubwave-button--secondary",onClick:n,children:y.modal.cancel}),i.jsx("button",{type:"button",className:"pubwave-button pubwave-button--primary",onClick:j,children:y.modal.save})]})]})});return xr.createPortal(N,document.body)}const Pr={groups:{basic:"Basic",list:"Lists",media:"Media",advanced:"Advanced",layout:"Layout"},commands:{paragraph:{title:"Text",description:"Plain text block"},heading1:{title:"Heading 1",description:"Large section heading"},heading2:{title:"Heading 2",description:"Medium section heading"},heading3:{title:"Heading 3",description:"Small section heading"},bulletList:{title:"Bullet List",description:"Create a bulleted list"},orderedList:{title:"Numbered List",description:"Create a numbered list"},taskList:{title:"To-do list",description:"Create a todo list with checkboxes"},image:{title:"Image",description:"Upload or paste an image"},blockquote:{title:"Blockquote",description:"Create a quote block"},codeBlock:{title:"Code",description:"Create a code snippet"},horizontalRule:{title:"Divider",description:"Create a horizontal line"},table:{title:"Table",description:"Insert a table"},layoutTwoColumn:{title:"Two Column Layout",description:"Split content into two side-by-side columns"},layoutThreeColumn:{title:"Three Column Layout",description:"Split content into three side-by-side columns"}}},Dr={bold:"Bold",italic:"Italic",underline:"Underline",strike:"Strikethrough",code:"Inline Code",link:"Link",turnInto:"Turn Into",colorPicker:"Text and background color",textColor:"Text color",backgroundColor:"Background color",recentlyUsed:"Recently used",openLink:"Open link",removeLink:"Remove link",confirmLink:"Confirm link",clearLink:"Clear link",blockTypes:{text:"Text",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",bulletedList:"Bulleted list",numberedList:"Numbered list"}},Ir={editor:"Rich text editor",editorContent:"Editor content area",toolbar:"Text formatting toolbar",boldButton:"Toggle bold formatting",italicButton:"Toggle italic formatting",underlineButton:"Toggle underline formatting",strikeButton:"Toggle strikethrough formatting",codeButton:"Toggle inline code formatting",linkButton:"Add or edit link",turnIntoButton:"Turn into",colorPickerButton:"Text and background color",headingButton:"Set heading level",paragraphButton:"Convert to paragraph",dragHandle:"Drag to reorder block",dropIndicator:"Drop here to move block",blockMenu:"Block options menu",addBlock:"Add new block",deleteBlock:"Delete this block",linkDialog:"Link editor dialog",linkUrlInput:"Link URL input",linkSaveButton:"Save link",linkRemoveButton:"Remove link",linkCancelButton:"Cancel link editing",addBlockBelow:"Add block below",dragToMove:"Drag to reorder block",openLinkInNewTab:"Open link in new tab",linkConfirmButton:"Confirm link",linkOpenButton:"Open link in new tab",linkClearButton:"Clear link input"},Rr='Write, type "/" for commands...',Er="Paste a link...",Or={modal:{title:"Edit Chart",close:"Close",save:"Save",cancel:"Cancel",fields:{chartType:"Chart Type",title:"Title",titlePlaceholder:"Chart title...",showLegend:"Show Legend",legendPosition:"Position",position:{top:"Top",bottom:"Bottom",left:"Left",right:"Right"},labels:"Labels (comma-separated)",labelsPlaceholder:"Jan, Feb, Mar, Apr...",datasets:{title:"Datasets",add:"+ Add Dataset",remove:"Remove",datasetLabel:"Dataset",datasetLabelPlaceholder:"Dataset label...",data:"Data (comma-separated numbers)",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"Bar Chart",line:"Line Chart",pie:"Pie Chart",doughnut:"Doughnut Chart",radar:"Radar Chart",polarArea:"Polar Area Chart"}},qn={slashMenu:Pr,toolbar:Dr,aria:Ir,placeholder:Rr,linkPlaceholder:Er,chart:Or},_r={groups:{basic:"基礎",list:"列表",media:"媒體",advanced:"高級",layout:"版面配置"},commands:{paragraph:{title:"文本",description:"普通文本塊"},heading1:{title:"標題 1",description:"大標題"},heading2:{title:"標題 2",description:"中標題"},heading3:{title:"標題 3",description:"小標題"},bulletList:{title:"無序列表",description:"創建無序列表"},orderedList:{title:"有序列表",description:"創建有序列表"},taskList:{title:"待辦清單",description:"創建帶複選框的待辦清單"},image:{title:"圖片",description:"上傳或粘貼圖片"},blockquote:{title:"引用",description:"創建引用塊"},codeBlock:{title:"代碼",description:"創建代碼片段"},horizontalRule:{title:"分割線",description:"創建水平分割線"},table:{title:"表格",description:"插入表格"},layoutTwoColumn:{title:"兩欄版面配置",description:"將內容分成兩個並排的欄"},layoutThreeColumn:{title:"三欄版面配置",description:"將內容分成三個並排的欄"}}},Nr={bold:"粗體",italic:"斜體",underline:"下劃線",strike:"刪除線",code:"行內代碼",link:"鏈接",turnInto:"轉換為",colorPicker:"文字和背景顏色",textColor:"文字顏色",backgroundColor:"背景顏色",recentlyUsed:"最近使用",openLink:"打開鏈接",removeLink:"移除鏈接",confirmLink:"確認鏈接",clearLink:"清空鏈接",blockTypes:{text:"文本",heading1:"標題 1",heading2:"標題 2",heading3:"標題 3",bulletedList:"無序列表",numberedList:"有序列表"}},Hr={editor:"富文本編輯器",editorContent:"編輯器內容區域",toolbar:"文本格式化工具欄",boldButton:"切換粗體格式",italicButton:"切換斜體格式",underlineButton:"切換下劃線格式",strikeButton:"切換刪除線格式",codeButton:"切換行內代碼格式",linkButton:"添加或編輯鏈接",turnIntoButton:"轉換為",colorPickerButton:"文字和背景顏色",headingButton:"設置標題級別",paragraphButton:"轉換為段落",dragHandle:"拖拽以重新排序塊",dropIndicator:"放置此處以移動塊",blockMenu:"塊選項菜單",addBlock:"添加新塊",deleteBlock:"刪除此塊",linkDialog:"鏈接編輯對話框",linkUrlInput:"鏈接 URL 輸入",linkSaveButton:"保存鏈接",linkRemoveButton:"移除鏈接",linkCancelButton:"取消鏈接編輯",addBlockBelow:"在下方添加塊",dragToMove:"拖拽以重新排序塊",openLinkInNewTab:"在新標籤頁中打開鏈接",linkConfirmButton:"確認鏈接",linkOpenButton:"在新標籤頁中打開鏈接",linkClearButton:"清空鏈接輸入"},$r='開始寫作,輸入 "/" 顯示命令...',zr="粘貼鏈接...",qr={modal:{title:"編輯圖表",close:"關閉",save:"保存",cancel:"取消",fields:{chartType:"圖表類型",title:"標題",titlePlaceholder:"圖表標題...",showLegend:"顯示圖例",legendPosition:"位置",position:{top:"頂部",bottom:"底部",left:"左側",right:"右側"},labels:"標籤(逗號分隔)",labelsPlaceholder:"一月, 二月, 三月, 四月...",datasets:{title:"數據集",add:"+ 添加數據集",remove:"移除",datasetLabel:"標籤",datasetLabelPlaceholder:"數據集標籤...",data:"數據(逗號分隔的數字)",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"柱狀圖",line:"折線圖",pie:"餅圖",doughnut:"環形圖",radar:"雷達圖",polarArea:"極地圖"}},Ur={slashMenu:_r,toolbar:Nr,aria:Hr,placeholder:$r,linkPlaceholder:zr,chart:qr},Fr={groups:{basic:"基础",list:"列表",media:"媒体",advanced:"高级",layout:"版面布局"},commands:{paragraph:{title:"文本",description:"普通文本块"},heading1:{title:"标题 1",description:"大标题"},heading2:{title:"标题 2",description:"中标题"},heading3:{title:"标题 3",description:"小标题"},bulletList:{title:"无序列表",description:"创建无序列表"},orderedList:{title:"有序列表",description:"创建有序列表"},taskList:{title:"待办清单",description:"创建带复选框的待办清单"},image:{title:"图片",description:"上传或粘贴图片"},blockquote:{title:"引用",description:"创建引用块"},codeBlock:{title:"代码",description:"创建代码片段"},horizontalRule:{title:"分割线",description:"创建水平分割线"},table:{title:"表格",description:"插入表格"},layoutTwoColumn:{title:"两栏布局",description:"将内容分成两个并排的栏"},layoutThreeColumn:{title:"三栏布局",description:"将内容分成三个并排的栏"}}},Wr={bold:"粗体",italic:"斜体",underline:"下划线",strike:"删除线",code:"行内代码",link:"链接",turnInto:"转换为",colorPicker:"文字和背景颜色",textColor:"文字颜色",backgroundColor:"背景颜色",recentlyUsed:"最近使用",openLink:"打开链接",removeLink:"移除链接",confirmLink:"确认链接",clearLink:"清空链接",blockTypes:{text:"文本",heading1:"标题 1",heading2:"标题 2",heading3:"标题 3",bulletedList:"无序列表",numberedList:"有序列表"}},Vr={editor:"富文本编辑器",editorContent:"编辑器内容区域",toolbar:"文本格式化工具栏",boldButton:"切换粗体格式",italicButton:"切换斜体格式",underlineButton:"切换下划线格式",strikeButton:"切换删除线格式",codeButton:"切换行内代码格式",linkButton:"添加或编辑链接",turnIntoButton:"转换为",colorPickerButton:"文字和背景颜色",headingButton:"设置标题级别",paragraphButton:"转换为段落",dragHandle:"拖拽以重新排序块",dropIndicator:"放置此处以移动块",blockMenu:"块选项菜单",addBlock:"添加新块",deleteBlock:"删除此块",linkDialog:"链接编辑对话框",linkUrlInput:"链接 URL 输入",linkSaveButton:"保存链接",linkRemoveButton:"移除链接",linkCancelButton:"取消链接编辑",addBlockBelow:"在下方添加块",dragToMove:"拖拽以重新排序块",openLinkInNewTab:"在新标签页中打开链接",linkConfirmButton:"确认链接",linkOpenButton:"在新标签页中打开链接",linkClearButton:"清空链接输入"},Gr='开始写作,输入 "/" 显示命令...',Yr="粘贴链接...",Kr={modal:{title:"编辑图表",close:"关闭",save:"保存",cancel:"取消",fields:{chartType:"图表类型",title:"标题",titlePlaceholder:"图表标题...",showLegend:"显示图例",legendPosition:"位置",position:{top:"顶部",bottom:"底部",left:"左侧",right:"右侧"},labels:"标签(逗号分隔)",labelsPlaceholder:"一月, 二月, 三月, 四月...",datasets:{title:"数据集",add:"+ 添加数据集",remove:"移除",datasetLabel:"标签",datasetLabelPlaceholder:"数据集标签...",data:"数据(逗号分隔的数字)",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"柱状图",line:"折线图",pie:"饼图",doughnut:"环形图",radar:"雷达图",polarArea:"极地图"}},Xr={slashMenu:Fr,toolbar:Wr,aria:Vr,placeholder:Gr,linkPlaceholder:Yr,chart:Kr},Jr={groups:{basic:"基本",list:"リスト",media:"メディア",advanced:"高度",layout:"レイアウト"},commands:{paragraph:{title:"テキスト",description:"プレーンテキストブロック"},heading1:{title:"見出し1",description:"大きなセクション見出し"},heading2:{title:"見出し2",description:"中サイズのセクション見出し"},heading3:{title:"見出し3",description:"小さなセクション見出し"},bulletList:{title:"箇条書きリスト",description:"箇条書きリストを作成"},orderedList:{title:"番号付きリスト",description:"番号付きリストを作成"},taskList:{title:"To-doリスト",description:"チェックボックス付きのTo-doリストを作成"},image:{title:"画像",description:"画像をアップロードまたは貼り付け"},blockquote:{title:"引用",description:"引用ブロックを作成"},codeBlock:{title:"コード",description:"コードスニペットを作成"},horizontalRule:{title:"区切り線",description:"水平線を作成"},table:{title:"テーブル",description:"テーブルを挿入"},layoutTwoColumn:{title:"2カラムレイアウト",description:"コンテンツを2つの横並びカラムに分割"},layoutThreeColumn:{title:"3カラムレイアウト",description:"コンテンツを3つの横並びカラムに分割"}}},Zr={bold:"太字",italic:"斜体",underline:"下線",strike:"取り消し線",code:"インラインコード",link:"リンク",turnInto:"変換",colorPicker:"テキストと背景色",textColor:"文字色",backgroundColor:"背景色",recentlyUsed:"最近使用",openLink:"リンクを開く",removeLink:"リンクを削除",confirmLink:"リンクを確認",clearLink:"リンクをクリア",blockTypes:{text:"テキスト",heading1:"見出し1",heading2:"見出し2",heading3:"見出し3",bulletedList:"箇条書きリスト",numberedList:"番号付きリスト"}},Qr={editor:"リッチテキストエディタ",editorContent:"エディタコンテンツ領域",toolbar:"テキスト書式設定ツールバー",boldButton:"太字書式を切り替え",italicButton:"斜体書式を切り替え",underlineButton:"下線書式を切り替え",strikeButton:"取り消し線書式を切り替え",codeButton:"インラインコード書式を切り替え",linkButton:"リンクを追加または編集",turnIntoButton:"変換",colorPickerButton:"テキストと背景色",headingButton:"見出しレベルを設定",paragraphButton:"段落に変換",dragHandle:"ブロックを並び替えるためにドラッグ",dropIndicator:"ブロックを移動するためにここにドロップ",blockMenu:"ブロックオプションメニュー",addBlock:"新しいブロックを追加",deleteBlock:"このブロックを削除",linkDialog:"リンク編集ダイアログ",linkUrlInput:"リンクURL入力",linkSaveButton:"リンクを保存",linkRemoveButton:"リンクを削除",linkCancelButton:"リンク編集をキャンセル",addBlockBelow:"下にブロックを追加",dragToMove:"ブロックを並び替えるためにドラッグ",openLinkInNewTab:"新しいタブでリンクを開く",linkConfirmButton:"リンクを確認",linkOpenButton:"新しいタブでリンクを開く",linkClearButton:"リンク入力をクリア"},ea='書き始めましょう、コマンドを表示するには "/" を入力...',ta="リンクを貼り付け...",na={modal:{title:"チャート編集",close:"閉じる",save:"保存",cancel:"キャンセル",fields:{chartType:"チャートタイプ",title:"タイトル",titlePlaceholder:"チャートタイトル...",showLegend:"凡例を表示",legendPosition:"位置",position:{top:"上",bottom:"下",left:"左",right:"右"},labels:"ラベル(カンマ区切り)",labelsPlaceholder:"1月, 2月, 3月, 4月...",datasets:{title:"データセット",add:"+ データセットを追加",remove:"削除",datasetLabel:"ラベル",datasetLabelPlaceholder:"データセットラベル...",data:"データ(カンマ区切りの数値)",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"棒グラフ",line:"折れ線グラフ",pie:"円グラフ",doughnut:"ドーナツグラフ",radar:"レーダーチャート",polarArea:"極座標グラフ"}},oa={slashMenu:Jr,toolbar:Zr,aria:Qr,placeholder:ea,linkPlaceholder:ta,chart:na},ra={groups:{basic:"기본",list:"목록",media:"미디어",advanced:"고급",layout:"레이아웃"},commands:{paragraph:{title:"텍스트",description:"일반 텍스트 블록"},heading1:{title:"제목 1",description:"큰 섹션 제목"},heading2:{title:"제목 2",description:"중간 섹션 제목"},heading3:{title:"제목 3",description:"작은 섹션 제목"},bulletList:{title:"글머리 기호 목록",description:"글머리 기호 목록 만들기"},orderedList:{title:"번호 매기기 목록",description:"번호 매기기 목록 만들기"},taskList:{title:"할 일 목록",description:"확인란 있는 할 일 목록 만들기"},image:{title:"이미지",description:"이미지 업로드 또는 붙여넣기"},blockquote:{title:"인용",description:"인용 블록 만들기"},codeBlock:{title:"코드",description:"코드 스니펫 만들기"},horizontalRule:{title:"구분선",description:"수평선 만들기"},table:{title:"표",description:"표를 삽입"},layoutTwoColumn:{title:"2열 레이아웃",description:"콘텐츠를 두 개의 나란히 있는 열로 분할"},layoutThreeColumn:{title:"3열 레이아웃",description:"콘텐츠를 세 개의 나란히 있는 열로 분할"}}},aa={bold:"굵게",italic:"기울임",underline:"밑줄",strike:"취소선",code:"인라인 코드",link:"링크",turnInto:"변환",colorPicker:"텍스트 및 배경색",textColor:"텍스트 색상",backgroundColor:"배경 색상",recentlyUsed:"최근 사용",openLink:"링크 열기",removeLink:"링크 제거",confirmLink:"링크 확인",clearLink:"링크 지우기",blockTypes:{text:"텍스트",heading1:"제목 1",heading2:"제목 2",heading3:"제목 3",bulletedList:"글머리 기호 목록",numberedList:"번호 매기기 목록"}},ia={editor:"리치 텍스트 에디터",editorContent:"에디터 내용 영역",toolbar:"텍스트 서식 도구 모음",boldButton:"굵게 서식 전환",italicButton:"기울임 서식 전환",underlineButton:"밑줄 서식 전환",strikeButton:"취소선 서식 전환",codeButton:"인라인 코드 서식 전환",linkButton:"링크 추가 또는 편집",turnIntoButton:"변환",colorPickerButton:"텍스트 및 배경색",headingButton:"제목 수준 설정",paragraphButton:"단락으로 변환",dragHandle:"블록 재정렬을 위해 드래그",dropIndicator:"블록 이동을 위해 여기에 놓기",blockMenu:"블록 옵션 메뉴",addBlock:"새 블록 추가",deleteBlock:"이 블록 삭제",linkDialog:"링크 편집 대화 상자",linkUrlInput:"링크 URL 입력",linkSaveButton:"링크 저장",linkRemoveButton:"링크 제거",linkCancelButton:"링크 편집 취소",addBlockBelow:"아래에 블록 추가",dragToMove:"블록 재정렬을 위해 드래그",openLinkInNewTab:"새 탭에서 링크 열기",linkConfirmButton:"링크 확인",linkOpenButton:"새 탭에서 링크 열기",linkClearButton:"링크 입력 지우기"},sa='작성 시작, 명령을 표시하려면 "/" 입력...',la="링크 붙여넣기...",ca={modal:{title:"차트 편집",close:"닫기",save:"저장",cancel:"취소",fields:{chartType:"차트 유형",title:"제목",titlePlaceholder:"차트 제목...",showLegend:"범례 표시",legendPosition:"위치",position:{top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"},labels:"레이블(쉼표로 구분)",labelsPlaceholder:"1월, 2월, 3월, 4월...",datasets:{title:"데이터 세트",add:"+ 데이터 세트 추가",remove:"제거",datasetLabel:"레이블",datasetLabelPlaceholder:"데이터 세트 레이블...",data:"데이터(쉼표로 구분된 숫자)",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"막대형 차트",line:"선형 차트",pie:"원형 차트",doughnut:"도넛형 차트",radar:"레이더 차트",polarArea:"극좌표형 차트"}},ua={slashMenu:ra,toolbar:aa,aria:ia,placeholder:sa,linkPlaceholder:la,chart:ca},da={groups:{basic:"De base",list:"Listes",media:"Médias",advanced:"Avancé",layout:"Mise en page"},commands:{paragraph:{title:"Texte",description:"Bloc de texte simple"},heading1:{title:"Titre 1",description:"Grand titre de section"},heading2:{title:"Titre 2",description:"Titre de section moyen"},heading3:{title:"Titre 3",description:"Petit titre de section"},bulletList:{title:"Liste à puces",description:"Créer une liste à puces"},orderedList:{title:"Liste numérotée",description:"Créer une liste numérotée"},taskList:{title:"Liste de tâches",description:"Créer une liste de tâches avec cases à cocher"},image:{title:"Image",description:"Télécharger ou coller une image"},blockquote:{title:"Citation",description:"Créer un bloc de citation"},codeBlock:{title:"Code",description:"Créer un extrait de code"},horizontalRule:{title:"Séparateur",description:"Créer une ligne horizontale"},table:{title:"Tableau",description:"Insérer un tableau"},layoutTwoColumn:{title:"Mise en page à deux colonnes",description:"Diviser le contenu en deux colonnes côte à côte"},layoutThreeColumn:{title:"Mise en page à trois colonnes",description:"Diviser le contenu en trois colonnes côte à côte"}}},pa={bold:"Gras",italic:"Italique",underline:"Souligné",strike:"Barré",code:"Code en ligne",link:"Lien",turnInto:"Convertir en",colorPicker:"Couleur du texte et du fond",textColor:"Couleur du texte",backgroundColor:"Couleur de fond",recentlyUsed:"Récemment utilisés",openLink:"Ouvrir le lien",removeLink:"Supprimer le lien",confirmLink:"Confirmer le lien",clearLink:"Effacer le lien",blockTypes:{text:"Texte",heading1:"Titre 1",heading2:"Titre 2",heading3:"Titre 3",bulletedList:"Liste à puces",numberedList:"Liste numérotée"}},fa={editor:"Éditeur de texte riche",editorContent:"Zone de contenu de l'éditeur",toolbar:"Barre d'outils de formatage de texte",boldButton:"Activer/désactiver le formatage en gras",italicButton:"Activer/désactiver le formatage en italique",underlineButton:"Activer/désactiver le soulignement",strikeButton:"Activer/désactiver le texte barré",codeButton:"Activer/désactiver le code en ligne",linkButton:"Ajouter ou modifier un lien",turnIntoButton:"Convertir en",colorPickerButton:"Couleur du texte et du fond",headingButton:"Définir le niveau de titre",paragraphButton:"Convertir en paragraphe",dragHandle:"Glisser pour réorganiser le bloc",dropIndicator:"Déposer ici pour déplacer le bloc",blockMenu:"Menu des options de bloc",addBlock:"Ajouter un nouveau bloc",deleteBlock:"Supprimer ce bloc",linkDialog:"Boîte de dialogue d'édition de lien",linkUrlInput:"Entrée d'URL de lien",linkSaveButton:"Enregistrer le lien",linkRemoveButton:"Supprimer le lien",linkCancelButton:"Annuler l'édition du lien",addBlockBelow:"Ajouter un bloc en dessous",dragToMove:"Glisser pour réorganiser le bloc",openLinkInNewTab:"Ouvrir le lien dans un nouvel onglet",linkConfirmButton:"Confirmer le lien",linkOpenButton:"Ouvrir le lien dans un nouvel onglet",linkClearButton:"Effacer la saisie du lien"},ha='Écrivez, tapez "/" pour afficher les commandes...',ba="Collez un lien...",va={modal:{title:"Modifier le graphique",close:"Fermer",save:"Enregistrer",cancel:"Annuler",fields:{chartType:"Type de graphique",title:"Titre",titlePlaceholder:"Titre du graphique...",showLegend:"Afficher la légende",legendPosition:"Position",position:{top:"Haut",bottom:"Bas",left:"Gauche",right:"Droite"},labels:"Étiquettes (séparées par des virgules)",labelsPlaceholder:"Jan, Fév, Mar, Avr...",datasets:{title:"Jeux de données",add:"+ Ajouter un jeu de données",remove:"Supprimer",datasetLabel:"Étiquette",datasetLabelPlaceholder:"Étiquette du jeu de données...",data:"Données (nombres séparés par des virgules)",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"Graphique à barres",line:"Graphique linéaire",pie:"Graphique circulaire",doughnut:"Graphique en anneau",radar:"Graphique radar",polarArea:"Graphique en coordonnées polaires"}},ga={slashMenu:da,toolbar:pa,aria:fa,placeholder:ha,linkPlaceholder:ba,chart:va},ma={groups:{basic:"Basis",list:"Listen",media:"Medien",advanced:"Erweitert",layout:"Layout"},commands:{paragraph:{title:"Text",description:"Einfacher Textblock"},heading1:{title:"Überschrift 1",description:"Große Abschnittsüberschrift"},heading2:{title:"Überschrift 2",description:"Mittlere Abschnittsüberschrift"},heading3:{title:"Überschrift 3",description:"Kleine Abschnittsüberschrift"},bulletList:{title:"Aufzählungsliste",description:"Aufzählungsliste erstellen"},orderedList:{title:"Nummerierte Liste",description:"Nummerierte Liste erstellen"},taskList:{title:"To-do-Liste",description:"To-do-Liste mit Kontrollkästchen erstellen"},image:{title:"Bild",description:"Bild hochladen oder einfügen"},blockquote:{title:"Zitat",description:"Zitatblock erstellen"},codeBlock:{title:"Code",description:"Codeausschnitt erstellen"},horizontalRule:{title:"Trennlinie",description:"Horizontale Linie erstellen"},table:{title:"Tabelle",description:"Eine Tabelle einfügen"},layoutTwoColumn:{title:"Zweispaltiges Layout",description:"Inhalt in zwei nebeneinander liegende Spalten aufteilen"},layoutThreeColumn:{title:"Dreispaltiges Layout",description:"Inhalt in drei nebeneinander liegende Spalten aufteilen"}}},xa={bold:"Fett",italic:"Kursiv",underline:"Unterstrichen",strike:"Durchgestrichen",code:"Inline-Code",link:"Link",turnInto:"Umwandeln in",colorPicker:"Text- und Hintergrundfarbe",textColor:"Textfarbe",backgroundColor:"Hintergrundfarbe",recentlyUsed:"Zuletzt verwendet",openLink:"Link öffnen",removeLink:"Link entfernen",confirmLink:"Link bestätigen",clearLink:"Link löschen",blockTypes:{text:"Text",heading1:"Überschrift 1",heading2:"Überschrift 2",heading3:"Überschrift 3",bulletedList:"Aufzählungsliste",numberedList:"Nummerierte Liste"}},ya={editor:"Rich-Text-Editor",editorContent:"Editor-Inhaltsbereich",toolbar:"Textformatierungs-Symbolleiste",boldButton:"Fettformatierung ein/aus",italicButton:"Kursivformatierung ein/aus",underlineButton:"Unterstreichung ein/aus",strikeButton:"Durchstreichung ein/aus",codeButton:"Inline-Code-Formatierung ein/aus",linkButton:"Link hinzufügen oder bearbeiten",turnIntoButton:"Umwandeln in",colorPickerButton:"Text- und Hintergrundfarbe",headingButton:"Überschriftsebene festlegen",paragraphButton:"In Absatz umwandeln",dragHandle:"Zum Neuordnen des Blocks ziehen",dropIndicator:"Hier ablegen, um Block zu verschieben",blockMenu:"Block-Optionsmenü",addBlock:"Neuen Block hinzufügen",deleteBlock:"Diesen Block löschen",linkDialog:"Link-Bearbeitungsdialog",linkUrlInput:"Link-URL-Eingabe",linkSaveButton:"Link speichern",linkRemoveButton:"Link entfernen",linkCancelButton:"Link-Bearbeitung abbrechen",addBlockBelow:"Block darunter hinzufügen",dragToMove:"Zum Neuordnen des Blocks ziehen",openLinkInNewTab:"Link in neuem Tab öffnen",linkConfirmButton:"Link bestätigen",linkOpenButton:"Link in neuem Tab öffnen",linkClearButton:"Link-Eingabe löschen"},wa='Schreiben, tippen Sie "/" für Befehle...',ka="Link einfügen...",Ca={modal:{title:"Chart bearbeiten",close:"Schließen",save:"Speichern",cancel:"Abbrechen",fields:{chartType:"Chart-Typ",title:"Titel",titlePlaceholder:"Chart-Titel...",showLegend:"Legende anzeigen",legendPosition:"Position",position:{top:"Oben",bottom:"Unten",left:"Links",right:"Rechts"},labels:"Beschriftungen (kommagetrennt)",labelsPlaceholder:"Jan, Feb, Mär, Apr...",datasets:{title:"Datensätze",add:"+ Datensatz hinzufügen",remove:"Entfernen",datasetLabel:"Datensatz",datasetLabelPlaceholder:"Datensatz-Beschriftung...",data:"Daten (kommagetrennte Zahlen)",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"Balkendiagramm",line:"Liniendiagramm",pie:"Kreisdiagramm",doughnut:"Ringdiagramm",radar:"Netzdiagramm",polarArea:"Polärfächen-Diagramm"}},Ta={slashMenu:ma,toolbar:xa,aria:ya,placeholder:wa,linkPlaceholder:ka,chart:Ca},La={groups:{basic:"Básico",list:"Listas",media:"Medios",advanced:"Avanzado",layout:"Diseño"},commands:{paragraph:{title:"Texto",description:"Bloque de texto plano"},heading1:{title:"Título 1",description:"Título de sección grande"},heading2:{title:"Título 2",description:"Título de sección mediano"},heading3:{title:"Título 3",description:"Título de sección pequeño"},bulletList:{title:"Lista con viñetas",description:"Crear una lista con viñetas"},orderedList:{title:"Lista numerada",description:"Crear una lista numerada"},taskList:{title:"Lista de tareas",description:"Crear una lista de tareas con casillas"},image:{title:"Imagen",description:"Subir o pegar una imagen"},blockquote:{title:"Cita",description:"Crear un bloque de cita"},codeBlock:{title:"Código",description:"Crear un fragmento de código"},horizontalRule:{title:"Divisor",description:"Crear una línea horizontal"},table:{title:"Tabla",description:"Insertar una tabla"},layoutTwoColumn:{title:"Diseño de dos columnas",description:"Dividir el contenido en dos columnas una al lado de la otra"},layoutThreeColumn:{title:"Diseño de tres columnas",description:"Dividir el contenido en tres columnas una al lado de la otra"}}},Ba={bold:"Negrita",italic:"Cursiva",underline:"Subrayado",strike:"Tachado",code:"Código en línea",link:"Enlace",turnInto:"Convertir en",colorPicker:"Color de texto y fondo",textColor:"Color del texto",backgroundColor:"Color de fondo",recentlyUsed:"Recientemente usados",openLink:"Abrir enlace",removeLink:"Eliminar enlace",confirmLink:"Confirmar enlace",clearLink:"Limpiar enlace",blockTypes:{text:"Texto",heading1:"Título 1",heading2:"Título 2",heading3:"Título 3",bulletedList:"Lista con viñetas",numberedList:"Lista numerada"}},Aa={editor:"Editor de texto enriquecido",editorContent:"Área de contenido del editor",toolbar:"Barra de herramientas de formato de texto",boldButton:"Activar/desactivar formato en negrita",italicButton:"Activar/desactivar formato en cursiva",underlineButton:"Activar/desactivar subrayado",strikeButton:"Activar/desactivar tachado",codeButton:"Activar/desactivar código en línea",linkButton:"Añadir o editar enlace",turnIntoButton:"Convertir en",colorPickerButton:"Color de texto y fondo",headingButton:"Establecer nivel de título",paragraphButton:"Convertir a párrafo",dragHandle:"Arrastrar para reorganizar el bloque",dropIndicator:"Soltar aquí para mover el bloque",blockMenu:"Menú de opciones del bloque",addBlock:"Añadir nuevo bloque",deleteBlock:"Eliminar este bloque",linkDialog:"Diálogo de edición de enlace",linkUrlInput:"Entrada de URL del enlace",linkSaveButton:"Guardar enlace",linkRemoveButton:"Eliminar enlace",linkCancelButton:"Cancelar edición de enlace",addBlockBelow:"Añadir bloque debajo",dragToMove:"Arrastrar para reorganizar el bloque",openLinkInNewTab:"Abrir enlace en nueva pestaña",linkConfirmButton:"Confirmar enlace",linkOpenButton:"Abrir enlace en nueva pestaña",linkClearButton:"Limpiar entrada de enlace"},ja='Escribe, escribe "/" para comandos...',Sa="Pegue un enlace...",Ma={modal:{title:"Editar gráfico",close:"Cerrar",save:"Guardar",cancel:"Cancelar",fields:{chartType:"Tipo de gráfico",title:"Título",titlePlaceholder:"Título del gráfico...",showLegend:"Mostrar leyenda",legendPosition:"Posición",position:{top:"Arriba",bottom:"Abajo",left:"Izquierda",right:"Derecha"},labels:"Etiquetas (separadas por comas)",labelsPlaceholder:"Ene, Feb, Mar, Abr...",datasets:{title:"Conjuntos de datos",add:"+ Añadir conjunto de datos",remove:"Eliminar",datasetLabel:"Etiqueta",datasetLabelPlaceholder:"Etiqueta del conjunto de datos...",data:"Datos (números separados por comas)",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"Gráfico de barras",line:"Gráfico de líneas",pie:"Gráfico circular",doughnut:"Gráfico de anillo",radar:"Gráfico radar",polarArea:"Gráfico de área polar"}},Pa={slashMenu:La,toolbar:Ba,aria:Aa,placeholder:ja,linkPlaceholder:Sa,chart:Ma},Da={groups:{basic:"Básico",list:"Listas",media:"Mídia",advanced:"Avançado",layout:"Layout"},commands:{paragraph:{title:"Texto",description:"Bloco de texto simples"},heading1:{title:"Título 1",description:"Título de seção grande"},heading2:{title:"Título 2",description:"Título de seção médio"},heading3:{title:"Título 3",description:"Título de seção pequeno"},bulletList:{title:"Lista com marcadores",description:"Criar uma lista com marcadores"},orderedList:{title:"Lista numerada",description:"Criar uma lista numerada"},taskList:{title:"Lista de tarefas",description:"Criar uma lista de tarefas com caixas de seleção"},image:{title:"Imagem",description:"Enviar ou colar uma imagem"},blockquote:{title:"Citação",description:"Criar um bloco de citação"},codeBlock:{title:"Código",description:"Criar um trecho de código"},horizontalRule:{title:"Divisor",description:"Criar uma linha horizontal"},table:{title:"Tabela",description:"Inserir uma tabela"},layoutTwoColumn:{title:"Layout de duas colunas",description:"Dividir o conteúdo em duas colunas lado a lado"},layoutThreeColumn:{title:"Layout de três colunas",description:"Dividir o conteúdo em três colunas lado a lado"}}},Ia={bold:"Negrito",italic:"Itálico",underline:"Sublinhado",strike:"Tachado",code:"Código inline",link:"Link",turnInto:"Converter em",colorPicker:"Cor do texto e fundo",textColor:"Cor do texto",backgroundColor:"Cor de fundo",recentlyUsed:"Usados recentemente",openLink:"Abrir link",removeLink:"Remover link",confirmLink:"Confirmar link",clearLink:"Limpar link",blockTypes:{text:"Texto",heading1:"Título 1",heading2:"Título 2",heading3:"Título 3",bulletedList:"Lista com marcadores",numberedList:"Lista numerada"}},Ra={editor:"Editor de texto rico",editorContent:"Área de conteúdo do editor",toolbar:"Barra de ferramentas de formatação de texto",boldButton:"Alternar formatação em negrito",italicButton:"Alternar formatação em itálico",underlineButton:"Alternar sublinhado",strikeButton:"Alternar tachado",codeButton:"Alternar código inline",linkButton:"Adicionar ou editar link",turnIntoButton:"Converter em",colorPickerButton:"Cor do texto e fundo",headingButton:"Definir nível de título",paragraphButton:"Converter em parágrafo",dragHandle:"Arrastar para reorganizar o bloco",dropIndicator:"Soltar aqui para mover o bloco",blockMenu:"Menu de opções do bloco",addBlock:"Adicionar novo bloco",deleteBlock:"Excluir este bloco",linkDialog:"Diálogo de edição de link",linkUrlInput:"Entrada de URL do link",linkSaveButton:"Salvar link",linkRemoveButton:"Remover link",linkCancelButton:"Cancelar edição de link",addBlockBelow:"Adicionar bloco abaixo",dragToMove:"Arrastar para reorganizar o bloco",openLinkInNewTab:"Abrir link em nova aba",linkConfirmButton:"Confirmar link",linkOpenButton:"Abrir link em nova aba",linkClearButton:"Limpar entrada de link"},Ea='Escreva, digite "/" para comandos...',Oa="Cole um link...",_a={modal:{title:"Editar gráfico",close:"Fechar",save:"Salvar",cancel:"Cancelar",fields:{chartType:"Tipo de gráfico",title:"Título",titlePlaceholder:"Título do gráfico...",showLegend:"Mostrar legenda",legendPosition:"Posição",position:{top:"Superior",bottom:"Inferior",left:"Esquerda",right:"Direita"},labels:"Rótulos (separados por vírgula)",labelsPlaceholder:"Jan, Fev, Mar, Abr...",datasets:{title:"Conjuntos de dados",add:"+ Adicionar conjunto de dados",remove:"Remover",datasetLabel:"Rótulo",datasetLabelPlaceholder:"Rótulo do conjunto de dados...",data:"Dados (números separados por vírgula)",dataPlaceholder:"10, 20, 30, 40..."}}},chartTypes:{bar:"Gráfico de barras",line:"Gráfico de linhas",pie:"Gráfico de pizza",doughnut:"Gráfico de rosca",radar:"Gráfico de radar",polarArea:"Gráfico de área polar"}},Na={slashMenu:Da,toolbar:Ia,aria:Ra,placeholder:Ea,linkPlaceholder:Oa,chart:_a},Ft=qn,Ha={en:qn,zh:Ur,"zh-CN":Xr,ja:oa,ko:ua,fr:ga,de:Ta,es:Pa,pt:Na};function jt(e){return e&&Ha[e]||Ft}const Un=x.createContext({locale:Ft}),fn=Un.Provider;function We(){return x.useContext(Un).locale}const $a=async()=>import("chart.js/auto");function Xe(e,t,n){const o=getComputedStyle(e),r=t.replace(/^var\(/,"").replace(/\)$/,"");return o.getPropertyValue(r).trim()||n}function za(e){var B,_,b;const{node:t,updateAttributes:n,editor:o,selected:r}=e,a=t.attrs.data,[s,l]=x.useState(!1),[c,f]=x.useState(!1),[u,m]=x.useState(null),h=x.useRef(null),v=x.useRef(null),p=x.useRef(null),g=We(),C=((B=o==null?void 0:o.options)==null?void 0:B.editable)??!0,y=C?r:!1,S=x.useCallback(()=>{if(!u||!p.current||!v.current)return;const L=v.current,M=Xe(L,"--pubwave-text","#37352f"),E=Xe(L,"--pubwave-text-muted","#9b9a97"),$=Xe(L,"--pubwave-border","#e3e2e0"),q=u.options.plugins||{},H=u.options.scales;if(q.legend){const P=q.legend;P.labels?P.labels.color=M:q.legend.labels={color:M},P.onHover=()=>{const R=h.current;R&&(R.style.cursor="pointer")},P.onLeave=()=>{const R=h.current;R&&(R.style.cursor="default")}}q.title&&(q.title.color=M),H&&(H.x&&(H.x.ticks&&(H.x.ticks.color=E),H.x.grid&&(H.x.grid.color=$)),H.y&&(H.y.ticks&&(H.y.ticks.color=E),H.y.grid&&(H.y.grid.color=$))),u.update("none")},[u]);x.useEffect(()=>!h.current||!a?void 0:((async()=>{var M,E,$,q,H,P,R,W,V,J,Z,Q,ae,ye,ie,we,de,ke;try{const Ce=(await $a()).default;if(p.current=Ce,h.current){const G=Ce.getChart(h.current);G&&G.destroy()}u&&u.destroy();const Oe=(M=h.current)==null?void 0:M.getContext("2d");if(!Oe){console.warn("Failed to get 2D context for chart");return}const pe=v.current,Te=pe?Xe(pe,"--pubwave-text","#37352f"):"#37352f",Me=pe?Xe(pe,"--pubwave-text-muted","#9b9a97"):"#9b9a97",_e=pe?Xe(pe,"--pubwave-border","#e3e2e0"):"#e3e2e0",fe=((E=a.options)==null?void 0:E.scales)??{},he=T(a.type)?{x:{...fe.x??{},ticks:{...(($=fe.x)==null?void 0:$.ticks)??{},color:Me},grid:{...((q=fe.x)==null?void 0:q.grid)??{},color:_e}},y:{...fe.y??{},ticks:{...((H=fe.y)==null?void 0:H.ticks)??{},color:Me},grid:{...((P=fe.y)==null?void 0:P.grid)??{},color:_e}}}:void 0,be={...a.options,responsive:!0,maintainAspectRatio:!1,plugins:{...(R=a.options)==null?void 0:R.plugins,legend:{display:((J=(V=(W=a.options)==null?void 0:W.plugins)==null?void 0:V.legend)==null?void 0:J.display)??!0,position:((ae=(Q=(Z=a.options)==null?void 0:Z.plugins)==null?void 0:Q.legend)==null?void 0:ae.position)??"top",...(we=(ie=(ye=a.options)==null?void 0:ye.plugins)==null?void 0:ie.legend)!=null&&we.labels?{labels:{...a.options.plugins.legend.labels,color:Te}}:{labels:{color:Te}},onHover:()=>{const G=h.current;G&&(G.style.cursor="pointer")},onLeave:()=>{const G=h.current;G&&(G.style.cursor="default")}},title:(ke=(de=a.options)==null?void 0:de.plugins)!=null&&ke.title?{...a.options.plugins.title,color:Te,...a.options.plugins.title.font?{font:{...a.options.plugins.title.font}}:{}}:void 0},scales:he},Ne=new Ce(Oe,{type:a.type,data:a.data,options:be});m(Ne)}catch(Ee){console.error("Failed to load Chart.js:",Ee)}})(),()=>{u&&u.destroy()}),[a,C]),x.useEffect(()=>{if(!u||!v.current)return;const L=()=>{setTimeout(()=>{S()},0)},M=new MutationObserver($=>{$.forEach(q=>{(q.attributeName==="style"||q.attributeName==="class")&&L()})});let E=v.current;for(;E&&(M.observe(E,{attributes:!0}),!(E.classList.contains("pubwave-editor")||E===document.body));)E=E.parentElement;return M.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>{M.disconnect()}},[u,S]);function T(L){return["bar","line","radar"].includes(L)}const d=x.useCallback(L=>{n({data:L}),l(!1)},[n]),A=x.useCallback(()=>{l(!1)},[]),k=x.useCallback(()=>{l(!0)},[]);if(!a)return i.jsx(Ae.NodeViewWrapper,{className:"pubwave-editor__chart",children:i.jsx("div",{className:"pubwave-chart__placeholder",children:"Invalid chart data"})});const j=(_=a.options)==null?void 0:_.height,I=(b=a.options)==null?void 0:b.minHeight,N=j||I?{height:j?`${j}px`:void 0,minHeight:I?`${I}px`:void 0}:void 0;return i.jsxs(Ae.NodeViewWrapper,{ref:v,className:"pubwave-editor__chart","data-selected":y,"data-chart-type":a.type,children:[i.jsxs("div",{className:"pubwave-chart__container",onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),children:[i.jsx("div",{className:"pubwave-chart__canvas-wrapper",style:N,children:i.jsx("canvas",{ref:h,className:"pubwave-chart__canvas"})}),C&&(c||y)&&i.jsx("button",{type:"button",className:"pubwave-chart__edit-button",onClick:k,"aria-label":"Edit chart",title:"Edit chart",children:i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),i.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})})]}),s&&a&&i.jsx(Mr,{initialData:a,onSave:d,onCancel:A,locale:g})]})}const qa=ne.Node.create({name:"chart",priority:1e3,group:"block",atom:!0,draggable:!0,addAttributes(){return{data:{default:null,parseHTML:e=>{const t=e.getAttribute("data-chart-data");if(t)try{return JSON.parse(t)}catch{return null}return null},renderHTML:e=>e.data?{"data-chart-data":JSON.stringify(e.data)}:{}}}},parseHTML(){return[{tag:'div[data-type="chart"]'}]},renderHTML({HTMLAttributes:e}){return["div",ne.mergeAttributes({"data-type":"chart"},e)]},addNodeView(){return Ae.ReactNodeViewRenderer(za)}});function Ua(e){return i.jsx(Ae.NodeViewWrapper,{className:"pubwave-layout__column","data-type":"layoutColumn",children:i.jsx(Ae.NodeViewContent,{as:"div",className:"pubwave-layout__column-content"})})}const Fa=ne.Node.create({name:"layout",priority:1e3,group:"block",draggable:!0,content:"layoutColumn+",addAttributes(){return{columns:{default:2,parseHTML:e=>{const t=e.getAttribute("data-layout-columns");return t?parseInt(t,10):2},renderHTML:e=>({"data-layout-columns":String(e.columns)})}}},parseHTML(){return[{tag:'div[data-type="layout"]',getAttrs:e=>{const t=e.getAttribute("data-layout-columns"),n=t?parseInt(t,10):2;return n!==2&&n!==3?!1:{columns:n}}}]},renderHTML({node:e,HTMLAttributes:t}){const n=e.attrs.columns,o=["pubwave-editor__layout",`pubwave-layout--${n}-cols`];return["div",ne.mergeAttributes({"data-type":"layout","data-layout-columns":String(n),class:o.join(" ")},t),0]}}),Wa=ne.Node.create({name:"layoutColumn",priority:1e3,group:"block",isolating:!0,content:"block+",parseHTML(){return[{tag:'div[data-type="layoutColumn"]'},{tag:"div.pubwave-layout__column"}]},renderHTML({HTMLAttributes:e}){return["div",ne.mergeAttributes({"data-type":"layoutColumn",class:"pubwave-layout__column"},e),0]},addNodeView(){return Ae.ReactNodeViewRenderer(Ua)}});async function Va(e,t){const n=(t==null?void 0:t.maxSize)??10485760;if(e.size>n)throw new Error(`Image file is too large. Maximum size is ${n/1024/1024}MB`);if(t!=null&&t.handler)try{return await t.handler(e)}catch(o){console.warn("Custom image upload failed, falling back to base64:",o)}return new Promise((o,r)=>{const a=new FileReader;a.onload=s=>{var c;const l=(c=s.target)==null?void 0:c.result;l?o(l):r(new Error("Failed to read image file"))},a.onerror=()=>{r(new Error("Failed to read image file"))},a.readAsDataURL(e)})}function Ga(e){return yr.extend({addProseMirrorPlugins(){return[new je.Plugin({key:new je.PluginKey("imagePasteHandler"),props:{handlePaste:(t,n)=>{var r;const o=Array.from(((r=n.clipboardData)==null?void 0:r.items)||[]);for(const a of o)if(a.type.indexOf("image")===0){n.preventDefault();const s=a.getAsFile();if(s)return Va(s,e).then(l=>{const{state:c,dispatch:f}=t,u=c.schema.nodes.image;if(u){const m=u.create({src:l}),h=c.tr.replaceSelectionWith(m);f(h)}}).catch(l=>{console.error("Failed to upload image:",l)}),!0}return!1}}})]}}).configure({inline:!1,allowBase64:!0,HTMLAttributes:{class:"pubwave-editor__image"}})}function Ya(e={}){const{headingLevels:t=[1,2,3],imageUpload:n,enableChart:o=!0,enableLayout:r=!0}=e,a=[nr,or.configure({HTMLAttributes:{class:"pubwave-editor__paragraph"}}),rr,mr,ar.configure({levels:t,HTMLAttributes:{class:"pubwave-editor__heading"}}),ir.configure({HTMLAttributes:{class:"pubwave-editor__bullet-list"}}),sr.configure({HTMLAttributes:{class:"pubwave-editor__ordered-list"}}),lr.configure({HTMLAttributes:{class:"pubwave-editor__list-item"}}),cr.configure({HTMLAttributes:{class:"pubwave-editor__task-list"}}),ur.configure({nested:!0,HTMLAttributes:{class:"pubwave-editor__task-item"}}),dr.configure({resizable:!0,HTMLAttributes:{class:"pubwave-editor__table"}}),pr.configure({HTMLAttributes:{class:"pubwave-editor__table-row"}}),fr.configure({HTMLAttributes:{class:"pubwave-editor__table-header"}}),hr.configure({HTMLAttributes:{class:"pubwave-editor__table-cell"}}),br.configure({HTMLAttributes:{class:"pubwave-editor__blockquote"}}),vr.configure({HTMLAttributes:{class:"pubwave-editor__code-block"}}),gr.configure({HTMLAttributes:{class:"pubwave-editor__divider"}}),Ga(n)];return o&&a.push(qa.configure({HTMLAttributes:{class:"pubwave-editor__chart"}})),r&&a.push(Fa.configure({HTMLAttributes:{class:"pubwave-editor__layout"}}),Wa.configure({HTMLAttributes:{class:"pubwave-editor__layout-column"}})),a}const Ka=ne.Mark.create({name:"textColor",excludes:"",addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{color:{default:null,parseHTML:e=>{if(typeof e=="string")return null;const t=e;return t.style.color||t.getAttribute("data-color")||null},renderHTML:e=>e.color?{style:`color: ${e.color}`,"data-color":e.color}:{}}}},parseHTML(){return[{tag:'span[style*="color"]',getAttrs:e=>{if(typeof e=="string")return!1;const t=e,n=t.style.color||t.getAttribute("data-color");return n?{color:n}:!1}}]},renderHTML({HTMLAttributes:e}){return["span",ne.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setColor:e=>({chain:t,state:n})=>{var r,a,s;const o=((a=(r=n.storedMarks)==null?void 0:r.find(l=>l.type.name===this.name))==null?void 0:a.attrs)||((s=n.selection.$from.marks().find(l=>l.type.name===this.name))==null?void 0:s.attrs);return(o==null?void 0:o.color)===e?!0:n.selection.empty?t().focus().unsetMark(this.name).setMark(this.name,{color:e}).run():t().focus().unsetMark(this.name).setMark(this.name,{color:e}).run()},unsetColor:()=>({chain:e})=>e().unsetMark(this.name).run()}}}),Xa=ne.Mark.create({name:"backgroundColor",excludes:"",addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{backgroundColor:{default:null,parseHTML:e=>{if(typeof e=="string")return null;const t=e;return t.style.backgroundColor||t.getAttribute("data-background-color")||null},renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`,"data-background-color":e.backgroundColor}:{}}}},parseHTML(){return[{tag:'span[style*="background-color"]',getAttrs:e=>{if(typeof e=="string")return!1;const t=e,n=t.style.backgroundColor||t.getAttribute("data-background-color");return n?{backgroundColor:n}:!1}}]},renderHTML({HTMLAttributes:e}){return["span",ne.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setBackgroundColor:e=>({chain:t,state:n})=>{var r,a,s;const o=((a=(r=n.storedMarks)==null?void 0:r.find(l=>l.type.name===this.name))==null?void 0:a.attrs)||((s=n.selection.$from.marks().find(l=>l.type.name===this.name))==null?void 0:s.attrs);return(o==null?void 0:o.backgroundColor)===e?!0:n.selection.empty?t().focus().unsetMark(this.name).setMark(this.name,{backgroundColor:e}).run():t().focus().unsetMark(this.name).setMark(this.name,{backgroundColor:e}).run()},unsetBackgroundColor:()=>({chain:e})=>e().unsetMark(this.name).run()}}});function Ja(e={}){const{linkOpenInNewTab:t=!0,linkOpenOnClick:n=!0}=e;return[wr.configure({HTMLAttributes:{class:"pubwave-editor__mark--bold"}}),kr.configure({HTMLAttributes:{class:"pubwave-editor__mark--italic"}}),Cr.configure({HTMLAttributes:{class:"pubwave-editor__mark--underline"}}),Tr.configure({HTMLAttributes:{class:"pubwave-editor__mark--strike"}}),Lr.configure({HTMLAttributes:{class:"pubwave-editor__mark--code"}}),Br.configure({openOnClick:n,HTMLAttributes:{class:"pubwave-editor__mark--link",rel:t?"noopener noreferrer":void 0,target:t?"_blank":void 0},validate:o=>{try{return new URL(o),!0}catch{return o.startsWith("/")||o.startsWith("#")}}}),Ka.configure({HTMLAttributes:{class:"pubwave-editor__mark--text-color"}}),Xa.configure({HTMLAttributes:{class:"pubwave-editor__mark--background-color"}})]}function Za(e,t,n){x.useEffect(()=>{if(e>=0&&n.current&&t.current){const o=t.current,r=n.current,a=o.scrollTop,s=o.clientHeight,l=o.scrollHeight,c=r.offsetTop,f=r.offsetHeight,u=o.querySelector(".pubwave-slash-menu__group"),m=o.querySelector(".pubwave-slash-menu__item"),h=Array.from(o.querySelectorAll(".pubwave-slash-menu__item")).pop(),v=c-a,p=v+f;let g=a;if(v<0)g=c-4,u&&g>u.offsetTop&&(g=Math.max(0,u.offsetTop)),m&&g>m.offsetTop-2&&(g=Math.max(0,m.offsetTop-2));else if(p>s){if(g=c-s+f+4,h){const y=h.offsetTop+h.offsetHeight-s+2;g>y&&(g=y)}g=Math.min(l-s,g)}Math.abs(g-a)>.5&&(o.scrollTop=g)}},[e,t,n])}const Qa={backgroundColor:"var(--pubwave-bg, #ffffff)",border:"1px solid var(--pubwave-border, #e5e7eb)",borderRadius:"var(--pubwave-radius-lg, 8px)",boxShadow:"var(--pubwave-shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05))",maxHeight:"280px",overflowY:"auto",minWidth:"240px",maxWidth:"300px",padding:"var(--pubwave-spacing-1, 4px)",display:"flex",flexDirection:"column"},ei={marginBottom:"0"},ti={padding:"var(--pubwave-spacing-2, 8px) var(--pubwave-spacing-3, 12px) var(--pubwave-spacing-1, 4px)",fontSize:"var(--pubwave-font-size-xs, 11px)",fontWeight:600,color:"var(--pubwave-text-muted, #6b7280)",textTransform:"uppercase",letterSpacing:"0.5px"},ni={display:"flex",alignItems:"center",gap:"var(--pubwave-spacing-3, 12px)",width:"100%",padding:"var(--pubwave-spacing-2, 8px) var(--pubwave-spacing-3, 12px)",border:"none",background:"none",cursor:"pointer",textAlign:"left",borderRadius:"var(--pubwave-radius-md, 6px)",transition:"background-color 0.1s ease",fontSize:"var(--pubwave-font-size-base, 14px)",color:"var(--pubwave-text, #1a1a1a)"},oi={display:"flex",alignItems:"center",justifyContent:"center",width:"var(--pubwave-icon-size, 20px)",height:"var(--pubwave-icon-size, 20px)",color:"var(--pubwave-text-tertiary, #4b5563)",flexShrink:0},ri={fontSize:"var(--pubwave-font-size-base, 14px)",fontWeight:400,color:"var(--pubwave-text, #1a1a1a)"},ai=typeof window>"u",Ot=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement=="function";function Y(e){return Ot?window.requestAnimationFrame(e):0}function vt(){if(!Ot)return!1;const e="ontouchstart"in window||navigator.maxTouchPoints>0,t=window.matchMedia("(pointer: coarse)").matches,n=window.matchMedia("(hover: hover)").matches;return e&&t||e&&!n}function Fn(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("path",{d:"M4 7V4h16v3M9 20h6M12 4v16"})})}function Wn(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("path",{d:"M4 12h8M4 18V6M12 18V6M17 10l3-2v12"})})}function Vn(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("path",{d:"M4 12h8M4 18V6M12 18V6M21 18h-5c0-2.5 5-2.5 5-5 0-1.5-1-3-3-3s-3 1.5-3 3"})})}function Gn(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("path",{d:"M4 12h8M4 18V6M12 18V6M17 12h3M17 18c2.5 0 4-1 4-3s-1.5-3-4-3"})})}function Yn(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"9",y1:"6",x2:"20",y2:"6"}),i.jsx("line",{x1:"9",y1:"12",x2:"20",y2:"12"}),i.jsx("line",{x1:"9",y1:"18",x2:"20",y2:"18"}),i.jsx("circle",{cx:"4",cy:"6",r:"1.5",fill:"currentColor"}),i.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),i.jsx("circle",{cx:"4",cy:"18",r:"1.5",fill:"currentColor"})]})}function Kn(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"10",y1:"6",x2:"21",y2:"6"}),i.jsx("line",{x1:"10",y1:"12",x2:"21",y2:"12"}),i.jsx("line",{x1:"10",y1:"18",x2:"21",y2:"18"}),i.jsx("text",{x:"3",y:"8",fontSize:"8",fill:"currentColor",stroke:"none",children:"1"}),i.jsx("text",{x:"3",y:"14",fontSize:"8",fill:"currentColor",stroke:"none",children:"2"}),i.jsx("text",{x:"3",y:"20",fontSize:"8",fill:"currentColor",stroke:"none",children:"3"})]})}function ii(){return i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("polyline",{points:"6,9 12,15 18,9"})})}function si(){return i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M4 2h5a3 3 0 0 1 0 6H4V2z"}),i.jsx("path",{d:"M4 8h6a3 3 0 0 1 0 6H4V8z"})]})}function li(){return i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("line",{x1:"11",y1:"2",x2:"5",y2:"14"}),i.jsx("line",{x1:"6",y1:"2",x2:"12",y2:"2"}),i.jsx("line",{x1:"4",y1:"14",x2:"10",y2:"14"})]})}function ci(){return i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M4 2v6a4 4 0 0 0 8 0V2"}),i.jsx("line",{x1:"2",y1:"14",x2:"14",y2:"14"})]})}function ui(){return i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("line",{x1:"2",y1:"8",x2:"14",y2:"8"}),i.jsx("path",{d:"M5 4c0-1 1.5-2 3-2s3 .5 3 2c0 1-1 2-3 2"}),i.jsx("path",{d:"M5 12c0 1 1.5 2 3 2s3-.5 3-2c0-1-1-2-3-2"})]})}function di(){return i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("polyline",{points:"5 4 1 8 5 12"}),i.jsx("polyline",{points:"11 4 15 8 11 12"})]})}function pi(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"1.87 0 12.19 16",fill:"currentColor",children:[i.jsx("path",{d:"M12.848 2.8a3.145 3.145 0 0 0-4.448 0L6.918 4.283a.625.625 0 0 0 .884.883l1.482-1.482c.74-.74 1.94-.74 2.68 0l.294.294c.74.74.74 1.94 0 2.68l-1.482 1.483a.625.625 0 1 0 .884.884l1.482-1.482a3.145 3.145 0 0 0 0-4.449z"}),i.jsx("path",{d:"M10.472 5.47a.625.625 0 0 0-.884 0L5.229 9.83a.625.625 0 1 0 .884.883l4.359-4.359a.625.625 0 0 0 0-.883"}),i.jsx("path",{d:"M5.167 6.918a.625.625 0 0 0-.884 0L2.8 8.4a3.146 3.146 0 0 0 0 4.448l.294.294a3.145 3.145 0 0 0 4.449 0l1.482-1.482a.625.625 0 0 0-.884-.884L6.66 12.258c-.74.74-1.94.74-2.68 0l-.295-.294c-.74-.74-.74-1.94 0-2.68L5.167 7.8a.625.625 0 0 0 0-.883"})]})}function fi(){return i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M10 3h4v4M14 3l-7 7M14 11v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h3"})})}function hi(){return i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M13 4L6 11l-3-3"})})}function bi(){return i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("line",{x1:"4",y1:"4",x2:"12",y2:"12"}),i.jsx("line",{x1:"12",y1:"4",x2:"4",y2:"12"})]})}function vi({textColor:e,backgroundColor:t}){const n=t||"transparent",o=!t;return i.jsx("div",{style:{width:"20px",height:"20px",borderRadius:"50%",backgroundColor:n,border:o?"1px solid var(--pubwave-border)":"none",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:e,lineHeight:1},children:"A"})})}function gi(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"3",y:"5",width:"4",height:"4",rx:"0.5"}),i.jsx("rect",{x:"3",y:"14",width:"4",height:"4",rx:"0.5"}),i.jsx("path",{d:"M4 16l1.5 1.5L7 15"}),i.jsx("line",{x1:"10",y1:"7",x2:"21",y2:"7"}),i.jsx("line",{x1:"10",y1:"16",x2:"21",y2:"16"})]})}function mi(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M3 21c3 0 7-1 7-8V5c0-1.25-.75-2-2-2H4c-1.25 0-2 .75-2 2v6c0 1.25.75 2 2 2h4"}),i.jsx("path",{d:"M15 21c3 0 7-1 7-8V5c0-1.25-.75-2-2-2h-4c-1.25 0-2 .75-2 2v6c0 1.25.75 2 2 2h4"})]})}function xi(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("polyline",{points:"16,18 22,12 16,6"}),i.jsx("polyline",{points:"8,6 2,12 8,18"})]})}function yi(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"})})}function wi(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),i.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"}),i.jsx("line",{x1:"9",y1:"4",x2:"9",y2:"20"}),i.jsx("line",{x1:"15",y1:"4",x2:"15",y2:"20"})]})}function ki(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),i.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),i.jsx("polyline",{points:"21,15 16,10 5,21"})]})}function Ci(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"2",y:"3",width:"20",height:"18",rx:"2"}),i.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function Ti(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"2",y:"3",width:"20",height:"18",rx:"2"}),i.jsx("line",{x1:"8",y1:"3",x2:"8",y2:"21"}),i.jsx("line",{x1:"16",y1:"3",x2:"16",y2:"21"})]})}async function Li(e,t){const n=(t==null?void 0:t.maxSize)??10485760;if(e.size>n)throw new Error(`Image file is too large. Maximum size is ${n/1024/1024}MB`);if(t!=null&&t.handler)try{return await t.handler(e)}catch(o){console.warn("Custom image upload failed, falling back to base64:",o)}return new Promise((o,r)=>{const a=new FileReader;a.onload=s=>{var c;const l=(c=s.target)==null?void 0:c.result;l?o(l):r(new Error("Failed to read image file"))},a.onerror=()=>{r(new Error("Failed to read image file"))},a.readAsDataURL(e)})}function Bi(e,t,n){if(!((n==null?void 0:n.accept)??["image/*"]).some(a=>a==="image/*"?t.type.startsWith("image/"):t.type===a)){console.warn("Selected file is not an image");return}Li(t,n).then(a=>{e.chain().focus().setImage({src:a}).run()}).catch(a=>{console.error("Failed to upload image:",a)})}function hn(e,t){const{state:n,dispatch:o}=e.view,r=n.schema.nodes.layout,a=n.schema.nodes.layoutColumn;if(!r||!a){console.warn("Layout node type not found in schema");return}const s=n.schema.nodes.paragraph;if(!s){console.warn("Paragraph node type not found in schema");return}const l=Array.from({length:t},()=>a.create(null,s.create())),c=r.create({columns:t},l),f=n.tr.replaceSelectionWith(c);o(f);const u=f.selection.$from.before();e.chain().focus().setTextSelection(u+2).run()}function Jt(e,t){var r,a,s,l,c,f;const o=(t||{slashMenu:{commands:{paragraph:{title:"Text",description:"Plain text block"},heading1:{title:"Heading 1",description:"Large section heading"},heading2:{title:"Heading 2",description:"Medium section heading"},heading3:{title:"Heading 3",description:"Small section heading"},bulletList:{title:"Bullet List",description:"Create a bulleted list"},orderedList:{title:"Numbered List",description:"Create a numbered list"},taskList:{title:"To-do list",description:"Create a todo list with checkboxes"},image:{title:"Image",description:"Upload or paste an image"},blockquote:{title:"Blockquote",description:"Create a quote block"},codeBlock:{title:"Code",description:"Create a code snippet"},horizontalRule:{title:"Divider",description:"Create a horizontal line"},table:{title:"Table",description:"Insert a table"},layoutTwoColumn:{title:"Two Column Layout",description:"Split content into two side-by-side columns"},layoutThreeColumn:{title:"Three Column Layout",description:"Split content into three side-by-side columns"}}}}).slashMenu.commands;return[{id:"paragraph",title:o.paragraph.title,description:o.paragraph.description,icon:i.jsx(Fn,{}),aliases:["p","text","paragraph"],group:"basic",action:u=>u.chain().focus().setParagraph().run()},{id:"heading1",title:o.heading1.title,description:o.heading1.description,icon:i.jsx(Wn,{}),aliases:["h1","title"],group:"basic",action:u=>u.chain().focus().toggleHeading({level:1}).run()},{id:"heading2",title:o.heading2.title,description:o.heading2.description,icon:i.jsx(Vn,{}),aliases:["h2","subtitle"],group:"basic",action:u=>u.chain().focus().toggleHeading({level:2}).run()},{id:"heading3",title:o.heading3.title,description:o.heading3.description,icon:i.jsx(Gn,{}),aliases:["h3"],group:"basic",action:u=>u.chain().focus().toggleHeading({level:3}).run()},{id:"bulletList",title:o.bulletList.title,description:o.bulletList.description,icon:i.jsx(Yn,{}),aliases:["ul","bullet","unordered","-"],group:"list",action:u=>u.chain().focus().toggleBulletList().run()},{id:"orderedList",title:o.orderedList.title,description:o.orderedList.description,icon:i.jsx(Kn,{}),aliases:["ol","numbered","ordered","1."],group:"list",action:u=>u.chain().focus().toggleOrderedList().run()},{id:"taskList",title:o.taskList.title,description:o.taskList.description,icon:i.jsx(gi,{}),aliases:["todo","task","checkbox","[]"],group:"list",action:u=>u.chain().focus().toggleTaskList().run()},{id:"image",title:o.image.title,description:o.image.description,icon:i.jsx(ki,{}),aliases:["img","picture","photo","pic"],group:"media",action:u=>{const m=document.createElement("input");m.type="file";const h=(e==null?void 0:e.accept)??["image/*"];m.accept=h.join(","),m.style.display="none",m.onchange=v=>{var g;const p=(g=v.target.files)==null?void 0:g[0];p&&Bi(u,p,e),document.body.removeChild(m)},document.body.appendChild(m),m.click()}},{id:"blockquote",title:o.blockquote.title,description:o.blockquote.description,icon:i.jsx(mi,{}),aliases:["quote","blockquote",">"],group:"advanced",action:u=>u.chain().focus().toggleBlockquote().run()},{id:"codeBlock",title:o.codeBlock.title,description:o.codeBlock.description,icon:i.jsx(xi,{}),aliases:["code","pre","snippet","```"],group:"advanced",action:u=>u.chain().focus().toggleCodeBlock().run()},{id:"horizontalRule",title:o.horizontalRule.title,description:o.horizontalRule.description,icon:i.jsx(yi,{}),aliases:["hr","divider","line","---"],group:"advanced",action:u=>{u.chain().focus().setHorizontalRule().run(),Y(()=>{const{state:m}=u.view,{$from:h}=m.selection;let v=-1;const p=h.pos;if(m.doc.descendants((g,C)=>{if(g.type.name==="horizontalRule"){const y=Math.abs(C-p);(v===-1||Math.abs(v-p)>y)&&(v=C)}}),v!==-1){const g=m.doc.nodeAt(v);if(g){const C=v+g.nodeSize;u.chain().setTextSelection(C).insertContent({type:"paragraph"}).focus().run()}}else u.chain().focus().createParagraphNear().run()})}},{id:"table",title:((r=o.table)==null?void 0:r.title)??"Table",description:((a=o.table)==null?void 0:a.description)??"Insert a table",icon:i.jsx(wi,{}),aliases:["table","grid","tbl"],group:"advanced",action:u=>u.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()},{id:"layoutTwoColumn",title:((s=o.layoutTwoColumn)==null?void 0:s.title)??"Two Column Layout",description:((l=o.layoutTwoColumn)==null?void 0:l.description)??"Split content into two side-by-side columns",icon:i.jsx(Ci,{}),aliases:["layout2","two columns","2 col","columns"],group:"layout",action:u=>hn(u,2)},{id:"layoutThreeColumn",title:((c=o.layoutThreeColumn)==null?void 0:c.title)??"Three Column Layout",description:((f=o.layoutThreeColumn)==null?void 0:f.description)??"Split content into three side-by-side columns",icon:i.jsx(Ti,{}),aliases:["layout3","three columns","3 col"],group:"layout",action:u=>hn(u,3)}]}const Xn=Jt();function Ai(e,t){if(!t)return e;const n=t.toLowerCase();return e.filter(o=>{var l;const r=o.title.toLowerCase(),a=r.startsWith(n)||r.includes(` ${n}`),s=((l=o.aliases)==null?void 0:l.some(c=>c.toLowerCase().startsWith(n)))??!1;return a||s})}var ee="top",ce="bottom",ue="right",te="left",Zt="auto",gt=[ee,ce,ue,te],Qe="start",dt="end",ji="clippingParents",Jn="viewport",rt="popper",Si="reference",bn=gt.reduce(function(e,t){return e.concat([t+"-"+Qe,t+"-"+dt])},[]),Zn=[].concat(gt,[Zt]).reduce(function(e,t){return e.concat([t,t+"-"+Qe,t+"-"+dt])},[]),Mi="beforeRead",Pi="read",Di="afterRead",Ii="beforeMain",Ri="main",Ei="afterMain",Oi="beforeWrite",_i="write",Ni="afterWrite",Hi=[Mi,Pi,Di,Ii,Ri,Ei,Oi,_i,Ni];function me(e){return e?(e.nodeName||"").toLowerCase():null}function re(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Fe(e){var t=re(e).Element;return e instanceof t||e instanceof Element}function le(e){var t=re(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Qt(e){if(typeof ShadowRoot>"u")return!1;var t=re(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function $i(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var o=t.styles[n]||{},r=t.attributes[n]||{},a=t.elements[n];!le(a)||!me(a)||(Object.assign(a.style,o),Object.keys(r).forEach(function(s){var l=r[s];l===!1?a.removeAttribute(s):a.setAttribute(s,l===!0?"":l)}))})}function zi(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(o){var r=t.elements[o],a=t.attributes[o]||{},s=Object.keys(t.styles.hasOwnProperty(o)?t.styles[o]:n[o]),l=s.reduce(function(c,f){return c[f]="",c},{});!le(r)||!me(r)||(Object.assign(r.style,l),Object.keys(a).forEach(function(c){r.removeAttribute(c)}))})}}const Qn={name:"applyStyles",enabled:!0,phase:"write",fn:$i,effect:zi,requires:["computeStyles"]};function ge(e){return e.split("-")[0]}var Ue=Math.max,Dt=Math.min,et=Math.round;function Wt(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function eo(){return!/^((?!chrome|android).)*safari/i.test(Wt())}function tt(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var o=e.getBoundingClientRect(),r=1,a=1;t&&le(e)&&(r=e.offsetWidth>0&&et(o.width)/e.offsetWidth||1,a=e.offsetHeight>0&&et(o.height)/e.offsetHeight||1);var s=Fe(e)?re(e):window,l=s.visualViewport,c=!eo()&&n,f=(o.left+(c&&l?l.offsetLeft:0))/r,u=(o.top+(c&&l?l.offsetTop:0))/a,m=o.width/r,h=o.height/a;return{width:m,height:h,top:u,right:f+m,bottom:u+h,left:f,x:f,y:u}}function en(e){var t=tt(e),n=e.offsetWidth,o=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-o)<=1&&(o=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:o}}function to(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Qt(n)){var o=t;do{if(o&&e.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function Se(e){return re(e).getComputedStyle(e)}function qi(e){return["table","td","th"].indexOf(me(e))>=0}function De(e){return((Fe(e)?e.ownerDocument:e.document)||window.document).documentElement}function _t(e){return me(e)==="html"?e:e.assignedSlot||e.parentNode||(Qt(e)?e.host:null)||De(e)}function vn(e){return!le(e)||Se(e).position==="fixed"?null:e.offsetParent}function Ui(e){var t=/firefox/i.test(Wt()),n=/Trident/i.test(Wt());if(n&&le(e)){var o=Se(e);if(o.position==="fixed")return null}var r=_t(e);for(Qt(r)&&(r=r.host);le(r)&&["html","body"].indexOf(me(r))<0;){var a=Se(r);if(a.transform!=="none"||a.perspective!=="none"||a.contain==="paint"||["transform","perspective"].indexOf(a.willChange)!==-1||t&&a.willChange==="filter"||t&&a.filter&&a.filter!=="none")return r;r=r.parentNode}return null}function mt(e){for(var t=re(e),n=vn(e);n&&qi(n)&&Se(n).position==="static";)n=vn(n);return n&&(me(n)==="html"||me(n)==="body"&&Se(n).position==="static")?t:n||Ui(e)||t}function tn(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function lt(e,t,n){return Ue(e,Dt(t,n))}function Fi(e,t,n){var o=lt(e,t,n);return o>n?n:o}function no(){return{top:0,right:0,bottom:0,left:0}}function oo(e){return Object.assign({},no(),e)}function ro(e,t){return t.reduce(function(n,o){return n[o]=e,n},{})}var Wi=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,oo(typeof t!="number"?t:ro(t,gt))};function Vi(e){var t,n=e.state,o=e.name,r=e.options,a=n.elements.arrow,s=n.modifiersData.popperOffsets,l=ge(n.placement),c=tn(l),f=[te,ue].indexOf(l)>=0,u=f?"height":"width";if(!(!a||!s)){var m=Wi(r.padding,n),h=en(a),v=c==="y"?ee:te,p=c==="y"?ce:ue,g=n.rects.reference[u]+n.rects.reference[c]-s[c]-n.rects.popper[u],C=s[c]-n.rects.reference[c],y=mt(a),S=y?c==="y"?y.clientHeight||0:y.clientWidth||0:0,T=g/2-C/2,d=m[v],A=S-h[u]-m[p],k=S/2-h[u]/2+T,j=lt(d,k,A),I=c;n.modifiersData[o]=(t={},t[I]=j,t.centerOffset=j-k,t)}}function Gi(e){var t=e.state,n=e.options,o=n.element,r=o===void 0?"[data-popper-arrow]":o;r!=null&&(typeof r=="string"&&(r=t.elements.popper.querySelector(r),!r)||to(t.elements.popper,r)&&(t.elements.arrow=r))}const Yi={name:"arrow",enabled:!0,phase:"main",fn:Vi,effect:Gi,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function nt(e){return e.split("-")[1]}var Ki={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Xi(e,t){var n=e.x,o=e.y,r=t.devicePixelRatio||1;return{x:et(n*r)/r||0,y:et(o*r)/r||0}}function gn(e){var t,n=e.popper,o=e.popperRect,r=e.placement,a=e.variation,s=e.offsets,l=e.position,c=e.gpuAcceleration,f=e.adaptive,u=e.roundOffsets,m=e.isFixed,h=s.x,v=h===void 0?0:h,p=s.y,g=p===void 0?0:p,C=typeof u=="function"?u({x:v,y:g}):{x:v,y:g};v=C.x,g=C.y;var y=s.hasOwnProperty("x"),S=s.hasOwnProperty("y"),T=te,d=ee,A=window;if(f){var k=mt(n),j="clientHeight",I="clientWidth";if(k===re(n)&&(k=De(n),Se(k).position!=="static"&&l==="absolute"&&(j="scrollHeight",I="scrollWidth")),k=k,r===ee||(r===te||r===ue)&&a===dt){d=ce;var N=m&&k===A&&A.visualViewport?A.visualViewport.height:k[j];g-=N-o.height,g*=c?1:-1}if(r===te||(r===ee||r===ce)&&a===dt){T=ue;var B=m&&k===A&&A.visualViewport?A.visualViewport.width:k[I];v-=B-o.width,v*=c?1:-1}}var _=Object.assign({position:l},f&&Ki),b=u===!0?Xi({x:v,y:g},re(n)):{x:v,y:g};if(v=b.x,g=b.y,c){var L;return Object.assign({},_,(L={},L[d]=S?"0":"",L[T]=y?"0":"",L.transform=(A.devicePixelRatio||1)<=1?"translate("+v+"px, "+g+"px)":"translate3d("+v+"px, "+g+"px, 0)",L))}return Object.assign({},_,(t={},t[d]=S?g+"px":"",t[T]=y?v+"px":"",t.transform="",t))}function Ji(e){var t=e.state,n=e.options,o=n.gpuAcceleration,r=o===void 0?!0:o,a=n.adaptive,s=a===void 0?!0:a,l=n.roundOffsets,c=l===void 0?!0:l,f={placement:ge(t.placement),variation:nt(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:r,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,gn(Object.assign({},f,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:s,roundOffsets:c})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,gn(Object.assign({},f,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const Zi={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Ji,data:{}};var Bt={passive:!0};function Qi(e){var t=e.state,n=e.instance,o=e.options,r=o.scroll,a=r===void 0?!0:r,s=o.resize,l=s===void 0?!0:s,c=re(t.elements.popper),f=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&f.forEach(function(u){u.addEventListener("scroll",n.update,Bt)}),l&&c.addEventListener("resize",n.update,Bt),function(){a&&f.forEach(function(u){u.removeEventListener("scroll",n.update,Bt)}),l&&c.removeEventListener("resize",n.update,Bt)}}const es={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Qi,data:{}};var ts={left:"right",right:"left",bottom:"top",top:"bottom"};function St(e){return e.replace(/left|right|bottom|top/g,function(t){return ts[t]})}var ns={start:"end",end:"start"};function mn(e){return e.replace(/start|end/g,function(t){return ns[t]})}function nn(e){var t=re(e),n=t.pageXOffset,o=t.pageYOffset;return{scrollLeft:n,scrollTop:o}}function on(e){return tt(De(e)).left+nn(e).scrollLeft}function os(e,t){var n=re(e),o=De(e),r=n.visualViewport,a=o.clientWidth,s=o.clientHeight,l=0,c=0;if(r){a=r.width,s=r.height;var f=eo();(f||!f&&t==="fixed")&&(l=r.offsetLeft,c=r.offsetTop)}return{width:a,height:s,x:l+on(e),y:c}}function rs(e){var t,n=De(e),o=nn(e),r=(t=e.ownerDocument)==null?void 0:t.body,a=Ue(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=Ue(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),l=-o.scrollLeft+on(e),c=-o.scrollTop;return Se(r||n).direction==="rtl"&&(l+=Ue(n.clientWidth,r?r.clientWidth:0)-a),{width:a,height:s,x:l,y:c}}function rn(e){var t=Se(e),n=t.overflow,o=t.overflowX,r=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+o)}function ao(e){return["html","body","#document"].indexOf(me(e))>=0?e.ownerDocument.body:le(e)&&rn(e)?e:ao(_t(e))}function ct(e,t){var n;t===void 0&&(t=[]);var o=ao(e),r=o===((n=e.ownerDocument)==null?void 0:n.body),a=re(o),s=r?[a].concat(a.visualViewport||[],rn(o)?o:[]):o,l=t.concat(s);return r?l:l.concat(ct(_t(s)))}function Vt(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function as(e,t){var n=tt(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function xn(e,t,n){return t===Jn?Vt(os(e,n)):Fe(t)?as(t,n):Vt(rs(De(e)))}function is(e){var t=ct(_t(e)),n=["absolute","fixed"].indexOf(Se(e).position)>=0,o=n&&le(e)?mt(e):e;return Fe(o)?t.filter(function(r){return Fe(r)&&to(r,o)&&me(r)!=="body"}):[]}function ss(e,t,n,o){var r=t==="clippingParents"?is(e):[].concat(t),a=[].concat(r,[n]),s=a[0],l=a.reduce(function(c,f){var u=xn(e,f,o);return c.top=Ue(u.top,c.top),c.right=Dt(u.right,c.right),c.bottom=Dt(u.bottom,c.bottom),c.left=Ue(u.left,c.left),c},xn(e,s,o));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function io(e){var t=e.reference,n=e.element,o=e.placement,r=o?ge(o):null,a=o?nt(o):null,s=t.x+t.width/2-n.width/2,l=t.y+t.height/2-n.height/2,c;switch(r){case ee:c={x:s,y:t.y-n.height};break;case ce:c={x:s,y:t.y+t.height};break;case ue:c={x:t.x+t.width,y:l};break;case te:c={x:t.x-n.width,y:l};break;default:c={x:t.x,y:t.y}}var f=r?tn(r):null;if(f!=null){var u=f==="y"?"height":"width";switch(a){case Qe:c[f]=c[f]-(t[u]/2-n[u]/2);break;case dt:c[f]=c[f]+(t[u]/2-n[u]/2);break}}return c}function pt(e,t){t===void 0&&(t={});var n=t,o=n.placement,r=o===void 0?e.placement:o,a=n.strategy,s=a===void 0?e.strategy:a,l=n.boundary,c=l===void 0?ji:l,f=n.rootBoundary,u=f===void 0?Jn:f,m=n.elementContext,h=m===void 0?rt:m,v=n.altBoundary,p=v===void 0?!1:v,g=n.padding,C=g===void 0?0:g,y=oo(typeof C!="number"?C:ro(C,gt)),S=h===rt?Si:rt,T=e.rects.popper,d=e.elements[p?S:h],A=ss(Fe(d)?d:d.contextElement||De(e.elements.popper),c,u,s),k=tt(e.elements.reference),j=io({reference:k,element:T,placement:r}),I=Vt(Object.assign({},T,j)),N=h===rt?I:k,B={top:A.top-N.top+y.top,bottom:N.bottom-A.bottom+y.bottom,left:A.left-N.left+y.left,right:N.right-A.right+y.right},_=e.modifiersData.offset;if(h===rt&&_){var b=_[r];Object.keys(B).forEach(function(L){var M=[ue,ce].indexOf(L)>=0?1:-1,E=[ee,ce].indexOf(L)>=0?"y":"x";B[L]+=b[E]*M})}return B}function ls(e,t){t===void 0&&(t={});var n=t,o=n.placement,r=n.boundary,a=n.rootBoundary,s=n.padding,l=n.flipVariations,c=n.allowedAutoPlacements,f=c===void 0?Zn:c,u=nt(o),m=u?l?bn:bn.filter(function(p){return nt(p)===u}):gt,h=m.filter(function(p){return f.indexOf(p)>=0});h.length===0&&(h=m);var v=h.reduce(function(p,g){return p[g]=pt(e,{placement:g,boundary:r,rootBoundary:a,padding:s})[ge(g)],p},{});return Object.keys(v).sort(function(p,g){return v[p]-v[g]})}function cs(e){if(ge(e)===Zt)return[];var t=St(e);return[mn(e),t,mn(t)]}function us(e){var t=e.state,n=e.options,o=e.name;if(!t.modifiersData[o]._skip){for(var r=n.mainAxis,a=r===void 0?!0:r,s=n.altAxis,l=s===void 0?!0:s,c=n.fallbackPlacements,f=n.padding,u=n.boundary,m=n.rootBoundary,h=n.altBoundary,v=n.flipVariations,p=v===void 0?!0:v,g=n.allowedAutoPlacements,C=t.options.placement,y=ge(C),S=y===C,T=c||(S||!p?[St(C)]:cs(C)),d=[C].concat(T).reduce(function(Z,Q){return Z.concat(ge(Q)===Zt?ls(t,{placement:Q,boundary:u,rootBoundary:m,padding:f,flipVariations:p,allowedAutoPlacements:g}):Q)},[]),A=t.rects.reference,k=t.rects.popper,j=new Map,I=!0,N=d[0],B=0;B<d.length;B++){var _=d[B],b=ge(_),L=nt(_)===Qe,M=[ee,ce].indexOf(b)>=0,E=M?"width":"height",$=pt(t,{placement:_,boundary:u,rootBoundary:m,altBoundary:h,padding:f}),q=M?L?ue:te:L?ce:ee;A[E]>k[E]&&(q=St(q));var H=St(q),P=[];if(a&&P.push($[b]<=0),l&&P.push($[q]<=0,$[H]<=0),P.every(function(Z){return Z})){N=_,I=!1;break}j.set(_,P)}if(I)for(var R=p?3:1,W=function(Q){var ae=d.find(function(ye){var ie=j.get(ye);if(ie)return ie.slice(0,Q).every(function(we){return we})});if(ae)return N=ae,"break"},V=R;V>0;V--){var J=W(V);if(J==="break")break}t.placement!==N&&(t.modifiersData[o]._skip=!0,t.placement=N,t.reset=!0)}}const ds={name:"flip",enabled:!0,phase:"main",fn:us,requiresIfExists:["offset"],data:{_skip:!1}};function yn(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function wn(e){return[ee,ue,ce,te].some(function(t){return e[t]>=0})}function ps(e){var t=e.state,n=e.name,o=t.rects.reference,r=t.rects.popper,a=t.modifiersData.preventOverflow,s=pt(t,{elementContext:"reference"}),l=pt(t,{altBoundary:!0}),c=yn(s,o),f=yn(l,r,a),u=wn(c),m=wn(f);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:f,isReferenceHidden:u,hasPopperEscaped:m},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":m})}const fs={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:ps};function hs(e,t,n){var o=ge(e),r=[te,ee].indexOf(o)>=0?-1:1,a=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,s=a[0],l=a[1];return s=s||0,l=(l||0)*r,[te,ue].indexOf(o)>=0?{x:l,y:s}:{x:s,y:l}}function bs(e){var t=e.state,n=e.options,o=e.name,r=n.offset,a=r===void 0?[0,0]:r,s=Zn.reduce(function(u,m){return u[m]=hs(m,t.rects,a),u},{}),l=s[t.placement],c=l.x,f=l.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=f),t.modifiersData[o]=s}const vs={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:bs};function gs(e){var t=e.state,n=e.name;t.modifiersData[n]=io({reference:t.rects.reference,element:t.rects.popper,placement:t.placement})}const ms={name:"popperOffsets",enabled:!0,phase:"read",fn:gs,data:{}};function xs(e){return e==="x"?"y":"x"}function ys(e){var t=e.state,n=e.options,o=e.name,r=n.mainAxis,a=r===void 0?!0:r,s=n.altAxis,l=s===void 0?!1:s,c=n.boundary,f=n.rootBoundary,u=n.altBoundary,m=n.padding,h=n.tether,v=h===void 0?!0:h,p=n.tetherOffset,g=p===void 0?0:p,C=pt(t,{boundary:c,rootBoundary:f,padding:m,altBoundary:u}),y=ge(t.placement),S=nt(t.placement),T=!S,d=tn(y),A=xs(d),k=t.modifiersData.popperOffsets,j=t.rects.reference,I=t.rects.popper,N=typeof g=="function"?g(Object.assign({},t.rects,{placement:t.placement})):g,B=typeof N=="number"?{mainAxis:N,altAxis:N}:Object.assign({mainAxis:0,altAxis:0},N),_=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,b={x:0,y:0};if(k){if(a){var L,M=d==="y"?ee:te,E=d==="y"?ce:ue,$=d==="y"?"height":"width",q=k[d],H=q+C[M],P=q-C[E],R=v?-I[$]/2:0,W=S===Qe?j[$]:I[$],V=S===Qe?-I[$]:-j[$],J=t.elements.arrow,Z=v&&J?en(J):{width:0,height:0},Q=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:no(),ae=Q[M],ye=Q[E],ie=lt(0,j[$],Z[$]),we=T?j[$]/2-R-ie-ae-B.mainAxis:W-ie-ae-B.mainAxis,de=T?-j[$]/2+R+ie+ye+B.mainAxis:V+ie+ye+B.mainAxis,ke=t.elements.arrow&&mt(t.elements.arrow),Ee=ke?d==="y"?ke.clientTop||0:ke.clientLeft||0:0,Ce=(L=_==null?void 0:_[d])!=null?L:0,Oe=q+we-Ce-Ee,pe=q+de-Ce,Te=lt(v?Dt(H,Oe):H,q,v?Ue(P,pe):P);k[d]=Te,b[d]=Te-q}if(l){var Me,_e=d==="x"?ee:te,fe=d==="x"?ce:ue,he=k[A],be=A==="y"?"height":"width",Ne=he+C[_e],G=he-C[fe],ot=[ee,te].indexOf(y)!==-1,yt=(Me=_==null?void 0:_[A])!=null?Me:0,wt=ot?Ne:he-j[be]-I[be]-yt+B.altAxis,kt=ot?he+j[be]+I[be]-yt-B.altAxis:G,Ct=v&&ot?Fi(wt,he,kt):lt(v?wt:Ne,he,v?kt:G);k[A]=Ct,b[A]=Ct-he}t.modifiersData[o]=b}}const ws={name:"preventOverflow",enabled:!0,phase:"main",fn:ys,requiresIfExists:["offset"]};function ks(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Cs(e){return e===re(e)||!le(e)?nn(e):ks(e)}function Ts(e){var t=e.getBoundingClientRect(),n=et(t.width)/e.offsetWidth||1,o=et(t.height)/e.offsetHeight||1;return n!==1||o!==1}function Ls(e,t,n){n===void 0&&(n=!1);var o=le(t),r=le(t)&&Ts(t),a=De(t),s=tt(e,r,n),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(o||!o&&!n)&&((me(t)!=="body"||rn(a))&&(l=Cs(t)),le(t)?(c=tt(t,!0),c.x+=t.clientLeft,c.y+=t.clientTop):a&&(c.x=on(a))),{x:s.left+l.scrollLeft-c.x,y:s.top+l.scrollTop-c.y,width:s.width,height:s.height}}function Bs(e){var t=new Map,n=new Set,o=[];e.forEach(function(a){t.set(a.name,a)});function r(a){n.add(a.name);var s=[].concat(a.requires||[],a.requiresIfExists||[]);s.forEach(function(l){if(!n.has(l)){var c=t.get(l);c&&r(c)}}),o.push(a)}return e.forEach(function(a){n.has(a.name)||r(a)}),o}function As(e){var t=Bs(e);return Hi.reduce(function(n,o){return n.concat(t.filter(function(r){return r.phase===o}))},[])}function js(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function Ss(e){var t=e.reduce(function(n,o){var r=n[o.name];return n[o.name]=r?Object.assign({},r,o,{options:Object.assign({},r.options,o.options),data:Object.assign({},r.data,o.data)}):o,n},{});return Object.keys(t).map(function(n){return t[n]})}var kn={placement:"bottom",modifiers:[],strategy:"absolute"};function Cn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(o){return!(o&&typeof o.getBoundingClientRect=="function")})}function Ms(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,o=n===void 0?[]:n,r=t.defaultOptions,a=r===void 0?kn:r;return function(l,c,f){f===void 0&&(f=a);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},kn,a),modifiersData:{},elements:{reference:l,popper:c},attributes:{},styles:{}},m=[],h=!1,v={state:u,setOptions:function(y){var S=typeof y=="function"?y(u.options):y;g(),u.options=Object.assign({},a,u.options,S),u.scrollParents={reference:Fe(l)?ct(l):l.contextElement?ct(l.contextElement):[],popper:ct(c)};var T=As(Ss([].concat(o,u.options.modifiers)));return u.orderedModifiers=T.filter(function(d){return d.enabled}),p(),v.update()},forceUpdate:function(){if(!h){var y=u.elements,S=y.reference,T=y.popper;if(Cn(S,T)){u.rects={reference:Ls(S,mt(T),u.options.strategy==="fixed"),popper:en(T)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(B){return u.modifiersData[B.name]=Object.assign({},B.data)});for(var d=0;d<u.orderedModifiers.length;d++){if(u.reset===!0){u.reset=!1,d=-1;continue}var A=u.orderedModifiers[d],k=A.fn,j=A.options,I=j===void 0?{}:j,N=A.name;typeof k=="function"&&(u=k({state:u,options:I,name:N,instance:v})||u)}}}},update:js(function(){return new Promise(function(C){v.forceUpdate(),C(u)})}),destroy:function(){g(),h=!0}};if(!Cn(l,c))return v;v.setOptions(f).then(function(C){!h&&f.onFirstUpdate&&f.onFirstUpdate(C)});function p(){u.orderedModifiers.forEach(function(C){var y=C.name,S=C.options,T=S===void 0?{}:S,d=C.effect;if(typeof d=="function"){var A=d({state:u,name:y,instance:v,options:T}),k=function(){};m.push(A||k)}})}function g(){m.forEach(function(C){return C()}),m=[]}return v}}var Ps=[es,ms,Zi,Qn,vs,ds,ws,Yi,fs],Ds=Ms({defaultModifiers:Ps}),Is="tippy-box",so="tippy-content",Rs="tippy-backdrop",lo="tippy-arrow",co="tippy-svg-arrow",ze={passive:!0,capture:!0},uo=function(){return document.body};function Es(e,t){return{}.hasOwnProperty.call(e,t)}function $t(e,t,n){if(Array.isArray(e)){var o=e[t];return o??(Array.isArray(n)?n[t]:n)}return e}function an(e,t){var n={}.toString.call(e);return n.indexOf("[object")===0&&n.indexOf(t+"]")>-1}function po(e,t){return typeof e=="function"?e.apply(void 0,t):e}function Tn(e,t){if(t===0)return e;var n;return function(o){clearTimeout(n),n=setTimeout(function(){e(o)},t)}}function Os(e,t){var n=Object.assign({},e);return t.forEach(function(o){delete n[o]}),n}function _s(e){return e.split(/\s+/).filter(Boolean)}function Ze(e){return[].concat(e)}function Ln(e,t){e.indexOf(t)===-1&&e.push(t)}function Ns(e){return e.filter(function(t,n){return e.indexOf(t)===n})}function Hs(e){return e.split("-")[0]}function It(e){return[].slice.call(e)}function Bn(e){return Object.keys(e).reduce(function(t,n){return e[n]!==void 0&&(t[n]=e[n]),t},{})}function ut(){return document.createElement("div")}function ft(e){return["Element","Fragment"].some(function(t){return an(e,t)})}function $s(e){return an(e,"NodeList")}function zs(e){return an(e,"MouseEvent")}function qs(e){return!!(e&&e._tippy&&e._tippy.reference===e)}function Us(e){return ft(e)?[e]:$s(e)?It(e):Array.isArray(e)?e:It(document.querySelectorAll(e))}function zt(e,t){e.forEach(function(n){n&&(n.style.transitionDuration=t+"ms")})}function An(e,t){e.forEach(function(n){n&&n.setAttribute("data-state",t)})}function Fs(e){var t,n=Ze(e),o=n[0];return o!=null&&(t=o.ownerDocument)!=null&&t.body?o.ownerDocument:document}function Ws(e,t){var n=t.clientX,o=t.clientY;return e.every(function(r){var a=r.popperRect,s=r.popperState,l=r.props,c=l.interactiveBorder,f=Hs(s.placement),u=s.modifiersData.offset;if(!u)return!0;var m=f==="bottom"?u.top.y:0,h=f==="top"?u.bottom.y:0,v=f==="right"?u.left.x:0,p=f==="left"?u.right.x:0,g=a.top-o+m>c,C=o-a.bottom-h>c,y=a.left-n+v>c,S=n-a.right-p>c;return g||C||y||S})}function qt(e,t,n){var o=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){e[o](r,n)})}function jn(e,t){for(var n=t;n;){var o;if(e.contains(n))return!0;n=n.getRootNode==null||(o=n.getRootNode())==null?void 0:o.host}return!1}var ve={isTouch:!1},Sn=0;function Vs(){ve.isTouch||(ve.isTouch=!0,window.performance&&document.addEventListener("mousemove",fo))}function fo(){var e=performance.now();e-Sn<20&&(ve.isTouch=!1,document.removeEventListener("mousemove",fo)),Sn=e}function Gs(){var e=document.activeElement;if(qs(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}function Ys(){document.addEventListener("touchstart",Vs,ze),window.addEventListener("blur",Gs)}var Ks=typeof window<"u"&&typeof document<"u",Xs=Ks?!!window.msCrypto:!1;function Je(e){var t=e==="destroy"?"n already-":" ";return[e+"() was called on a"+t+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function Mn(e){var t=/[ \t]{2,}/g,n=/^[ \t]*/gm;return e.replace(t," ").replace(n,"").trim()}function Js(e){return Mn(`
2
2
  %ctippy.js
3
3
 
4
- %c`+Sn(e)+`
4
+ %c`+Mn(e)+`
5
5
 
6
6
  %c👷‍ This is a development-only message. It will be removed in production.
7
- `)}function fo(e){return[qs(e),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var lt;process.env.NODE_ENV!=="production"&&Us();function Us(){lt=new Set}function me(e,t){if(e&&!lt.has(t)){var n;lt.add(t),(n=console).warn.apply(n,fo(t))}}function Yt(e,t){if(e&&!lt.has(t)){var n;lt.add(t),(n=console).error.apply(n,fo(t))}}function Fs(e){var t=!e,n=Object.prototype.toString.call(e)==="[object Object]"&&!e.addEventListener;Yt(t,["tippy() was passed","`"+String(e)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Yt(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var ho={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Ws={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},oe=Object.assign({appendTo:co,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},ho,Ws),Vs=Object.keys(oe),Gs=function(t){process.env.NODE_ENV!=="production"&&vo(t,[]);var n=Object.keys(t);n.forEach(function(o){oe[o]=t[o]})};function bo(e){var t=e.plugins||[],n=t.reduce(function(o,r){var a=r.name,s=r.defaultValue;if(a){var l;o[a]=e[a]!==void 0?e[a]:(l=oe[a])!=null?l:s}return o},{});return Object.assign({},e,n)}function Ys(e,t){var n=t?Object.keys(bo(Object.assign({},oe,{plugins:t}))):Vs,o=n.reduce(function(r,a){var s=(e.getAttribute("data-tippy-"+a)||"").trim();if(!s)return r;if(a==="content")r[a]=s;else try{r[a]=JSON.parse(s)}catch{r[a]=s}return r},{});return o}function Mn(e,t){var n=Object.assign({},t,{content:uo(t.content,[e])},t.ignoreAttributes?{}:Ys(e,t.plugins));return n.aria=Object.assign({},oe.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?t.interactive:n.aria.expanded,content:n.aria.content==="auto"?t.interactive?null:"describedby":n.aria.content},n}function vo(e,t){e===void 0&&(e={}),t===void 0&&(t=[]);var n=Object.keys(e);n.forEach(function(o){var r=As(oe,Object.keys(ho)),a=!Bs(r,o);a&&(a=t.filter(function(s){return s.name===o}).length===0),me(a,["`"+o+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",`
7
+ `)}function ho(e){return[Js(e),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var ht;process.env.NODE_ENV!=="production"&&Zs();function Zs(){ht=new Set}function Le(e,t){if(e&&!ht.has(t)){var n;ht.add(t),(n=console).warn.apply(n,ho(t))}}function Gt(e,t){if(e&&!ht.has(t)){var n;ht.add(t),(n=console).error.apply(n,ho(t))}}function Qs(e){var t=!e,n=Object.prototype.toString.call(e)==="[object Object]"&&!e.addEventListener;Gt(t,["tippy() was passed","`"+String(e)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Gt(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var bo={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},el={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},oe=Object.assign({appendTo:uo,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},bo,el),tl=Object.keys(oe),nl=function(t){process.env.NODE_ENV!=="production"&&go(t,[]);var n=Object.keys(t);n.forEach(function(o){oe[o]=t[o]})};function vo(e){var t=e.plugins||[],n=t.reduce(function(o,r){var a=r.name,s=r.defaultValue;if(a){var l;o[a]=e[a]!==void 0?e[a]:(l=oe[a])!=null?l:s}return o},{});return Object.assign({},e,n)}function ol(e,t){var n=t?Object.keys(vo(Object.assign({},oe,{plugins:t}))):tl,o=n.reduce(function(r,a){var s=(e.getAttribute("data-tippy-"+a)||"").trim();if(!s)return r;if(a==="content")r[a]=s;else try{r[a]=JSON.parse(s)}catch{r[a]=s}return r},{});return o}function Pn(e,t){var n=Object.assign({},t,{content:po(t.content,[e])},t.ignoreAttributes?{}:ol(e,t.plugins));return n.aria=Object.assign({},oe.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?t.interactive:n.aria.expanded,content:n.aria.content==="auto"?t.interactive?null:"describedby":n.aria.content},n}function go(e,t){e===void 0&&(e={}),t===void 0&&(t=[]);var n=Object.keys(e);n.forEach(function(o){var r=Os(oe,Object.keys(bo)),a=!Es(r,o);a&&(a=t.filter(function(s){return s.name===o}).length===0),Le(a,["`"+o+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",`
8
8
 
9
9
  `,`All props: https://atomiks.github.io/tippyjs/v6/all-props/
10
- `,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var Ks=function(){return"innerHTML"};function Kt(e,t){e[Ks()]=t}function Pn(e){var t=rt();return e===!0?t.className=so:(t.className=lo,st(e)?t.appendChild(e):Kt(t,e)),t}function Dn(e,t){st(t.content)?(Kt(e,""),e.appendChild(t.content)):typeof t.content!="function"&&(t.allowHTML?Kt(e,t.content):e.textContent=t.content)}function Xt(e){var t=e.firstElementChild,n=Rt(t.children);return{box:t,content:n.find(function(o){return o.classList.contains(io)}),arrow:n.find(function(o){return o.classList.contains(so)||o.classList.contains(lo)}),backdrop:n.find(function(o){return o.classList.contains(Ls)})}}function go(e){var t=rt(),n=rt();n.className=Ts,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var o=rt();o.className=io,o.setAttribute("data-state","hidden"),Dn(o,e.props),t.appendChild(n),n.appendChild(o),r(e.props,e.props);function r(a,s){var l=Xt(t),c=l.box,p=l.content,u=l.arrow;s.theme?c.setAttribute("data-theme",s.theme):c.removeAttribute("data-theme"),typeof s.animation=="string"?c.setAttribute("data-animation",s.animation):c.removeAttribute("data-animation"),s.inertia?c.setAttribute("data-inertia",""):c.removeAttribute("data-inertia"),c.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?c.setAttribute("role",s.role):c.removeAttribute("role"),(a.content!==s.content||a.allowHTML!==s.allowHTML)&&Dn(p,e.props),s.arrow?u?a.arrow!==s.arrow&&(c.removeChild(u),c.appendChild(Pn(s.arrow))):c.appendChild(Pn(s.arrow)):u&&c.removeChild(u)}return{popper:t,onUpdate:r}}go.$$tippy=!0;var Xs=1,Bt=[],Ft=[];function Js(e,t){var n=Mn(e,Object.assign({},oe,bo(Ln(t)))),o,r,a,s=!1,l=!1,c=!1,p=!1,u,m,h,b=[],f=Cn(bt,n.interactiveDebounce),g,T=Xs++,k=null,M=Ss(n.plugins),C={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},d={id:T,reference:e,popper:rt(),popperInstance:k,props:n,state:C,plugins:M,clearDelayTimeouts:yt,setProps:wt,setContent:kt,show:No,hide:Ho,hideWithInteractivity:$o,enable:Je,disable:xt,unmount:zo,destroy:qo};if(!n.render)return process.env.NODE_ENV!=="production"&&Yt(!0,"render() function has not been supplied."),d;var j=n.render(d),w=j.popper,S=j.onUpdate;w.setAttribute("data-tippy-root",""),w.id="tippy-"+d.id,d.popper=w,e._tippy=d,w._tippy=d;var P=M.map(function(y){return y.fn(d)}),R=e.hasAttribute("aria-expanded");return X(),N(),F(),U("onCreate",[d]),n.showOnCreate&&Xe(),w.addEventListener("mouseenter",function(){d.props.interactive&&d.state.isVisible&&d.clearDelayTimeouts()}),w.addEventListener("mouseleave",function(){d.props.interactive&&d.props.trigger.indexOf("mouseenter")>=0&&_().addEventListener("mousemove",f)}),d;function B(){var y=d.props.touch;return Array.isArray(y)?y:[y,0]}function v(){return B()[0]==="hold"}function L(){var y;return!!((y=d.props.render)!=null&&y.$$tippy)}function A(){return g||e}function _(){var y=A().parentNode;return y?Os(y):document}function H(){return Xt(w)}function z(y){return d.state.isMounted&&!d.state.isVisible||pe.isTouch||u&&u.type==="focus"?0:zt(d.props.delay,y?0:1,oe.delay)}function F(y){y===void 0&&(y=!1),w.style.pointerEvents=d.props.interactive&&!y?"":"none",w.style.zIndex=""+d.props.zIndex}function U(y,D,O){if(O===void 0&&(O=!0),P.forEach(function($){$[y]&&$[y].apply($,D)}),O){var q;(q=d.props)[y].apply(q,D)}}function I(){var y=d.props.aria;if(y.content){var D="aria-"+y.content,O=w.id,q=qe(d.props.triggerTarget||e);q.forEach(function($){var J=$.getAttribute(D);if(d.state.isVisible)$.setAttribute(D,J?J+" "+O:O);else{var se=J&&J.replace(O,"").trim();se?$.setAttribute(D,se):$.removeAttribute(D)}})}}function N(){if(!(R||!d.props.aria.expanded)){var y=qe(d.props.triggerTarget||e);y.forEach(function(D){d.props.interactive?D.setAttribute("aria-expanded",d.state.isVisible&&D===A()?"true":"false"):D.removeAttribute("aria-expanded")})}}function W(){_().removeEventListener("mousemove",f),Bt=Bt.filter(function(y){return y!==f})}function V(y){if(!(pe.isTouch&&(c||y.type==="mousedown"))){var D=y.composedPath&&y.composedPath()[0]||y.target;if(!(d.props.interactive&&An(w,D))){if(qe(d.props.triggerTarget||e).some(function(O){return An(O,D)})){if(pe.isTouch||d.state.isVisible&&d.props.trigger.indexOf("click")>=0)return}else U("onClickOutside",[d,y]);d.props.hideOnClick===!0&&(d.clearDelayTimeouts(),d.hide(),l=!0,setTimeout(function(){l=!1}),d.state.isMounted||ne())}}}function K(){c=!0}function Q(){c=!1}function G(){var y=_();y.addEventListener("mousedown",V,!0),y.addEventListener("touchend",V,Pe),y.addEventListener("touchstart",Q,Pe),y.addEventListener("touchmove",K,Pe)}function ne(){var y=_();y.removeEventListener("mousedown",V,!0),y.removeEventListener("touchend",V,Pe),y.removeEventListener("touchstart",Q,Pe),y.removeEventListener("touchmove",K,Pe)}function ve(y,D){ke(y,function(){!d.state.isVisible&&w.parentNode&&w.parentNode.contains(w)&&D()})}function ie(y,D){ke(y,D)}function ke(y,D){var O=H().box;function q($){$.target===O&&(Ut(O,"remove",q),D())}if(y===0)return D();Ut(O,"remove",m),Ut(O,"add",q),m=q}function de(y,D,O){O===void 0&&(O=!1);var q=qe(d.props.triggerTarget||e);q.forEach(function($){$.addEventListener(y,D,O),b.push({node:$,eventType:y,handler:D,options:O})})}function X(){v()&&(de("touchstart",Ge,{passive:!0}),de("touchend",vt,{passive:!0})),js(d.props.trigger).forEach(function(y){if(y!=="manual")switch(de(y,Ge),y){case"mouseenter":de("mouseleave",vt);break;case"focus":de(zs?"focusout":"blur",Ye);break;case"focusin":de("focusout",Ye);break}})}function ht(){b.forEach(function(y){var D=y.node,O=y.eventType,q=y.handler,$=y.options;D.removeEventListener(O,q,$)}),b=[]}function Ge(y){var D,O=!1;if(!(!d.state.isEnabled||Ke(y)||l)){var q=((D=u)==null?void 0:D.type)==="focus";u=y,g=y.currentTarget,N(),!d.state.isVisible&&Ds(y)&&Bt.forEach(function($){return $(y)}),y.type==="click"&&(d.props.trigger.indexOf("mouseenter")<0||s)&&d.props.hideOnClick!==!1&&d.state.isVisible?O=!0:Xe(y),y.type==="click"&&(s=!O),O&&!q&&je(y)}}function bt(y){var D=y.target,O=A().contains(D)||w.contains(D);if(!(y.type==="mousemove"&&O)){var q=Ce().concat(w).map(function($){var J,se=$._tippy,Ne=(J=se.popperInstance)==null?void 0:J.state;return Ne?{popperRect:$.getBoundingClientRect(),popperState:Ne,props:n}:null}).filter(Boolean);Es(q,y)&&(W(),je(y))}}function vt(y){var D=Ke(y)||d.props.trigger.indexOf("click")>=0&&s;if(!D){if(d.props.interactive){d.hideWithInteractivity(y);return}je(y)}}function Ye(y){d.props.trigger.indexOf("focusin")<0&&y.target!==A()||d.props.interactive&&y.relatedTarget&&w.contains(y.relatedTarget)||je(y)}function Ke(y){return pe.isTouch?v()!==y.type.indexOf("touch")>=0:!1}function gt(){mt();var y=d.props,D=y.popperOptions,O=y.placement,q=y.offset,$=y.getReferenceClientRect,J=y.moveTransition,se=L()?Xt(w).arrow:null,Ne=$?{getBoundingClientRect:$,contextElement:$.contextElement||A()}:e,dn={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Ct){var He=Ct.state;if(L()){var Uo=H(),$t=Uo.box;["placement","reference-hidden","escaped"].forEach(function(Tt){Tt==="placement"?$t.setAttribute("data-placement",He.placement):He.attributes.popper["data-popper-"+Tt]?$t.setAttribute("data-"+Tt,""):$t.removeAttribute("data-"+Tt)}),He.attributes.popper={}}}},Se=[{name:"offset",options:{offset:q}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!J}},dn];L()&&se&&Se.push({name:"arrow",options:{element:se,padding:3}}),Se.push.apply(Se,(D==null?void 0:D.modifiers)||[]),d.popperInstance=Cs(Ne,w,Object.assign({},D,{placement:O,onFirstUpdate:h,modifiers:Se}))}function mt(){d.popperInstance&&(d.popperInstance.destroy(),d.popperInstance=null)}function ge(){var y=d.props.appendTo,D,O=A();d.props.interactive&&y===co||y==="parent"?D=O.parentNode:D=uo(y,[O]),D.contains(w)||D.appendChild(w),d.state.isMounted=!0,gt(),process.env.NODE_ENV!=="production"&&me(d.props.interactive&&y===oe.appendTo&&O.nextElementSibling!==w,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
10
+ `,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var rl=function(){return"innerHTML"};function Yt(e,t){e[rl()]=t}function Dn(e){var t=ut();return e===!0?t.className=lo:(t.className=co,ft(e)?t.appendChild(e):Yt(t,e)),t}function In(e,t){ft(t.content)?(Yt(e,""),e.appendChild(t.content)):typeof t.content!="function"&&(t.allowHTML?Yt(e,t.content):e.textContent=t.content)}function Kt(e){var t=e.firstElementChild,n=It(t.children);return{box:t,content:n.find(function(o){return o.classList.contains(so)}),arrow:n.find(function(o){return o.classList.contains(lo)||o.classList.contains(co)}),backdrop:n.find(function(o){return o.classList.contains(Rs)})}}function mo(e){var t=ut(),n=ut();n.className=Is,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var o=ut();o.className=so,o.setAttribute("data-state","hidden"),In(o,e.props),t.appendChild(n),n.appendChild(o),r(e.props,e.props);function r(a,s){var l=Kt(t),c=l.box,f=l.content,u=l.arrow;s.theme?c.setAttribute("data-theme",s.theme):c.removeAttribute("data-theme"),typeof s.animation=="string"?c.setAttribute("data-animation",s.animation):c.removeAttribute("data-animation"),s.inertia?c.setAttribute("data-inertia",""):c.removeAttribute("data-inertia"),c.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?c.setAttribute("role",s.role):c.removeAttribute("role"),(a.content!==s.content||a.allowHTML!==s.allowHTML)&&In(f,e.props),s.arrow?u?a.arrow!==s.arrow&&(c.removeChild(u),c.appendChild(Dn(s.arrow))):c.appendChild(Dn(s.arrow)):u&&c.removeChild(u)}return{popper:t,onUpdate:r}}mo.$$tippy=!0;var al=1,At=[],Ut=[];function il(e,t){var n=Pn(e,Object.assign({},oe,vo(Bn(t)))),o,r,a,s=!1,l=!1,c=!1,f=!1,u,m,h,v=[],p=Tn(Oe,n.interactiveDebounce),g,C=al++,y=null,S=Ns(n.plugins),T={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},d={id:C,reference:e,popper:ut(),popperInstance:y,props:n,state:T,plugins:S,clearDelayTimeouts:wt,setProps:kt,setContent:Ct,show:Ho,hide:$o,hideWithInteractivity:zo,enable:ot,disable:yt,unmount:qo,destroy:Uo};if(!n.render)return process.env.NODE_ENV!=="production"&&Gt(!0,"render() function has not been supplied."),d;var A=n.render(d),k=A.popper,j=A.onUpdate;k.setAttribute("data-tippy-root",""),k.id="tippy-"+d.id,d.popper=k,e._tippy=d,k._tippy=d;var I=S.map(function(w){return w.fn(d)}),N=e.hasAttribute("aria-expanded");return ke(),R(),q(),H("onCreate",[d]),n.showOnCreate&&Ne(),k.addEventListener("mouseenter",function(){d.props.interactive&&d.state.isVisible&&d.clearDelayTimeouts()}),k.addEventListener("mouseleave",function(){d.props.interactive&&d.props.trigger.indexOf("mouseenter")>=0&&M().addEventListener("mousemove",p)}),d;function B(){var w=d.props.touch;return Array.isArray(w)?w:[w,0]}function _(){return B()[0]==="hold"}function b(){var w;return!!((w=d.props.render)!=null&&w.$$tippy)}function L(){return g||e}function M(){var w=L().parentNode;return w?Fs(w):document}function E(){return Kt(k)}function $(w){return d.state.isMounted&&!d.state.isVisible||ve.isTouch||u&&u.type==="focus"?0:$t(d.props.delay,w?0:1,oe.delay)}function q(w){w===void 0&&(w=!1),k.style.pointerEvents=d.props.interactive&&!w?"":"none",k.style.zIndex=""+d.props.zIndex}function H(w,D,O){if(O===void 0&&(O=!0),I.forEach(function(U){U[w]&&U[w].apply(U,D)}),O){var F;(F=d.props)[w].apply(F,D)}}function P(){var w=d.props.aria;if(w.content){var D="aria-"+w.content,O=k.id,F=Ze(d.props.triggerTarget||e);F.forEach(function(U){var K=U.getAttribute(D);if(d.state.isVisible)U.setAttribute(D,K?K+" "+O:O);else{var se=K&&K.replace(O,"").trim();se?U.setAttribute(D,se):U.removeAttribute(D)}})}}function R(){if(!(N||!d.props.aria.expanded)){var w=Ze(d.props.triggerTarget||e);w.forEach(function(D){d.props.interactive?D.setAttribute("aria-expanded",d.state.isVisible&&D===L()?"true":"false"):D.removeAttribute("aria-expanded")})}}function W(){M().removeEventListener("mousemove",p),At=At.filter(function(w){return w!==p})}function V(w){if(!(ve.isTouch&&(c||w.type==="mousedown"))){var D=w.composedPath&&w.composedPath()[0]||w.target;if(!(d.props.interactive&&jn(k,D))){if(Ze(d.props.triggerTarget||e).some(function(O){return jn(O,D)})){if(ve.isTouch||d.state.isVisible&&d.props.trigger.indexOf("click")>=0)return}else H("onClickOutside",[d,w]);d.props.hideOnClick===!0&&(d.clearDelayTimeouts(),d.hide(),l=!0,setTimeout(function(){l=!1}),d.state.isMounted||ae())}}}function J(){c=!0}function Z(){c=!1}function Q(){var w=M();w.addEventListener("mousedown",V,!0),w.addEventListener("touchend",V,ze),w.addEventListener("touchstart",Z,ze),w.addEventListener("touchmove",J,ze)}function ae(){var w=M();w.removeEventListener("mousedown",V,!0),w.removeEventListener("touchend",V,ze),w.removeEventListener("touchstart",Z,ze),w.removeEventListener("touchmove",J,ze)}function ye(w,D){we(w,function(){!d.state.isVisible&&k.parentNode&&k.parentNode.contains(k)&&D()})}function ie(w,D){we(w,D)}function we(w,D){var O=E().box;function F(U){U.target===O&&(qt(O,"remove",F),D())}if(w===0)return D();qt(O,"remove",m),qt(O,"add",F),m=F}function de(w,D,O){O===void 0&&(O=!1);var F=Ze(d.props.triggerTarget||e);F.forEach(function(U){U.addEventListener(w,D,O),v.push({node:U,eventType:w,handler:D,options:O})})}function ke(){_()&&(de("touchstart",Ce,{passive:!0}),de("touchend",pe,{passive:!0})),_s(d.props.trigger).forEach(function(w){if(w!=="manual")switch(de(w,Ce),w){case"mouseenter":de("mouseleave",pe);break;case"focus":de(Xs?"focusout":"blur",Te);break;case"focusin":de("focusout",Te);break}})}function Ee(){v.forEach(function(w){var D=w.node,O=w.eventType,F=w.handler,U=w.options;D.removeEventListener(O,F,U)}),v=[]}function Ce(w){var D,O=!1;if(!(!d.state.isEnabled||Me(w)||l)){var F=((D=u)==null?void 0:D.type)==="focus";u=w,g=w.currentTarget,R(),!d.state.isVisible&&zs(w)&&At.forEach(function(U){return U(w)}),w.type==="click"&&(d.props.trigger.indexOf("mouseenter")<0||s)&&d.props.hideOnClick!==!1&&d.state.isVisible?O=!0:Ne(w),w.type==="click"&&(s=!O),O&&!F&&G(w)}}function Oe(w){var D=w.target,O=L().contains(D)||k.contains(D);if(!(w.type==="mousemove"&&O)){var F=be().concat(k).map(function(U){var K,se=U._tippy,Ye=(K=se.popperInstance)==null?void 0:K.state;return Ye?{popperRect:U.getBoundingClientRect(),popperState:Ye,props:n}:null}).filter(Boolean);Ws(F,w)&&(W(),G(w))}}function pe(w){var D=Me(w)||d.props.trigger.indexOf("click")>=0&&s;if(!D){if(d.props.interactive){d.hideWithInteractivity(w);return}G(w)}}function Te(w){d.props.trigger.indexOf("focusin")<0&&w.target!==L()||d.props.interactive&&w.relatedTarget&&k.contains(w.relatedTarget)||G(w)}function Me(w){return ve.isTouch?_()!==w.type.indexOf("touch")>=0:!1}function _e(){fe();var w=d.props,D=w.popperOptions,O=w.placement,F=w.offset,U=w.getReferenceClientRect,K=w.moveTransition,se=b()?Kt(k).arrow:null,Ye=U?{getBoundingClientRect:U,contextElement:U.contextElement||L()}:e,dn={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Tt){var Ke=Tt.state;if(b()){var Fo=E(),Ht=Fo.box;["placement","reference-hidden","escaped"].forEach(function(Lt){Lt==="placement"?Ht.setAttribute("data-placement",Ke.placement):Ke.attributes.popper["data-popper-"+Lt]?Ht.setAttribute("data-"+Lt,""):Ht.removeAttribute("data-"+Lt)}),Ke.attributes.popper={}}}},He=[{name:"offset",options:{offset:F}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!K}},dn];b()&&se&&He.push({name:"arrow",options:{element:se,padding:3}}),He.push.apply(He,(D==null?void 0:D.modifiers)||[]),d.popperInstance=Ds(Ye,k,Object.assign({},D,{placement:O,onFirstUpdate:h,modifiers:He}))}function fe(){d.popperInstance&&(d.popperInstance.destroy(),d.popperInstance=null)}function he(){var w=d.props.appendTo,D,O=L();d.props.interactive&&w===uo||w==="parent"?D=O.parentNode:D=po(w,[O]),D.contains(k)||D.appendChild(k),d.state.isMounted=!0,_e(),process.env.NODE_ENV!=="production"&&Le(d.props.interactive&&w===oe.appendTo&&O.nextElementSibling!==k,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
11
11
 
12
12
  `,"Using a wrapper <div> or <span> tag around the reference element","solves this by creating a new parentNode context.",`
13
13
 
14
14
  `,"Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.",`
15
15
 
16
- `,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function Ce(){return Rt(w.querySelectorAll("[data-tippy-root]"))}function Xe(y){d.clearDelayTimeouts(),y&&U("onTrigger",[d,y]),G();var D=z(!0),O=B(),q=O[0],$=O[1];pe.isTouch&&q==="hold"&&$&&(D=$),D?o=setTimeout(function(){d.show()},D):d.show()}function je(y){if(d.clearDelayTimeouts(),U("onUntrigger",[d,y]),!d.state.isVisible){ne();return}if(!(d.props.trigger.indexOf("mouseenter")>=0&&d.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(y.type)>=0&&s)){var D=z(!1);D?r=setTimeout(function(){d.state.isVisible&&d.hide()},D):a=requestAnimationFrame(function(){d.hide()})}}function Je(){d.state.isEnabled=!0}function xt(){d.hide(),d.state.isEnabled=!1}function yt(){clearTimeout(o),clearTimeout(r),cancelAnimationFrame(a)}function wt(y){if(process.env.NODE_ENV!=="production"&&me(d.state.isDestroyed,ze("setProps")),!d.state.isDestroyed){U("onBeforeUpdate",[d,y]),ht();var D=d.props,O=Mn(e,Object.assign({},D,Ln(y),{ignoreAttributes:!0}));d.props=O,X(),D.interactiveDebounce!==O.interactiveDebounce&&(W(),f=Cn(bt,O.interactiveDebounce)),D.triggerTarget&&!O.triggerTarget?qe(D.triggerTarget).forEach(function(q){q.removeAttribute("aria-expanded")}):O.triggerTarget&&e.removeAttribute("aria-expanded"),N(),F(),S&&S(D,O),d.popperInstance&&(gt(),Ce().forEach(function(q){requestAnimationFrame(q._tippy.popperInstance.forceUpdate)})),U("onAfterUpdate",[d,y])}}function kt(y){d.setProps({content:y})}function No(){process.env.NODE_ENV!=="production"&&me(d.state.isDestroyed,ze("show"));var y=d.state.isVisible,D=d.state.isDestroyed,O=!d.state.isEnabled,q=pe.isTouch&&!d.props.touch,$=zt(d.props.duration,0,oe.duration);if(!(y||D||O||q)&&!A().hasAttribute("disabled")&&(U("onShow",[d],!1),d.props.onShow(d)!==!1)){if(d.state.isVisible=!0,L()&&(w.style.visibility="visible"),F(),G(),d.state.isMounted||(w.style.transition="none"),L()){var J=H(),se=J.box,Ne=J.content;qt([se,Ne],0)}h=function(){var Se;if(!(!d.state.isVisible||p)){if(p=!0,w.offsetHeight,w.style.transition=d.props.moveTransition,L()&&d.props.animation){var Ht=H(),Ct=Ht.box,He=Ht.content;qt([Ct,He],$),Bn([Ct,He],"visible")}I(),N(),Tn(Ft,d),(Se=d.popperInstance)==null||Se.forceUpdate(),U("onMount",[d]),d.props.animation&&L()&&ie($,function(){d.state.isShown=!0,U("onShown",[d])})}},ge()}}function Ho(){process.env.NODE_ENV!=="production"&&me(d.state.isDestroyed,ze("hide"));var y=!d.state.isVisible,D=d.state.isDestroyed,O=!d.state.isEnabled,q=zt(d.props.duration,1,oe.duration);if(!(y||D||O)&&(U("onHide",[d],!1),d.props.onHide(d)!==!1)){if(d.state.isVisible=!1,d.state.isShown=!1,p=!1,s=!1,L()&&(w.style.visibility="hidden"),W(),ne(),F(!0),L()){var $=H(),J=$.box,se=$.content;d.props.animation&&(qt([J,se],q),Bn([J,se],"hidden"))}I(),N(),d.props.animation?L()&&ve(q,d.unmount):d.unmount()}}function $o(y){process.env.NODE_ENV!=="production"&&me(d.state.isDestroyed,ze("hideWithInteractivity")),_().addEventListener("mousemove",f),Tn(Bt,f),f(y)}function zo(){process.env.NODE_ENV!=="production"&&me(d.state.isDestroyed,ze("unmount")),d.state.isVisible&&d.hide(),d.state.isMounted&&(mt(),Ce().forEach(function(y){y._tippy.unmount()}),w.parentNode&&w.parentNode.removeChild(w),Ft=Ft.filter(function(y){return y!==d}),d.state.isMounted=!1,U("onHidden",[d]))}function qo(){process.env.NODE_ENV!=="production"&&me(d.state.isDestroyed,ze("destroy")),!d.state.isDestroyed&&(d.clearDelayTimeouts(),d.unmount(),ht(),delete e._tippy,d.state.isDestroyed=!0,U("onDestroy",[d]))}}function Be(e,t){t===void 0&&(t={});var n=oe.plugins.concat(t.plugins||[]);process.env.NODE_ENV!=="production"&&(Fs(e),vo(t,n)),Hs();var o=Object.assign({},t,{plugins:n}),r=Rs(e);if(process.env.NODE_ENV!=="production"){var a=st(o.content),s=r.length>1;me(a&&s,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",`
16
+ `,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function be(){return It(k.querySelectorAll("[data-tippy-root]"))}function Ne(w){d.clearDelayTimeouts(),w&&H("onTrigger",[d,w]),Q();var D=$(!0),O=B(),F=O[0],U=O[1];ve.isTouch&&F==="hold"&&U&&(D=U),D?o=setTimeout(function(){d.show()},D):d.show()}function G(w){if(d.clearDelayTimeouts(),H("onUntrigger",[d,w]),!d.state.isVisible){ae();return}if(!(d.props.trigger.indexOf("mouseenter")>=0&&d.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(w.type)>=0&&s)){var D=$(!1);D?r=setTimeout(function(){d.state.isVisible&&d.hide()},D):a=requestAnimationFrame(function(){d.hide()})}}function ot(){d.state.isEnabled=!0}function yt(){d.hide(),d.state.isEnabled=!1}function wt(){clearTimeout(o),clearTimeout(r),cancelAnimationFrame(a)}function kt(w){if(process.env.NODE_ENV!=="production"&&Le(d.state.isDestroyed,Je("setProps")),!d.state.isDestroyed){H("onBeforeUpdate",[d,w]),Ee();var D=d.props,O=Pn(e,Object.assign({},D,Bn(w),{ignoreAttributes:!0}));d.props=O,ke(),D.interactiveDebounce!==O.interactiveDebounce&&(W(),p=Tn(Oe,O.interactiveDebounce)),D.triggerTarget&&!O.triggerTarget?Ze(D.triggerTarget).forEach(function(F){F.removeAttribute("aria-expanded")}):O.triggerTarget&&e.removeAttribute("aria-expanded"),R(),q(),j&&j(D,O),d.popperInstance&&(_e(),be().forEach(function(F){requestAnimationFrame(F._tippy.popperInstance.forceUpdate)})),H("onAfterUpdate",[d,w])}}function Ct(w){d.setProps({content:w})}function Ho(){process.env.NODE_ENV!=="production"&&Le(d.state.isDestroyed,Je("show"));var w=d.state.isVisible,D=d.state.isDestroyed,O=!d.state.isEnabled,F=ve.isTouch&&!d.props.touch,U=$t(d.props.duration,0,oe.duration);if(!(w||D||O||F)&&!L().hasAttribute("disabled")&&(H("onShow",[d],!1),d.props.onShow(d)!==!1)){if(d.state.isVisible=!0,b()&&(k.style.visibility="visible"),q(),Q(),d.state.isMounted||(k.style.transition="none"),b()){var K=E(),se=K.box,Ye=K.content;zt([se,Ye],0)}h=function(){var He;if(!(!d.state.isVisible||f)){if(f=!0,k.offsetHeight,k.style.transition=d.props.moveTransition,b()&&d.props.animation){var Nt=E(),Tt=Nt.box,Ke=Nt.content;zt([Tt,Ke],U),An([Tt,Ke],"visible")}P(),R(),Ln(Ut,d),(He=d.popperInstance)==null||He.forceUpdate(),H("onMount",[d]),d.props.animation&&b()&&ie(U,function(){d.state.isShown=!0,H("onShown",[d])})}},he()}}function $o(){process.env.NODE_ENV!=="production"&&Le(d.state.isDestroyed,Je("hide"));var w=!d.state.isVisible,D=d.state.isDestroyed,O=!d.state.isEnabled,F=$t(d.props.duration,1,oe.duration);if(!(w||D||O)&&(H("onHide",[d],!1),d.props.onHide(d)!==!1)){if(d.state.isVisible=!1,d.state.isShown=!1,f=!1,s=!1,b()&&(k.style.visibility="hidden"),W(),ae(),q(!0),b()){var U=E(),K=U.box,se=U.content;d.props.animation&&(zt([K,se],F),An([K,se],"hidden"))}P(),R(),d.props.animation?b()&&ye(F,d.unmount):d.unmount()}}function zo(w){process.env.NODE_ENV!=="production"&&Le(d.state.isDestroyed,Je("hideWithInteractivity")),M().addEventListener("mousemove",p),Ln(At,p),p(w)}function qo(){process.env.NODE_ENV!=="production"&&Le(d.state.isDestroyed,Je("unmount")),d.state.isVisible&&d.hide(),d.state.isMounted&&(fe(),be().forEach(function(w){w._tippy.unmount()}),k.parentNode&&k.parentNode.removeChild(k),Ut=Ut.filter(function(w){return w!==d}),d.state.isMounted=!1,H("onHidden",[d]))}function Uo(){process.env.NODE_ENV!=="production"&&Le(d.state.isDestroyed,Je("destroy")),!d.state.isDestroyed&&(d.clearDelayTimeouts(),d.unmount(),Ee(),delete e._tippy,d.state.isDestroyed=!0,H("onDestroy",[d]))}}function Ie(e,t){t===void 0&&(t={});var n=oe.plugins.concat(t.plugins||[]);process.env.NODE_ENV!=="production"&&(Qs(e),go(t,n)),Ys();var o=Object.assign({},t,{plugins:n}),r=Us(e);if(process.env.NODE_ENV!=="production"){var a=ft(o.content),s=r.length>1;Le(a&&s,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",`
17
17
 
18
18
  `,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
19
19
 
20
20
  `,`1) content: element.innerHTML
21
- `,"2) content: () => element.cloneNode(true)"].join(" "))}var l=r.reduce(function(c,p){var u=p&&Js(p,o);return u&&c.push(u),c},[]);return st(e)?l[0]:l}Be.defaultProps=oe;Be.setDefaultProps=Gs;Be.currentInput=pe;Object.assign({},Zn,{effect:function(t){var n=t.state,o={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,o.popper),n.styles=o,n.elements.arrow&&Object.assign(n.elements.arrow.style,o.arrow)}});Be.setDefaultProps({render:go});const E={colors:{background:"var(--pubwave-color-background)",surface:"var(--pubwave-color-surface)",text:"var(--pubwave-color-text)",textMuted:"var(--pubwave-color-text-muted)",border:"var(--pubwave-color-border)",borderLight:"var(--pubwave-color-border-light)",hover:"var(--pubwave-color-hover)",focus:"var(--pubwave-color-focus)",selection:"var(--pubwave-color-selection)",selectionBg:"var(--pubwave-color-selection-bg)",primary:"var(--pubwave-color-primary)",primaryFaded:"var(--pubwave-color-primary-faded)",dropIndicator:"var(--pubwave-color-drop-indicator)",dropTarget:"var(--pubwave-color-drop-target)",error:"var(--pubwave-color-error)"},spacing:{xs:"var(--pubwave-spacing-xs)",sm:"var(--pubwave-spacing-sm)",md:"var(--pubwave-spacing-md)",lg:"var(--pubwave-spacing-lg)",xl:"var(--pubwave-spacing-xl)",blockPaddingX:"var(--pubwave-block-padding-x)",blockPaddingY:"var(--pubwave-block-padding-y)",blockMarginY:"var(--pubwave-block-margin-y)",toolbarGap:"var(--pubwave-toolbar-gap)"},typography:{fontFamily:"var(--pubwave-font-family)",fontSizeBase:"var(--pubwave-font-size-base)",fontSizeSmall:"var(--pubwave-font-size-small)",lineHeightBase:"var(--pubwave-line-height-base)",lineHeightHeading:"var(--pubwave-line-height-heading)",fontWeightNormal:"var(--pubwave-font-weight-normal)",fontWeightMedium:"var(--pubwave-font-weight-medium)",fontWeightBold:"var(--pubwave-font-weight-bold)",fontWeightHeading:"var(--pubwave-font-weight-heading)"},borderRadius:{sm:"var(--pubwave-border-radius-sm)",md:"var(--pubwave-border-radius)",lg:"var(--pubwave-border-radius-large)"},shadow:{sm:"var(--pubwave-shadow-sm)",md:"var(--pubwave-shadow-md)",toolbar:"var(--pubwave-shadow-toolbar)",popup:"var(--pubwave-shadow-popup)"},transition:{fast:"var(--pubwave-transition-fast)",normal:"var(--pubwave-transition-normal)"},zIndex:{dragPreview:100,dragHandle:40,toolbar:50,dropdown:60}},Zs=`
21
+ `,"2) content: () => element.cloneNode(true)"].join(" "))}var l=r.reduce(function(c,f){var u=f&&il(f,o);return u&&c.push(u),c},[]);return ft(e)?l[0]:l}Ie.defaultProps=oe;Ie.setDefaultProps=nl;Ie.currentInput=ve;Object.assign({},Qn,{effect:function(t){var n=t.state,o={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,o.popper),n.styles=o,n.elements.arrow&&Object.assign(n.elements.arrow.style,o.arrow)}});Ie.setDefaultProps({render:mo});const z={colors:{background:"var(--pubwave-color-background)",surface:"var(--pubwave-color-surface)",text:"var(--pubwave-color-text)",textMuted:"var(--pubwave-color-text-muted)",border:"var(--pubwave-color-border)",borderLight:"var(--pubwave-color-border-light)",hover:"var(--pubwave-color-hover)",focus:"var(--pubwave-color-focus)",selection:"var(--pubwave-color-selection)",selectionBg:"var(--pubwave-color-selection-bg)",primary:"var(--pubwave-color-primary)",primaryFaded:"var(--pubwave-color-primary-faded)",dropIndicator:"var(--pubwave-color-drop-indicator)",dropTarget:"var(--pubwave-color-drop-target)",error:"var(--pubwave-color-error)"},spacing:{xs:"var(--pubwave-spacing-xs)",sm:"var(--pubwave-spacing-sm)",md:"var(--pubwave-spacing-md)",lg:"var(--pubwave-spacing-lg)",xl:"var(--pubwave-spacing-xl)",blockPaddingX:"var(--pubwave-block-padding-x)",blockPaddingY:"var(--pubwave-block-padding-y)",blockMarginY:"var(--pubwave-block-margin-y)",toolbarGap:"var(--pubwave-toolbar-gap)"},typography:{fontFamily:"var(--pubwave-font-family)",fontSizeBase:"var(--pubwave-font-size-base)",fontSizeSmall:"var(--pubwave-font-size-small)",lineHeightBase:"var(--pubwave-line-height-base)",lineHeightHeading:"var(--pubwave-line-height-heading)",fontWeightNormal:"var(--pubwave-font-weight-normal)",fontWeightMedium:"var(--pubwave-font-weight-medium)",fontWeightBold:"var(--pubwave-font-weight-bold)",fontWeightHeading:"var(--pubwave-font-weight-heading)"},borderRadius:{sm:"var(--pubwave-border-radius-sm)",md:"var(--pubwave-border-radius)",lg:"var(--pubwave-border-radius-large)"},shadow:{sm:"var(--pubwave-shadow-sm)",md:"var(--pubwave-shadow-md)",toolbar:"var(--pubwave-shadow-toolbar)",popup:"var(--pubwave-shadow-popup)"},transition:{fast:"var(--pubwave-transition-fast)",normal:"var(--pubwave-transition-normal)"},zIndex:{dragPreview:100,dragHandle:40,toolbar:50,dropdown:60}},sl=`
22
22
  :root {
23
23
  /* Colors - Light theme */
24
24
  --pubwave-color-background: #ffffff;
@@ -100,4 +100,4 @@
100
100
  --pubwave-color-error: #f87171;
101
101
  }
102
102
  }
103
- `,Qs=Zs;function Ee(...e){return e.filter(Boolean).join(" ")}const St={padding:"var(--pubwave-spacing-2, 8px) var(--pubwave-spacing-3, 12px) var(--pubwave-spacing-1, 4px)",fontSize:"var(--pubwave-font-size-xs, 11px)",fontWeight:600,color:"var(--pubwave-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"};function mo(e=Dt,t,n){var a;const o=t||n?Kn(t,n):e,r=((a=n==null?void 0:n.slashMenu)==null?void 0:a.groups)||{basic:"Style",list:"Lists",media:"Media",advanced:"Advanced",layout:"Layout"};return re.Extension.create({name:"slashCommands",addOptions(){return{suggestion:{char:"/",command:({editor:s,range:l,props:c})=>{if(c.id==="taskList"){s.chain().focus().deleteRange(l).toggleTaskList().run();return}s.chain().focus().deleteRange(l).run(),c.action(s)}}}},addProseMirrorPlugins(){const s=this.editor;return[xr({editor:this.editor,...this.options.suggestion,allowed:({state:l,range:c})=>{try{if(s.isActive("codeBlock"))return!1;const p=l.doc.resolve(c.from);for(let u=p.depth;u>=1;u--)if(p.node(u).type.name==="codeBlock")return!1;return!0}catch{return!0}},items:({query:l,state:c})=>{let p=o;try{const u=c.doc.resolve(c.selection.from);for(let m=u.depth;m>=0;m--)if(u.node(m).type.name==="layoutColumn"){p=o.filter(b=>b.group!=="layout");break}}catch{}return mi(p,l)},render:()=>{let l,c;return{onStart:p=>{this.editor.isActive("codeBlock")||(l=new ye.ReactRenderer(xo,{props:{...p,query:p.query,editor:this.editor,groupLabels:r},editor:this.editor}),p.clientRect&&(c=Be("body",{getReferenceClientRect:p.clientRect,appendTo:()=>document.body,content:l.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",offset:[0,8],zIndex:E.zIndex.dropdown,arrow:!1,duration:[0,0],animation:!1,popperOptions:{modifiers:[{name:"preventOverflow",options:{boundary:"viewport",padding:8,altAxis:!0}},{name:"flip",options:{fallbackPlacements:["top-start","bottom-end","top"]}}]},onShow(u){const m=u.popper.querySelector(".tippy-box");m&&(m.style.zIndex=String(E.zIndex.dropdown),m.style.backgroundColor="transparent",m.style.background="transparent",m.style.border="none");const h=u.popper.querySelector(".pubwave-slash-menu");if(h){const b=document.querySelector(".ProseMirror");if(b){const f=h.getBoundingClientRect(),T=b.getBoundingClientRect().bottom-f.top-16,k=Math.max(200,Math.min(280,T));h.style.maxHeight=`${k}px`}}}})))},onUpdate(p){var u,m,h;if(l.updateProps({...p,query:p.query,editor:p.editor,groupLabels:r}),p.items.length===0){if(c[0]){c[0].hide();const b=c[0].popper.querySelector(".tippy-box");b&&(b.style.opacity="0",b.style.pointerEvents="none")}return}p.clientRect&&((u=c[0])==null||u.setProps({getReferenceClientRect:p.clientRect}),(m=c[0])!=null&&m.state.isVisible||(h=c[0])==null||h.show())},onKeyDown(p){var u,m;return p.event.key==="Escape"?((u=c[0])==null||u.hide(),!0):((m=l.ref)==null?void 0:m.onKeyDown(p))??!1},onExit(){var p;(p=c[0])==null||p.destroy(),l.destroy()}}}})]}})}const xo=x.forwardRef(function({items:t,command:n,query:o="",groupLabels:r},a){const[s,l]=x.useState(-1),c=x.useRef(null),p=x.useRef(null);x.useEffect(()=>{t.length>0&&o.length>0?l(0):(t.length,l(-1))},[t,o]),Ua(s,c,p);const u=x.useMemo(()=>{const f={};for(const g of t){const T=f[g.group]??[];T.push(g),f[g.group]=T}return f},[t]),m=t,h=x.useCallback(f=>{const g=m[f];g&&n(g)},[m,n]);x.useImperativeHandle(a,()=>({onKeyDown:({event:f})=>m.length===0?!1:f.key==="ArrowUp"?(l(g=>g<0?m.length-1:g<=0?0:g-1),!0):f.key==="ArrowDown"?(l(g=>g<0?0:g>=m.length-1?m.length-1:g+1),!0):f.key==="Enter"&&s>=0&&s<m.length?(h(s),!0):!1}));const b=r||{basic:"Style",list:"Lists",media:"Media",advanced:"Advanced"};return t.length===0?null:i.jsx("div",{className:"pubwave-slash-menu",ref:c,style:Fa,"data-testid":"slash-menu",children:i.jsx("div",{style:{padding:"var(--pubwave-spacing-1, 4px) 0"},children:(()=>{let f=0;return["basic","list","media","advanced"].map(T=>{const k=u[T];return!k||k.length===0?null:i.jsxs("div",{className:"pubwave-slash-menu__group",style:Wa,children:[i.jsx("div",{className:"pubwave-slash-menu__group-label",style:Va,children:b[T]||T}),k.map(M=>{const C=f++,d=C===s;return i.jsxs("button",{ref:d?p:null,className:`pubwave-slash-menu__item ${d?"pubwave-slash-menu__item--selected":""}`,style:{...Ga,backgroundColor:d?"var(--pubwave-hover-bg, #f3f4f6)":"transparent"},onClick:()=>h(C),onMouseEnter:()=>l(C),children:[i.jsx("span",{className:"pubwave-slash-menu__item-icon",style:Ya,children:M.icon}),i.jsx("span",{className:"pubwave-slash-menu__item-title",style:Ka,children:M.title})]},M.id)})]},T)})})()})})}),Z=new Pt.PluginKey("pubwave-dnd"),Ot={draggingBlockId:null,draggingBlockPos:null,dropTargetPos:null,dropPosition:null,cancelled:!1};function De(e,t){switch(t.type){case"START_DRAG":return{...e,draggingBlockId:t.blockId,draggingBlockPos:t.pos,dropTargetPos:null,dropPosition:null,cancelled:!1};case"UPDATE_DROP_TARGET":return{...e,dropTargetPos:t.pos,dropPosition:t.position};case"CANCEL_DRAG":return{...e,cancelled:!0,draggingBlockId:null,draggingBlockPos:null,dropTargetPos:null,dropPosition:null};case"COMPLETE_DRAG":return{...e,draggingBlockId:null,draggingBlockPos:null,dropTargetPos:null,dropPosition:null};case"RESET":return Ot;default:return e}}function ct(e,t){const n=Math.max(0,Math.min(t,e.content.size));try{const o=e.resolve(n);if(o.depth>=1){const r=o.node(1);if(["taskList","bulletList","orderedList","blockquote","table"].includes(r.type.name))return{node:r,pos:o.before(1)}}for(let r=o.depth;r>0;r--){const a=o.node(r);if(a.isBlock)return{node:a,pos:o.before(r)}}if(o.depth===0&&e.childCount>0){let r=0;for(let a=0;a<e.childCount;a++){const s=e.child(a);if(r+s.nodeSize>n)return{node:s,pos:r};r+=s.nodeSize}return{node:e.lastChild,pos:e.content.size-e.lastChild.nodeSize}}return null}catch{let o=null,r=0;for(let a=0;a<e.childCount;a++){const s=e.child(a);if(r<=n&&r+s.nodeSize>n){o={node:s,pos:r};break}r+=s.nodeSize}return o}}function yo(e,t,n,o){const{state:r}=e,{tr:a,doc:s}=r,l=ct(s,t);if(!l)return!1;const c=ct(s,n);if(!c)return!1;let p=c.pos;if(o==="after"&&(p=c.pos+c.node.nodeSize),l.pos===c.pos||p===l.pos||p===l.pos+l.node.nodeSize)return!1;const u=l.node,m=l.pos,h=l.pos+u.nodeSize,b=s.slice(m,h);let f=p;m<p&&(f=p-u.nodeSize),a.delete(m,h);const g=a.doc.content.size;if(f<0?f=0:f>g&&(f=g),f>=0&&f<=g)a.insert(f,b.content);else return!1;return a.setSelection(r.selection.map(a.doc,a.mapping)),e.view.dispatch(a),!0}function In(e,t){const n=e.state.doc;if(n.childCount===0)return null;const o=0,r=e.nodeDOM(o);let a=0;for(let p=0;p<n.childCount-1;p++)a+=n.child(p).nodeSize;const s=e.nodeDOM(a),l=t.clientY;if(r){const p=r.getBoundingClientRect();if(l<p.top+50)return{pos:o,position:"before"}}if(s){const p=s.getBoundingClientRect();if(l>p.bottom-50)return{pos:a,position:"after"}}const c=e.posAtCoords({left:t.clientX,top:t.clientY});if(c){const p=ct(n,c.pos);if(p){const u=e.nodeDOM(p.pos);if(u){const m=u.getBoundingClientRect(),h=m.top+m.height/2;return{pos:p.pos,position:l<h?"before":"after"}}}}return null}function wo(e){let t=Ot;return new Pt.Plugin({key:Z,state:{init(){return Ot},apply(n,o){const r=n.getMeta(Z);return r!==void 0?(t=r,r):(t=o,o)}},props:{handleKeyDown(n,o){return o.key==="Escape"&&t.draggingBlockId?(t=De(t,{type:"CANCEL_DRAG"}),n.dispatch(n.state.tr.setMeta(Z,t)),!0):!1},handleDOMEvents:{dragover(n,o){var s;if(!((s=o.dataTransfer)!=null&&s.types.includes("application/x-pubwave-block")))return!1;o.preventDefault(),o.dataTransfer.dropEffect="move",t=Z.getState(n.state)??t;const a=In(n,o);return a?(t=De(t,{type:"UPDATE_DROP_TARGET",pos:a.pos,position:a.position}),n.dispatch(n.state.tr.setMeta(Z,t))):t.dropTargetPos!==null&&(t=De(t,{type:"UPDATE_DROP_TARGET",pos:null,position:null}),n.dispatch(n.state.tr.setMeta(Z,t))),!0},drop(n,o){var h;const r=(h=o.dataTransfer)==null?void 0:h.getData("application/x-pubwave-block");if(!r)return!1;o.preventDefault(),o.stopPropagation();let l=(Z.getState(n.state)??t).draggingBlockPos;if(l===null&&r.startsWith("block-")){const b=parseInt(r.replace("block-",""),10);isNaN(b)||(l=b)}if(l===null)return!1;const c=In(n,o);if(!c)return!1;const{pos:p,position:u}=c;if(p===l||!e)return!1;const m=yo(e,l,p,u);return t=De(t,{type:"COMPLETE_DRAG"}),n.dispatch(n.state.tr.setMeta(Z,t)),m},dragleave(n,o){const r=o.relatedTarget;return r!=null&&r.closest(".pubwave-editor")||(t=De(t,{type:"UPDATE_DROP_TARGET",pos:null,position:null}),n.dispatch(n.state.tr.setMeta(Z,t))),!1}}}})}function sn(e){return Z.getState(e.state)??Ot}function ko(e,t,n){const{view:o}=e,r={type:"START_DRAG",blockId:t,pos:n},a=De(sn(e),r);o.dispatch(o.state.tr.setMeta(Z,a))}function el(e){const{view:t}=e,n={type:"CANCEL_DRAG"},o=De(sn(e),n);t.dispatch(t.state.tr.setMeta(Z,o))}const tl=["paragraph","heading","bulletList","orderedList","taskList","table","blockquote","codeBlock","horizontalRule","image","chart"],nl=["bold","italic","underline","strike","code","link"];function ln(e={}){const{placeholder:t,historyDepth:n=100,headingLevels:o,linkOpenInNewTab:r,linkOpenOnClick:a,enableSlashCommands:s=!0,slashCommands:l,imageUpload:c,locale:p}=e,u=p?At(p):null,m=t??(u==null?void 0:u.placeholder)??'Write,type "/" for commands...',h=[...Ha({headingLevels:o,imageUpload:c}),...qa({linkOpenInNewTab:r,linkOpenOnClick:a}),Fo.configure({placeholder:m,emptyEditorClass:"pubwave-editor--empty",emptyNodeClass:"pubwave-editor__node--empty"}),Wo.configure({depth:n}),Vo.configure({color:"var(--pubwave-dropcursor-color, #3b82f6)",width:2}),Go,re.Extension.create({name:"dragAndDrop",addProseMirrorPlugins(){return[wo(this.editor)]}})];if(s){const b=At(p||"en"),f=l?[...Dt,...l]:Dt;h.push(mo(f,c,b))}return h}function ol(e={}){if(!_t)throw new Error("createEditor() cannot be called server-side. Ensure this function is only called in client-side code (e.g., useEffect, event handlers).");const{content:t,editable:n=!0,placeholder:o,autofocus:r=!1,onUpdate:a,onSelectionUpdate:s,onFocus:l,onBlur:c,onCreate:p,onDestroy:u}=e,h={extensions:ln({placeholder:o,headingLevels:[1,2,3],linkOpenInNewTab:!0,linkOpenOnClick:!0}),content:t,editable:n,autofocus:r,editorProps:{attributes:{class:"pubwave-editor__content","data-placeholder":o??'Write,type "/" for commands...'}},onUpdate:a?({editor:b})=>{a({editor:b})}:void 0,onSelectionUpdate:s?({editor:b})=>{s({editor:b})}:void 0,onFocus:l?({editor:b})=>{l({editor:b})}:void 0,onBlur:c?({editor:b})=>{c({editor:b})}:void 0,onCreate:p?({editor:b})=>{p({editor:b})}:void 0,onDestroy:u?()=>{u()}:void 0};return new re.Editor(h)}function rl(e){e&&!e.isDestroyed&&e.destroy()}function al(e){return e!==null&&!e.isDestroyed}function cn(e){const{state:t}=e,{selection:n}=t,{from:o,to:r,empty:a}=n,s=a?"":t.doc.textBetween(o,r," "),l=n instanceof Object&&"node"in n,c=s.length>0,p=e.isActive("bold"),u=e.isActive("italic"),m=e.isActive("underline"),h=e.isActive("strike"),b=e.isActive("code"),f=e.isActive("link"),g=f?e.getAttributes("link").href:null;return{hasSelection:!a||l,isEmpty:a&&!l,hasTextContent:c,isNodeSelection:l,selectedText:s,from:o,to:r,isBold:p,isItalic:u,isUnderline:m,isStrike:h,isCode:b,hasLink:f,linkHref:g}}function il(e){return e.state.selection.empty}function Mt(e){const t=cn(e);return t.isEmpty?!1:!!t.hasTextContent}function sl(e){if(typeof window>"u")return null;const{view:t}=e,{from:n,to:o}=t.state.selection;if(n===o)return null;const r=t.coordsAtPos(n),a=t.coordsAtPos(o),s=Math.min(r.top,a.top),l=Math.max(r.bottom,a.bottom),c=Math.min(r.left,a.left),p=Math.max(r.right,a.right);return{top:s,left:c,right:p,bottom:l,width:p-c,height:l-s}}function ll(e){return e.chain().focus().toggleBold().run()}function cl(e){return e.chain().focus().toggleItalic().run()}function ul(e,t){return t?e.chain().focus().setLink({href:t}).run():e.chain().focus().unsetLink().run()}function dl(e){return e.chain().focus().unsetLink().run()}function pl(e){return e.chain().focus().setParagraph().run()}function fl(e,t){return e.chain().focus().setHeading({level:t}).run()}function hl(e,t){return e.chain().focus().toggleHeading({level:t}).run()}function bl(e){return e.chain().focus().undo().run()}function vl(e){return e.chain().focus().redo().run()}function gl(e,t){return e.chain().focus(t).run()}function ml(e){return e.chain().focus().selectAll().run()}function xl(e){return e.chain().focus().unsetAllMarks().run()}function yl(e,t){return e.isActive(t)}function wl(e,t,n){return e.isActive(t,n)}function kl(e){const t=[];return e.isActive("bold")&&t.push("bold"),e.isActive("italic")&&t.push("italic"),e.isActive("link")&&t.push("link"),t}function Cl(e){return e.getAttributes("link").href??null}function Co(e){return e?!e.isEditable:!0}function ft(e){return e?e.isEditable:!1}function Tl(e){return ft(e)}function Ll(e){return ft(e)}function Bl(e){return ft(e)}function Al(e){return ft(e)}function jl(e){return Co(e)?"pubwave-editor--readonly":""}const Et={editor:"Rich text editor",toolbar:"Text formatting toolbar",dragHandle:"Drag to reorder block"},Qe={bold:"Cmd+B",italic:"Cmd+I",underline:"Cmd+U",strike:"Cmd+Shift+X",code:"Cmd+E"};function Te(e,t){return t?`${e} (${t})`:e}const xe=x.forwardRef(({active:e=!1,disabled:t=!1,onClick:n,"data-tooltip":o,"data-testid":r,"aria-label":a,children:s,style:l},c)=>i.jsx("button",{ref:c,type:"button",className:Ee("pubwave-toolbar__button",e&&"pubwave-toolbar__button--active",t&&"pubwave-toolbar__button--disabled"),style:{display:"flex",alignItems:"center",justifyContent:"center",width:(l==null?void 0:l.width)??"var(--pubwave-button-width, 28px)",height:(l==null?void 0:l.height)??"var(--pubwave-button-height, 28px)",minWidth:l==null?void 0:l.minWidth,padding:(l==null?void 0:l.padding)??0,border:"none",borderRadius:"var(--pubwave-radius-sm, 4px)",backgroundColor:"transparent",color:e?"var(--pubwave-primary)":"var(--pubwave-text)",cursor:t?"not-allowed":"pointer",opacity:t?.5:1,transition:"color 0.1s ease, background-color 0.1s ease",...l},onClick:p=>{p.preventDefault(),p.stopPropagation(),n()},disabled:t,"data-tooltip":o,"data-testid":r,"aria-label":a,"aria-pressed":e,onMouseDown:p=>{p.preventDefault(),p.stopPropagation()},children:s}));xe.displayName="ToolbarButton";function Rn(){return i.jsx("div",{className:"pubwave-toolbar__divider",style:{width:"var(--pubwave-divider-width, 1px)",height:"var(--pubwave-divider-height, 20px)",backgroundColor:"var(--pubwave-border)",margin:"0 var(--pubwave-spacing-1, 4px)"},role:"separator","aria-orientation":"vertical"})}function To(e,t,n,o=8){const r=e,a=window.innerHeight-t,s=n+o;return r>=s?"top":a>=s?"bottom":r>=a?"top":"bottom"}function Sl(e,t,n=8){return To(e.top,e.bottom,t,n)}function Lo(e,t,n,o="left",r=8){const a=window.innerWidth,s=(e+t)/2,l=e,c=a-t,p=n+r,u=n+r,m=n/2+r;let h=o,b;return o==="left"?(b=e,(b<r||b+n>a-r)&&(c>=u&&t+n<=a-r?(h="right",b=t-n):l>=m&&s-n/2>=r?(h="center",b=s-n/2):(c>=l?(h="right",b=t-n):(h="left",b=e),b=Math.max(r,Math.min(b,a-n-r))))):o==="center"?(b=s-n/2,(b<r||b+n>a-r)&&(c>=u&&t+n<=a-r?(h="right",b=t-n):l>=p&&e+n<=a-r?(h="left",b=e):(c>=l?(h="right",b=t-n):(h="left",b=e),b=Math.max(r,Math.min(b,a-n-r))))):(b=t-n,(b<r||b+n>a-r)&&(l>=p&&e+n<=a-r?(h="left",b=e):l>=m&&s-n/2>=r?(h="center",b=s-n/2):(l>=c?(h="left",b=e):(h="right",b=t-n),b=Math.max(r,Math.min(b,a-n-r))))),b=Math.max(r,Math.min(b,a-n-r)),{align:h,left:b}}function Ml(e,t,n="left",o=8){return Lo(e.left,e.right,t,n,o)}function un({isOpen:e,buttonRef:t,children:n,className:o,style:r,align:a="left",margin:s=8,onClickOutside:l,onClick:c,"data-testid":p}){const[u,m]=x.useState("top"),[h,b]=x.useState(null),f=x.useRef(null);if(x.useEffect(()=>{if(!e||!t.current)return;const T=()=>{if(!f.current||!t.current)return;const M=t.current.getBoundingClientRect(),C=f.current.offsetHeight||300,d=f.current.offsetWidth||240,j=Sl(M,C,s);m(j);let w=t.current.parentElement;for(;w;){const P=window.getComputedStyle(w);if(P.position==="relative"||P.position==="absolute"||P.position==="fixed")break;w=w.parentElement}const S=Ml(M,d,a,s);if(w){const P=w.getBoundingClientRect(),R=S.left-P.left;b({align:S.align,left:R})}else b(S)};T();const k=requestAnimationFrame(()=>{T()});return()=>cancelAnimationFrame(k)},[e,t,s,a]),x.useEffect(()=>{if(!e||!l)return;const T=k=>{f.current&&!f.current.contains(k.target)&&t.current&&!t.current.contains(k.target)&&l(k)};return document.addEventListener("mousedown",T),()=>{document.removeEventListener("mousedown",T)}},[e,l,t]),!e)return null;const g=()=>{if(h)return{left:`${h.left}px`};switch(a){case"center":return{left:"50%",transform:"translateX(-50%)"};case"right":return{right:0};case"left":default:return{left:0}}};return i.jsx("div",{ref:f,className:o,"data-testid":p,style:{position:"absolute",...u==="top"?{bottom:"100%",marginBottom:`${s}px`}:{top:"100%",marginTop:`${s}px`},...g(),...r},onClick:T=>{T.stopPropagation(),c==null||c(T)},children:n})}function Pl({editor:e,isOpen:t,onToggle:n,onClose:o}){const r=Oe(),a=x.useRef(null),s=x.useCallback(()=>e.isActive("heading",{level:1})?"heading1":e.isActive("heading",{level:2})?"heading2":e.isActive("heading",{level:3})?"heading3":e.isActive("bulletList")?"bulletList":e.isActive("orderedList")?"orderedList":e.isActive("taskList")?"taskList":e.isActive("blockquote")?"blockquote":e.isActive("codeBlock")?"codeBlock":"paragraph",[e]),l=x.useMemo(()=>[{id:"paragraph",label:r.toolbar.blockTypes.text,icon:i.jsx(Un,{}),action:h=>h.chain().focus().setParagraph().run(),isActive:h=>h.isActive("paragraph")},{id:"heading1",label:r.toolbar.blockTypes.heading1,icon:i.jsx(Fn,{}),action:h=>h.chain().focus().setHeading({level:1}).run(),isActive:h=>h.isActive("heading",{level:1})},{id:"heading2",label:r.toolbar.blockTypes.heading2,icon:i.jsx(Wn,{}),action:h=>h.chain().focus().setHeading({level:2}).run(),isActive:h=>h.isActive("heading",{level:2})},{id:"heading3",label:r.toolbar.blockTypes.heading3,icon:i.jsx(Vn,{}),action:h=>h.chain().focus().setHeading({level:3}).run(),isActive:h=>h.isActive("heading",{level:3})},{id:"bulletList",label:r.toolbar.blockTypes.bulletedList,icon:i.jsx(Gn,{}),action:h=>h.chain().focus().toggleBulletList().run(),isActive:h=>h.isActive("bulletList")},{id:"orderedList",label:r.toolbar.blockTypes.numberedList,icon:i.jsx(Yn,{}),action:h=>h.chain().focus().toggleOrderedList().run(),isActive:h=>h.isActive("orderedList")}],[r]),c=s(),p=l.find(h=>h.id===c),u=x.useCallback(h=>{h.action(e),o(),setTimeout(()=>{e.chain().blur().run()},0)},[e,o]),m=h=>h===r.toolbar.blockTypes.heading1?r.toolbar.blockTypes.heading1:h===r.toolbar.blockTypes.heading2?r.toolbar.blockTypes.heading2:h===r.toolbar.blockTypes.heading3?r.toolbar.blockTypes.heading3:h===r.toolbar.blockTypes.bulletedList?r.toolbar.blockTypes.bulletedList:h===r.toolbar.blockTypes.numberedList?r.toolbar.blockTypes.numberedList:r.toolbar.blockTypes.text;return i.jsxs("div",{style:{position:"relative"},children:[i.jsx(xe,{ref:a,active:t,onClick:n,"data-tooltip":Te(r.toolbar.turnInto),"data-testid":"toolbar-turnInto","aria-label":r.aria.turnIntoButton,style:{width:"auto",minWidth:"auto",padding:"0 8px",height:"var(--pubwave-button-height, 28px)"},children:i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"4px",whiteSpace:"nowrap"},children:[i.jsx("span",{style:{fontSize:"12px",fontWeight:500},children:p?m(p.label):r.toolbar.blockTypes.text}),i.jsx(Ja,{})]})}),i.jsxs(un,{isOpen:t,buttonRef:a,align:"left",margin:8,onClickOutside:()=>o(),className:"pubwave-turn-into-dropdown","data-testid":"turn-into-dropdown",style:{backgroundColor:"var(--pubwave-surface, var(--pubwave-bg))",border:"1px solid var(--pubwave-border)",borderRadius:"var(--pubwave-radius-lg, 8px)",boxShadow:"var(--pubwave-shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05))",padding:"var(--pubwave-spacing-1, 4px)",minWidth:"240px",zIndex:E.zIndex.dropdown+1},children:[i.jsx("div",{style:St,children:r.toolbar.turnInto}),l.map(h=>{const b=h.isActive(e);return i.jsxs("button",{type:"button",className:Ee("pubwave-toolbar__turn-into-option",b&&"pubwave-toolbar__turn-into-option--active"),onClick:()=>u(h),style:{width:"100%",display:"flex",alignItems:"center",gap:"var(--pubwave-spacing-2, 8px)",padding:"var(--pubwave-spacing-2, 8px) var(--pubwave-spacing-3, 12px)",border:"none",backgroundColor:b?"var(--pubwave-primary-faded)":"transparent",color:b?"var(--pubwave-primary)":"var(--pubwave-text)",cursor:"pointer",fontSize:"var(--pubwave-font-size-base, 14px)",textAlign:"left",borderRadius:"var(--pubwave-border-radius-sm, 0.25rem)",transition:"background-color 0.1s ease"},children:[i.jsx("span",{style:{display:"flex",alignItems:"center",width:"18px",height:"18px",flexShrink:0},children:h.icon}),i.jsx("span",{children:h.label})]},h.id)})]})]})}function be(e){return!!(e&&!e.isDestroyed)}function Dl(e,t){be(e)&&Y(()=>{if(be(e))switch(t){case"start":e.commands.focus("start");break;case"end":e.commands.focus("end");break;case"preserve":e.commands.focus();break;default:typeof t=="number"&&(e.commands.setTextSelection(t),e.commands.focus())}})}function Ae(e){be(e)&&Y(()=>{be(e)&&(e.isFocused||e.commands.focus())})}function Il(e,t){be(e)&&(t.preventDefault(),Y(()=>{be(e)&&e.commands.focus()}))}function Rl(e){if(!be(e))return function(){};const t=o=>{const r=o.relatedTarget;if(r){const a=e.view.dom.closest(".pubwave-editor");a&&!a.contains(r)&&r.closest(".pubwave-toolbar, .pubwave-menu, .pubwave-dialog")}},n=e.view.dom;return n.addEventListener("focusout",t),()=>{n.removeEventListener("focusout",t)}}function Bo(e){if(!be(e))return null;const{from:t,to:n,empty:o}=e.state.selection;return{from:t,to:n,empty:o}}function tt(e,t){if(!be(e)||!t)return;const{from:n,to:o}=t,r=e.state.doc.content.size,a=Math.min(n,r),s=Math.min(o,r);e.commands.setTextSelection({from:a,to:s})}function Ol(e){if(!be(e))return;const{selection:t}=e.state;if(t.$anchor.pos>0){e.commands.focus();return}e.commands.focus("end")}function El(e){const t=e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),n=t[0],o=t[t.length-1],r=a=>{a.key==="Tab"&&(a.shiftKey?document.activeElement===n&&(a.preventDefault(),o==null||o.focus()):document.activeElement===o&&(a.preventDefault(),n==null||n.focus()))};return{activate(){e.addEventListener("keydown",r),n==null||n.focus()},deactivate(){e.removeEventListener("keydown",r)}}}function _l({editor:e,isOpen:t,onToggle:n,onClose:o,selectionState:r}){const a=Oe(),s=x.useRef(null),l=x.useRef(null),c=x.useRef(null),p=x.useRef([]),u=x.useRef(null),[m,h]=x.useState(""),b=(r==null?void 0:r.hasLink)??!1,f=(r==null?void 0:r.linkHref)??null;x.useEffect(()=>{t?(u.current=Bo(e),h(f||""),setTimeout(()=>{var C,d;(C=l.current)==null||C.focus(),(d=l.current)==null||d.select()},50)):u.current=null},[t,f,e]),x.useEffect(()=>{if(!ut()){if(!t){p.current.forEach(C=>C.destroy()),p.current=[];return}return p.current.forEach(C=>C.destroy()),p.current=[],Y(()=>{Y(()=>{if(!c.current)return;c.current.querySelectorAll("[data-tooltip]").forEach(d=>{const j=d.getAttribute("data-tooltip");if(j){const w=Be(d,{content:j,placement:"top",delay:[300,0],duration:[200,150],theme:"light-border"});p.current.push(w)}})})}),()=>{p.current.forEach(C=>C.destroy()),p.current=[]}}},[t,a,m,f]);const g=x.useCallback(C=>{if(C==null||C.preventDefault(),!m.trim()){u.current&&tt(e,u.current),e.chain().focus().unsetLink().run(),u.current&&Y(()=>{Y(()=>{tt(e,u.current)})}),o();return}let d=m.trim();!/^https?:\/\//i.test(d)&&!d.startsWith("/")&&!d.startsWith("#")&&(d=`https://${d}`),u.current&&tt(e,u.current),e.chain().focus().setLink({href:d}).run(),u.current&&Y(()=>{Y(()=>{tt(e,u.current)})}),o()},[e,m,o]),T=x.useCallback(()=>{const C=m.trim()||f;if(C){let d=C;!/^https?:\/\//i.test(d)&&!d.startsWith("/")&&!d.startsWith("#")&&(d=`https://${d}`),window.open(d,"_blank","noopener,noreferrer")}},[m,f]),k=x.useCallback(()=>{var C;h(""),(C=l.current)==null||C.focus()},[]),M=x.useCallback(C=>{C.key==="Enter"?(C.preventDefault(),g()):C.key==="Escape"&&(C.preventDefault(),o(),e.chain().focus().run())},[g,o,e]);return i.jsxs("div",{style:{position:"relative"},children:[i.jsx(xe,{ref:s,active:b,onClick:n,"data-tooltip":Te(a.toolbar.link),"data-testid":"toolbar-link","aria-label":a.aria.linkButton,children:i.jsx(oi,{})}),i.jsx(un,{isOpen:t,buttonRef:s,align:"left",margin:8,onClickOutside:()=>o(),className:"pubwave-link-dropdown",style:{backgroundColor:"var(--pubwave-surface, var(--pubwave-bg))",border:"1px solid var(--pubwave-border)",borderRadius:"var(--pubwave-radius-lg, 8px)",boxShadow:"var(--pubwave-shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05))",padding:"var(--pubwave-spacing-2, 8px)",minWidth:"280px",zIndex:E.zIndex.dropdown+1},children:i.jsx("div",{ref:c,children:i.jsx("form",{onSubmit:g,style:{display:"flex",flexDirection:"column",gap:"8px"},children:i.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[i.jsx("input",{ref:l,type:"text",value:m,onChange:C=>h(C.target.value),onKeyDown:M,placeholder:a.linkPlaceholder,"data-testid":"link-input","aria-label":a.aria.linkUrlInput,style:{flex:1,padding:"6px 100px 6px 8px",border:"1px solid var(--pubwave-border)",borderRadius:"var(--pubwave-radius-sm, 4px)",fontSize:"var(--pubwave-font-size-base, 14px)",backgroundColor:"var(--pubwave-bg)",color:"var(--pubwave-text)",outline:"none"}}),i.jsxs("div",{style:{position:"absolute",right:"4px",display:"flex",alignItems:"center",gap:"2px"},children:[i.jsx("button",{type:"button",onClick:g,"data-tooltip":a.toolbar.confirmLink,"data-testid":"link-confirm-button","aria-label":a.aria.linkConfirmButton,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",padding:0,border:"none",borderRadius:"var(--pubwave-radius-sm, 4px)",backgroundColor:"transparent",color:"var(--pubwave-text)",cursor:"pointer",transition:"background-color 0.1s ease"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor="var(--pubwave-hover, rgba(0, 0, 0, 0.05))"},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent"},children:i.jsx(ai,{})}),(m.trim()||f)&&i.jsx("button",{type:"button",onClick:T,"data-tooltip":a.toolbar.openLink,"data-testid":"link-open-button","aria-label":a.aria.linkOpenButton,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",padding:0,border:"none",borderRadius:"var(--pubwave-radius-sm, 4px)",backgroundColor:"transparent",color:"var(--pubwave-text)",cursor:"pointer",transition:"background-color 0.1s ease"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor="var(--pubwave-hover, rgba(0, 0, 0, 0.05))"},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent"},children:i.jsx(ri,{})}),i.jsx("button",{type:"button",onClick:k,"data-tooltip":a.toolbar.clearLink,"data-testid":"link-clear-button","aria-label":a.aria.linkClearButton,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",padding:0,border:"none",borderRadius:"var(--pubwave-radius-sm, 4px)",backgroundColor:"transparent",color:"var(--pubwave-text)",cursor:"pointer",transition:"background-color 0.1s ease"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor="var(--pubwave-hover, rgba(0, 0, 0, 0.05))"},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent"},children:i.jsx(ii,{})})]})]})})})})]})}const Nl=[{name:"Default",value:null,color:"#1f2937"},{name:"Gray",value:"#6b7280",color:"#6b7280"},{name:"Brown",value:"#92400e",color:"#92400e"},{name:"Orange",value:"#ea580c",color:"#ea580c"},{name:"Orange Dark",value:"#c2410c",color:"#c2410c"},{name:"Green",value:"#16a34a",color:"#16a34a"},{name:"Blue",value:"#2563eb",color:"#2563eb"},{name:"Purple",value:"#9333ea",color:"#9333ea"},{name:"Pink",value:"#ec4899",color:"#ec4899"},{name:"Red",value:"#dc2626",color:"#dc2626"}],Hl=[{name:"Default",value:null,color:"#ffffff"},{name:"Gray",value:"#f3f4f6",color:"#f3f4f6"},{name:"Peach",value:"#fed7aa",color:"#fed7aa"},{name:"Orange",value:"#fdba74",color:"#fdba74"},{name:"Yellow",value:"#fde047",color:"#fde047"},{name:"Green",value:"#86efac",color:"#86efac"},{name:"Blue",value:"#93c5fd",color:"#93c5fd"},{name:"Purple",value:"#c084fc",color:"#c084fc"},{name:"Pink",value:"#f9a8d4",color:"#f9a8d4"},{name:"Red",value:"#fca5a5",color:"#fca5a5"}],Ao="pubwave-editor-recent-colors",On=5;function $l(){if(typeof window>"u")return[];try{const e=localStorage.getItem(Ao);if(e)return JSON.parse(e)}catch{}return[]}function En(e){if(!(typeof window>"u"))try{localStorage.setItem(Ao,JSON.stringify(e))}catch{}}function zl({editor:e,onClose:t,buttonRef:n}){const o=Oe(),[r,a]=x.useState([]),s=x.useRef(null),l=x.useRef([]);x.useEffect(()=>{const f=$l();f.length>0&&a(f)},[]);const c=()=>{try{const f=e.getAttributes("textColor");return(f==null?void 0:f.color)||null}catch{return null}},p=()=>{try{const f=e.getAttributes("backgroundColor");return(f==null?void 0:f.backgroundColor)||null}catch{return null}},u=c(),m=p(),h=f=>{f===null?e.chain().focus().unsetColor().run():(e.chain().focus().setColor(f).run(),a(g=>{const k=[{type:"text",value:f},...g.filter(M=>!(M.type==="text"&&M.value===f))].slice(0,On);return En(k),k}))},b=f=>{f===null?e.chain().focus().unsetBackgroundColor().run():(e.chain().focus().setBackgroundColor(f).run(),a(g=>{const k=[{type:"background",value:f},...g.filter(M=>!(M.type==="background"&&M.value===f))].slice(0,On);return En(k),k}))};return x.useEffect(()=>{if(!ut()&&s.current)return l.current.forEach(f=>f.destroy()),l.current=[],requestAnimationFrame(()=>{if(!s.current)return;s.current.querySelectorAll("[data-tooltip]").forEach(g=>{const T=g.getAttribute("data-tooltip");if(T){const k=Be(g,{content:T,placement:"top",delay:[300,0],duration:[200,150],theme:"light-border"});l.current.push(k)}})}),()=>{l.current.forEach(f=>f.destroy()),l.current=[]}},[r,u,m,o]),i.jsx(un,{isOpen:!0,buttonRef:n,align:"center",margin:8,onClickOutside:()=>t==null?void 0:t(),className:"pubwave-color-picker","data-testid":"color-picker",style:{backgroundColor:"var(--pubwave-bg, #ffffff)",border:"1px solid var(--pubwave-border, #e5e7eb)",borderRadius:"var(--pubwave-radius-lg, 8px)",boxShadow:"var(--pubwave-shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1))",padding:"12px",minWidth:"240px",zIndex:E.zIndex.dropdown+1},children:i.jsxs("div",{ref:s,children:[r.length>0&&i.jsxs("div",{style:{marginBottom:"16px"},children:[i.jsx("div",{style:{...St,paddingLeft:0,paddingRight:0,marginBottom:"8px"},children:o.toolbar.recentlyUsed}),i.jsx("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:r.map((f,g)=>i.jsx("button",{type:"button",onClick:()=>{f.type==="text"?h(f.value):b(f.value)},style:{width:"24px",height:"24px",borderRadius:"4px",border:"1px solid var(--pubwave-border, #e5e7eb)",backgroundColor:f.type==="background"?f.value:"#ffffff",cursor:"pointer",padding:f.type==="text"?"4px":0,display:f.type==="text"?"flex":"block",alignItems:f.type==="text"?"center":"normal",justifyContent:f.type==="text"?"center":"normal"},"data-tooltip":f.type==="text"?`${f.value} text`:`${f.value} background`,children:f.type==="text"&&i.jsx("span",{style:{fontSize:"12px",fontWeight:500,color:f.value,lineHeight:1},children:"A"})},`${f.type}-${f.value}-${g}`))})]}),i.jsxs("div",{style:{marginBottom:"16px"},children:[i.jsx("div",{style:{...St,paddingLeft:0,paddingRight:0,marginBottom:"8px"},children:o.toolbar.textColor}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(5, 1fr)",gap:"6px"},children:Nl.map(f=>{const g=u===f.value;return i.jsx("button",{type:"button",onClick:()=>h(f.value),style:{width:"100%",aspectRatio:"1",borderRadius:"4px",border:g?"2px solid var(--pubwave-primary, #3b82f6)":"1px solid var(--pubwave-border, #e5e7eb)",backgroundColor:"#ffffff",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center"},"data-tooltip":f.value?`${f.name} text`:"Default text",children:i.jsx("span",{style:{fontSize:"12px",fontWeight:500,color:f.color},children:"A"})},f.name)})})]}),i.jsxs("div",{children:[i.jsx("div",{style:{...St,paddingLeft:0,paddingRight:0,marginBottom:"8px"},children:o.toolbar.backgroundColor}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(5, 1fr)",gap:"6px"},children:Hl.map(f=>{const g=m===f.value;return i.jsx("button",{type:"button",onClick:()=>b(f.value),style:{width:"100%",aspectRatio:"1",borderRadius:"4px",border:g?"2px solid var(--pubwave-primary, #3b82f6)":"1px solid var(--pubwave-border, #e5e7eb)",backgroundColor:f.color,cursor:"pointer",padding:0},"data-tooltip":f.value?`${f.name} background`:"Default background"},f.name)})})]})]})})}function ql({editor:e,isOpen:t,onToggle:n,onClose:o}){const r=Oe(),a=x.useRef(null),s=()=>{try{const f=e.getAttributes("textColor");return(f==null?void 0:f.color)||null}catch{return null}},l=()=>{try{if(!e.isActive("backgroundColor"))return null;const f=e.getAttributes("backgroundColor");return(f==null?void 0:f.backgroundColor)||null}catch{return null}},c=s(),p=l(),u=c||p,h=c||(()=>{if(typeof window>"u")return"#1f2937";const f=document.querySelector(".pubwave-editor");return f&&window.getComputedStyle(f).getPropertyValue("--pubwave-text").trim()||"#1f2937"})(),b=p;return i.jsxs("div",{style:{position:"relative"},children:[i.jsx(xe,{ref:a,active:!!u,onClick:n,"data-tooltip":Te(r.toolbar.textColor),"data-testid":"toolbar-colorPicker","aria-label":r.aria.colorPickerButton,children:i.jsx(si,{textColor:h,backgroundColor:b})}),t&&i.jsx(zl,{editor:e,onClose:o,buttonRef:a})]})}function Ul({editor:e,selectionState:t}){const n=Oe(),[o,r]=x.useState(null),a=x.useCallback(()=>{r(null),e.chain().focus().toggleBold().run()},[e]),s=x.useCallback(()=>{r(null),e.chain().focus().toggleItalic().run()},[e]),l=x.useCallback(()=>{r(null),e.chain().focus().toggleUnderline().run()},[e]),c=x.useCallback(()=>{r(null),e.chain().focus().toggleStrike().run()},[e]),p=x.useCallback(()=>{r(null),e.chain().focus().toggleCode().run()},[e]),u=x.useCallback(()=>{r(M=>M==="turnInto"?null:"turnInto")},[]),m=x.useCallback(()=>{r(M=>M==="link"?null:"link")},[]),h=x.useCallback(()=>{r(M=>M==="colorPicker"?null:"colorPicker")},[]),b=(t==null?void 0:t.isBold)??!1,f=(t==null?void 0:t.isItalic)??!1,g=(t==null?void 0:t.isUnderline)??!1,T=(t==null?void 0:t.isStrike)??!1,k=(t==null?void 0:t.isCode)??!1;return i.jsxs(i.Fragment,{children:[i.jsx(Pl,{editor:e,isOpen:o==="turnInto",onToggle:u,onClose:()=>r(null)}),i.jsx(Rn,{}),i.jsx(xe,{active:b,onClick:a,"data-tooltip":Te(n.toolbar.bold,Qe.bold),"data-testid":"toolbar-bold","aria-label":n.aria.boldButton,children:i.jsx(Za,{})}),i.jsx(xe,{active:f,onClick:s,"data-tooltip":Te(n.toolbar.italic,Qe.italic),"data-testid":"toolbar-italic","aria-label":n.aria.italicButton,children:i.jsx(Qa,{})}),i.jsx(xe,{active:g,onClick:l,"data-tooltip":Te(n.toolbar.underline,Qe.underline),"data-testid":"toolbar-underline","aria-label":n.aria.underlineButton,children:i.jsx(ei,{})}),i.jsx(xe,{active:T,onClick:c,"data-tooltip":Te(n.toolbar.strike,Qe.strike),"data-testid":"toolbar-strike","aria-label":n.aria.strikeButton,children:i.jsx(ti,{})}),i.jsx(xe,{active:k,onClick:p,"data-tooltip":Te(n.toolbar.code,Qe.code),"data-testid":"toolbar-code","aria-label":n.aria.codeButton,children:i.jsx(ni,{})}),i.jsx(Rn,{}),i.jsx(_l,{editor:e,isOpen:o==="link",onToggle:m,onClose:()=>r(null),selectionState:t}),i.jsx(ql,{editor:e,isOpen:o==="colorPicker",onToggle:h,onClose:()=>r(null)})]})}const et=8;function Me(e){return!e.isDestroyed}function Fl(e,t){if(!t)return{top:0,left:0,visible:!1};const{view:n}=e,{from:o,to:r}=n.state.selection,a=n.coordsAtPos(o),s=n.coordsAtPos(r),l=Math.min(a.top,s.top),c=Math.min(a.left,s.left),p=Math.max(a.right,s.right),u=t.getBoundingClientRect(),m=u.width,h=u.height,b=Math.max(a.bottom,s.bottom),f=To(l,b,h,et);let g;f==="top"?g=l-h-et:g=b+et;const k=Lo(c,p,m,"center",et).left,M=window.innerWidth,C=window.innerHeight,d=et,j=Math.max(d,Math.min(k,M-m-d));return{top:Math.max(d,Math.min(g,C-h-d)),left:j,visible:!0}}function jo({editor:e,className:t,children:n,onVisibilityChange:o}){const r=x.useRef(null),a=x.useRef(!1),s=x.useRef(0),l=x.useRef(!1),[c,p]=x.useState({top:0,left:0,visible:!1}),[u,m]=x.useState(null),[h,b]=x.useState(!1),f=x.useRef([]),g=x.useMemo(()=>!Me(e)||a.current||!h?!1:Mt(e),[e,u,h]),T=x.useCallback(()=>{if(!Me(e))return;const C=cn(e);m(C)},[e]),k=x.useCallback(()=>{if(!g||!r.current){p(C=>({...C,visible:!1}));return}Y(()=>{if(!Me(e))return;const C=Fl(e,r.current);p(C)})},[e,g]);x.useEffect(()=>{if(!Me(e))return;const d=e.view.dom.closest(".pubwave-editor"),j=S=>{const P=S.target,R=r.current;if(R&&P&&R.contains(P)){a.current=!1;return}d&&P&&d.contains(P)?l.current=!0:l.current=!1,a.current=!0,b(!1)},w=S=>{const P=Date.now(),B=P-s.current<300;s.current=P;const v=S.target,L=r.current;if(L&&v&&L.contains(v)){a.current=!1;return}if(a.current=!1,!l.current){b(!1);return}setTimeout(()=>{Me(e)&&(Mt(e)?(T(),b(!0),Y(()=>{k()})):(b(!1),p(_=>({..._,visible:!1}))))},B?100:10)};return document.addEventListener("mousedown",j),document.addEventListener("mouseup",w),()=>{document.removeEventListener("mousedown",j),document.removeEventListener("mouseup",w)}},[e,T,k]),x.useEffect(()=>{if(!Me(e))return;T();const C=()=>{!a.current&&h&&T()},d=()=>{a.current||(T(),Mt(e)?b(!0):b(!1),Y(()=>{k()}))},j=()=>{setTimeout(()=>{const w=document.activeElement,S=r.current;S&&w&&S.contains(w)||(b(!1),C())},0)};return e.on("update",C),e.on("selectionUpdate",d),e.on("focus",d),e.on("blur",j),()=>{e.off("update",C),e.off("selectionUpdate",d),e.off("focus",d),e.off("blur",j)}},[e,T,k,h]),x.useEffect(()=>{k(),o==null||o(g)},[g,k,o]),x.useEffect(()=>{if(!g)return;const C=()=>{k()};return window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),()=>{window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0)}},[g,k]);const M=Oe();return x.useEffect(()=>{if(!ut()){if(!g||!c.visible||!r.current){f.current.forEach(C=>C.destroy()),f.current=[];return}return f.current.forEach(C=>C.destroy()),f.current=[],Y(()=>{if(!r.current)return;r.current.querySelectorAll("[data-tooltip]").forEach(d=>{const j=d.getAttribute("data-tooltip");if(j){const w=Be(d,{content:j,placement:"top",delay:[300,0],duration:[200,150],theme:"light-border"});f.current.push(w)}})}),()=>{f.current.forEach(C=>C.destroy()),f.current=[]}}},[g,c.visible,M]),Me(e)?i.jsx("div",{ref:r,className:Ee("pubwave-toolbar",g&&c.visible?"pubwave-toolbar--visible":"pubwave-toolbar--hidden",t),style:{position:"fixed",top:c.top,left:c.left,zIndex:E.zIndex.toolbar,opacity:g&&c.visible?1:0,pointerEvents:g&&c.visible?"auto":"none",transform:g&&c.visible?"translateY(0)":"translateY(4px)",transition:`opacity ${E.transition.fast}, transform ${E.transition.fast}`,isolation:"isolate"},role:"toolbar","aria-label":Et.toolbar,"aria-hidden":!g||!c.visible,"data-testid":"bubble-toolbar",children:i.jsx("div",{className:"pubwave-toolbar__content",style:{display:"flex",alignItems:"center",gap:0,padding:"var(--pubwave-spacing-1, 4px)",backgroundColor:"var(--pubwave-surface, var(--pubwave-bg))",color:"var(--pubwave-text)",border:"1px solid var(--pubwave-border)",borderRadius:"var(--pubwave-radius-lg, 8px)",boxShadow:"var(--pubwave-shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05))"},children:n??i.jsx(Ul,{editor:e,selectionState:u})})}):null}const Wl=768;function Vl(e,t,n){if(!e||!(e instanceof Node))return null;try{const o=n.view.posAtDOM(e,0),r=n.state.doc.resolve(o);if(r.depth>=1){const a=r.node(1);if(["taskList","bulletList","orderedList","blockquote"].includes(a.type.name)){const l=n.view.nodeDOM(r.before(1));if(l&&t.contains(l))return l}}for(let a=r.depth;a>0;a--)if(r.node(a).isBlock){const l=r.before(a),c=n.view.nodeDOM(l);if(c&&t.contains(c))return c}}catch{let r=e instanceof HTMLElement?e:e.parentElement;for(;r&&r.parentElement;){if(r.parentElement===t)return r;r=r.parentElement}}return null}function So({editor:e}){const t=x.useRef(null),n=x.useRef(null),o=x.useRef(!1),r=x.useRef(null),[a,s]=x.useState(!1),[l,c]=x.useState(!1),[p,u]=x.useState({top:0}),[m,h]=x.useState(!1),[b,f]=x.useState(!1);x.useEffect(()=>{const w=()=>{h(ut()),f(window.innerWidth<Wl)};return w(),window.addEventListener("resize",w),()=>{window.removeEventListener("resize",w)}},[]);const g=x.useCallback(()=>{const w=t.current,S=n.current;if(!w||!S)return;const P=w.closest(".pubwave-editor");if(!P)return;P.offsetHeight;const R=P.getBoundingClientRect();let B=14,v=S;["UL","OL","BLOCKQUOTE"].includes(S.tagName)&&S.firstElementChild instanceof HTMLElement&&(v=S.firstElementChild),v.offsetHeight;const L=v.getBoundingClientRect();try{const _=window.getComputedStyle(v),H=_.lineHeight;if(H&&H!=="normal"){const z=parseFloat(H);isNaN(z)||(B=z/2)}else{const z=parseFloat(_.fontSize);isNaN(z)||(B=z*1.5/2)}}catch{}const A=L.top-R.top+B;!isNaN(A)&&isFinite(A)&&A>=0&&u({top:A})},[]),T=x.useCallback(w=>{n.current=w,s(!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{g()})})},[g]),k=x.useCallback(()=>{o.current||(n.current=null,s(!1))},[]),M=x.useCallback(()=>{r.current&&(clearTimeout(r.current),r.current=null)},[]);x.useEffect(()=>{const w=e.view.dom,S=w.closest(".pubwave-editor");if(!S)return;const P=L=>{if(o.current)return;const A=L.target;if(!A||(M(),A.closest(".pubwave-block-handle"))||!w.contains(A))return;const _=Vl(A,w,e);_&&(_!==n.current?T(_):s(!0))},R=L=>{if(o.current)return;const A=L.relatedTarget;if(!A){M(),r.current=setTimeout(()=>{k()},150);return}A.closest(".pubwave-block-handle")||w.contains(A)||A.closest(".pubwave-editor")||(M(),r.current=setTimeout(()=>{k()},150))},B=()=>{o.current||(M(),r.current=setTimeout(()=>{k()},150))};w.addEventListener("mouseover",P),w.addEventListener("mouseout",R),S.addEventListener("mouseleave",B);const v=({transaction:L})=>{L.docChanged&&!o.current&&k()};return e.on("transaction",v),()=>{w.removeEventListener("mouseover",P),w.removeEventListener("mouseout",R),S.removeEventListener("mouseleave",B),e.off("transaction",v),M()}},[e,T,k,M]),x.useEffect(()=>{a&&n.current&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{g()})})},[a,g]),x.useEffect(()=>{if(!a)return;const w=()=>{n.current&&g()};return window.addEventListener("scroll",w,!0),()=>window.removeEventListener("scroll",w,!0)},[a,g]);const C=x.useCallback(()=>{const w=n.current;if(w)try{const S=e.view.posAtDOM(w,0),P=e.state.doc.resolve(S);let R=S;for(let L=P.depth;L>0;L--)if(P.node(L).isBlock){R=P.start(L);break}const v=e.state.doc.resolve(R).after(1);e.chain().focus().insertContentAt(v,{type:"paragraph"}).setTextSelection(v+1).run(),setTimeout(()=>{e.commands.insertContent("/")},10)}catch(S){console.error("Failed to add block:",S)}},[e]),d=x.useCallback(w=>{const S=n.current;if(!S)return;o.current=!0,requestAnimationFrame(()=>{c(!0)});const P=e.view.posAtDOM(S,0),R=ct(e.state.doc,P);if(!R)return;const B=R.pos,v=`block-${B}`;ko(e,v,B),w.dataTransfer.effectAllowed="move",w.dataTransfer.setData("application/x-pubwave-block",v),S.classList.add("pubwave-block--dragging");const L=S.cloneNode(!0);L.classList.add("pubwave-block--drag-preview"),L.style.opacity="1";const A=U=>{U.style.setProperty("color","#9b9a97","important"),U.style.setProperty("border-color","#9b9a97","important"),U.style.setProperty("--pubwave-text","#9b9a97","important"),Array.from(U.children).forEach(I=>{I instanceof HTMLElement&&A(I)})};A(L);const _=S.getBoundingClientRect();L.style.width=`${_.width}px`,L.style.position="static",L.style.transform="none";const H=document.createElement("div");H.className="pubwave-editor";const z=document.createElement("div");z.className="pubwave-editor__content";const F=document.createElement("div");F.className="ProseMirror",F.appendChild(L),z.appendChild(F),H.appendChild(z),H.style.position="absolute",H.style.top="-9999px",H.style.left="-9999px",document.body.appendChild(H),w.dataTransfer.setDragImage(L,0,0),setTimeout(()=>{document.body.removeChild(H)},0)},[e]),j=x.useCallback(()=>{o.current=!1,c(!1),n.current&&n.current.classList.remove("pubwave-block--dragging"),s(!1)},[]);return m||b||!a?null:i.jsxs("div",{ref:t,className:"pubwave-block-handle","data-testid":"block-handle",style:{position:"absolute",left:"calc(var(--pubwave-container-padding-left, 140px) - 80px)",top:`${p.top}px`,transform:"translateY(-50%)",display:"flex",alignItems:"center",gap:"2px",pointerEvents:"auto",transition:`opacity ${E.transition.fast}`,zIndex:E.zIndex.dragHandle,opacity:a&&!l?1:0},onMouseEnter:w=>{w.stopPropagation(),r.current&&(clearTimeout(r.current),r.current=null)},onMouseLeave:w=>{w.stopPropagation();const S=w.relatedTarget;S!=null&&S.closest(".pubwave-editor")||(r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{k()},150))},children:[i.jsx("button",{type:"button",className:"pubwave-block-handle__add",onClick:C,"data-testid":"add-block-button",style:{width:"var(--pubwave-button-width, 28px)",height:"var(--pubwave-button-height, 28px)",display:"flex",alignItems:"center",justifyContent:"center",border:"none",borderRadius:E.borderRadius.sm,background:"transparent",color:`var(--pubwave-text-muted, ${E.colors.textMuted})`,cursor:"pointer",transition:`background-color ${E.transition.fast}, color ${E.transition.fast}`},title:"Add block","aria-label":"Add block below",children:i.jsx(Gl,{})}),i.jsx("div",{className:"pubwave-block-handle__drag",draggable:!0,onDragStart:d,onDragEnd:j,"data-testid":"drag-handle",style:{width:"44px",height:"44px",padding:"8px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:E.borderRadius.sm,background:"transparent",color:`var(--pubwave-text-muted, ${E.colors.textMuted})`,cursor:"grab",transition:`background-color ${E.transition.fast}, color ${E.transition.fast}`},role:"button",tabIndex:0,title:"Drag to move","aria-label":"Drag to reorder block",children:i.jsx(Yl,{})})]})}function Gl(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"8",y1:"3",x2:"8",y2:"13"}),i.jsx("line",{x1:"3",y1:"8",x2:"13",y2:"8"})]})}function Yl(){return i.jsxs("svg",{width:"12",height:"18",viewBox:"0 0 10 16",fill:"currentColor",children:[i.jsx("circle",{cx:"2",cy:"3",r:"1.5"}),i.jsx("circle",{cx:"2",cy:"8",r:"1.5"}),i.jsx("circle",{cx:"2",cy:"13",r:"1.5"}),i.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),i.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),i.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}function Mo({visible:e,position:t,className:n}){return i.jsxs("div",{className:Ee("pubwave-drop-indicator",e&&"pubwave-drop-indicator--visible",`pubwave-drop-indicator--${t}`,n),"data-testid":"drop-indicator",style:{position:"absolute",left:0,right:0,height:"2px",backgroundColor:`var(--pubwave-drop-indicator-color, ${E.colors.dropIndicator})`,borderRadius:"1px",...t==="before"?{top:"-1px"}:{bottom:"-1px"},opacity:e?1:0,transform:e?"scaleX(1)":"scaleX(0.8)",transition:`opacity ${E.transition.fast}, transform ${E.transition.fast}`,zIndex:10,pointerEvents:"none"},"aria-hidden":"true",children:[i.jsx(_n,{position:"left",visible:e}),i.jsx(_n,{position:"right",visible:e})]})}function _n({position:e,visible:t}){return i.jsx("div",{className:`pubwave-drop-indicator__cap pubwave-drop-indicator__cap--${e}`,style:{position:"absolute",top:"50%",transform:"translateY(-50%)",...e==="left"?{left:"-4px"}:{right:"-4px"},width:"8px",height:"8px",borderRadius:"50%",backgroundColor:`var(--pubwave-drop-indicator-color, ${E.colors.dropIndicator})`,opacity:t?1:0,transition:`opacity ${E.transition.fast}`}})}function Kl({editor:e}){const[t,n]=x.useState(null),[o,r]=x.useState(null);return x.useEffect(()=>{const a=Z.getState(e.state);a&&n(a);const s=()=>{const l=Z.getState(e.state);l&&(l.dropTargetPos!==(t==null?void 0:t.dropTargetPos)||l.dropPosition!==(t==null?void 0:t.dropPosition))&&n(l)};return e.on("transaction",s),()=>{e.off("transaction",s)}},[e,t]),x.useEffect(()=>{if(!(t!=null&&t.dropTargetPos)||!t.dropPosition){r(null);return}const a=requestAnimationFrame(()=>{var b;const s=e.view,l=t.dropTargetPos;if(l===null)return;let c=s.nodeDOM(l);if(!c&&l>0){const f=s.domAtPos(l).node;f instanceof HTMLElement&&(c=f)}if(!c||!(c instanceof HTMLElement))return;const p=c.getBoundingClientRect(),u=(b=s.dom.closest(".pubwave-editor"))==null?void 0:b.getBoundingClientRect();if(!u)return;const m=8;let h=0;t.dropPosition==="before"?h=p.top-u.top-m:h=p.bottom-u.top+m,r({top:h,left:p.left-u.left,width:p.width})});return()=>cancelAnimationFrame(a)},[t,e]),!(t!=null&&t.dropTargetPos)||!t.dropPosition||!o?null:i.jsx("div",{style:{position:"absolute",top:o.top,left:o.left,width:o.width,height:"2px",pointerEvents:"none",zIndex:50},children:i.jsx(Mo,{visible:!0,position:t.dropPosition,className:"pubwave-drop-indicator--overlay"})})}const Xl=x.forwardRef(function(t,n){const{content:o,editable:r=!0,placeholder:a,theme:s,autofocus:l=!1,imageUpload:c,onChange:p,onSelectionChange:u,onFocus:m,onBlur:h,onReady:b,className:f,width:g,height:T,minHeight:k,"data-testid":M="pubwave-editor"}=t,C=At(s==null?void 0:s.locale),d=a??C.placeholder??'Write,type "/" for commands...',j=ye.useEditor({extensions:ln({placeholder:d,headingLevels:[1,2,3],linkOpenInNewTab:!0,linkOpenOnClick:!0,imageUpload:c,locale:s==null?void 0:s.locale}),content:o,editable:r,autofocus:l,immediatelyRender:!1,editorProps:{attributes:{class:`pubwave-editor__content ${(s==null?void 0:s.contentClassName)??""}`.trim(),"data-placeholder":d}},onUpdate:({editor:v})=>{p==null||p(v.getJSON())},onSelectionUpdate:()=>{u==null||u()},onFocus:()=>{m==null||m()},onBlur:()=>{h==null||h()},onCreate:({editor:v})=>{const L=w(v);b==null||b(L)}}),w=x.useCallback(v=>({getState:()=>({selection:{hasSelection:!(v!=null&&v.state.selection.empty),isMultiBlock:!1,from:(v==null?void 0:v.state.selection.from)??0,to:(v==null?void 0:v.state.selection.to)??0,isEmpty:(v==null?void 0:v.state.selection.empty)??!0},marks:{isBold:(v==null?void 0:v.isActive("bold"))??!1,isItalic:(v==null?void 0:v.isActive("italic"))??!1,isLink:(v==null?void 0:v.isActive("link"))??!1,linkHref:v?v.getAttributes("link").href:void 0},isFocused:(v==null?void 0:v.isFocused)??!1,isEditable:(v==null?void 0:v.isEditable)??!1,isEmpty:(v==null?void 0:v.isEmpty)??!0,characterCount:0}),getJSON:()=>(v==null?void 0:v.getJSON())??{type:"doc",content:[]},getHTML:()=>(v==null?void 0:v.getHTML())??"",getText:()=>(v==null?void 0:v.getText())??"",setContent:L=>v==null?void 0:v.commands.setContent(L),clearContent:()=>v==null?void 0:v.commands.clearContent(),setEditable:L=>v==null?void 0:v.setEditable(L),focus:L=>{L==="start"?v==null||v.commands.focus("start"):L==="end"?v==null||v.commands.focus("end"):v==null||v.commands.focus()},blur:()=>v==null?void 0:v.commands.blur(),toggleBold:()=>v==null?void 0:v.chain().focus().toggleBold().run(),toggleItalic:()=>v==null?void 0:v.chain().focus().toggleItalic().run(),setLink:L=>{L?v==null||v.chain().focus().setLink({href:L}).run():v==null||v.chain().focus().unsetLink().run()},destroy:()=>v==null?void 0:v.destroy(),tiptapEditor:v??null}),[]);x.useImperativeHandle(n,()=>j?w(j):null,[j,w]);const[S,P]=x.useState(!1);x.useEffect(()=>{P(!0)},[]),x.useEffect(()=>{var L;if(!((L=j==null?void 0:j.view)!=null&&L.dom))return;const v=j.view.dom;v&&v.setAttribute("data-placeholder",d)},[j,d,s==null?void 0:s.locale]);const R=["pubwave-editor",(s==null?void 0:s.classNamePrefix)??"",(s==null?void 0:s.containerClassName)??"",j?jl(j):"",T||k?"pubwave-editor--fixed-height":"",f].filter(Boolean).join(" "),B={position:"relative",overflow:T||k?"hidden":"visible",...T||k?{display:"flex",flexDirection:"column"}:{}};if(g&&(B["--pubwave-container-width"]=g,B.width=g,B["--pubwave-container-max-width"]=g,B.maxWidth=g),T&&(B["--pubwave-container-height"]=T,B.height=T),k&&(B["--pubwave-container-min-height"]=k,B.minHeight=k),s!=null&&s.colors){const{colors:v}=s,A=(v.text||"#1f2937").toLowerCase().trim(),_=A.startsWith("#f")||A.startsWith("#e")||A.includes("f1")||A.includes("f3")||A.includes("f0")||A.includes("fdf")||A.includes("ffb")||A.includes("ffc")||A.includes("ffd")||A.includes("ffe")||A.includes("fff")||A.includes("e0")||A.includes("e5")||A.includes("ecf")||A.includes("eef");v.background&&(v.background.includes("gradient")?(B.background=v.background,_?(B["--pubwave-surface"]="rgba(38, 38, 38, 0.95)",B["--pubwave-bg"]="#1a1a1a"):(B["--pubwave-surface"]="rgba(255, 255, 255, 0.95)",B["--pubwave-bg"]="#ffffff")):(B["--pubwave-bg"]=v.background,B["--pubwave-surface"]=v.background)),v.text&&(B["--pubwave-text"]=v.text),v.textMuted&&(B["--pubwave-text-muted"]=v.textMuted),v.border&&(B["--pubwave-border"]=v.border),v.primary&&(B["--pubwave-primary"]=v.primary),v.linkColor&&(B["--pubwave-link-color"]=v.linkColor),_?B["--pubwave-hover"]="rgba(255, 255, 255, 0.1)":B["--pubwave-hover"]="rgba(0, 0, 0, 0.05)"}if(s!=null&&s.backgroundImage){const v=s.backgroundImage,L=s.backgroundImageOptions||{};v.startsWith("url(")||v.includes("gradient")||v.includes("linear-gradient")||v.includes("radial-gradient")?B.backgroundImage=v:B.backgroundImage=`url(${v})`,L.repeat!==void 0?B.backgroundRepeat=L.repeat:B.backgroundRepeat="no-repeat",L.position!==void 0?B.backgroundPosition=L.position:B.backgroundPosition="center",L.size!==void 0?B.backgroundSize=L.size:B.backgroundSize="cover",L.attachment!==void 0?B.backgroundAttachment=L.attachment:B.backgroundAttachment="scroll"}return!S||!j?i.jsx(pn,{value:{locale:C},children:i.jsx("div",{className:R,"data-testid":M,role:"application","aria-label":Et.editor,style:B})}):i.jsx(pn,{value:{locale:C},children:i.jsxs("div",{className:R,"data-testid":M,role:"application","aria-label":Et.editor,style:B,children:[i.jsx(ye.EditorContent,{editor:j}),r&&i.jsx(jo,{editor:j}),r&&i.jsx(So,{editor:j}),r&&i.jsx(Kl,{editor:j})]})})});function _e(e){return!e.isDestroyed}function Po(e){if(!_e(e))return{success:!1,message:"Editor not available"};const t=e.chain().focus().toggleBold().run();return Ae(e),{success:t,message:t?"Bold toggled":"Could not toggle bold"}}function Do(e){if(!_e(e))return{success:!1,message:"Editor not available"};const t=e.chain().focus().toggleItalic().run();return Ae(e),{success:t,message:t?"Italic toggled":"Could not toggle italic"}}function Io(e,t){if(!_e(e))return{success:!1,message:"Editor not available"};if(!t.trim())return{success:!1,message:"URL is required"};let n=t.trim();!/^https?:\/\//i.test(n)&&!n.startsWith("/")&&(n=`https://${n}`);const o=e.chain().focus().setLink({href:n}).run();return Ae(e),{success:o,message:o?"Link added":"Could not add link"}}function Ro(e){if(!_e(e))return{success:!1,message:"Editor not available"};const t=e.chain().focus().unsetLink().run();return Ae(e),{success:t,message:t?"Link removed":"Could not remove link"}}function Oo(e,t=window.prompt.bind(window)){if(!_e(e))return{success:!1,message:"Editor not available"};if(e.isActive("link"))return Ro(e);const o=t("Enter URL:");return o?Io(e,o):(Ae(e),{success:!1,message:"Link cancelled"})}function Jl(e,t){if(!_e(e))return{success:!1,message:"Editor not available"};const n=e.chain().focus().setHeading({level:t}).run();Ae(e);const o=String(t);return{success:n,message:n?`Heading ${o} applied`:"Could not set heading"}}function Zl(e){if(!_e(e))return{success:!1,message:"Editor not available"};const t=e.chain().focus().setParagraph().run();return Ae(e),{success:t,message:t?"Paragraph applied":"Could not set paragraph"}}function Ql(e,t,n){return()=>{const o=t(e);n==null||n(o)}}const ec=[{id:"bold",label:"Bold",shortcut:"Cmd+B",icon:"bold",action:Po,isActive:e=>e.isActive("bold")},{id:"italic",label:"Italic",shortcut:"Cmd+I",icon:"italic",action:Do,isActive:e=>e.isActive("italic")},{id:"link",label:"Link",icon:"link",action:e=>Oo(e),isActive:e=>e.isActive("link")}],Nn="44px",Hn="20px";function tc({blockId:e,isHovered:t,isDragging:n=!1,onDragStart:o,onDragEnd:r,className:a}){const s=x.useRef(null),[l,c]=x.useState(!1),p=x.useCallback(f=>{if(f.dataTransfer.effectAllowed="move",f.dataTransfer.setData("text/plain",e),f.dataTransfer.setData("application/x-pubwave-block",e),s.current){const g=s.current.getBoundingClientRect();f.dataTransfer.setDragImage(s.current,g.width/2,g.height/2)}o==null||o(e,f)},[e,o]),u=x.useCallback(f=>{c(!1),r==null||r(e,f)},[e,r]),m=x.useCallback(()=>{c(!0)},[]),h=x.useCallback(()=>{c(!1)},[]),b=t||n;return i.jsx("div",{ref:s,className:Ee("pubwave-drag-handle",b&&"pubwave-drag-handle--visible",n&&"pubwave-drag-handle--dragging",l&&"pubwave-drag-handle--pressed",a),"data-testid":"drag-handle",style:{position:"absolute",left:"-32px",top:"50%",transform:"translateY(-50%)",width:Nn,height:Nn,display:"flex",alignItems:"center",justifyContent:"center",cursor:n?"grabbing":"grab",opacity:b?1:0,transition:`opacity ${E.transition.fast}`,userSelect:"none",WebkitUserSelect:"none"},draggable:!0,onDragStart:p,onDragEnd:u,onMouseDown:m,onMouseUp:h,role:"button","aria-label":Et.dragHandle,tabIndex:b?0:-1,children:i.jsx("div",{className:"pubwave-drag-handle__visual",style:{width:Hn,height:Hn,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:E.borderRadius.sm,backgroundColor:l?`var(--pubwave-drag-handle-active-bg, ${E.colors.focus})`:"transparent",transition:`background-color ${E.transition.fast}`},children:i.jsx(nc,{})})})}function nc(){return i.jsxs("svg",{width:"12",height:"16",viewBox:"0 0 12 16",fill:"currentColor",style:{color:`var(--pubwave-drag-handle-color, ${E.colors.textMuted})`},children:[i.jsx("circle",{cx:"3",cy:"3",r:"1.5"}),i.jsx("circle",{cx:"3",cy:"8",r:"1.5"}),i.jsx("circle",{cx:"3",cy:"13",r:"1.5"}),i.jsx("circle",{cx:"9",cy:"3",r:"1.5"}),i.jsx("circle",{cx:"9",cy:"8",r:"1.5"}),i.jsx("circle",{cx:"9",cy:"13",r:"1.5"})]})}const Jt=50,oc=15;function $n(e){const t=1-e/Jt;return Math.round(t*oc)}function Eo(e){const t={isActive:!1,direction:null,speed:0,animationId:null},n=()=>e??window,o=()=>{if(e){const a=e.getBoundingClientRect();return{top:a.top,bottom:a.bottom}}return{top:0,bottom:window.innerHeight}},r=()=>{if(!t.isActive||t.direction===null)return;const a=n(),s=t.direction==="up"?-t.speed:t.speed;a===window?window.scrollBy(0,s):a instanceof HTMLElement&&(a.scrollTop+=s),t.animationId=Y(r)};return{start(){t.isActive=!0},update(a){if(!t.isActive)return;const s=o(),l=a-s.top,c=s.bottom-a;l<Jt?(t.direction="up",t.speed=$n(l)):c<Jt?(t.direction="down",t.speed=$n(c)):(t.direction=null,t.speed=0),t.direction!==null&&t.animationId===null?t.animationId=Y(r):t.direction===null&&t.animationId!==null&&(cancelAnimationFrame(t.animationId),t.animationId=null)},stop(){t.isActive=!1,t.direction=null,t.speed=0,t.animationId!==null&&(cancelAnimationFrame(t.animationId),t.animationId=null)}}}function rc(e){let t=null;const n=()=>(t??(t=Eo(e)),t);return{startAutoScroll(){n().start()},updateAutoScroll(o){n().update(o.clientY)},stopAutoScroll(){n().stop(),t=null}}}const ac=3e3;function _o({message:e,type:t="info",duration:n=ac,onDismiss:o,className:r}){const[a,s]=x.useState(!0);x.useEffect(()=>{if(n<=0)return;const p=setTimeout(()=>{s(!1),o==null||o()},n);return()=>{clearTimeout(p)}},[n,o]);const l=x.useCallback(()=>{s(!1),o==null||o()},[o]),c={info:E.colors.text,success:"var(--pubwave-color-success, #10b981)",error:E.colors.error,warning:"var(--pubwave-color-warning, #f59e0b)"};return i.jsxs("div",{className:Ee("pubwave-toast",`pubwave-toast--${t}`,a?"pubwave-toast--visible":"pubwave-toast--hidden",r),style:{position:"fixed",bottom:"24px",left:"50%",transform:`translateX(-50%) translateY(${a?"0":"16px"})`,padding:`${E.spacing.sm} ${E.spacing.md}`,backgroundColor:`var(--pubwave-toast-bg, ${E.colors.surface})`,border:`1px solid var(--pubwave-toast-border, ${E.colors.border})`,borderRadius:E.borderRadius.md,boxShadow:E.shadow.md,color:c[t],fontSize:E.typography.fontSizeSmall,opacity:a?1:0,transition:`opacity ${E.transition.normal}, transform ${E.transition.normal}`,zIndex:100,maxWidth:"400px",textAlign:"center"},role:"status","aria-live":"polite",children:[i.jsx("span",{className:"pubwave-toast__message",children:e}),i.jsx("button",{type:"button",className:"pubwave-toast__dismiss",onClick:l,style:{marginLeft:E.spacing.sm,padding:"0 4px",background:"none",border:"none",color:E.colors.textMuted,cursor:"pointer",fontSize:"16px",lineHeight:1},"aria-label":"Dismiss",children:"×"})]})}function ic({toasts:e,onDismiss:t}){return i.jsx("div",{className:"pubwave-toast-container",children:e.map((n,o)=>{const r=24+o*56,a=100-o;return i.jsx("div",{style:{position:"fixed",bottom:`${String(r)}px`,left:"50%",transform:"translateX(-50%)",zIndex:a},children:i.jsx(_o,{message:n.message,type:n.type,duration:n.duration,onDismiss:()=>{t(n.id)}})},n.id)})})}function sc(){const e=String(Date.now()),t=Math.random().toString(36).slice(2,9);return`toast-${e}-${t}`}exports.BlockHandle=So;exports.BubbleToolbar=jo;exports.DragHandle=tc;exports.DropIndicator=Mo;exports.PubwaveEditor=Xl;exports.SUPPORTED_BLOCKS=tl;exports.SUPPORTED_MARKS=nl;exports.SlashMenuList=xo;exports.Toast=_o;exports.ToastContainer=ic;exports.canUseDOM=_t;exports.cancelDrag=el;exports.clearFormatting=xl;exports.cn=Ee;exports.createActionHandler=Ql;exports.createAutoScroller=Eo;exports.createDndPlugin=wo;exports.createEditor=ol;exports.createExtensions=ln;exports.createFocusTrap=El;exports.createSlashCommandsExtension=mo;exports.createToastId=sc;exports.defaultSlashCommands=Dt;exports.defaultTokens=Qs;exports.defaultToolbarActions=ec;exports.destroyEditor=rl;exports.dndPluginKey=Z;exports.findBlockAtPos=ct;exports.focusAfterClick=Il;exports.focusAt=Dl;exports.focusEditor=gl;exports.getActiveLinkHref=Cl;exports.getActiveMarks=kl;exports.getDndState=sn;exports.getSelectionBounds=sl;exports.getSelectionState=cn;exports.handleSelectionClear=Ol;exports.isEditable=ft;exports.isEditorValid=al;exports.isMarkActive=yl;exports.isMobileDevice=ut;exports.isNodeActive=wl;exports.isReadOnly=Co;exports.isSSR=Xa;exports.isSelectionEmpty=il;exports.maintainFocus=Rl;exports.moveBlock=yo;exports.redo=vl;exports.restoreFocus=Ae;exports.restoreSelection=tt;exports.saveSelection=Bo;exports.selectAll=ml;exports.setHeading=fl;exports.setLink=ul;exports.setParagraph=pl;exports.shouldAllowInteraction=Al;exports.shouldAllowToolbar=Ll;exports.shouldRenderEditUI=Tl;exports.shouldShowDragHandle=Bl;exports.shouldShowToolbar=Mt;exports.startDrag=ko;exports.toggleBold=ll;exports.toggleHeading=hl;exports.toggleItalic=cl;exports.tokens=E;exports.toolbarRemoveLink=Ro;exports.toolbarSetHeading=Jl;exports.toolbarSetLink=Io;exports.toolbarSetParagraph=Zl;exports.toolbarToggleBold=Po;exports.toolbarToggleItalic=Do;exports.toolbarToggleLink=Oo;exports.undo=bl;exports.unsetLink=dl;exports.useAutoScroll=rc;
103
+ `,ll=sl;function Ve(...e){return e.filter(Boolean).join(" ")}const Mt={padding:"var(--pubwave-spacing-2, 8px) var(--pubwave-spacing-3, 12px) var(--pubwave-spacing-1, 4px)",fontSize:"var(--pubwave-font-size-xs, 11px)",fontWeight:600,color:"var(--pubwave-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"};function xo(e,t,n){var a;const o=e??(t||n?Jt(t,n):Xn),r=((a=n==null?void 0:n.slashMenu)==null?void 0:a.groups)||{basic:"Style",list:"Lists",media:"Media",advanced:"Advanced",layout:"Layout"};return ne.Extension.create({name:"slashCommands",addOptions(){return{suggestion:{char:"/",command:({editor:s,range:l,props:c})=>{if(c.id==="taskList"){s.chain().focus().deleteRange(l).toggleTaskList().run();return}s.chain().focus().deleteRange(l).run(),c.action(s)}}}},addProseMirrorPlugins(){const s=this.editor;return[Ar({editor:this.editor,...this.options.suggestion,allowed:({state:l,range:c})=>{try{if(s.isActive("codeBlock"))return!1;const f=l.doc.resolve(c.from);for(let u=f.depth;u>=1;u--)if(f.node(u).type.name==="codeBlock")return!1;return!0}catch{return!0}},items:({query:l,state:c})=>{let f=o;try{const u=c.doc.resolve(c.selection.from);for(let m=u.depth;m>=0;m--)if(u.node(m).type.name==="layoutColumn"){f=o.filter(v=>v.group!=="layout");break}}catch{}return Ai(f,l)},render:()=>{let l,c;return{onStart:f=>{this.editor.isActive("codeBlock")||(l=new Ae.ReactRenderer(yo,{props:{...f,query:f.query,editor:this.editor,groupLabels:r},editor:this.editor}),f.clientRect&&(c=Ie("body",{getReferenceClientRect:f.clientRect,appendTo:()=>document.body,content:l.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",offset:[0,8],zIndex:z.zIndex.dropdown,arrow:!1,duration:[0,0],animation:!1,popperOptions:{modifiers:[{name:"preventOverflow",options:{boundary:"viewport",padding:8,altAxis:!0}},{name:"flip",options:{fallbackPlacements:["top-start","bottom-end","top"]}}]},onShow(u){const m=u.popper.querySelector(".tippy-box");m&&(m.style.zIndex=String(z.zIndex.dropdown),m.style.backgroundColor="transparent",m.style.background="transparent",m.style.border="none");const h=u.popper.querySelector(".pubwave-slash-menu");if(h){const v=document.querySelector(".ProseMirror");if(v){const p=h.getBoundingClientRect(),C=v.getBoundingClientRect().bottom-p.top-16,y=Math.max(200,Math.min(280,C));h.style.maxHeight=`${y}px`}}}})))},onUpdate(f){var u,m,h;if(l.updateProps({...f,query:f.query,editor:f.editor,groupLabels:r}),f.items.length===0){if(c[0]){c[0].hide();const v=c[0].popper.querySelector(".tippy-box");v&&(v.style.opacity="0",v.style.pointerEvents="none")}return}f.clientRect&&((u=c[0])==null||u.setProps({getReferenceClientRect:f.clientRect}),(m=c[0])!=null&&m.state.isVisible||(h=c[0])==null||h.show())},onKeyDown(f){var u,m;return f.event.key==="Escape"?((u=c[0])==null||u.hide(),!0):((m=l.ref)==null?void 0:m.onKeyDown(f))??!1},onExit(){var f;(f=c[0])==null||f.destroy(),l.destroy()}}}})]}})}const yo=x.forwardRef(function({items:t,command:n,query:o="",groupLabels:r},a){const[s,l]=x.useState(-1),c=x.useRef(null),f=x.useRef(null);x.useEffect(()=>{t.length>0&&o.length>0?l(0):(t.length,l(-1))},[t,o]),Za(s,c,f);const u=x.useMemo(()=>{const p={};for(const g of t){const C=p[g.group]??[];C.push(g),p[g.group]=C}return p},[t]),m=t,h=x.useCallback(p=>{const g=m[p];g&&n(g)},[m,n]);x.useImperativeHandle(a,()=>({onKeyDown:({event:p})=>m.length===0?!1:p.key==="ArrowUp"?(l(g=>g<0?m.length-1:g<=0?0:g-1),!0):p.key==="ArrowDown"?(l(g=>g<0?0:g>=m.length-1?m.length-1:g+1),!0):p.key==="Enter"&&s>=0&&s<m.length?(h(s),!0):!1}));const v=r||{basic:"Style",list:"Lists",media:"Media",advanced:"Advanced"};return t.length===0?null:i.jsx("div",{className:"pubwave-slash-menu",ref:c,style:Qa,"data-testid":"slash-menu",children:i.jsx("div",{style:{padding:"var(--pubwave-spacing-1, 4px) 0"},children:(()=>{let p=0;return["basic","list","media","advanced"].map(C=>{const y=u[C];return!y||y.length===0?null:i.jsxs("div",{className:"pubwave-slash-menu__group",style:ei,children:[i.jsx("div",{className:"pubwave-slash-menu__group-label",style:ti,children:v[C]||C}),y.map(S=>{const T=p++,d=T===s;return i.jsxs("button",{ref:d?f:null,className:`pubwave-slash-menu__item ${d?"pubwave-slash-menu__item--selected":""}`,style:{...ni,backgroundColor:d?"var(--pubwave-hover-bg, #f3f4f6)":"transparent"},onClick:()=>h(T),onMouseEnter:()=>l(T),children:[i.jsx("span",{className:"pubwave-slash-menu__item-icon",style:oi,children:S.icon}),i.jsx("span",{className:"pubwave-slash-menu__item-title",style:ri,children:S.title})]},S.id)})]},C)})})()})})}),X=new je.PluginKey("pubwave-dnd"),Rt={draggingBlockId:null,draggingBlockPos:null,dropTargetPos:null,dropPosition:null,cancelled:!1};function qe(e,t){switch(t.type){case"START_DRAG":return{...e,draggingBlockId:t.blockId,draggingBlockPos:t.pos,dropTargetPos:null,dropPosition:null,cancelled:!1};case"UPDATE_DROP_TARGET":return{...e,dropTargetPos:t.pos,dropPosition:t.position};case"CANCEL_DRAG":return{...e,cancelled:!0,draggingBlockId:null,draggingBlockPos:null,dropTargetPos:null,dropPosition:null};case"COMPLETE_DRAG":return{...e,draggingBlockId:null,draggingBlockPos:null,dropTargetPos:null,dropPosition:null};case"RESET":return Rt;default:return e}}function bt(e,t){const n=Math.max(0,Math.min(t,e.content.size));try{const o=e.resolve(n);if(o.depth>=1){const r=o.node(1);if(["taskList","bulletList","orderedList","blockquote","table"].includes(r.type.name))return{node:r,pos:o.before(1)}}for(let r=o.depth;r>0;r--){const a=o.node(r);if(a.isBlock)return{node:a,pos:o.before(r)}}if(o.depth===0&&e.childCount>0){let r=0;for(let a=0;a<e.childCount;a++){const s=e.child(a);if(r+s.nodeSize>n)return{node:s,pos:r};r+=s.nodeSize}return{node:e.lastChild,pos:e.content.size-e.lastChild.nodeSize}}return null}catch{let o=null,r=0;for(let a=0;a<e.childCount;a++){const s=e.child(a);if(r<=n&&r+s.nodeSize>n){o={node:s,pos:r};break}r+=s.nodeSize}return o}}function wo(e,t,n,o){const{state:r}=e,{tr:a,doc:s}=r,l=bt(s,t);if(!l)return!1;const c=bt(s,n);if(!c)return!1;let f=c.pos;if(o==="after"&&(f=c.pos+c.node.nodeSize),l.pos===c.pos||f===l.pos||f===l.pos+l.node.nodeSize)return!1;const u=l.node,m=l.pos,h=l.pos+u.nodeSize,v=s.slice(m,h);let p=f;m<f&&(p=f-u.nodeSize),a.delete(m,h);const g=a.doc.content.size;if(p<0?p=0:p>g&&(p=g),p>=0&&p<=g)a.insert(p,v.content);else return!1;return a.setSelection(r.selection.map(a.doc,a.mapping)),e.view.dispatch(a),!0}function Rn(e,t){const n=e.state.doc;if(n.childCount===0)return null;const o=0,r=e.nodeDOM(o);let a=0;for(let f=0;f<n.childCount-1;f++)a+=n.child(f).nodeSize;const s=e.nodeDOM(a),l=t.clientY;if(r){const f=r.getBoundingClientRect();if(l<f.top+50)return{pos:o,position:"before"}}if(s){const f=s.getBoundingClientRect();if(l>f.bottom-50)return{pos:a,position:"after"}}const c=e.posAtCoords({left:t.clientX,top:t.clientY});if(c){const f=bt(n,c.pos);if(f){const u=e.nodeDOM(f.pos);if(u){const m=u.getBoundingClientRect(),h=m.top+m.height/2;return{pos:f.pos,position:l<h?"before":"after"}}}}return null}function ko(e){let t=Rt;return new je.Plugin({key:X,state:{init(){return Rt},apply(n,o){const r=n.getMeta(X);return r!==void 0?(t=r,r):(t=o,o)}},props:{handleKeyDown(n,o){return o.key==="Escape"&&t.draggingBlockId?(t=qe(t,{type:"CANCEL_DRAG"}),n.dispatch(n.state.tr.setMeta(X,t)),!0):!1},handleDOMEvents:{dragover(n,o){var s;if(!((s=o.dataTransfer)!=null&&s.types.includes("application/x-pubwave-block")))return!1;o.preventDefault(),o.dataTransfer.dropEffect="move",t=X.getState(n.state)??t;const a=Rn(n,o);return a?(t=qe(t,{type:"UPDATE_DROP_TARGET",pos:a.pos,position:a.position}),n.dispatch(n.state.tr.setMeta(X,t))):t.dropTargetPos!==null&&(t=qe(t,{type:"UPDATE_DROP_TARGET",pos:null,position:null}),n.dispatch(n.state.tr.setMeta(X,t))),!0},drop(n,o){var h;const r=(h=o.dataTransfer)==null?void 0:h.getData("application/x-pubwave-block");if(!r)return!1;o.preventDefault(),o.stopPropagation();let l=(X.getState(n.state)??t).draggingBlockPos;if(l===null&&r.startsWith("block-")){const v=parseInt(r.replace("block-",""),10);isNaN(v)||(l=v)}if(l===null)return!1;const c=Rn(n,o);if(!c)return!1;const{pos:f,position:u}=c;if(f===l||!e)return!1;const m=wo(e,l,f,u);return t=qe(t,{type:"COMPLETE_DRAG"}),n.dispatch(n.state.tr.setMeta(X,t)),m},dragleave(n,o){const r=o.relatedTarget;return r!=null&&r.closest(".pubwave-editor")||(t=qe(t,{type:"UPDATE_DROP_TARGET",pos:null,position:null}),n.dispatch(n.state.tr.setMeta(X,t))),!1}}}})}function sn(e){return X.getState(e.state)??Rt}function Co(e,t,n){const{view:o}=e,r={type:"START_DRAG",blockId:t,pos:n},a=qe(sn(e),r);o.dispatch(o.state.tr.setMeta(X,a))}function cl(e){const{view:t}=e,n={type:"CANCEL_DRAG"},o=qe(sn(e),n);t.dispatch(t.state.tr.setMeta(X,o))}const ul=new je.PluginKey("editorBehaviors");function dl(e,t){const n=e.dom,o=n.getBoundingClientRect();if(t.clientX<o.left||t.clientX>o.right||t.clientY<o.top||t.clientY>o.bottom)return!1;const r=n.lastElementChild;if(!r)return!0;const a=r.getBoundingClientRect();return t.clientY>a.bottom+1}function pl(e,t){if(t.button!==0||t.defaultPrevented||!dl(e,t))return!1;const{state:n}=e,o=n.schema.nodes.paragraph;if(!o)return!1;const r=n.doc.content.size,a=n.doc.lastChild,s=n.tr;return a&&a.type===o&&a.content.size===0?(s.setSelection(je.TextSelection.create(n.doc,Math.max(1,r-1))),e.dispatch(s),e.focus(),!0):(s.insert(r,o.create()),s.setSelection(je.TextSelection.create(s.doc,r+1)),e.dispatch(s.scrollIntoView()),e.focus(),!0)}function fl(e,t){if(t.key!=="Enter"||t.defaultPrevented)return!1;const{state:n}=e,{selection:o}=n;if(!o.empty)return!1;const{$from:r}=o,a=n.schema.nodes.paragraph;if(!a||r.parent.type!==a||r.parent.content.size!==0)return!1;let s=-1,l=-1;for(let y=r.depth;y>0;y--){const S=r.node(y);S.type.name==="layoutColumn"&&s===-1&&(s=y),S.type.name==="layout"&&l===-1&&(l=y)}if(s===-1||l===-1)return!1;const c=r.node(s);if(r.index(s)!==c.childCount-1)return!1;t.preventDefault();const u=n.tr,m=r.before(r.depth),h=r.parent.nodeSize;c.childCount>1&&u.delete(m,m+h);const v=r.before(l),p=u.mapping.map(v),g=u.doc.nodeAt(p);if(!g)return!1;const C=p+g.nodeSize;return u.insert(C,a.create()),u.setSelection(je.TextSelection.create(u.doc,C+1)),e.dispatch(u.scrollIntoView()),e.focus(),!0}function hl(){return new je.Plugin({key:ul,props:{handleClick(e,t,n){return n instanceof MouseEvent?pl(e,n):!1},handleKeyDown(e,t){return fl(e,t)}}})}const bl=["paragraph","heading","bulletList","orderedList","taskList","table","blockquote","codeBlock","horizontalRule","image","chart","layout"],vl=["bold","italic","underline","strike","code","link"];function ln(e={}){const{placeholder:t,historyDepth:n=100,headingLevels:o,linkOpenInNewTab:r,linkOpenOnClick:a,enableChart:s,enableLayout:l,enableSlashCommands:c=!0,slashCommands:f,imageUpload:u,locale:m}=e,h=m?jt(m):null,v=t??(h==null?void 0:h.placeholder)??'Write,type "/" for commands...',p=[...Ya({headingLevels:o,imageUpload:u,enableChart:s,enableLayout:l}),...Ja({linkOpenInNewTab:r,linkOpenOnClick:a}),Zo.configure({placeholder:v,emptyEditorClass:"pubwave-editor--empty",emptyNodeClass:"pubwave-editor__node--empty"}),Qo.configure({depth:n}),er.configure({color:"var(--pubwave-dropcursor-color, #3b82f6)",width:2}),tr,ne.Extension.create({name:"dragAndDrop",addProseMirrorPlugins(){return[ko(this.editor)]}}),ne.Extension.create({name:"editorBehaviors",addProseMirrorPlugins(){return[hl()]}})];if(c){const g=jt(m||"en"),C=Jt(u,g);let y=f?[...C,...f]:C;l===!1&&(y=y.filter(S=>S.group!=="layout")),p.push(xo(y,u,g))}return p}function gl(e={}){if(!Ot)throw new Error("createEditor() cannot be called server-side. Ensure this function is only called in client-side code (e.g., useEffect, event handlers).");const{content:t,editable:n=!0,placeholder:o,autofocus:r=!1,imageUpload:a,enableChart:s,enableLayout:l,onUpdate:c,onSelectionUpdate:f,onFocus:u,onBlur:m,onCreate:h,onDestroy:v}=e,g={extensions:ln({placeholder:o,headingLevels:[1,2,3],linkOpenInNewTab:!0,linkOpenOnClick:!0,imageUpload:a,enableChart:s,enableLayout:l}),content:t,editable:n,autofocus:r,editorProps:{attributes:{class:"pubwave-editor__content","data-placeholder":o??'Write,type "/" for commands...'}},onUpdate:c?({editor:C})=>{c({editor:C})}:void 0,onSelectionUpdate:f?({editor:C})=>{f({editor:C})}:void 0,onFocus:u?({editor:C})=>{u({editor:C})}:void 0,onBlur:m?({editor:C})=>{m({editor:C})}:void 0,onCreate:h?({editor:C})=>{h({editor:C})}:void 0,onDestroy:v?()=>{v()}:void 0};return new ne.Editor(g)}function ml(e){e&&!e.isDestroyed&&e.destroy()}function xl(e){return e!==null&&!e.isDestroyed}function cn(e){const{state:t}=e,{selection:n}=t,{from:o,to:r,empty:a}=n,s=a?"":t.doc.textBetween(o,r," "),l=n instanceof Object&&"node"in n,c=s.length>0,f=e.isActive("bold"),u=e.isActive("italic"),m=e.isActive("underline"),h=e.isActive("strike"),v=e.isActive("code"),p=e.isActive("link"),g=p?e.getAttributes("link").href:null;return{hasSelection:!a||l,isEmpty:a&&!l,hasTextContent:c,isNodeSelection:l,selectedText:s,from:o,to:r,isBold:f,isItalic:u,isUnderline:m,isStrike:h,isCode:v,hasLink:p,linkHref:g}}function yl(e){return e.state.selection.empty}function Pt(e){const t=cn(e);return t.isEmpty?!1:!!t.hasTextContent}function wl(e){if(typeof window>"u")return null;const{view:t}=e,{from:n,to:o}=t.state.selection;if(n===o)return null;const r=t.coordsAtPos(n),a=t.coordsAtPos(o),s=Math.min(r.top,a.top),l=Math.max(r.bottom,a.bottom),c=Math.min(r.left,a.left),f=Math.max(r.right,a.right);return{top:s,left:c,right:f,bottom:l,width:f-c,height:l-s}}function kl(e){return e.chain().focus().toggleBold().run()}function Cl(e){return e.chain().focus().toggleItalic().run()}function Tl(e,t){return t?e.chain().focus().setLink({href:t}).run():e.chain().focus().unsetLink().run()}function Ll(e){return e.chain().focus().unsetLink().run()}function Bl(e){return e.chain().focus().setParagraph().run()}function Al(e,t){return e.chain().focus().setHeading({level:t}).run()}function jl(e,t){return e.chain().focus().toggleHeading({level:t}).run()}function Sl(e){return e.chain().focus().undo().run()}function Ml(e){return e.chain().focus().redo().run()}function Pl(e,t){return e.chain().focus(t).run()}function Dl(e){return e.chain().focus().selectAll().run()}function Il(e){return e.chain().focus().unsetAllMarks().run()}function Rl(e,t){return e.isActive(t)}function El(e,t,n){return e.isActive(t,n)}function Ol(e){const t=[];return e.isActive("bold")&&t.push("bold"),e.isActive("italic")&&t.push("italic"),e.isActive("link")&&t.push("link"),t}function _l(e){return e.getAttributes("link").href??null}function To(e){return e?!e.isEditable:!0}function xt(e){return e?e.isEditable:!1}function Nl(e){return xt(e)}function Hl(e){return xt(e)}function $l(e){return xt(e)}function zl(e){return xt(e)}function ql(e){return To(e)?"pubwave-editor--readonly":""}const Et={editor:"Rich text editor",toolbar:"Text formatting toolbar",dragHandle:"Drag to reorder block"},at={bold:"Cmd+B",italic:"Cmd+I",underline:"Cmd+U",strike:"Cmd+Shift+X",code:"Cmd+E"};function Pe(e,t){return t?`${e} (${t})`:e}const Be=x.forwardRef(({active:e=!1,disabled:t=!1,onClick:n,"data-tooltip":o,"data-testid":r,"aria-label":a,children:s,style:l},c)=>i.jsx("button",{ref:c,type:"button",className:Ve("pubwave-toolbar__button",e&&"pubwave-toolbar__button--active",t&&"pubwave-toolbar__button--disabled"),style:{display:"flex",alignItems:"center",justifyContent:"center",width:(l==null?void 0:l.width)??"var(--pubwave-button-width, 28px)",height:(l==null?void 0:l.height)??"var(--pubwave-button-height, 28px)",minWidth:l==null?void 0:l.minWidth,padding:(l==null?void 0:l.padding)??0,border:"none",borderRadius:"var(--pubwave-radius-sm, 4px)",backgroundColor:"transparent",color:e?"var(--pubwave-primary)":"var(--pubwave-text)",cursor:t?"not-allowed":"pointer",opacity:t?.5:1,transition:"color 0.1s ease, background-color 0.1s ease",...l},onClick:f=>{f.preventDefault(),f.stopPropagation(),n()},disabled:t,"data-tooltip":o,"data-testid":r,"aria-label":a,"aria-pressed":e,onMouseDown:f=>{f.preventDefault(),f.stopPropagation()},children:s}));Be.displayName="ToolbarButton";function En(){return i.jsx("div",{className:"pubwave-toolbar__divider",style:{width:"var(--pubwave-divider-width, 1px)",height:"var(--pubwave-divider-height, 20px)",backgroundColor:"var(--pubwave-border)",margin:"0 var(--pubwave-spacing-1, 4px)"},role:"separator","aria-orientation":"vertical"})}function Lo(e,t,n,o=8){const r=e,a=window.innerHeight-t,s=n+o;return r>=s?"top":a>=s?"bottom":r>=a?"top":"bottom"}function Ul(e,t,n=8){return Lo(e.top,e.bottom,t,n)}function Bo(e,t,n,o="left",r=8){const a=window.innerWidth,s=(e+t)/2,l=e,c=a-t,f=n+r,u=n+r,m=n/2+r;let h=o,v;return o==="left"?(v=e,(v<r||v+n>a-r)&&(c>=u&&t+n<=a-r?(h="right",v=t-n):l>=m&&s-n/2>=r?(h="center",v=s-n/2):(c>=l?(h="right",v=t-n):(h="left",v=e),v=Math.max(r,Math.min(v,a-n-r))))):o==="center"?(v=s-n/2,(v<r||v+n>a-r)&&(c>=u&&t+n<=a-r?(h="right",v=t-n):l>=f&&e+n<=a-r?(h="left",v=e):(c>=l?(h="right",v=t-n):(h="left",v=e),v=Math.max(r,Math.min(v,a-n-r))))):(v=t-n,(v<r||v+n>a-r)&&(l>=f&&e+n<=a-r?(h="left",v=e):l>=m&&s-n/2>=r?(h="center",v=s-n/2):(l>=c?(h="left",v=e):(h="right",v=t-n),v=Math.max(r,Math.min(v,a-n-r))))),v=Math.max(r,Math.min(v,a-n-r)),{align:h,left:v}}function Fl(e,t,n="left",o=8){return Bo(e.left,e.right,t,n,o)}function un({isOpen:e,buttonRef:t,children:n,className:o,style:r,align:a="left",margin:s=8,onClickOutside:l,onClick:c,"data-testid":f}){const[u,m]=x.useState("top"),[h,v]=x.useState(null),p=x.useRef(null);if(x.useEffect(()=>{if(!e||!t.current)return;const C=()=>{if(!p.current||!t.current)return;const S=t.current.getBoundingClientRect(),T=p.current.offsetHeight||300,d=p.current.offsetWidth||240,A=Ul(S,T,s);m(A);let k=t.current.parentElement;for(;k;){const I=window.getComputedStyle(k);if(I.position==="relative"||I.position==="absolute"||I.position==="fixed")break;k=k.parentElement}const j=Fl(S,d,a,s);if(k){const I=k.getBoundingClientRect(),N=j.left-I.left;v({align:j.align,left:N})}else v(j)};C();const y=requestAnimationFrame(()=>{C()});return()=>cancelAnimationFrame(y)},[e,t,s,a]),x.useEffect(()=>{if(!e||!l)return;const C=y=>{p.current&&!p.current.contains(y.target)&&t.current&&!t.current.contains(y.target)&&l(y)};return document.addEventListener("mousedown",C),()=>{document.removeEventListener("mousedown",C)}},[e,l,t]),!e)return null;const g=()=>{if(h)return{left:`${h.left}px`};switch(a){case"center":return{left:"50%",transform:"translateX(-50%)"};case"right":return{right:0};case"left":default:return{left:0}}};return i.jsx("div",{ref:p,className:o,"data-testid":f,style:{position:"absolute",...u==="top"?{bottom:"100%",marginBottom:`${s}px`}:{top:"100%",marginTop:`${s}px`},...g(),...r},onClick:C=>{C.stopPropagation(),c==null||c(C)},children:n})}function Wl({editor:e,isOpen:t,onToggle:n,onClose:o}){const r=We(),a=x.useRef(null),s=x.useCallback(()=>e.isActive("heading",{level:1})?"heading1":e.isActive("heading",{level:2})?"heading2":e.isActive("heading",{level:3})?"heading3":e.isActive("bulletList")?"bulletList":e.isActive("orderedList")?"orderedList":e.isActive("taskList")?"taskList":e.isActive("blockquote")?"blockquote":e.isActive("codeBlock")?"codeBlock":"paragraph",[e]),l=x.useMemo(()=>[{id:"paragraph",label:r.toolbar.blockTypes.text,icon:i.jsx(Fn,{}),action:h=>h.chain().focus().setParagraph().run(),isActive:h=>h.isActive("paragraph")},{id:"heading1",label:r.toolbar.blockTypes.heading1,icon:i.jsx(Wn,{}),action:h=>h.chain().focus().setHeading({level:1}).run(),isActive:h=>h.isActive("heading",{level:1})},{id:"heading2",label:r.toolbar.blockTypes.heading2,icon:i.jsx(Vn,{}),action:h=>h.chain().focus().setHeading({level:2}).run(),isActive:h=>h.isActive("heading",{level:2})},{id:"heading3",label:r.toolbar.blockTypes.heading3,icon:i.jsx(Gn,{}),action:h=>h.chain().focus().setHeading({level:3}).run(),isActive:h=>h.isActive("heading",{level:3})},{id:"bulletList",label:r.toolbar.blockTypes.bulletedList,icon:i.jsx(Yn,{}),action:h=>h.chain().focus().toggleBulletList().run(),isActive:h=>h.isActive("bulletList")},{id:"orderedList",label:r.toolbar.blockTypes.numberedList,icon:i.jsx(Kn,{}),action:h=>h.chain().focus().toggleOrderedList().run(),isActive:h=>h.isActive("orderedList")}],[r]),c=s(),f=l.find(h=>h.id===c),u=x.useCallback(h=>{h.action(e),o(),setTimeout(()=>{e.chain().blur().run()},0)},[e,o]),m=h=>h===r.toolbar.blockTypes.heading1?r.toolbar.blockTypes.heading1:h===r.toolbar.blockTypes.heading2?r.toolbar.blockTypes.heading2:h===r.toolbar.blockTypes.heading3?r.toolbar.blockTypes.heading3:h===r.toolbar.blockTypes.bulletedList?r.toolbar.blockTypes.bulletedList:h===r.toolbar.blockTypes.numberedList?r.toolbar.blockTypes.numberedList:r.toolbar.blockTypes.text;return i.jsxs("div",{style:{position:"relative"},children:[i.jsx(Be,{ref:a,active:t,onClick:n,"data-tooltip":Pe(r.toolbar.turnInto),"data-testid":"toolbar-turnInto","aria-label":r.aria.turnIntoButton,style:{width:"auto",minWidth:"auto",padding:"0 8px",height:"var(--pubwave-button-height, 28px)"},children:i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"4px",whiteSpace:"nowrap"},children:[i.jsx("span",{style:{fontSize:"12px",fontWeight:500},children:f?m(f.label):r.toolbar.blockTypes.text}),i.jsx(ii,{})]})}),i.jsxs(un,{isOpen:t,buttonRef:a,align:"left",margin:8,onClickOutside:()=>o(),className:"pubwave-turn-into-dropdown","data-testid":"turn-into-dropdown",style:{backgroundColor:"var(--pubwave-surface, var(--pubwave-bg))",border:"1px solid var(--pubwave-border)",borderRadius:"var(--pubwave-radius-lg, 8px)",boxShadow:"var(--pubwave-shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05))",padding:"var(--pubwave-spacing-1, 4px)",minWidth:"240px",zIndex:z.zIndex.dropdown+1},children:[i.jsx("div",{style:Mt,children:r.toolbar.turnInto}),l.map(h=>{const v=h.isActive(e);return i.jsxs("button",{type:"button",className:Ve("pubwave-toolbar__turn-into-option",v&&"pubwave-toolbar__turn-into-option--active"),onClick:()=>u(h),style:{width:"100%",display:"flex",alignItems:"center",gap:"var(--pubwave-spacing-2, 8px)",padding:"var(--pubwave-spacing-2, 8px) var(--pubwave-spacing-3, 12px)",border:"none",backgroundColor:v?"var(--pubwave-primary-faded)":"transparent",color:v?"var(--pubwave-primary)":"var(--pubwave-text)",cursor:"pointer",fontSize:"var(--pubwave-font-size-base, 14px)",textAlign:"left",borderRadius:"var(--pubwave-border-radius-sm, 0.25rem)",transition:"background-color 0.1s ease"},children:[i.jsx("span",{style:{display:"flex",alignItems:"center",width:"18px",height:"18px",flexShrink:0},children:h.icon}),i.jsx("span",{children:h.label})]},h.id)})]})]})}function xe(e){return!!(e&&!e.isDestroyed)}function Vl(e,t){xe(e)&&Y(()=>{if(xe(e))switch(t){case"start":e.commands.focus("start");break;case"end":e.commands.focus("end");break;case"preserve":e.commands.focus();break;default:typeof t=="number"&&(e.commands.setTextSelection(t),e.commands.focus())}})}function Re(e){xe(e)&&Y(()=>{xe(e)&&(e.isFocused||e.commands.focus())})}function Gl(e,t){xe(e)&&(t.preventDefault(),Y(()=>{xe(e)&&e.commands.focus()}))}function Yl(e){if(!xe(e))return function(){};const t=o=>{const r=o.relatedTarget;if(r){const a=e.view.dom.closest(".pubwave-editor");a&&!a.contains(r)&&r.closest(".pubwave-toolbar, .pubwave-menu, .pubwave-dialog")}},n=e.view.dom;return n.addEventListener("focusout",t),()=>{n.removeEventListener("focusout",t)}}function Ao(e){if(!xe(e))return null;const{from:t,to:n,empty:o}=e.state.selection;return{from:t,to:n,empty:o}}function st(e,t){if(!xe(e)||!t)return;const{from:n,to:o}=t,r=e.state.doc.content.size,a=Math.min(n,r),s=Math.min(o,r);e.commands.setTextSelection({from:a,to:s})}function Kl(e){if(!xe(e))return;const{selection:t}=e.state;if(t.$anchor.pos>0){e.commands.focus();return}e.commands.focus("end")}function Xl(e){const t=e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),n=t[0],o=t[t.length-1],r=a=>{a.key==="Tab"&&(a.shiftKey?document.activeElement===n&&(a.preventDefault(),o==null||o.focus()):document.activeElement===o&&(a.preventDefault(),n==null||n.focus()))};return{activate(){e.addEventListener("keydown",r),n==null||n.focus()},deactivate(){e.removeEventListener("keydown",r)}}}function Jl({editor:e,isOpen:t,onToggle:n,onClose:o,selectionState:r}){const a=We(),s=x.useRef(null),l=x.useRef(null),c=x.useRef(null),f=x.useRef([]),u=x.useRef(null),[m,h]=x.useState(""),v=(r==null?void 0:r.hasLink)??!1,p=(r==null?void 0:r.linkHref)??null;x.useEffect(()=>{t?(u.current=Ao(e),h(p||""),setTimeout(()=>{var T,d;(T=l.current)==null||T.focus(),(d=l.current)==null||d.select()},50)):u.current=null},[t,p,e]),x.useEffect(()=>{if(!vt()){if(!t){f.current.forEach(T=>T.destroy()),f.current=[];return}return f.current.forEach(T=>T.destroy()),f.current=[],Y(()=>{Y(()=>{if(!c.current)return;c.current.querySelectorAll("[data-tooltip]").forEach(d=>{const A=d.getAttribute("data-tooltip");if(A){const k=Ie(d,{content:A,placement:"top",delay:[300,0],duration:[200,150],theme:"light-border"});f.current.push(k)}})})}),()=>{f.current.forEach(T=>T.destroy()),f.current=[]}}},[t,a,m,p]);const g=x.useCallback(T=>{if(T==null||T.preventDefault(),!m.trim()){u.current&&st(e,u.current),e.chain().focus().unsetLink().run(),u.current&&Y(()=>{Y(()=>{st(e,u.current)})}),o();return}let d=m.trim();!/^https?:\/\//i.test(d)&&!d.startsWith("/")&&!d.startsWith("#")&&(d=`https://${d}`),u.current&&st(e,u.current),e.chain().focus().setLink({href:d}).run(),u.current&&Y(()=>{Y(()=>{st(e,u.current)})}),o()},[e,m,o]),C=x.useCallback(()=>{const T=m.trim()||p;if(T){let d=T;!/^https?:\/\//i.test(d)&&!d.startsWith("/")&&!d.startsWith("#")&&(d=`https://${d}`),window.open(d,"_blank","noopener,noreferrer")}},[m,p]),y=x.useCallback(()=>{var T;h(""),(T=l.current)==null||T.focus()},[]),S=x.useCallback(T=>{T.key==="Enter"?(T.preventDefault(),g()):T.key==="Escape"&&(T.preventDefault(),o(),e.chain().focus().run())},[g,o,e]);return i.jsxs("div",{style:{position:"relative"},children:[i.jsx(Be,{ref:s,active:v,onClick:n,"data-tooltip":Pe(a.toolbar.link),"data-testid":"toolbar-link","aria-label":a.aria.linkButton,children:i.jsx(pi,{})}),i.jsx(un,{isOpen:t,buttonRef:s,align:"left",margin:8,onClickOutside:()=>o(),className:"pubwave-link-dropdown",style:{backgroundColor:"var(--pubwave-surface, var(--pubwave-bg))",border:"1px solid var(--pubwave-border)",borderRadius:"var(--pubwave-radius-lg, 8px)",boxShadow:"var(--pubwave-shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05))",padding:"var(--pubwave-spacing-2, 8px)",minWidth:"280px",zIndex:z.zIndex.dropdown+1},children:i.jsx("div",{ref:c,children:i.jsx("form",{onSubmit:g,style:{display:"flex",flexDirection:"column",gap:"8px"},children:i.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[i.jsx("input",{ref:l,type:"text",value:m,onChange:T=>h(T.target.value),onKeyDown:S,placeholder:a.linkPlaceholder,"data-testid":"link-input","aria-label":a.aria.linkUrlInput,style:{flex:1,padding:"6px 100px 6px 8px",border:"1px solid var(--pubwave-border)",borderRadius:"var(--pubwave-radius-sm, 4px)",fontSize:"var(--pubwave-font-size-base, 14px)",backgroundColor:"var(--pubwave-bg)",color:"var(--pubwave-text)",outline:"none"}}),i.jsxs("div",{style:{position:"absolute",right:"4px",display:"flex",alignItems:"center",gap:"2px"},children:[i.jsx("button",{type:"button",onClick:g,"data-tooltip":a.toolbar.confirmLink,"data-testid":"link-confirm-button","aria-label":a.aria.linkConfirmButton,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",padding:0,border:"none",borderRadius:"var(--pubwave-radius-sm, 4px)",backgroundColor:"transparent",color:"var(--pubwave-text)",cursor:"pointer",transition:"background-color 0.1s ease"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor="var(--pubwave-hover, rgba(0, 0, 0, 0.05))"},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent"},children:i.jsx(hi,{})}),(m.trim()||p)&&i.jsx("button",{type:"button",onClick:C,"data-tooltip":a.toolbar.openLink,"data-testid":"link-open-button","aria-label":a.aria.linkOpenButton,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",padding:0,border:"none",borderRadius:"var(--pubwave-radius-sm, 4px)",backgroundColor:"transparent",color:"var(--pubwave-text)",cursor:"pointer",transition:"background-color 0.1s ease"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor="var(--pubwave-hover, rgba(0, 0, 0, 0.05))"},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent"},children:i.jsx(fi,{})}),i.jsx("button",{type:"button",onClick:y,"data-tooltip":a.toolbar.clearLink,"data-testid":"link-clear-button","aria-label":a.aria.linkClearButton,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",padding:0,border:"none",borderRadius:"var(--pubwave-radius-sm, 4px)",backgroundColor:"transparent",color:"var(--pubwave-text)",cursor:"pointer",transition:"background-color 0.1s ease"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor="var(--pubwave-hover, rgba(0, 0, 0, 0.05))"},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent"},children:i.jsx(bi,{})})]})]})})})})]})}const Zl=[{name:"Default",value:null,color:"#1f2937"},{name:"Gray",value:"#6b7280",color:"#6b7280"},{name:"Brown",value:"#92400e",color:"#92400e"},{name:"Orange",value:"#ea580c",color:"#ea580c"},{name:"Orange Dark",value:"#c2410c",color:"#c2410c"},{name:"Green",value:"#16a34a",color:"#16a34a"},{name:"Blue",value:"#2563eb",color:"#2563eb"},{name:"Purple",value:"#9333ea",color:"#9333ea"},{name:"Pink",value:"#ec4899",color:"#ec4899"},{name:"Red",value:"#dc2626",color:"#dc2626"}],Ql=[{name:"Default",value:null,color:"#ffffff"},{name:"Gray",value:"#f3f4f6",color:"#f3f4f6"},{name:"Peach",value:"#fed7aa",color:"#fed7aa"},{name:"Orange",value:"#fdba74",color:"#fdba74"},{name:"Yellow",value:"#fde047",color:"#fde047"},{name:"Green",value:"#86efac",color:"#86efac"},{name:"Blue",value:"#93c5fd",color:"#93c5fd"},{name:"Purple",value:"#c084fc",color:"#c084fc"},{name:"Pink",value:"#f9a8d4",color:"#f9a8d4"},{name:"Red",value:"#fca5a5",color:"#fca5a5"}],jo="pubwave-editor-recent-colors",On=5;function ec(){if(typeof window>"u")return[];try{const e=localStorage.getItem(jo);if(e)return JSON.parse(e)}catch{}return[]}function _n(e){if(!(typeof window>"u"))try{localStorage.setItem(jo,JSON.stringify(e))}catch{}}function tc({editor:e,onClose:t,buttonRef:n}){const o=We(),[r,a]=x.useState([]),s=x.useRef(null),l=x.useRef([]);x.useEffect(()=>{const p=ec();p.length>0&&a(p)},[]);const c=()=>{try{const p=e.getAttributes("textColor");return(p==null?void 0:p.color)||null}catch{return null}},f=()=>{try{const p=e.getAttributes("backgroundColor");return(p==null?void 0:p.backgroundColor)||null}catch{return null}},u=c(),m=f(),h=p=>{p===null?e.chain().focus().unsetColor().run():(e.chain().focus().setColor(p).run(),a(g=>{const y=[{type:"text",value:p},...g.filter(S=>!(S.type==="text"&&S.value===p))].slice(0,On);return _n(y),y}))},v=p=>{p===null?e.chain().focus().unsetBackgroundColor().run():(e.chain().focus().setBackgroundColor(p).run(),a(g=>{const y=[{type:"background",value:p},...g.filter(S=>!(S.type==="background"&&S.value===p))].slice(0,On);return _n(y),y}))};return x.useEffect(()=>{if(!vt()&&s.current)return l.current.forEach(p=>p.destroy()),l.current=[],requestAnimationFrame(()=>{if(!s.current)return;s.current.querySelectorAll("[data-tooltip]").forEach(g=>{const C=g.getAttribute("data-tooltip");if(C){const y=Ie(g,{content:C,placement:"top",delay:[300,0],duration:[200,150],theme:"light-border"});l.current.push(y)}})}),()=>{l.current.forEach(p=>p.destroy()),l.current=[]}},[r,u,m,o]),i.jsx(un,{isOpen:!0,buttonRef:n,align:"center",margin:8,onClickOutside:()=>t==null?void 0:t(),className:"pubwave-color-picker","data-testid":"color-picker",style:{backgroundColor:"var(--pubwave-bg, #ffffff)",border:"1px solid var(--pubwave-border, #e5e7eb)",borderRadius:"var(--pubwave-radius-lg, 8px)",boxShadow:"var(--pubwave-shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1))",padding:"12px",minWidth:"240px",zIndex:z.zIndex.dropdown+1},children:i.jsxs("div",{ref:s,children:[r.length>0&&i.jsxs("div",{style:{marginBottom:"16px"},children:[i.jsx("div",{style:{...Mt,paddingLeft:0,paddingRight:0,marginBottom:"8px"},children:o.toolbar.recentlyUsed}),i.jsx("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:r.map((p,g)=>i.jsx("button",{type:"button",onClick:()=>{p.type==="text"?h(p.value):v(p.value)},style:{width:"24px",height:"24px",borderRadius:"4px",border:"1px solid var(--pubwave-border, #e5e7eb)",backgroundColor:p.type==="background"?p.value:"#ffffff",cursor:"pointer",padding:p.type==="text"?"4px":0,display:p.type==="text"?"flex":"block",alignItems:p.type==="text"?"center":"normal",justifyContent:p.type==="text"?"center":"normal"},"data-tooltip":p.type==="text"?`${p.value} text`:`${p.value} background`,children:p.type==="text"&&i.jsx("span",{style:{fontSize:"12px",fontWeight:500,color:p.value,lineHeight:1},children:"A"})},`${p.type}-${p.value}-${g}`))})]}),i.jsxs("div",{style:{marginBottom:"16px"},children:[i.jsx("div",{style:{...Mt,paddingLeft:0,paddingRight:0,marginBottom:"8px"},children:o.toolbar.textColor}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(5, 1fr)",gap:"6px"},children:Zl.map(p=>{const g=u===p.value;return i.jsx("button",{type:"button",onClick:()=>h(p.value),style:{width:"100%",aspectRatio:"1",borderRadius:"4px",border:g?"2px solid var(--pubwave-primary, #3b82f6)":"1px solid var(--pubwave-border, #e5e7eb)",backgroundColor:"#ffffff",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center"},"data-tooltip":p.value?`${p.name} text`:"Default text",children:i.jsx("span",{style:{fontSize:"12px",fontWeight:500,color:p.color},children:"A"})},p.name)})})]}),i.jsxs("div",{children:[i.jsx("div",{style:{...Mt,paddingLeft:0,paddingRight:0,marginBottom:"8px"},children:o.toolbar.backgroundColor}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(5, 1fr)",gap:"6px"},children:Ql.map(p=>{const g=m===p.value;return i.jsx("button",{type:"button",onClick:()=>v(p.value),style:{width:"100%",aspectRatio:"1",borderRadius:"4px",border:g?"2px solid var(--pubwave-primary, #3b82f6)":"1px solid var(--pubwave-border, #e5e7eb)",backgroundColor:p.color,cursor:"pointer",padding:0},"data-tooltip":p.value?`${p.name} background`:"Default background"},p.name)})})]})]})})}function nc({editor:e,isOpen:t,onToggle:n,onClose:o}){const r=We(),a=x.useRef(null),s=()=>{try{const p=e.getAttributes("textColor");return(p==null?void 0:p.color)||null}catch{return null}},l=()=>{try{if(!e.isActive("backgroundColor"))return null;const p=e.getAttributes("backgroundColor");return(p==null?void 0:p.backgroundColor)||null}catch{return null}},c=s(),f=l(),u=c||f,h=c||(()=>{if(typeof window>"u")return"#1f2937";const p=document.querySelector(".pubwave-editor");return p&&window.getComputedStyle(p).getPropertyValue("--pubwave-text").trim()||"#1f2937"})(),v=f;return i.jsxs("div",{style:{position:"relative"},children:[i.jsx(Be,{ref:a,active:!!u,onClick:n,"data-tooltip":Pe(r.toolbar.textColor),"data-testid":"toolbar-colorPicker","aria-label":r.aria.colorPickerButton,children:i.jsx(vi,{textColor:h,backgroundColor:v})}),t&&i.jsx(tc,{editor:e,onClose:o,buttonRef:a})]})}function oc({editor:e,selectionState:t}){const n=We(),[o,r]=x.useState(null),a=x.useCallback(()=>{r(null),e.chain().focus().toggleBold().run()},[e]),s=x.useCallback(()=>{r(null),e.chain().focus().toggleItalic().run()},[e]),l=x.useCallback(()=>{r(null),e.chain().focus().toggleUnderline().run()},[e]),c=x.useCallback(()=>{r(null),e.chain().focus().toggleStrike().run()},[e]),f=x.useCallback(()=>{r(null),e.chain().focus().toggleCode().run()},[e]),u=x.useCallback(()=>{r(S=>S==="turnInto"?null:"turnInto")},[]),m=x.useCallback(()=>{r(S=>S==="link"?null:"link")},[]),h=x.useCallback(()=>{r(S=>S==="colorPicker"?null:"colorPicker")},[]),v=(t==null?void 0:t.isBold)??!1,p=(t==null?void 0:t.isItalic)??!1,g=(t==null?void 0:t.isUnderline)??!1,C=(t==null?void 0:t.isStrike)??!1,y=(t==null?void 0:t.isCode)??!1;return i.jsxs(i.Fragment,{children:[i.jsx(Wl,{editor:e,isOpen:o==="turnInto",onToggle:u,onClose:()=>r(null)}),i.jsx(En,{}),i.jsx(Be,{active:v,onClick:a,"data-tooltip":Pe(n.toolbar.bold,at.bold),"data-testid":"toolbar-bold","aria-label":n.aria.boldButton,children:i.jsx(si,{})}),i.jsx(Be,{active:p,onClick:s,"data-tooltip":Pe(n.toolbar.italic,at.italic),"data-testid":"toolbar-italic","aria-label":n.aria.italicButton,children:i.jsx(li,{})}),i.jsx(Be,{active:g,onClick:l,"data-tooltip":Pe(n.toolbar.underline,at.underline),"data-testid":"toolbar-underline","aria-label":n.aria.underlineButton,children:i.jsx(ci,{})}),i.jsx(Be,{active:C,onClick:c,"data-tooltip":Pe(n.toolbar.strike,at.strike),"data-testid":"toolbar-strike","aria-label":n.aria.strikeButton,children:i.jsx(ui,{})}),i.jsx(Be,{active:y,onClick:f,"data-tooltip":Pe(n.toolbar.code,at.code),"data-testid":"toolbar-code","aria-label":n.aria.codeButton,children:i.jsx(di,{})}),i.jsx(En,{}),i.jsx(Jl,{editor:e,isOpen:o==="link",onToggle:m,onClose:()=>r(null),selectionState:t}),i.jsx(nc,{editor:e,isOpen:o==="colorPicker",onToggle:h,onClose:()=>r(null)})]})}const it=8;function $e(e){return!e.isDestroyed}function rc(e,t){if(!t)return{top:0,left:0,visible:!1};const{view:n}=e,{from:o,to:r}=n.state.selection,a=n.coordsAtPos(o),s=n.coordsAtPos(r),l=Math.min(a.top,s.top),c=Math.min(a.left,s.left),f=Math.max(a.right,s.right),u=t.getBoundingClientRect(),m=u.width,h=u.height,v=Math.max(a.bottom,s.bottom),p=Lo(l,v,h,it);let g;p==="top"?g=l-h-it:g=v+it;const y=Bo(c,f,m,"center",it).left,S=window.innerWidth,T=window.innerHeight,d=it,A=Math.max(d,Math.min(y,S-m-d));return{top:Math.max(d,Math.min(g,T-h-d)),left:A,visible:!0}}function So({editor:e,className:t,children:n,onVisibilityChange:o}){const r=x.useRef(null),a=x.useRef(!1),s=x.useRef(0),l=x.useRef(!1),[c,f]=x.useState({top:0,left:0,visible:!1}),[u,m]=x.useState(null),[h,v]=x.useState(!1),p=x.useRef([]),g=x.useMemo(()=>!$e(e)||a.current||!h?!1:Pt(e),[e,u,h]),C=x.useCallback(()=>{if(!$e(e))return;const T=cn(e);m(T)},[e]),y=x.useCallback(()=>{if(!g||!r.current){f(T=>({...T,visible:!1}));return}Y(()=>{if(!$e(e))return;const T=rc(e,r.current);f(T)})},[e,g]);x.useEffect(()=>{if(!$e(e))return;const d=e.view.dom.closest(".pubwave-editor"),A=j=>{const I=j.target,N=r.current;if(N&&I&&N.contains(I)){a.current=!1;return}d&&I&&d.contains(I)?l.current=!0:l.current=!1,a.current=!0,v(!1)},k=j=>{const I=Date.now(),B=I-s.current<300;s.current=I;const _=j.target,b=r.current;if(b&&_&&b.contains(_)){a.current=!1;return}if(a.current=!1,!l.current){v(!1);return}setTimeout(()=>{$e(e)&&(Pt(e)?(C(),v(!0),Y(()=>{y()})):(v(!1),f(M=>({...M,visible:!1}))))},B?100:10)};return document.addEventListener("mousedown",A),document.addEventListener("mouseup",k),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("mouseup",k)}},[e,C,y]),x.useEffect(()=>{if(!$e(e))return;C();const T=()=>{!a.current&&h&&C()},d=()=>{a.current||(C(),Pt(e)?v(!0):v(!1),Y(()=>{y()}))},A=()=>{setTimeout(()=>{const k=document.activeElement,j=r.current;j&&k&&j.contains(k)||(v(!1),T())},0)};return e.on("update",T),e.on("selectionUpdate",d),e.on("focus",d),e.on("blur",A),()=>{e.off("update",T),e.off("selectionUpdate",d),e.off("focus",d),e.off("blur",A)}},[e,C,y,h]),x.useEffect(()=>{y(),o==null||o(g)},[g,y,o]),x.useEffect(()=>{if(!g)return;const T=()=>{y()};return window.addEventListener("resize",T),window.addEventListener("scroll",T,!0),()=>{window.removeEventListener("resize",T),window.removeEventListener("scroll",T,!0)}},[g,y]);const S=We();return x.useEffect(()=>{if(!vt()){if(!g||!c.visible||!r.current){p.current.forEach(T=>T.destroy()),p.current=[];return}return p.current.forEach(T=>T.destroy()),p.current=[],Y(()=>{if(!r.current)return;r.current.querySelectorAll("[data-tooltip]").forEach(d=>{const A=d.getAttribute("data-tooltip");if(A){const k=Ie(d,{content:A,placement:"top",delay:[300,0],duration:[200,150],theme:"light-border"});p.current.push(k)}})}),()=>{p.current.forEach(T=>T.destroy()),p.current=[]}}},[g,c.visible,S]),$e(e)?i.jsx("div",{ref:r,className:Ve("pubwave-toolbar",g&&c.visible?"pubwave-toolbar--visible":"pubwave-toolbar--hidden",t),style:{position:"fixed",top:c.top,left:c.left,zIndex:z.zIndex.toolbar,opacity:g&&c.visible?1:0,pointerEvents:g&&c.visible?"auto":"none",transform:g&&c.visible?"translateY(0)":"translateY(4px)",transition:`opacity ${z.transition.fast}, transform ${z.transition.fast}`,isolation:"isolate"},role:"toolbar","aria-label":Et.toolbar,"aria-hidden":!g||!c.visible,"data-testid":"bubble-toolbar",children:i.jsx("div",{className:"pubwave-toolbar__content",style:{display:"flex",alignItems:"center",gap:0,padding:"var(--pubwave-spacing-1, 4px)",backgroundColor:"var(--pubwave-surface, var(--pubwave-bg))",color:"var(--pubwave-text)",border:"1px solid var(--pubwave-border)",borderRadius:"var(--pubwave-radius-lg, 8px)",boxShadow:"var(--pubwave-shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05))"},children:n??i.jsx(oc,{editor:e,selectionState:u})})}):null}const ac=768;function ic(e,t,n){if(!e||!(e instanceof Node))return null;try{if(e instanceof HTMLElement){const a=e.closest("table");if(a&&t.contains(a))return a}const o=n.view.posAtDOM(e,0),r=n.state.doc.resolve(o);if(r.depth>=1){const a=r.node(1);if(["taskList","bulletList","orderedList","blockquote"].includes(a.type.name)){const l=n.view.nodeDOM(r.before(1));if(l&&t.contains(l))return l}}for(let a=r.depth;a>0;a--)if(r.node(a).isBlock){const l=r.before(a),c=n.view.nodeDOM(l);if(c&&t.contains(c))return c}}catch{let r=e instanceof HTMLElement?e:e.parentElement;for(;r&&r.parentElement;){if(r.parentElement===t)return r;r=r.parentElement}}return null}function Mo({editor:e}){const t=x.useRef(null),n=x.useRef(null),o=x.useRef(!1),r=x.useRef(null),[a,s]=x.useState(!1),[l,c]=x.useState(!1),[f,u]=x.useState({top:0}),[m,h]=x.useState(!1),[v,p]=x.useState(!1);x.useEffect(()=>{const k=()=>{h(vt()),p(window.innerWidth<ac)};return k(),window.addEventListener("resize",k),()=>{window.removeEventListener("resize",k)}},[]);const g=x.useCallback(()=>{const k=t.current,j=n.current;if(!k||!j)return;const I=k.closest(".pubwave-editor");if(!I)return;I.offsetHeight;const N=I.getBoundingClientRect();let B=14,_=j;if(["UL","OL","BLOCKQUOTE"].includes(j.tagName)&&j.firstElementChild instanceof HTMLElement&&(_=j.firstElementChild),j.tagName==="TABLE"){const M=j.querySelector("thead")||j.querySelector("tr");M instanceof HTMLElement&&(_=M)}_.offsetHeight;const b=_.getBoundingClientRect();try{const M=window.getComputedStyle(_),E=M.lineHeight;if(E&&E!=="normal"){const $=parseFloat(E);isNaN($)||(B=$/2)}else{const $=parseFloat(M.fontSize);isNaN($)||(B=$*1.5/2)}}catch{}const L=b.top-N.top+B;!isNaN(L)&&isFinite(L)&&L>=0&&u({top:L})},[]),C=x.useCallback(k=>{n.current=k,s(!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{g()})})},[g]),y=x.useCallback(()=>{o.current||(n.current=null,s(!1))},[]),S=x.useCallback(()=>{r.current&&(clearTimeout(r.current),r.current=null)},[]);x.useEffect(()=>{const k=e.view.dom,j=k.closest(".pubwave-editor");if(!j)return;const I=b=>{if(o.current)return;const L=b.target;if(!L||(S(),L.closest(".pubwave-block-handle"))||!k.contains(L))return;const M=ic(L,k,e);M&&(M!==n.current?C(M):s(!0))},N=b=>{if(o.current)return;const L=b.relatedTarget;if(!L){S(),r.current=setTimeout(()=>{y()},150);return}L.closest(".pubwave-block-handle")||k.contains(L)||L.closest(".pubwave-editor")||(S(),r.current=setTimeout(()=>{y()},150))},B=()=>{o.current||(S(),r.current=setTimeout(()=>{y()},150))};k.addEventListener("mouseover",I),k.addEventListener("mouseout",N),j.addEventListener("mouseleave",B);const _=({transaction:b})=>{b.docChanged&&!o.current&&y()};return e.on("transaction",_),()=>{k.removeEventListener("mouseover",I),k.removeEventListener("mouseout",N),j.removeEventListener("mouseleave",B),e.off("transaction",_),S()}},[e,C,y,S]),x.useEffect(()=>{a&&n.current&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{g()})})},[a,g]),x.useEffect(()=>{if(!a)return;const k=()=>{n.current&&g()};return window.addEventListener("scroll",k,!0),()=>window.removeEventListener("scroll",k,!0)},[a,g]);const T=x.useCallback(()=>{const k=n.current;if(k)try{const j=e.view.posAtDOM(k,0),I=e.state.doc.resolve(j);let N=j;for(let b=I.depth;b>0;b--)if(I.node(b).isBlock){N=I.start(b);break}const _=e.state.doc.resolve(N).after(1);e.chain().focus().insertContentAt(_,{type:"paragraph"}).setTextSelection(_+1).run(),setTimeout(()=>{e.commands.insertContent("/")},10)}catch(j){console.error("Failed to add block:",j)}},[e]),d=x.useCallback(k=>{const j=n.current;if(!j)return;o.current=!0,requestAnimationFrame(()=>{c(!0)});const I=e.view.posAtDOM(j,0),N=bt(e.state.doc,I);if(!N)return;const B=N.pos,_=`block-${B}`;Co(e,_,B),k.dataTransfer.effectAllowed="move",k.dataTransfer.setData("application/x-pubwave-block",_),j.classList.add("pubwave-block--dragging");const b=j.cloneNode(!0);b.classList.add("pubwave-block--drag-preview"),b.style.opacity="1";const L=H=>{H.style.setProperty("color","#9b9a97","important"),H.style.setProperty("border-color","#9b9a97","important"),H.style.setProperty("--pubwave-text","#9b9a97","important"),Array.from(H.children).forEach(P=>{P instanceof HTMLElement&&L(P)})};L(b);const M=j.getBoundingClientRect();b.style.width=`${M.width}px`,b.style.position="static",b.style.transform="none";const E=document.createElement("div");E.className="pubwave-editor";const $=document.createElement("div");$.className="pubwave-editor__content";const q=document.createElement("div");q.className="ProseMirror",q.appendChild(b),$.appendChild(q),E.appendChild($),E.style.position="absolute",E.style.top="-9999px",E.style.left="-9999px",document.body.appendChild(E),k.dataTransfer.setDragImage(b,0,0),setTimeout(()=>{document.body.removeChild(E)},0)},[e]),A=x.useCallback(()=>{o.current=!1,c(!1),n.current&&n.current.classList.remove("pubwave-block--dragging"),s(!1)},[]);return m||v||!a?null:i.jsxs("div",{ref:t,className:"pubwave-block-handle","data-testid":"block-handle",style:{position:"absolute",left:"calc(var(--pubwave-container-padding-left, 140px) - 80px)",top:`${f.top}px`,transform:"translateY(-50%)",display:"flex",alignItems:"center",gap:"2px",pointerEvents:"auto",transition:`opacity ${z.transition.fast}`,zIndex:z.zIndex.dragHandle,opacity:a&&!l?1:0},onMouseEnter:k=>{k.stopPropagation(),r.current&&(clearTimeout(r.current),r.current=null)},onMouseLeave:k=>{k.stopPropagation();const j=k.relatedTarget;j!=null&&j.closest(".pubwave-editor")||(r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{y()},150))},children:[i.jsx("button",{type:"button",className:"pubwave-block-handle__add",onClick:T,"data-testid":"add-block-button",style:{width:"var(--pubwave-button-width, 28px)",height:"var(--pubwave-button-height, 28px)",display:"flex",alignItems:"center",justifyContent:"center",border:"none",borderRadius:z.borderRadius.sm,background:"transparent",color:`var(--pubwave-text-muted, ${z.colors.textMuted})`,cursor:"pointer",transition:`background-color ${z.transition.fast}, color ${z.transition.fast}`},title:"Add block","aria-label":"Add block below",children:i.jsx(sc,{})}),i.jsx("div",{className:"pubwave-block-handle__drag",draggable:!0,onDragStart:d,onDragEnd:A,"data-testid":"drag-handle",style:{width:"44px",height:"44px",padding:"8px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:z.borderRadius.sm,background:"transparent",color:`var(--pubwave-text-muted, ${z.colors.textMuted})`,cursor:"grab",transition:`background-color ${z.transition.fast}, color ${z.transition.fast}`},role:"button",tabIndex:0,title:"Drag to move","aria-label":"Drag to reorder block",children:i.jsx(lc,{})})]})}function sc(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"8",y1:"3",x2:"8",y2:"13"}),i.jsx("line",{x1:"3",y1:"8",x2:"13",y2:"8"})]})}function lc(){return i.jsxs("svg",{width:"12",height:"18",viewBox:"0 0 10 16",fill:"currentColor",children:[i.jsx("circle",{cx:"2",cy:"3",r:"1.5"}),i.jsx("circle",{cx:"2",cy:"8",r:"1.5"}),i.jsx("circle",{cx:"2",cy:"13",r:"1.5"}),i.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),i.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),i.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}function Po({visible:e,position:t,className:n}){return i.jsxs("div",{className:Ve("pubwave-drop-indicator",e&&"pubwave-drop-indicator--visible",`pubwave-drop-indicator--${t}`,n),"data-testid":"drop-indicator",style:{position:"absolute",left:0,right:0,height:"2px",backgroundColor:`var(--pubwave-drop-indicator-color, ${z.colors.dropIndicator})`,borderRadius:"1px",...t==="before"?{top:"-1px"}:{bottom:"-1px"},opacity:e?1:0,transform:e?"scaleX(1)":"scaleX(0.8)",transition:`opacity ${z.transition.fast}, transform ${z.transition.fast}`,zIndex:10,pointerEvents:"none"},"aria-hidden":"true",children:[i.jsx(Nn,{position:"left",visible:e}),i.jsx(Nn,{position:"right",visible:e})]})}function Nn({position:e,visible:t}){return i.jsx("div",{className:`pubwave-drop-indicator__cap pubwave-drop-indicator__cap--${e}`,style:{position:"absolute",top:"50%",transform:"translateY(-50%)",...e==="left"?{left:"-4px"}:{right:"-4px"},width:"8px",height:"8px",borderRadius:"50%",backgroundColor:`var(--pubwave-drop-indicator-color, ${z.colors.dropIndicator})`,opacity:t?1:0,transition:`opacity ${z.transition.fast}`}})}function cc({editor:e}){const[t,n]=x.useState(null),[o,r]=x.useState(null);return x.useEffect(()=>{const a=X.getState(e.state);a&&n(a);const s=()=>{const l=X.getState(e.state);l&&(l.dropTargetPos!==(t==null?void 0:t.dropTargetPos)||l.dropPosition!==(t==null?void 0:t.dropPosition))&&n(l)};return e.on("transaction",s),()=>{e.off("transaction",s)}},[e,t]),x.useEffect(()=>{if(!(t!=null&&t.dropTargetPos)||!t.dropPosition){r(null);return}const a=requestAnimationFrame(()=>{var v;const s=e.view,l=t.dropTargetPos;if(l===null)return;let c=s.nodeDOM(l);if(!c&&l>0){const p=s.domAtPos(l).node;p instanceof HTMLElement&&(c=p)}if(!c||!(c instanceof HTMLElement))return;const f=c.getBoundingClientRect(),u=(v=s.dom.closest(".pubwave-editor"))==null?void 0:v.getBoundingClientRect();if(!u)return;const m=8;let h=0;t.dropPosition==="before"?h=f.top-u.top-m:h=f.bottom-u.top+m,r({top:h,left:f.left-u.left,width:f.width})});return()=>cancelAnimationFrame(a)},[t,e]),!(t!=null&&t.dropTargetPos)||!t.dropPosition||!o?null:i.jsx("div",{style:{position:"absolute",top:o.top,left:o.left,width:o.width,height:"2px",pointerEvents:"none",zIndex:50},children:i.jsx(Po,{visible:!0,position:t.dropPosition,className:"pubwave-drop-indicator--overlay"})})}const uc=x.forwardRef(function(t,n){const{content:o,editable:r=!0,placeholder:a,theme:s,autofocus:l=!1,imageUpload:c,onChange:f,onSelectionChange:u,onFocus:m,onBlur:h,onReady:v,className:p,width:g,height:C,minHeight:y,"data-testid":S="pubwave-editor"}=t,T=jt(s==null?void 0:s.locale),d=a??T.placeholder??'Write,type "/" for commands...',A=Ae.useEditor({extensions:ln({placeholder:d,headingLevels:[1,2,3],linkOpenInNewTab:!0,linkOpenOnClick:!0,imageUpload:c,locale:s==null?void 0:s.locale}),content:o,editable:r,autofocus:l,immediatelyRender:!1,editorProps:{attributes:{class:`pubwave-editor__content ${(s==null?void 0:s.contentClassName)??""}`.trim(),"data-placeholder":d}},onUpdate:({editor:b})=>{f==null||f(b.getJSON())},onSelectionUpdate:()=>{u==null||u()},onFocus:()=>{m==null||m()},onBlur:()=>{h==null||h()},onCreate:({editor:b})=>{const L=k(b);v==null||v(L)}}),k=x.useCallback(b=>({getState:()=>({selection:{hasSelection:!(b!=null&&b.state.selection.empty),isMultiBlock:!1,from:(b==null?void 0:b.state.selection.from)??0,to:(b==null?void 0:b.state.selection.to)??0,isEmpty:(b==null?void 0:b.state.selection.empty)??!0},marks:{isBold:(b==null?void 0:b.isActive("bold"))??!1,isItalic:(b==null?void 0:b.isActive("italic"))??!1,isLink:(b==null?void 0:b.isActive("link"))??!1,linkHref:b?b.getAttributes("link").href:void 0},isFocused:(b==null?void 0:b.isFocused)??!1,isEditable:(b==null?void 0:b.isEditable)??!1,isEmpty:(b==null?void 0:b.isEmpty)??!0,characterCount:0}),getJSON:()=>(b==null?void 0:b.getJSON())??{type:"doc",content:[]},getHTML:()=>(b==null?void 0:b.getHTML())??"",getText:()=>(b==null?void 0:b.getText())??"",setContent:L=>b==null?void 0:b.commands.setContent(L),clearContent:()=>b==null?void 0:b.commands.clearContent(),setEditable:L=>b==null?void 0:b.setEditable(L),focus:L=>{L==="start"?b==null||b.commands.focus("start"):L==="end"?b==null||b.commands.focus("end"):b==null||b.commands.focus()},blur:()=>b==null?void 0:b.commands.blur(),toggleBold:()=>b==null?void 0:b.chain().focus().toggleBold().run(),toggleItalic:()=>b==null?void 0:b.chain().focus().toggleItalic().run(),setLink:L=>{L?b==null||b.chain().focus().setLink({href:L}).run():b==null||b.chain().focus().unsetLink().run()},destroy:()=>b==null?void 0:b.destroy(),tiptapEditor:b??null}),[]);x.useImperativeHandle(n,()=>A?k(A):null,[A,k]);const[j,I]=x.useState(!1);x.useEffect(()=>{I(!0)},[]),x.useEffect(()=>{var L;if(!((L=A==null?void 0:A.view)!=null&&L.dom))return;const b=A.view.dom;b&&b.setAttribute("data-placeholder",d)},[A,d,s==null?void 0:s.locale]);const N=["pubwave-editor",(s==null?void 0:s.classNamePrefix)??"",(s==null?void 0:s.containerClassName)??"",A?ql(A):"",C||y?"pubwave-editor--fixed-height":"",p].filter(Boolean).join(" "),B={position:"relative",overflow:C||y?"hidden":"visible",...C||y?{display:"flex",flexDirection:"column"}:{}};if(g&&(B["--pubwave-container-width"]=g,B.width=g,B["--pubwave-container-max-width"]=g,B.maxWidth=g),C&&(B["--pubwave-container-height"]=C,B.height=C),y&&(B["--pubwave-container-min-height"]=y,B.minHeight=y),s!=null&&s.colors){const{colors:b}=s,M=(b.text||"#1f2937").toLowerCase().trim(),E=M.startsWith("#f")||M.startsWith("#e")||M.includes("f1")||M.includes("f3")||M.includes("f0")||M.includes("fdf")||M.includes("ffb")||M.includes("ffc")||M.includes("ffd")||M.includes("ffe")||M.includes("fff")||M.includes("e0")||M.includes("e5")||M.includes("ecf")||M.includes("eef");b.background&&(b.background.includes("gradient")?(B.background=b.background,E?(B["--pubwave-surface"]="rgba(38, 38, 38, 0.95)",B["--pubwave-bg"]="#1a1a1a"):(B["--pubwave-surface"]="rgba(255, 255, 255, 0.95)",B["--pubwave-bg"]="#ffffff")):(B["--pubwave-bg"]=b.background,B["--pubwave-surface"]=b.background)),b.text&&(B["--pubwave-text"]=b.text),b.textMuted&&(B["--pubwave-text-muted"]=b.textMuted),b.border&&(B["--pubwave-border"]=b.border),b.primary&&(B["--pubwave-primary"]=b.primary),b.linkColor&&(B["--pubwave-link-color"]=b.linkColor),E?B["--pubwave-hover"]="rgba(255, 255, 255, 0.1)":B["--pubwave-hover"]="rgba(0, 0, 0, 0.05)"}if(s!=null&&s.backgroundImage){const b=s.backgroundImage,L=s.backgroundImageOptions||{};b.startsWith("url(")||b.includes("gradient")||b.includes("linear-gradient")||b.includes("radial-gradient")?B.backgroundImage=b:B.backgroundImage=`url(${b})`,L.repeat!==void 0?B.backgroundRepeat=L.repeat:B.backgroundRepeat="no-repeat",L.position!==void 0?B.backgroundPosition=L.position:B.backgroundPosition="center",L.size!==void 0?B.backgroundSize=L.size:B.backgroundSize="cover",L.attachment!==void 0?B.backgroundAttachment=L.attachment:B.backgroundAttachment="scroll"}if(!j||!A)return i.jsx(fn,{value:{locale:T},children:i.jsx("div",{className:N,"data-testid":S,role:"application","aria-label":Et.editor,style:B})});const _=b=>{if(!A||!r||b.button!==0||b.defaultPrevented)return;const L=b.target;if(!L)return;const M=A.view.dom;if(M&&M.contains(L))return;const E=M==null?void 0:M.lastElementChild,$=b.currentTarget.getBoundingClientRect();if(b.clientX<$.left||b.clientX>$.right||b.clientY<$.top||b.clientY>$.bottom)return;if(E){const W=E.getBoundingClientRect();if(b.clientY<=W.bottom+1)return}const{state:q}=A,H=q.schema.nodes.paragraph;if(!H)return;const P=q.doc.content.size,R=q.doc.lastChild;if(R&&R.type===H&&R.content.size===0){A.chain().focus().setTextSelection(Math.max(1,P-1)).run();return}A.chain().focus().insertContentAt(P,{type:"paragraph"}).setTextSelection(P+1).run()};return i.jsx(fn,{value:{locale:T},children:i.jsxs("div",{className:N,"data-testid":S,role:"application","aria-label":Et.editor,style:B,onMouseDown:_,children:[i.jsx(Ae.EditorContent,{editor:A}),r&&i.jsx(So,{editor:A}),r&&i.jsx(Mo,{editor:A}),r&&i.jsx(cc,{editor:A})]})})});function Ge(e){return!e.isDestroyed}function Do(e){if(!Ge(e))return{success:!1,message:"Editor not available"};const t=e.chain().focus().toggleBold().run();return Re(e),{success:t,message:t?"Bold toggled":"Could not toggle bold"}}function Io(e){if(!Ge(e))return{success:!1,message:"Editor not available"};const t=e.chain().focus().toggleItalic().run();return Re(e),{success:t,message:t?"Italic toggled":"Could not toggle italic"}}function Ro(e,t){if(!Ge(e))return{success:!1,message:"Editor not available"};if(!t.trim())return{success:!1,message:"URL is required"};let n=t.trim();!/^https?:\/\//i.test(n)&&!n.startsWith("/")&&(n=`https://${n}`);const o=e.chain().focus().setLink({href:n}).run();return Re(e),{success:o,message:o?"Link added":"Could not add link"}}function Eo(e){if(!Ge(e))return{success:!1,message:"Editor not available"};const t=e.chain().focus().unsetLink().run();return Re(e),{success:t,message:t?"Link removed":"Could not remove link"}}function Oo(e,t=window.prompt.bind(window)){if(!Ge(e))return{success:!1,message:"Editor not available"};if(e.isActive("link"))return Eo(e);const o=t("Enter URL:");return o?Ro(e,o):(Re(e),{success:!1,message:"Link cancelled"})}function dc(e,t){if(!Ge(e))return{success:!1,message:"Editor not available"};const n=e.chain().focus().setHeading({level:t}).run();Re(e);const o=String(t);return{success:n,message:n?`Heading ${o} applied`:"Could not set heading"}}function pc(e){if(!Ge(e))return{success:!1,message:"Editor not available"};const t=e.chain().focus().setParagraph().run();return Re(e),{success:t,message:t?"Paragraph applied":"Could not set paragraph"}}function fc(e,t,n){return()=>{const o=t(e);n==null||n(o)}}const hc=[{id:"bold",label:"Bold",shortcut:"Cmd+B",icon:"bold",action:Do,isActive:e=>e.isActive("bold")},{id:"italic",label:"Italic",shortcut:"Cmd+I",icon:"italic",action:Io,isActive:e=>e.isActive("italic")},{id:"link",label:"Link",icon:"link",action:e=>Oo(e),isActive:e=>e.isActive("link")}],Hn="44px",$n="20px";function bc({blockId:e,isHovered:t,isDragging:n=!1,onDragStart:o,onDragEnd:r,className:a}){const s=x.useRef(null),[l,c]=x.useState(!1),f=x.useCallback(p=>{if(p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",e),p.dataTransfer.setData("application/x-pubwave-block",e),s.current){const g=s.current.getBoundingClientRect();p.dataTransfer.setDragImage(s.current,g.width/2,g.height/2)}o==null||o(e,p)},[e,o]),u=x.useCallback(p=>{c(!1),r==null||r(e,p)},[e,r]),m=x.useCallback(()=>{c(!0)},[]),h=x.useCallback(()=>{c(!1)},[]),v=t||n;return i.jsx("div",{ref:s,className:Ve("pubwave-drag-handle",v&&"pubwave-drag-handle--visible",n&&"pubwave-drag-handle--dragging",l&&"pubwave-drag-handle--pressed",a),"data-testid":"drag-handle",style:{position:"absolute",left:"-32px",top:"50%",transform:"translateY(-50%)",width:Hn,height:Hn,display:"flex",alignItems:"center",justifyContent:"center",cursor:n?"grabbing":"grab",opacity:v?1:0,transition:`opacity ${z.transition.fast}`,userSelect:"none",WebkitUserSelect:"none"},draggable:!0,onDragStart:f,onDragEnd:u,onMouseDown:m,onMouseUp:h,role:"button","aria-label":Et.dragHandle,tabIndex:v?0:-1,children:i.jsx("div",{className:"pubwave-drag-handle__visual",style:{width:$n,height:$n,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:z.borderRadius.sm,backgroundColor:l?`var(--pubwave-drag-handle-active-bg, ${z.colors.focus})`:"transparent",transition:`background-color ${z.transition.fast}`},children:i.jsx(vc,{})})})}function vc(){return i.jsxs("svg",{width:"12",height:"16",viewBox:"0 0 12 16",fill:"currentColor",style:{color:`var(--pubwave-drag-handle-color, ${z.colors.textMuted})`},children:[i.jsx("circle",{cx:"3",cy:"3",r:"1.5"}),i.jsx("circle",{cx:"3",cy:"8",r:"1.5"}),i.jsx("circle",{cx:"3",cy:"13",r:"1.5"}),i.jsx("circle",{cx:"9",cy:"3",r:"1.5"}),i.jsx("circle",{cx:"9",cy:"8",r:"1.5"}),i.jsx("circle",{cx:"9",cy:"13",r:"1.5"})]})}const Xt=50,gc=15;function zn(e){const t=1-e/Xt;return Math.round(t*gc)}function _o(e){const t={isActive:!1,direction:null,speed:0,animationId:null},n=()=>e??window,o=()=>{if(e){const a=e.getBoundingClientRect();return{top:a.top,bottom:a.bottom}}return{top:0,bottom:window.innerHeight}},r=()=>{if(!t.isActive||t.direction===null)return;const a=n(),s=t.direction==="up"?-t.speed:t.speed;a===window?window.scrollBy(0,s):a instanceof HTMLElement&&(a.scrollTop+=s),t.animationId=Y(r)};return{start(){t.isActive=!0},update(a){if(!t.isActive)return;const s=o(),l=a-s.top,c=s.bottom-a;l<Xt?(t.direction="up",t.speed=zn(l)):c<Xt?(t.direction="down",t.speed=zn(c)):(t.direction=null,t.speed=0),t.direction!==null&&t.animationId===null?t.animationId=Y(r):t.direction===null&&t.animationId!==null&&(cancelAnimationFrame(t.animationId),t.animationId=null)},stop(){t.isActive=!1,t.direction=null,t.speed=0,t.animationId!==null&&(cancelAnimationFrame(t.animationId),t.animationId=null)}}}function mc(e){let t=null;const n=()=>(t??(t=_o(e)),t);return{startAutoScroll(){n().start()},updateAutoScroll(o){n().update(o.clientY)},stopAutoScroll(){n().stop(),t=null}}}const xc=3e3;function No({message:e,type:t="info",duration:n=xc,onDismiss:o,className:r}){const[a,s]=x.useState(!0);x.useEffect(()=>{if(n<=0)return;const f=setTimeout(()=>{s(!1),o==null||o()},n);return()=>{clearTimeout(f)}},[n,o]);const l=x.useCallback(()=>{s(!1),o==null||o()},[o]),c={info:z.colors.text,success:"var(--pubwave-color-success, #10b981)",error:z.colors.error,warning:"var(--pubwave-color-warning, #f59e0b)"};return i.jsxs("div",{className:Ve("pubwave-toast",`pubwave-toast--${t}`,a?"pubwave-toast--visible":"pubwave-toast--hidden",r),style:{position:"fixed",bottom:"24px",left:"50%",transform:`translateX(-50%) translateY(${a?"0":"16px"})`,padding:`${z.spacing.sm} ${z.spacing.md}`,backgroundColor:`var(--pubwave-toast-bg, ${z.colors.surface})`,border:`1px solid var(--pubwave-toast-border, ${z.colors.border})`,borderRadius:z.borderRadius.md,boxShadow:z.shadow.md,color:c[t],fontSize:z.typography.fontSizeSmall,opacity:a?1:0,transition:`opacity ${z.transition.normal}, transform ${z.transition.normal}`,zIndex:100,maxWidth:"400px",textAlign:"center"},role:"status","aria-live":"polite",children:[i.jsx("span",{className:"pubwave-toast__message",children:e}),i.jsx("button",{type:"button",className:"pubwave-toast__dismiss",onClick:l,style:{marginLeft:z.spacing.sm,padding:"0 4px",background:"none",border:"none",color:z.colors.textMuted,cursor:"pointer",fontSize:"16px",lineHeight:1},"aria-label":"Dismiss",children:"×"})]})}function yc({toasts:e,onDismiss:t}){return i.jsx("div",{className:"pubwave-toast-container",children:e.map((n,o)=>{const r=24+o*56,a=100-o;return i.jsx("div",{style:{position:"fixed",bottom:`${String(r)}px`,left:"50%",transform:"translateX(-50%)",zIndex:a},children:i.jsx(No,{message:n.message,type:n.type,duration:n.duration,onDismiss:()=>{t(n.id)}})},n.id)})})}function wc(){const e=String(Date.now()),t=Math.random().toString(36).slice(2,9);return`toast-${e}-${t}`}exports.BlockHandle=Mo;exports.BubbleToolbar=So;exports.DragHandle=bc;exports.DropIndicator=Po;exports.PubwaveEditor=uc;exports.SUPPORTED_BLOCKS=bl;exports.SUPPORTED_MARKS=vl;exports.SlashMenuList=yo;exports.Toast=No;exports.ToastContainer=yc;exports.canUseDOM=Ot;exports.cancelDrag=cl;exports.clearFormatting=Il;exports.cn=Ve;exports.createActionHandler=fc;exports.createAutoScroller=_o;exports.createDndPlugin=ko;exports.createEditor=gl;exports.createExtensions=ln;exports.createFocusTrap=Xl;exports.createSlashCommandsExtension=xo;exports.createToastId=wc;exports.defaultSlashCommands=Xn;exports.defaultTokens=ll;exports.defaultToolbarActions=hc;exports.destroyEditor=ml;exports.dndPluginKey=X;exports.findBlockAtPos=bt;exports.focusAfterClick=Gl;exports.focusAt=Vl;exports.focusEditor=Pl;exports.getActiveLinkHref=_l;exports.getActiveMarks=Ol;exports.getDndState=sn;exports.getSelectionBounds=wl;exports.getSelectionState=cn;exports.handleSelectionClear=Kl;exports.isEditable=xt;exports.isEditorValid=xl;exports.isMarkActive=Rl;exports.isMobileDevice=vt;exports.isNodeActive=El;exports.isReadOnly=To;exports.isSSR=ai;exports.isSelectionEmpty=yl;exports.maintainFocus=Yl;exports.moveBlock=wo;exports.redo=Ml;exports.restoreFocus=Re;exports.restoreSelection=st;exports.saveSelection=Ao;exports.selectAll=Dl;exports.setHeading=Al;exports.setLink=Tl;exports.setParagraph=Bl;exports.shouldAllowInteraction=zl;exports.shouldAllowToolbar=Hl;exports.shouldRenderEditUI=Nl;exports.shouldShowDragHandle=$l;exports.shouldShowToolbar=Pt;exports.startDrag=Co;exports.toggleBold=kl;exports.toggleHeading=jl;exports.toggleItalic=Cl;exports.tokens=z;exports.toolbarRemoveLink=Eo;exports.toolbarSetHeading=dc;exports.toolbarSetLink=Ro;exports.toolbarSetParagraph=pc;exports.toolbarToggleBold=Do;exports.toolbarToggleItalic=Io;exports.toolbarToggleLink=Oo;exports.undo=Sl;exports.unsetLink=Ll;exports.useAutoScroll=mc;