mokelay-editor 0.0.1

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.
@@ -0,0 +1 @@
1
+ .ce-advance-input-tool[data-v-5ab6cc48]{position:relative}.ce-advance-input-tool__editor-shell[data-v-5ab6cc48],.ce-advance-input-tool__preview[data-v-5ab6cc48]{position:relative;display:flex;align-items:center;min-height:42px;width:100%;border:1px solid rgb(148 163 184 / .6);border-radius:10px;background:#fff}.ce-advance-input-tool__editor[data-v-5ab6cc48]{width:100%;min-height:42px;padding:9px 12px;white-space:pre;overflow-x:auto;overflow-y:hidden;line-height:22px;outline:none;cursor:text}.ce-advance-input-tool__preview[data-v-5ab6cc48]{padding:9px 12px;white-space:pre;overflow-x:auto;overflow-y:hidden}.ce-advance-input-tool__editor-shell[data-v-5ab6cc48]:focus-within{border-color:#6366f1;box-shadow:0 0 0 2px #6366f126}.ce-advance-input-tool__menu[data-v-5ab6cc48]{position:absolute;z-index:20;min-width:168px;padding:6px;border:1px solid rgb(226 232 240);border-radius:12px;background:#fff;box-shadow:0 16px 40px #0f172a2e}.ce-advance-input-tool__menu-item[data-v-5ab6cc48]{display:flex;width:100%;border:0;border-radius:8px;padding:8px 10px;background:transparent;color:#0f172a;cursor:pointer;text-align:left}.ce-advance-input-tool__menu-item[data-v-5ab6cc48]:hover{background:#f1f5f9}.ce-advance-input-tool__preview-token[data-v-5ab6cc48],.ce-advance-input-tool__token[data-v-5ab6cc48]{display:inline-flex;align-items:center;margin:0 2px;vertical-align:middle}.ce-advance-input-tool__token[data-v-5ab6cc48]{border-radius:10px;cursor:pointer}.ce-advance-input-tool__token[data-v-5ab6cc48]:hover{box-shadow:0 0 0 2px #6366f12e}.ce-advance-input-tool__token--unknown[data-v-5ab6cc48]{padding:2px 8px;background:#f8fafc;color:#475569;font-size:12px}.ce-advance-input-tool__dialog[data-v-5ab6cc48]{width:min(100%,480px);border:0;border-radius:16px;padding:0;box-shadow:0 24px 80px #0f172a52}.ce-advance-input-tool__dialog[data-v-5ab6cc48]::backdrop{background:#0f172a73}.ce-advance-input-tool__dialog-panel[data-v-5ab6cc48]{margin:0;padding:20px;background:#fff}.ce-advance-input-tool__dialog-header[data-v-5ab6cc48]{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}.ce-advance-input-tool__dialog-title[data-v-5ab6cc48]{margin:0;color:#0f172a;font-size:18px;font-weight:600}.ce-advance-input-tool__dialog-close[data-v-5ab6cc48]{border:0;border-radius:10px;padding:8px 12px;background:#e2e8f0;color:#334155;cursor:pointer}.ce-advance-input-tool__dialog-body[data-v-5ab6cc48]{display:flex;flex-direction:column;gap:14px}.ce-advance-input-tool__dialog-field[data-v-5ab6cc48]{display:flex;flex-direction:column;gap:6px}.ce-advance-input-tool__dialog-field--checkbox[data-v-5ab6cc48]{flex-direction:row;align-items:center;gap:10px}.ce-advance-input-tool__dialog-label[data-v-5ab6cc48]{color:#334155;font-size:13px;font-weight:600}.ce-advance-input-tool__dialog-checkbox[data-v-5ab6cc48]{width:16px;height:16px;margin:0}.ce-advance-input-tool__dialog-input[data-v-5ab6cc48]{width:100%;border:1px solid rgb(148 163 184 / .65);border-radius:10px;padding:10px 12px;background:#fff;color:#0f172a;font-size:14px;line-height:20px}.ce-advance-input-tool__dialog-input[data-v-5ab6cc48]:focus{outline:none;border-color:#6366f1;box-shadow:0 0 0 2px #6366f126}.dark{background:#0f172a;border-color:#475569e6}.dark{background:#0f172a}.dark{background:#334155;color:#f1f5f9}.dark{background:#0f172a;color:#e2e8f0;border-color:#475569e6}.ce-advance-table-tool[data-v-6eb0809a]{width:100%;color:#0f172a}.ce-advance-table-tool__scroller[data-v-6eb0809a]{width:100%;overflow:auto;border:1px solid rgb(226 232 240);border-radius:8px;background:#fff}.ce-advance-table-tool__table[data-v-6eb0809a]{width:100%;min-width:520px;border-collapse:separate;border-spacing:0;font-size:14px;line-height:20px}.ce-advance-table-tool__cell[data-v-6eb0809a]{border-right:1px solid rgb(226 232 240);border-bottom:1px solid rgb(226 232 240);padding:10px 12px;background:#fff;text-align:left;vertical-align:middle;white-space:nowrap}.ce-advance-table-tool__cell[data-v-6eb0809a]:last-child{border-right:0}.ce-advance-table-tool__cell--header[data-v-6eb0809a]{position:sticky;top:0;z-index:3;background:#f8fafc;color:#334155;font-weight:600}.ce-advance-table-tool__cell--control[data-v-6eb0809a]{padding:10px;text-align:center}.ce-advance-table-tool__cell--fixed-left[data-v-6eb0809a],.ce-advance-table-tool__cell--fixed-right[data-v-6eb0809a]{z-index:2}.ce-advance-table-tool__cell--header.ce-advance-table-tool__cell--fixed-left[data-v-6eb0809a],.ce-advance-table-tool__cell--header.ce-advance-table-tool__cell--fixed-right[data-v-6eb0809a]{z-index:4}.ce-advance-table-tool__cell--fixed-left[data-v-6eb0809a]{box-shadow:1px 0 #e2e8f0}.ce-advance-table-tool__cell--fixed-right[data-v-6eb0809a]{box-shadow:-1px 0 #e2e8f0}.ce-advance-table-tool__row--selected .ce-advance-table-tool__cell[data-v-6eb0809a]{background:#eff6ff}.ce-advance-table-tool__checkbox[data-v-6eb0809a]{width:16px;height:16px;margin:0;vertical-align:middle;accent-color:rgb(37 99 235)}.ce-advance-table-tool__cell-token[data-v-6eb0809a]{display:inline-flex;align-items:center;margin:0 2px;vertical-align:middle}.ce-advance-table-tool__empty[data-v-6eb0809a]{color:#64748b;text-align:center}.dark{background:#1e293b;color:#f1f5f9}.dark{box-shadow:1px 0 #334155}.dark{box-shadow:-1px 0 #334155}.dark{background:#1e3a8a59}.ce-datasource-tool[data-v-b51983e4]{width:100%;border:1px solid rgb(226 232 240);border-radius:8px;background:#fff;color:#0f172a;font-size:14px;line-height:20px}.ce-datasource-tool__header[data-v-b51983e4]{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px;border-bottom:1px solid rgb(226 232 240)}.ce-datasource-tool__title[data-v-b51983e4]{font-size:15px;font-weight:650;color:#0f172a}.ce-datasource-tool__type-switch[data-v-b51983e4]{display:inline-grid;grid-template-columns:repeat(2,minmax(64px,1fr));overflow:hidden;border:1px solid rgb(203 213 225);border-radius:8px;background:#f8fafc}.ce-datasource-tool__type-button[data-v-b51983e4]{min-height:32px;border:0;border-right:1px solid rgb(203 213 225);padding:6px 12px;background:transparent;color:#475569;font:inherit;font-weight:600;cursor:pointer}.ce-datasource-tool__type-button[data-v-b51983e4]:last-child{border-right:0}.ce-datasource-tool__type-button--active[data-v-b51983e4]{background:#2563eb;color:#fff}.ce-datasource-tool__type-button[data-v-b51983e4]:disabled{cursor:default}.ce-datasource-tool__panel[data-v-b51983e4]{display:flex;flex-direction:column;gap:14px;padding:12px}.ce-datasource-tool__schema-panel[data-v-b51983e4]{display:flex;flex-direction:column;gap:12px;border-top:1px solid rgb(226 232 240);padding:12px}.ce-datasource-tool__generate-panel[data-v-b51983e4]{display:flex;flex-direction:column;gap:10px;border-top:1px solid rgb(226 232 240);padding:12px;background:#f8fafc}.ce-datasource-tool__schema-header[data-v-b51983e4]{display:flex;align-items:center;justify-content:space-between;gap:10px}.ce-datasource-tool__section-title[data-v-b51983e4]{color:#0f172a;font-size:14px;font-weight:700}.ce-datasource-tool__section-copy[data-v-b51983e4]{margin:2px 0 0;color:#64748b;font-size:13px}.ce-datasource-tool__generate-actions[data-v-b51983e4]{display:flex;align-items:center;flex-wrap:wrap;gap:10px}.ce-datasource-tool__schema-summary[data-v-b51983e4]{color:#334155;font-size:13px;font-weight:600}.ce-datasource-tool__schema-search[data-v-b51983e4]{max-width:260px}.ce-datasource-tool__grid[data-v-b51983e4]{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(120px,.4fr);gap:10px}.ce-datasource-tool__field[data-v-b51983e4]{display:flex;min-width:0;flex-direction:column;gap:6px}.ce-datasource-tool__label[data-v-b51983e4],.ce-datasource-tool__list-title[data-v-b51983e4]{margin:0;color:#334155;font-size:13px;font-weight:650}.ce-datasource-tool__input[data-v-b51983e4],.ce-datasource-tool__textarea[data-v-b51983e4]{width:100%;min-width:0;border:1px solid rgb(148 163 184 / .65);border-radius:8px;background:#fff;color:#0f172a;font:inherit}.ce-datasource-tool__input[data-v-b51983e4]{height:36px;padding:7px 10px}.ce-datasource-tool__textarea[data-v-b51983e4]{resize:vertical;padding:9px 10px}.ce-datasource-tool__textarea--json[data-v-b51983e4]{min-height:150px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,monospace;font-size:13px;line-height:19px}.ce-datasource-tool__textarea--schema[data-v-b51983e4]{min-height:130px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,monospace;font-size:13px;line-height:19px}.ce-datasource-tool__textarea--mock[data-v-b51983e4]{min-height:70px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,monospace;font-size:13px;line-height:18px}.ce-datasource-tool__input[data-v-b51983e4]:focus,.ce-datasource-tool__textarea[data-v-b51983e4]:focus{outline:none;border-color:#2563eb;box-shadow:0 0 0 2px #2563eb26}.ce-datasource-tool__input[data-v-b51983e4]:-moz-read-only,.ce-datasource-tool__textarea[data-v-b51983e4]:-moz-read-only{background:#f8fafc}.ce-datasource-tool__input[data-v-b51983e4]:read-only,.ce-datasource-tool__textarea[data-v-b51983e4]:read-only,.ce-datasource-tool__input[data-v-b51983e4]:disabled{background:#f8fafc}.ce-datasource-tool__error[data-v-b51983e4],.ce-datasource-tool__body-error[data-v-b51983e4]{margin:0;color:#b91c1c;font-size:13px}.ce-datasource-tool__list[data-v-b51983e4]{display:flex;flex-direction:column;gap:8px}.ce-datasource-tool__list[open][data-v-b51983e4]{gap:8px}.ce-datasource-tool__list-header[data-v-b51983e4]{display:flex;align-items:center;justify-content:space-between;gap:10px;cursor:pointer;list-style:none}.ce-datasource-tool__list-header[data-v-b51983e4]::-webkit-details-marker{display:none}.ce-datasource-tool__action[data-v-b51983e4],.ce-datasource-tool__remove[data-v-b51983e4],.ce-datasource-tool__schema-button[data-v-b51983e4]{min-height:32px;border:1px solid rgb(203 213 225);border-radius:8px;background:#fff;color:#1e40af;font:inherit;font-weight:650;cursor:pointer}.ce-datasource-tool__action[data-v-b51983e4]{padding:5px 12px}.ce-datasource-tool__schema-button[data-v-b51983e4]{padding:5px 12px;white-space:nowrap}.ce-datasource-tool__remove[data-v-b51983e4]{padding:5px 10px;color:#b91c1c}.ce-datasource-tool__action[data-v-b51983e4]:hover,.ce-datasource-tool__remove[data-v-b51983e4]:hover,.ce-datasource-tool__schema-button[data-v-b51983e4]:hover{background:#f8fafc}.ce-datasource-tool__schema-button[data-v-b51983e4]:disabled{cursor:wait;opacity:.7}.ce-datasource-tool__tabs[data-v-b51983e4]{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));overflow:hidden;border:1px solid rgb(203 213 225);border-radius:8px;background:#f8fafc}.ce-datasource-tool__tab[data-v-b51983e4]{min-height:34px;border:0;border-right:1px solid rgb(203 213 225);padding:6px 10px;background:transparent;color:#475569;font:inherit;font-weight:650;cursor:pointer}.ce-datasource-tool__tab[data-v-b51983e4]:last-child{border-right:0}.ce-datasource-tool__tab--active[data-v-b51983e4]{background:#2563eb;color:#fff}.ce-datasource-tool__schema-tab-panel[data-v-b51983e4]{display:flex;flex-direction:column;gap:10px}.ce-datasource-tool__field-list[data-v-b51983e4]{display:flex;flex-direction:column;gap:8px}.ce-datasource-tool__field-list-summary[data-v-b51983e4]{color:#334155;font-size:13px;font-weight:650}.ce-datasource-tool__schema-field[data-v-b51983e4]{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:10px;align-items:center;border:1px solid rgb(226 232 240);border-radius:8px;padding:8px;background:#fff}.ce-datasource-tool__checkbox[data-v-b51983e4]{width:16px;height:16px;margin:0;accent-color:rgb(37 99 235)}.ce-datasource-tool__schema-field-main[data-v-b51983e4]{display:flex;min-width:0;flex-direction:column;gap:4px}.ce-datasource-tool__field-label-input[data-v-b51983e4]{height:32px}.ce-datasource-tool__schema-path[data-v-b51983e4]{overflow:hidden;color:#64748b;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,monospace;font-size:12px;line-height:16px;text-overflow:ellipsis;white-space:nowrap}.ce-datasource-tool__schema-badges[data-v-b51983e4]{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:6px}.ce-datasource-tool__schema-badge[data-v-b51983e4]{display:inline-flex;align-items:center;min-height:24px;border-radius:999px;padding:3px 8px;background:#eff6ff;color:#1e40af;font-size:12px;font-weight:650;white-space:nowrap}.ce-datasource-tool__schema-badge--required[data-v-b51983e4]{background:#fef2f2;color:#b91c1c}.ce-datasource-tool__schema-tree[data-v-b51983e4]{display:flex;flex-direction:column;gap:6px;border:1px solid rgb(226 232 240);border-radius:8px;padding:8px;background:#f8fafc}.ce-datasource-tool__schema-node[data-v-b51983e4]{display:grid;grid-template-columns:minmax(90px,.5fr) minmax(0,1fr) auto auto;gap:8px;align-items:center;min-height:30px}.ce-datasource-tool__schema-node-name[data-v-b51983e4]{min-width:0;color:#0f172a;font-size:13px;font-weight:650;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ce-datasource-tool__empty[data-v-b51983e4]{margin:0;border:1px dashed rgb(203 213 225);border-radius:8px;padding:9px 10px;color:#64748b;font-size:13px}.ce-datasource-tool__row[data-v-b51983e4]{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;gap:8px;align-items:start}.ce-datasource-tool__body-row[data-v-b51983e4]{display:grid;grid-template-columns:minmax(120px,.8fr) minmax(110px,.4fr) minmax(0,1fr) auto;gap:8px;align-items:start}.ce-datasource-tool__body-error[data-v-b51983e4]{grid-column:3 / 5}@media(max-width:720px){.ce-datasource-tool__header[data-v-b51983e4],.ce-datasource-tool__schema-header[data-v-b51983e4]{align-items:stretch;flex-direction:column}.ce-datasource-tool__schema-search[data-v-b51983e4]{max-width:none}.ce-datasource-tool__grid[data-v-b51983e4],.ce-datasource-tool__row[data-v-b51983e4],.ce-datasource-tool__body-row[data-v-b51983e4],.ce-datasource-tool__schema-field[data-v-b51983e4],.ce-datasource-tool__schema-node[data-v-b51983e4]{grid-template-columns:1fr}.ce-datasource-tool__body-error[data-v-b51983e4]{grid-column:1}}.dark{border-color:#334155;background:#0f172a;color:#e2e8f0}.dark{border-bottom-color:#334155}.dark{border-top-color:#334155}.dark{border-top-color:#334155;background:#1e293b73}.dark{color:#f1f5f9}.dark{border-color:#475569;background:#1e293b}.dark{border-right-color:#475569;color:#cbd5e1}.dark{background:#3b82f6;color:#fff}.dark{border-color:#475569e6;background:#0f172a;color:#e2e8f0}.dark{border-color:#475569;background:#0f172a}.dark{background:#1e293b}.dark{border-color:#475569;color:#94a3b8}.dark{border-color:#334155;background:#0f172a}.dark{background:#1e40af57;color:#bfdbfe}.dark{background:#7f1d1d59;color:#fecaca}.dark{color:#f87171}.ce-editor-selector-tool[data-v-865609b6]{position:relative;width:100%}.ce-editor-selector-tool__editor-shell[data-v-865609b6],.ce-editor-selector-tool__preview[data-v-865609b6]{position:relative;width:100%;min-height:38px;border:1px solid rgb(148 163 184 / .6);border-radius:8px;background:#fff}.ce-editor-selector-tool__editor-shell[data-v-865609b6]{height:38px;padding:0 10px 0 38px;overflow:visible}.ce-editor-selector-tool__editor-shell--filled[data-v-865609b6]{height:auto;padding-top:4px;padding-bottom:4px}.ce-editor-selector-tool__editor[data-v-865609b6],.ce-editor-selector-tool__preview[data-v-865609b6]{min-height:0}.ce-editor-selector-tool__preview[data-v-865609b6]{display:flex;align-items:center;padding:7px 10px}.ce-editor-selector-tool__preview[data-v-865609b6]:empty{padding:0 10px}.ce-editor-selector-tool[data-v-865609b6] .codex-editor{min-height:0}.ce-editor-selector-tool[data-v-865609b6] .codex-editor__redactor{min-height:0;padding-bottom:0!important}.ce-editor-selector-tool[data-v-865609b6] .ce-block{padding:0}.ce-editor-selector-tool[data-v-865609b6] .ce-block__content,.ce-editor-selector-tool[data-v-865609b6] .ce-toolbar__content{max-width:none;margin:0}.ce-editor-selector-tool[data-v-865609b6] .ce-toolbar__actions{right:calc(100% + 8px);padding-right:0}.ce-editor-selector-tool[data-v-865609b6] .ce-paragraph{min-height:36px;padding:8px 0;line-height:20px;font-size:14px}.ce-editor-selector-tool[data-v-865609b6]:not(.ce-editor-selector-tool--filled) .ce-block,.ce-editor-selector-tool[data-v-865609b6]:not(.ce-editor-selector-tool--filled) .ce-block__content,.ce-editor-selector-tool[data-v-865609b6]:not(.ce-editor-selector-tool--filled) .ce-paragraph{min-height:0;height:36px}.ce-editor-selector-tool[data-v-865609b6]:not(.ce-editor-selector-tool--filled) .ce-paragraph{padding:8px 0}.ce-editor-selector-tool[data-v-865609b6] .ce-popover-item[data-item-name=paragraph],.ce-editor-selector-tool[data-v-865609b6] .ce-popover-item[data-item-name=table],.ce-editor-selector-tool[data-v-865609b6] .ce-popover-item[data-item-name=columns],.ce-editor-selector-tool[data-v-865609b6] .ce-popover-item[data-item-name=MEditorSelector]{display:none}.dark{border-color:#475569e6;background:#0f172a}.ce-form-item-tool[data-v-e6b491c3]{width:100%;color:#0f172a}.ce-form-item-tool__edit-shell[data-v-e6b491c3]{width:100%;border:1px dashed rgb(148 163 184 / .7);border-radius:8px;padding:8px}.ce-form-item-tool__label[data-v-e6b491c3]{color:#334155;font-size:13px;font-weight:600;line-height:20px}.ce-form-item-tool__body[data-v-e6b491c3]{display:flex;flex-direction:column;gap:8px}.ce-form-item-tool--horizontal .ce-form-item-tool__body[data-v-e6b491c3]{display:grid;grid-template-columns:minmax(96px,max-content) minmax(0,1fr);align-items:start;gap:12px}.ce-form-item-tool__label[data-v-e6b491c3]{padding-top:9px;word-break:break-word}.ce-form-item-tool__editor[data-v-e6b491c3]{min-width:0}.ce-form-item-tool__empty[data-v-e6b491c3]{display:inline-flex;min-height:38px;align-items:center;color:#64748b;font-size:14px;line-height:20px}@media(max-width:640px){.ce-form-item-tool--horizontal .ce-form-item-tool__body[data-v-e6b491c3]{display:flex;flex-direction:column}}.dark{color:#e2e8f0}.dark{border-color:#475569e6}.dark{color:#cbd5e1}.dark{color:#94a3b8}
@@ -0,0 +1,51 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MPage-PbJKUfhk.js","assets/editorjs-hCuh8vdW.js","assets/index-C0VPLP4t.js","assets/index-qSOXU8wC.css","assets/MForm-Ct41vjbV.js","assets/MForm-DHyGtILs.css"])))=>i.map(i=>d[i]);
2
+ var Qt=Object.defineProperty;var ea=(e,a,u)=>a in e?Qt(e,a,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[a]=u;var Ce=(e,a,u)=>ea(e,typeof a!="symbol"?a+"":a,u);import{A as He,F as ta,E as aa}from"./editorjs-hCuh8vdW.js";import{d as ge,i as Ye,j as Ze,k as ie,n as ve,l as he,o as r,c,b as i,m as pe,F as V,p as W,w as Y,t as h,u as k,q as oa,e as L,g as be,s as Qe,v as Ie,x as te,f as xe,r as X,y as Ae,z as me,A as ut,B as qe,C as ke,D as $t,E as P,G as pt,H as la,I as Re,J as Ke,_ as Se,h as U,K as fe,L as Le,M as St,N as na,O as mt,P as sa,Q as ra,R as ca,S as yt,T as ze,U as ia,V as Fe,W as da,X as ua,Y as pa,$ as ma,Z as ya,a0 as fa,a1 as va,a2 as ha,a3 as ft,a4 as vt,a5 as _a,a6 as ba,a7 as Et,a as Nt,a8 as ga,a9 as ka,aa as wa,ab as de,ac as ht,ad as _t,ae as bt,af as Ve,ag as je}from"./index-C0VPLP4t.js";const Ca={class:"ce-advance-input-tool","data-testid":"editor-advance-input-tool"},Ta={key:0,class:"ce-advance-input-tool__editor-shell"},xa=["data-testid","onMousedown"],$a={key:1,class:"ce-advance-input-tool__preview","data-testid":"preview-advance-input-value"},Sa={key:0,class:"ce-advance-input-tool__preview-text"},Ea={key:1,class:"ce-advance-input-tool__preview-token"},Na={class:"ce-advance-input-tool__dialog-header"},Da={class:"ce-advance-input-tool__dialog-title","data-testid":"advance-input-embedded-property-title"},Pa={type:"submit",class:"ce-advance-input-tool__dialog-close","data-testid":"advance-input-embedded-property-close"},Ia={key:0,class:"ce-advance-input-tool__dialog-body"},Aa=["checked","data-testid","onChange"],Ma={class:"ce-advance-input-tool__dialog-label"},Oa={class:"ce-advance-input-tool__dialog-label"},Ba=["value","data-testid","onChange"],Ra=["value"],La={class:"ce-advance-input-tool__dialog-label"},za=["value","placeholder","data-testid","onInput"],Fa=ke({toolbox:{get title(){return P.t("advanceInput.toolboxTitle")},icon:'<svg width="18" height="18" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="5" width="18" height="14" rx="3" ry="3" fill="none" stroke="currentColor" stroke-width="2"/><path d="M7 10h5M7 14h3M14 10h3M14 14h3" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>'},createInitialProps:()=>({value:$t()}),normalizeProps:e=>({edit:e.edit??!1,value:he(e.value)}),serialize:e=>({value:he(e.value)})}),Va=ge({__name:"MAdvanceInput",props:{edit:{type:Boolean},value:{},onChange:{type:Function},onToolChange:{type:Function}},setup(e){const a=e,{t:u}=xe(),_=X(null),x=X(null),N=X(!1),O=X({left:0,top:0}),d=X(null),m=new Map;let v=!1,w="";function D(y){return pt(y)}function z(y){return JSON.stringify(D(y))}function B(y){var s;const p=me(y);if(!p)throw new Error(`Unknown inline component "${y}".`);const t=p.normalizeProps({...((s=p.createInitialProps)==null?void 0:s.call(p))??{},edit:!1});return{id:la(),type:y,data:ut(p.serialize(t))}}function j(){m.forEach(y=>{y.app.unmount()}),m.clear()}function K(y){var H;const p=Re(y),t=me(p.type);if(!t){const F=document.createElement("span");return F.className="ce-advance-input-tool__token ce-advance-input-tool__token--unknown",F.dataset.segmentType="component",F.dataset.blockId=p.id,F.dataset.block=JSON.stringify(p),F.textContent=p.type,F}const s=document.createElement("span");s.className="ce-advance-input-tool__token",s.dataset.segmentType="component",s.dataset.blockId=p.id,s.dataset.block=JSON.stringify(p),s.contentEditable="false",s.setAttribute("data-testid",`editor-advance-input-token-${p.type}`);const b=document.createElement("span");b.className="ce-advance-input-tool__token-mount",s.appendChild(b);const E=t.normalizeProps({...((H=t.createInitialProps)==null?void 0:H.call(t))??{},...p.data,edit:!1}),M=qe(t.component,E);return M.mount(b),s.addEventListener("click",F=>{F.preventDefault(),F.stopPropagation(),ue(p.id)}),m.set(p.id,{app:M,block:Re(p),mountPoint:b,wrapper:s}),s}function $(y,p=!1){const t=_.value;if(!t)return;v=!0,j(),t.innerHTML="";const s=he(y);for(const b of s){if(b.type==="paragraph"){t.appendChild(document.createTextNode(Ae(b)));continue}t.appendChild(K(b)),t.appendChild(document.createTextNode("​"))}t.childNodes.length||t.appendChild(document.createTextNode("")),w=z(s),v=!1,p&&ve(()=>{ae(t)})}function G(){const y=_.value;if(!y)return $t();const p=[];return y.childNodes.forEach(t=>{if(t.nodeType===Node.TEXT_NODE){const s=(t.textContent??"").replace(/\u200B/g,"");p.push(Ke(s));return}if(t instanceof HTMLElement){if(t.dataset.segmentType==="component"){const s=t.dataset.blockId??"",b=m.get(s),E=t.dataset.block?JSON.parse(t.dataset.block):null,M=(b==null?void 0:b.block)??E;M&&p.push(Re(M));return}p.push(Ke((t.textContent??"").replace(/\u200B/g,"")))}}),pt(p)}function Z(y){var t,s;w=z(y);const p={edit:a.edit,value:y};(t=a.onToolChange)==null||t.call(a,p),(s=a.onChange)==null||s.call(a,p)}function A(){if(v)return;const y=D(G());z(y)!==w&&Z(y)}function ae(y){const p=window.getSelection();if(!p)return;const t=document.createRange();t.selectNodeContents(y),t.collapse(!1),p.removeAllRanges(),p.addRange(t)}function oe(){const y=_.value;y&&y.focus()}function le(){const y=_.value,p=window.getSelection();if(!y||!p||p.rangeCount===0)return null;const t=p.getRangeAt(0);return y.contains(t.startContainer)?{root:y,selection:p,range:t}:null}function I(){const y=le();if(!y||!y.selection.isCollapsed){N.value=!1;return}const{range:p,root:t}=y;let s="";if(p.startContainer.nodeType===Node.TEXT_NODE){const M=p.startContainer.textContent??"";p.startOffset>0&&(s=M[p.startOffset-1]??"")}else if(p.startContainer instanceof HTMLElement&&p.startOffset>0){const M=p.startContainer.childNodes[p.startOffset-1];if((M==null?void 0:M.nodeType)===Node.TEXT_NODE){const H=M.textContent??"";s=H[H.length-1]??""}}if(s!=="/"){N.value=!1;return}const b=p.getBoundingClientRect(),E=t.getBoundingClientRect();O.value={left:Math.max(0,b.left-E.left),top:Math.max(E.height+8,b.bottom-E.top+8)},N.value=!0}function J(){A(),I()}function q(){I()}function ee(){window.setTimeout(()=>{N.value=!1},120)}function Q(y){var s,b;if(y.key==="Enter"){y.preventDefault();return}if(y.key!=="Backspace")return;const p=le();if(!p||!p.selection.isCollapsed)return;const{range:t}=p;if(t.startContainer.nodeType===Node.TEXT_NODE){const E=t.startContainer;if(t.startOffset<=0||E.data[t.startOffset-1]!=="​")return;const M=E.previousSibling;if(!(M instanceof HTMLElement)||M.dataset.segmentType!=="component")return;y.preventDefault();const H=M.dataset.blockId??"";(s=m.get(H))==null||s.app.unmount(),m.delete(H),M.remove(),E.deleteData(t.startOffset-1,1),A();return}if(t.startContainer instanceof HTMLElement&&t.startOffset>0){const E=t.startContainer.childNodes[t.startOffset-1];if(!(E instanceof HTMLElement)||E.dataset.segmentType!=="component")return;y.preventDefault();const M=E.dataset.blockId??"";(b=m.get(M))==null||b.app.unmount(),m.delete(M),E.remove(),A()}}function ce(y){var t;y.preventDefault();const p=((t=y.clipboardData)==null?void 0:t.getData("text/plain"))??"";document.execCommand("insertText",!1,p.replace(/\n/g," "))}function ne(y){const p=le();if(!p)return;const{selection:t,range:s}=p,b=B(y);if(s.startContainer.nodeType===Node.TEXT_NODE){const F=s.startContainer;s.startOffset>0&&F.data[s.startOffset-1]==="/"&&(F.deleteData(s.startOffset-1,1),s.setStart(F,s.startOffset-1),s.collapse(!0))}const E=K(b),M=document.createTextNode("​");s.insertNode(M),s.insertNode(E);const H=document.createRange();H.setStart(M,1),H.collapse(!0),t.removeAllRanges(),t.addRange(H),N.value=!1,A(),oe()}function ue(y){var E,M,H,F;const p=m.get(y);if(!p)return;const t=me(p.block.type),s=((E=t==null?void 0:t.propertyPanel)==null?void 0:E.fields)??[];if(!t||!s.length)return;const b=t.normalizeProps({...((M=t.createInitialProps)==null?void 0:M.call(t))??{},...p.block.data,edit:!1});d.value={blockId:y,title:((H=t.propertyPanel)==null?void 0:H.title)||u("editor.propertyDialogTitle"),type:p.block.type,fields:s,values:Object.fromEntries(s.map(Ee=>[Ee.key,b[Ee.key]??""]))},(F=x.value)==null||F.showModal()}function g(){var y;(y=x.value)==null||y.close(),d.value=null}function C(y,p){var H;const t=d.value;if(!t)return;t.values[y]=p,d.value={...t,values:{...t.values}};const s=m.get(t.blockId),b=me(t.type);if(!s||!b)return;const E=b.normalizeProps({...((H=b.createInitialProps)==null?void 0:H.call(b))??{},...t.values,edit:!1});s.block={...s.block,data:ut(b.serialize(E))},s.wrapper.dataset.block=JSON.stringify(s.block),s.app.unmount();const M=qe(b.component,E);M.mount(s.mountPoint),s.app=M,A()}function S(){return he(a.value)}function T(y){var p;return((p=me(y))==null?void 0:p.component)??null}function se(y){return Ae(y)}function re(y){var t;const p=me(y.type);return p?p.normalizeProps({...((t=p.createInitialProps)==null?void 0:t.call(p))??{},...y.data,edit:!1}):{edit:!1}}return Ye(()=>{a.edit&&$(a.value)}),Ze(()=>{j()}),ie(()=>a.edit,y=>{if(!y){N.value=!1;return}ve(()=>{$(a.value)})}),ie(()=>a.value,y=>{if(!a.edit)return;const p=he(y);z(p)!==w&&$(p)}),(y,p)=>{var t;return r(),c("div",Ca,[e.edit?(r(),c("div",Ta,[i("div",{ref_key:"editableRef",ref:_,class:"ce-advance-input-tool__editor","data-testid":"editor-advance-input-content",contenteditable:"true",spellcheck:"false",onInput:J,onClick:q,onKeyup:I,onKeydown:Q,onPaste:ce,onBlur:ee},null,544),N.value?(r(),c("div",{key:0,class:"ce-advance-input-tool__menu","data-testid":"editor-advance-input-menu",style:pe({left:`${O.value.left}px`,top:`${O.value.top}px`})},[(r(!0),c(V,null,W(k(oa)(),([s,b])=>(r(),c("button",{key:s,type:"button",class:"ce-advance-input-tool__menu-item","data-testid":`editor-advance-input-menu-item-${s}`,onMousedown:Y(E=>ne(s),["prevent"])},h(b.toolbox.title),41,xa))),128))],4)):L("",!0)])):(r(),c("div",$a,[(r(!0),c(V,null,W(S(),(s,b)=>(r(),c(V,{key:`${s.id}-${s.type}-${b}`},[s.type==="paragraph"?(r(),c("span",Sa,h(se(s)),1)):(r(),c("span",Ea,[(r(),be(Ie(T(s.type)),Qe({ref_for:!0},re(s)),null,16))]))],64))),128))])),i("dialog",{ref_key:"embeddedDialogRef",ref:x,class:"ce-advance-input-tool__dialog","data-testid":"advance-input-embedded-property-dialog",onClose:p[0]||(p[0]=s=>d.value=null)},[i("form",{method:"dialog",class:"ce-advance-input-tool__dialog-panel",onSubmit:Y(g,["prevent"])},[i("div",Na,[i("h3",Da,h((t=d.value)==null?void 0:t.title),1),i("button",Pa,h(k(u)("editor.close")),1)]),d.value?(r(),c("div",Ia,[(r(!0),c(V,null,W(d.value.fields,s=>(r(),c("label",{key:s.key,class:te(["ce-advance-input-tool__dialog-field",{"ce-advance-input-tool__dialog-field--checkbox":s.type==="checkbox"}])},[s.type==="checkbox"?(r(),c(V,{key:0},[i("input",{class:"ce-advance-input-tool__dialog-checkbox",type:"checkbox",checked:d.value.values[s.key]===!0,"data-testid":`advance-input-embedded-property-input-${s.key}`,onChange:b=>C(s.key,b.target.checked)},null,40,Aa),i("span",Ma,h(s.label),1)],64)):s.type==="select"?(r(),c(V,{key:1},[i("span",Oa,h(s.label),1),i("select",{class:"ce-advance-input-tool__dialog-input",value:String(d.value.values[s.key]??""),"data-testid":`advance-input-embedded-property-input-${s.key}`,onChange:b=>C(s.key,b.target.value)},[(r(!0),c(V,null,W(s.options??[],b=>(r(),c("option",{key:b.value,value:b.value},h(b.label),9,Ra))),128))],40,Ba)],64)):(r(),c(V,{key:2},[i("span",La,h(s.label),1),i("input",{class:"ce-advance-input-tool__dialog-input",type:"text",value:String(d.value.values[s.key]??""),placeholder:s.placeholder,"data-testid":`advance-input-embedded-property-input-${s.key}`,onInput:b=>C(s.key,b.target.value)},null,40,za)],64))],2))),128))])):L("",!0)],32)],544)])}}}),gt=Se(Va,[["__scopeId","data-v-5ab6cc48"]]),ja={class:"ce-advance-table-tool","data-testid":"editor-advance-table-tool"},Ja={class:"ce-advance-table-tool__scroller"},Ha={class:"ce-advance-table-tool__table","data-testid":"advance-table"},qa=["checked","aria-label"],Ka=["data-testid"],Ua=["data-testid"],Wa=["data-testid"],Ga=["checked","aria-label","onChange"],Xa=["data-testid"],Ya=["data-testid"],Za={key:0,class:"ce-advance-table-tool__cell-text"},Qa={key:1,class:"ce-advance-table-tool__cell-token"},eo={key:0},to=["colspan"];function Je(e,a){return[Ke(e,a)]}function ao(){return[{id:"advance-table-default-tag",type:"MTag",data:{tagName:"{{tag}}",type:"{{tagType}}",size:"small",color:"",closable:!1}}]}function oo(){return[{id:"advance-table-default-link",type:"MLink",data:{text:"{{linkText}}",url:"{{linkUrl}}",open:!1}}]}function Ue(){return[{columnName:P.t("advanceTable.defaultColumns.name"),columnContent:Je("{{name}}","advance-table-default-name"),width:180,fixed:"left"},{columnName:P.t("advanceTable.defaultColumns.status"),columnContent:Je("{{status}}","advance-table-default-status"),width:140,fixed:null},{columnName:P.t("advanceTable.defaultColumns.tag"),columnContent:ao(),width:120,fixed:null},{columnName:P.t("advanceTable.defaultColumns.owner"),columnContent:Je("{{owner}}","advance-table-default-owner"),width:160,fixed:null},{columnName:P.t("advanceTable.defaultColumns.link"),columnContent:oo(),width:180,fixed:null}]}function Dt(){return[{name:P.t("advanceTable.defaultRows.first.name"),status:P.t("advanceTable.defaultRows.first.status"),tag:P.t("advanceTable.defaultRows.first.tag"),tagType:"warning",owner:P.t("advanceTable.defaultRows.first.owner"),linkText:P.t("advanceTable.defaultRows.first.linkText"),linkUrl:P.t("advanceTable.defaultRows.first.linkUrl")},{name:P.t("advanceTable.defaultRows.second.name"),status:P.t("advanceTable.defaultRows.second.status"),tag:P.t("advanceTable.defaultRows.second.tag"),tagType:"success",owner:P.t("advanceTable.defaultRows.second.owner"),linkText:P.t("advanceTable.defaultRows.second.linkText"),linkUrl:P.t("advanceTable.defaultRows.second.linkUrl")}]}const lo=ke({toolbox:{get title(){return P.t("advanceTable.toolboxTitle")},icon:'<svg width="18" height="18" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="5" width="18" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="2"/><path d="M3 10h18M8 5v14M16 5v14" stroke="currentColor" stroke-width="2"/></svg>'},propertyPanel:{get title(){return P.t("advanceTable.propertyPanelTitle")},get fields(){return[{key:"index",label:P.t("advanceTable.properties.index"),type:"checkbox"},{key:"selection",label:P.t("advanceTable.properties.selection"),type:"checkbox"}]}},createInitialProps:()=>({index:!1,selection:!1,columns:Ue(),data:Dt()}),normalizeProps:e=>({edit:e.edit??!1,index:e.index===!0,selection:e.selection===!0,columns:We(e.columns),data:Ge(e.data)}),serialize:e=>({index:e.index===!0,selection:e.selection===!0,columns:We(e.columns),data:Ge(e.data)})});function We(e){if(!Array.isArray(e)||!e.length)return Ue();const a=e.filter(u=>typeof u=="object"&&u!==null).map((u,_)=>{var x;return{columnName:((x=u.columnName)==null?void 0:x.trim())||`${P.t("advanceTable.defaultColumnName")}${_+1}`,columnContent:he(u.columnContent),width:no(u.width),fixed:so(u.fixed)}});return a.length?a:Ue()}function Ge(e){return Array.isArray(e)?e.filter(a=>typeof a=="object"&&a!==null&&!Array.isArray(a)):Dt()}function no(e){return typeof e!="number"||!Number.isFinite(e)||e<=0?null:Math.round(e)}function so(e){return e==="left"||e==="right"?e:null}const ro=ge({__name:"MAdvanceTable",props:{edit:{type:Boolean},index:{type:Boolean},selection:{type:Boolean},columns:{},data:{},onChange:{type:Function},onToolChange:{type:Function}},setup(e){const a=e,{t:u}=xe(),_=X(new Set),x=U(()=>We(a.columns)),N=U(()=>Ge(a.data)),O=U(()=>a.selection===!0),d=U(()=>a.index===!0),m=44,v=56,w=160;function D(g){if(g==null)return"";if(typeof g=="string")return g;if(typeof g=="number"||typeof g=="boolean")return String(g);try{return JSON.stringify(g)}catch{return String(g)}}function z(g,C){return g.replace(/\{\{\s*([\w.-]+)\s*\}\}/g,(S,T)=>D(B(C,T)))}function B(g,C){return C.split(".").reduce((S,T)=>typeof S!="object"||S===null||!(T in S)?"":S[T],g)}function j(g,C){return typeof g=="string"?z(g,C):Array.isArray(g)?g.map(S=>j(S,C)):typeof g=="object"&&g!==null?Object.fromEntries(Object.entries(g).map(([S,T])=>[S,j(T,C)])):g}function K(g,C){return he(C.columnContent).map(S=>S.type==="paragraph"?{...S,data:{text:z(Ae(S),g)}}:{...S,data:j(S.data,g)})}function $(g){var C;return((C=me(g))==null?void 0:C.component)??null}function G(g){var S;const C=me(g.type);return C?C.normalizeProps({...((S=C.createInitialProps)==null?void 0:S.call(C))??{},...g.data,edit:!1}):{edit:!1}}function Z(g){return Ae(g)}function A(g){return g.width??null}function ae(g){return A(g)??w}function oe(g){let C=0;O.value&&(C+=m),d.value&&(C+=v);for(let S=0;S<g;S+=1){const T=x.value[S];(T==null?void 0:T.fixed)==="left"&&(C+=ae(T))}return C}function le(g){let C=0;for(let S=x.value.length-1;S>g;S-=1){const T=x.value[S];(T==null?void 0:T.fixed)==="right"&&(C+=ae(T))}return C}function I(g,C){const S=A(g),T={};return S&&(T.width=`${S}px`,T.minWidth=`${S}px`),g.fixed==="left"&&(T.position="sticky",T.left=`${oe(C)}px`),g.fixed==="right"&&(T.position="sticky",T.right=`${le(C)}px`),T}function J(g){return{"ce-advance-table-tool__cell--fixed-left":g.fixed==="left","ce-advance-table-tool__cell--fixed-right":g.fixed==="right"}}function q(){return{width:`${m}px`,minWidth:`${m}px`,left:"0px"}}function ee(){return{width:`${v}px`,minWidth:`${v}px`,left:`${O.value?m:0}px`}}function Q(g){return _.value.has(g)}function ce(g){const C=new Set(_.value);C.has(g)?C.delete(g):C.add(g),_.value=C}function ne(){return N.value.length>0&&N.value.every((g,C)=>_.value.has(C))}function ue(){if(ne()){_.value=new Set;return}_.value=new Set(N.value.map((g,C)=>C))}return(g,C)=>(r(),c("div",ja,[i("div",Ja,[i("table",Ha,[i("thead",null,[i("tr",null,[e.selection?(r(),c("th",{key:0,class:"ce-advance-table-tool__cell ce-advance-table-tool__cell--header ce-advance-table-tool__cell--control ce-advance-table-tool__cell--fixed-left",style:pe(q()),"data-testid":"advance-table-selection-header"},[i("input",{class:"ce-advance-table-tool__checkbox",type:"checkbox",checked:ne(),"aria-label":k(u)("advanceTable.selectAll"),onChange:ue},null,40,qa)],4)):L("",!0),e.index?(r(),c("th",{key:1,class:"ce-advance-table-tool__cell ce-advance-table-tool__cell--header ce-advance-table-tool__cell--control ce-advance-table-tool__cell--fixed-left",style:pe(ee()),"data-testid":"advance-table-index-header"}," # ",4)):L("",!0),(r(!0),c(V,null,W(x.value,(S,T)=>(r(),c("th",{key:`header-${T}`,class:te(["ce-advance-table-tool__cell ce-advance-table-tool__cell--header",J(S)]),style:pe(I(S,T)),"data-testid":`advance-table-header-${T}`},h(S.columnName),15,Ka))),128))])]),i("tbody",null,[(r(!0),c(V,null,W(N.value,(S,T)=>(r(),c("tr",{key:`row-${T}`,class:te(["ce-advance-table-tool__row",{"ce-advance-table-tool__row--selected":Q(T)}]),"data-testid":`advance-table-row-${T}`},[e.selection?(r(),c("td",{key:0,class:"ce-advance-table-tool__cell ce-advance-table-tool__cell--control ce-advance-table-tool__cell--fixed-left",style:pe(q()),"data-testid":`advance-table-selection-cell-${T}`},[i("input",{class:"ce-advance-table-tool__checkbox",type:"checkbox",checked:Q(T),"aria-label":k(u)("advanceTable.selectRow"),onChange:se=>ce(T)},null,40,Ga)],12,Wa)):L("",!0),e.index?(r(),c("td",{key:1,class:"ce-advance-table-tool__cell ce-advance-table-tool__cell--control ce-advance-table-tool__cell--fixed-left",style:pe(ee()),"data-testid":`advance-table-index-cell-${T}`},h(T+1),13,Xa)):L("",!0),(r(!0),c(V,null,W(x.value,(se,re)=>(r(),c("td",{key:`cell-${T}-${re}`,class:te(["ce-advance-table-tool__cell",J(se)]),style:pe(I(se,re)),"data-testid":`advance-table-cell-${T}-${re}`},[(r(!0),c(V,null,W(K(S,se),(y,p)=>(r(),c(V,{key:`${T}-${re}-${y.id}-${y.type}-${p}`},[y.type==="paragraph"?(r(),c("span",Za,h(Z(y)),1)):(r(),c("span",Qa,[(r(),be(Ie($(y.type)),Qe({ref_for:!0},G(y)),null,16))]))],64))),128))],14,Ya))),128))],10,Ua))),128)),N.value.length?L("",!0):(r(),c("tr",eo,[i("td",{class:"ce-advance-table-tool__cell ce-advance-table-tool__empty",colspan:x.value.length+(e.selection?1:0)+(e.index?1:0)},h(k(u)("advanceTable.empty")),9,to)]))])])])]))}}),kt=Se(ro,[["__scopeId","data-v-6eb0809a"]]),co={class:"ce-datasource-tool","data-testid":"editor-datasource-tool"},io={class:"ce-datasource-tool__header"},uo={class:"ce-datasource-tool__title"},po=["aria-label"],mo=["disabled"],yo=["disabled"],fo={key:0,class:"ce-datasource-tool__panel","data-testid":"datasource-json-panel"},vo={class:"ce-datasource-tool__field"},ho={class:"ce-datasource-tool__label"},_o=["readonly","value"],bo={key:0,class:"ce-datasource-tool__error","data-testid":"datasource-json-error"},go={key:1,class:"ce-datasource-tool__panel","data-testid":"datasource-api-panel"},ko={class:"ce-datasource-tool__grid"},wo={class:"ce-datasource-tool__field"},Co={class:"ce-datasource-tool__label"},To=["readonly","value"],xo={class:"ce-datasource-tool__field"},$o={class:"ce-datasource-tool__label"},So=["readonly","value"],Eo={class:"ce-datasource-tool__field"},No={class:"ce-datasource-tool__label"},Do=["disabled","value"],Po={open:"",class:"ce-datasource-tool__list","data-testid":"datasource-header-list"},Io={class:"ce-datasource-tool__list-header"},Ao={class:"ce-datasource-tool__list-title"},Mo={key:0,class:"ce-datasource-tool__empty"},Oo=["data-testid","readonly","placeholder","value","onInput"],Bo=["data-testid","readonly","placeholder","value","onInput"],Ro=["data-testid","aria-label","onClick"],Lo={open:"",class:"ce-datasource-tool__list","data-testid":"datasource-query-list"},zo={class:"ce-datasource-tool__list-header"},Fo={class:"ce-datasource-tool__list-title"},Vo={key:0,class:"ce-datasource-tool__empty"},jo=["data-testid","readonly","placeholder","value","onInput"],Jo=["data-testid","readonly","placeholder","value","onInput"],Ho=["data-testid","aria-label","onClick"],qo={open:"",class:"ce-datasource-tool__list","data-testid":"datasource-body-list"},Ko={class:"ce-datasource-tool__list-header"},Uo={class:"ce-datasource-tool__list-title"},Wo={key:0,class:"ce-datasource-tool__empty"},Go=["data-testid","readonly","placeholder","value","onInput"],Xo=["data-testid","disabled","value","onChange"],Yo=["value"],Zo=["data-testid","disabled","value","onChange"],Qo=["data-testid"],el=["data-testid","readonly","value","onInput"],tl=["data-testid","type","readonly","placeholder","value","onInput"],al=["data-testid","aria-label","onClick"],ol=["data-testid"],ll={class:"ce-datasource-tool__generate-panel","data-testid":"datasource-schema-generate-panel"},nl={class:"ce-datasource-tool__section-title"},sl={class:"ce-datasource-tool__section-copy"},rl={class:"ce-datasource-tool__generate-actions"},cl=["disabled"],il={key:1,class:"ce-datasource-tool__schema-summary","data-testid":"datasource-schema-summary"},dl={key:0,class:"ce-datasource-tool__error","data-testid":"datasource-json-schema-error"},ul={class:"ce-datasource-tool__schema-panel","data-testid":"datasource-json-schema-panel"},pl={class:"ce-datasource-tool__schema-header"},ml={class:"ce-datasource-tool__section-title"},yl={class:"ce-datasource-tool__section-copy"},fl=["placeholder","value"],vl={class:"ce-datasource-tool__tabs","data-testid":"datasource-schema-tabs"},hl={key:0,class:"ce-datasource-tool__schema-tab-panel","data-testid":"datasource-list-schema-panel"},_l={key:0,class:"ce-datasource-tool__empty","data-testid":"datasource-schema-empty"},bl={key:1,class:"ce-datasource-tool__field"},gl={class:"ce-datasource-tool__label"},kl=["disabled","value"],wl=["value"],Cl={key:2,class:"ce-datasource-tool__empty","data-testid":"datasource-list-schema-empty"},Tl={key:3,class:"ce-datasource-tool__field-list","data-testid":"datasource-list-fields"},xl={class:"ce-datasource-tool__field-list-summary"},$l=["data-testid"],Sl=["disabled","checked","data-testid","onChange"],El={class:"ce-datasource-tool__schema-field-main"},Nl=["readonly","value","data-testid","onInput"],Dl={class:"ce-datasource-tool__schema-path"},Pl={class:"ce-datasource-tool__schema-badges"},Il={class:"ce-datasource-tool__schema-badge"},Al={class:"ce-datasource-tool__schema-badge"},Ml={key:0,class:"ce-datasource-tool__schema-badge ce-datasource-tool__schema-badge--required"},Ol={key:1,class:"ce-datasource-tool__schema-tab-panel","data-testid":"datasource-form-schema-panel"},Bl={key:0,class:"ce-datasource-tool__field-list","data-testid":"datasource-form-fields"},Rl={class:"ce-datasource-tool__field-list-summary"},Ll=["data-testid"],zl=["disabled","checked","data-testid","onChange"],Fl={class:"ce-datasource-tool__schema-field-main"},Vl=["readonly","value","data-testid","onInput"],jl={class:"ce-datasource-tool__schema-path"},Jl={class:"ce-datasource-tool__schema-badges"},Hl={class:"ce-datasource-tool__schema-badge"},ql={class:"ce-datasource-tool__schema-badge"},Kl={key:0,class:"ce-datasource-tool__schema-badge ce-datasource-tool__schema-badge--required"},Ul={key:1,class:"ce-datasource-tool__empty","data-testid":"datasource-form-schema-empty"},Wl={key:2,class:"ce-datasource-tool__schema-tab-panel","data-testid":"datasource-advanced-schema-panel"},Gl={key:0,class:"ce-datasource-tool__schema-tree","data-testid":"datasource-schema-tree"},Xl=["data-testid"],Yl={class:"ce-datasource-tool__schema-node-name"},Zl={class:"ce-datasource-tool__schema-path"},Ql={class:"ce-datasource-tool__schema-badge"},en={key:0,class:"ce-datasource-tool__schema-badge ce-datasource-tool__schema-badge--required"},tn={class:"ce-datasource-tool__field"},an={class:"ce-datasource-tool__label"},on=["readonly","value"],ln=ke({toolbox:{get title(){return P.t("datasource.toolboxTitle")},icon:'<svg width="18" height="18" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><ellipse cx="12" cy="6" rx="7" ry="3" fill="none" stroke="currentColor" stroke-width="2"/><path d="M5 6v6c0 1.7 3.1 3 7 3s7-1.3 7-3V6M5 12v6c0 1.7 3.1 3 7 3s7-1.3 7-3v-6" fill="none" stroke="currentColor" stroke-width="2"/><path d="M8 12c1.1.5 2.5.8 4 .8s2.9-.3 4-.8" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>'},createInitialProps:()=>({value:fa()}),normalizeProps:e=>({edit:e.edit??!1,value:fe(e.value)}),serialize:e=>({value:fe(e.value)})}),nn=ge({__name:"MDatasourceEditor",props:{edit:{type:Boolean},value:{},onChange:{type:Function},onToolChange:{type:Function}},setup(e){const a=e,{t:u}=xe(),_=fe(a.value),x=sa,N=X(_.type),O=Le(_.type==="JSON"?_.rawData:{}),d=X(g(O.value)),m=X(""),v=Le(_.jsonSchema),w=X(C(v.value)),D=X(""),z=X(!1),B=Le(_.schemaSelections),j=X("list"),K=X(""),$=St(_.type==="API"?_:na()),G=X($.bodyData.map(o=>we(o))),Z=X($.bodyData.map(()=>"")),A=U(()=>!a.edit),ae=U(()=>va(v.value)),oe=U(()=>ra(ae.value)),le=U(()=>ca(v.value)),I=U(()=>{var o,l;return((l=(o=B.value)==null?void 0:o.list)==null?void 0:l.fields)??[]}),J=U(()=>{var o,l;return((l=(o=B.value)==null?void 0:o.form)==null?void 0:l.fields)??[]}),q=U(()=>re(oe.value,K.value)),ee=U(()=>y(I.value,K.value)),Q=U(()=>y(J.value,K.value)),ce=U(()=>{var o,l;return((l=(o=B.value)==null?void 0:o.list)==null?void 0:l.recordPath)??""}),ne=U(()=>I.value.filter(o=>o.enabled).length),ue=U(()=>J.value.filter(o=>o.enabled).length);function g(o){return JSON.stringify(o,null,2)}function C(o){return o?JSON.stringify(o,null,2):""}function S(o){return u(`datasource.schemaTypes.${o}`)}function T(o){return u(`datasource.componentHints.${o}`)}function se(o){return o.trim().toLowerCase()}function re(o,l){const n=se(l);return n?o.filter(f=>f.name.toLowerCase().includes(n)||f.displayPath.toLowerCase().includes(n)):o}function y(o,l){const n=se(l);return n?o.filter(f=>f.label.toLowerCase().includes(n)||f.path.toLowerCase().includes(n)):o}function p(o){return o||"root"}function t(o){return o?`${o}[]`:u("datasource.fields.rootRecordPath")}function s(o){return{edit:a.edit,value:fe(o)}}function b(o){var n,f;if(!a.edit)return;const l=s(o);(n=a.onToolChange)==null||n.call(a,l),(f=a.onChange)==null||f.call(a,l)}function E(){return fe({type:"JSON",rawData:ha(O.value,{}),jsonSchema:v.value,schemaSelections:B.value})}function M(){return fe({type:"API",domain:$.domain,path:$.path,method:$.method,headerData:$.headerData,bodyData:$.bodyData,queryData:$.queryData,jsonSchema:v.value,schemaSelections:B.value})}function H(){b(N.value==="JSON"?E():M())}function F(){b(M())}function Ee(){G.value=$.bodyData.map(o=>we(o)),Z.value=$.bodyData.map(()=>"")}function Lt(o,l){v.value=o?ft(o):void 0,w.value=C(v.value),B.value=vt(l,v.value),D.value=""}function zt(o){Object.assign($,{type:"API",domain:o.domain,path:o.path,method:o.method,headerData:o.headerData.map(l=>({...l})),bodyData:o.bodyData.map(l=>({key:l.key,dataType:l.dataType,mock:mt(l.dataType,l.mock)})),queryData:o.queryData.map(l=>({...l}))}),Ee()}function Ft(o){const l=fe(o);if(N.value=l.type,Lt(l.jsonSchema,l.schemaSelections),l.type==="JSON"){O.value=l.rawData,d.value=g(l.rawData),m.value="";return}zt(l)}function tt(o){if(!(!a.edit||N.value===o)){if(N.value=o,o==="JSON"){b(E());return}F()}}function Vt(o){if(!a.edit)return;const l=o.target.value;d.value=l;try{const n=JSON.parse(l);if(!yt(n))throw new Error("Invalid JSON value.");O.value=ze(n),m.value="",b(E())}catch{m.value=u("datasource.validation.invalidJson")}}function jt(o){if(!a.edit)return;const l=o.target.value;if(w.value=l,!l.trim()){v.value=void 0,B.value=void 0,D.value="",H();return}try{const n=JSON.parse(l),f=ia(n);if(!f)throw new Error("Invalid JSON Schema.");v.value=f,B.value=Fe(f,B.value),D.value="",H()}catch{D.value=u("datasource.validation.invalidJsonSchema")}}function at(o,l){a.edit&&($[o]=l,F())}function Jt(o){a.edit&&($.method=da(o),F())}function Ne(o){return $[o]}function ot(o){a.edit&&($[o].push({key:"",mock:""}),F())}function De(o,l,n,f){if(!a.edit)return;const R=$[o][l];R&&(R[n]=f,F())}function lt(o,l){a.edit&&($[o].splice(l,1),F())}function Ht(){if(!a.edit)return;const o={key:"",dataType:"string",mock:""};$.bodyData.push(o),G.value.push(we(o)),Z.value.push(""),F()}function qt(o,l){if(!a.edit)return;const n=$.bodyData[o];n&&(n.key=l,F())}function Kt(o,l){if(!a.edit)return;const n=$.bodyData[o];n&&(n.dataType=ua(l),n.mock=pa(n.dataType),G.value[o]=we(n),Z.value[o]="",F())}function Be(o,l){if(!a.edit)return;const n=$.bodyData[o];if(!n)return;G.value[o]=l;const f=Zt(n.dataType,l);if(!f.ok){Z.value[o]=f.error;return}n.mock=f.value,Z.value[o]="",F()}function Ut(o){a.edit&&($.bodyData.splice(o,1),G.value.splice(o,1),Z.value.splice(o,1),F())}function Wt(o){return o instanceof _a?o.code==="apiRequestFailed"?`${u("datasource.validation.apiRequestFailed")} ${o.status??""} ${o.statusText??""}`.trim():u(`datasource.validation.${o.code}`):o instanceof Error?o.message:String(o)}function Gt(o){v.value=ft(o),w.value=C(v.value),B.value=Fe(v.value,B.value),D.value="",H()}function Xt(o){var l,n;!a.edit||!v.value||(B.value=Fe(v.value,{...B.value,list:{recordPath:o,fields:((n=(l=B.value)==null?void 0:l.list)==null?void 0:n.fields)??[]}}),H())}function nt(o,l,n){var it,dt;if(!a.edit)return;const f=vt(B.value,v.value),R=o==="list"?(it=f==null?void 0:f.list)==null?void 0:it.fields:(dt=f==null?void 0:f.form)==null?void 0:dt.fields;if(!R)return;const ct=R.map(Pe=>Pe.path===l?{...Pe,...n,label:n.label!==void 0?n.label:Pe.label}:Pe);B.value={...f,...o==="list"&&(f!=null&&f.list)?{list:{...f.list,fields:ct}}:{},...o==="form"?{form:{fields:ct}}:{}},H()}function st(o,l,n){nt(o,l,{label:n.trim()||l})}function rt(o,l,n){nt(o,l,{enabled:n})}async function Yt(){if(!(!a.edit||z.value)){if(D.value="",N.value==="JSON"){if(m.value){D.value=u("datasource.validation.fixJsonBeforeSchema");return}}else if(Z.value.findIndex(l=>!!l)>=0){D.value=u("datasource.validation.fixBodyBeforeSchema");return}z.value=!0;try{const o=await ma(N.value==="JSON"?E():M());Gt(o)}catch(o){D.value=Wt(o)}finally{z.value=!1}}}function Zt(o,l){if(o==="string")return{ok:!0,value:l};if(o==="number"){const n=l.trim(),f=Number(n);return!n||!Number.isFinite(f)?{ok:!1,error:u("datasource.validation.invalidNumber")}:{ok:!0,value:f}}if(o==="boolean")return{ok:!0,value:l==="true"};if(o==="null")return{ok:!0,value:null};try{const n=JSON.parse(l);return o==="object"?ya(n)?{ok:!0,value:ze(n)}:{ok:!1,error:u("datasource.validation.invalidObject")}:!Array.isArray(n)||!yt(n)?{ok:!1,error:u("datasource.validation.invalidArray")}:{ok:!0,value:ze(n)}}catch{return{ok:!1,error:u(o==="object"?"datasource.validation.invalidObject":"datasource.validation.invalidArray")}}}function we(o){const l=mt(o.dataType,o.mock);return o.dataType==="object"||o.dataType==="array"?g(l):o.dataType==="null"?"null":String(l)}return ie(()=>a.value,o=>{Ft(o)},{deep:!0}),(o,l)=>(r(),c("div",co,[i("div",io,[i("div",uo,h(k(u)("datasource.title")),1),i("div",{class:"ce-datasource-tool__type-switch","aria-label":k(u)("datasource.fields.type")},[i("button",{type:"button",class:te(["ce-datasource-tool__type-button",{"ce-datasource-tool__type-button--active":N.value==="JSON"}]),disabled:A.value,"data-testid":"datasource-type-json",onClick:l[0]||(l[0]=n=>tt("JSON"))}," JSON ",10,mo),i("button",{type:"button",class:te(["ce-datasource-tool__type-button",{"ce-datasource-tool__type-button--active":N.value==="API"}]),disabled:A.value,"data-testid":"datasource-type-api",onClick:l[1]||(l[1]=n=>tt("API"))}," API ",10,yo)],8,po)]),N.value==="JSON"?(r(),c("div",fo,[i("label",vo,[i("span",ho,h(k(u)("datasource.fields.rawData")),1),i("textarea",{class:"ce-datasource-tool__textarea ce-datasource-tool__textarea--json","data-testid":"datasource-raw-data",spellcheck:"false",readonly:A.value,value:d.value,onInput:Vt,onKeydown:l[2]||(l[2]=Y(()=>{},["stop"]))},null,40,_o)]),m.value?(r(),c("p",bo,h(m.value),1)):L("",!0)])):(r(),c("div",go,[i("div",ko,[i("label",wo,[i("span",Co,h(k(u)("datasource.fields.domain")),1),i("input",{class:"ce-datasource-tool__input","data-testid":"datasource-domain",type:"text",readonly:A.value,value:$.domain,onInput:l[3]||(l[3]=n=>at("domain",n.target.value)),onKeydown:l[4]||(l[4]=Y(()=>{},["stop"]))},null,40,To)]),i("label",xo,[i("span",$o,h(k(u)("datasource.fields.path")),1),i("input",{class:"ce-datasource-tool__input","data-testid":"datasource-path",type:"text",readonly:A.value,value:$.path,onInput:l[5]||(l[5]=n=>at("path",n.target.value)),onKeydown:l[6]||(l[6]=Y(()=>{},["stop"]))},null,40,So)]),i("label",Eo,[i("span",No,h(k(u)("datasource.fields.method")),1),i("select",{class:"ce-datasource-tool__input","data-testid":"datasource-method",disabled:A.value,value:$.method,onChange:l[7]||(l[7]=n=>Jt(n.target.value))},[...l[26]||(l[26]=[i("option",{value:"GET"},"GET",-1),i("option",{value:"POST"},"POST",-1)])],40,Do)])]),i("details",Po,[i("summary",Io,[i("span",Ao,h(k(u)("datasource.sections.headers")),1),e.edit?(r(),c("button",{key:0,class:"ce-datasource-tool__action",type:"button","data-testid":"datasource-header-add",onClick:l[8]||(l[8]=Y(n=>ot("headerData"),["stop","prevent"]))},h(k(u)("datasource.actions.add")),1)):L("",!0)]),Ne("headerData").length?L("",!0):(r(),c("p",Mo,h(k(u)("datasource.empty")),1)),(r(!0),c(V,null,W(Ne("headerData"),(n,f)=>(r(),c("div",{key:`header-${f}`,class:"ce-datasource-tool__row"},[i("input",{class:"ce-datasource-tool__input","data-testid":`datasource-header-key-${f}`,type:"text",readonly:A.value,placeholder:k(u)("datasource.fields.key"),value:n.key,onInput:R=>De("headerData",f,"key",R.target.value),onKeydown:l[9]||(l[9]=Y(()=>{},["stop"]))},null,40,Oo),i("input",{class:"ce-datasource-tool__input","data-testid":`datasource-header-mock-${f}`,type:"text",readonly:A.value,placeholder:k(u)("datasource.fields.mock"),value:n.mock,onInput:R=>De("headerData",f,"mock",R.target.value),onKeydown:l[10]||(l[10]=Y(()=>{},["stop"]))},null,40,Bo),e.edit?(r(),c("button",{key:0,class:"ce-datasource-tool__remove",type:"button","data-testid":`datasource-header-remove-${f}`,"aria-label":k(u)("datasource.actions.remove"),onClick:R=>lt("headerData",f)},h(k(u)("datasource.actions.remove")),9,Ro)):L("",!0)]))),128))]),i("details",Lo,[i("summary",zo,[i("span",Fo,h(k(u)("datasource.sections.queries")),1),e.edit?(r(),c("button",{key:0,class:"ce-datasource-tool__action",type:"button","data-testid":"datasource-query-add",onClick:l[11]||(l[11]=Y(n=>ot("queryData"),["stop","prevent"]))},h(k(u)("datasource.actions.add")),1)):L("",!0)]),Ne("queryData").length?L("",!0):(r(),c("p",Vo,h(k(u)("datasource.empty")),1)),(r(!0),c(V,null,W(Ne("queryData"),(n,f)=>(r(),c("div",{key:`query-${f}`,class:"ce-datasource-tool__row"},[i("input",{class:"ce-datasource-tool__input","data-testid":`datasource-query-key-${f}`,type:"text",readonly:A.value,placeholder:k(u)("datasource.fields.key"),value:n.key,onInput:R=>De("queryData",f,"key",R.target.value),onKeydown:l[12]||(l[12]=Y(()=>{},["stop"]))},null,40,jo),i("input",{class:"ce-datasource-tool__input","data-testid":`datasource-query-mock-${f}`,type:"text",readonly:A.value,placeholder:k(u)("datasource.fields.mock"),value:n.mock,onInput:R=>De("queryData",f,"mock",R.target.value),onKeydown:l[13]||(l[13]=Y(()=>{},["stop"]))},null,40,Jo),e.edit?(r(),c("button",{key:0,class:"ce-datasource-tool__remove",type:"button","data-testid":`datasource-query-remove-${f}`,"aria-label":k(u)("datasource.actions.remove"),onClick:R=>lt("queryData",f)},h(k(u)("datasource.actions.remove")),9,Ho)):L("",!0)]))),128))]),i("details",qo,[i("summary",Ko,[i("span",Uo,h(k(u)("datasource.sections.body")),1),e.edit?(r(),c("button",{key:0,class:"ce-datasource-tool__action",type:"button","data-testid":"datasource-body-add",onClick:Y(Ht,["stop","prevent"])},h(k(u)("datasource.actions.add")),1)):L("",!0)]),$.bodyData.length?L("",!0):(r(),c("p",Wo,h(k(u)("datasource.empty")),1)),(r(!0),c(V,null,W($.bodyData,(n,f)=>(r(),c("div",{key:`body-${f}`,class:"ce-datasource-tool__body-row"},[i("input",{class:"ce-datasource-tool__input","data-testid":`datasource-body-key-${f}`,type:"text",readonly:A.value,placeholder:k(u)("datasource.fields.key"),value:n.key,onInput:R=>qt(f,R.target.value),onKeydown:l[14]||(l[14]=Y(()=>{},["stop"]))},null,40,Go),i("select",{class:"ce-datasource-tool__input","data-testid":`datasource-body-type-${f}`,disabled:A.value,value:n.dataType,onChange:R=>Kt(f,R.target.value)},[(r(!0),c(V,null,W(k(x),R=>(r(),c("option",{key:R,value:R},h(R),9,Yo))),128))],40,Xo),n.dataType==="boolean"?(r(),c("select",{key:0,class:"ce-datasource-tool__input","data-testid":`datasource-body-mock-${f}`,disabled:A.value,value:String(n.mock===!0),onChange:R=>Be(f,R.target.value)},[...l[27]||(l[27]=[i("option",{value:"false"},"false",-1),i("option",{value:"true"},"true",-1)])],40,Zo)):n.dataType==="null"?(r(),c("input",{key:1,class:"ce-datasource-tool__input","data-testid":`datasource-body-mock-${f}`,type:"text",readonly:"",value:"null"},null,8,Qo)):n.dataType==="object"||n.dataType==="array"?(r(),c("textarea",{key:2,class:"ce-datasource-tool__textarea ce-datasource-tool__textarea--mock","data-testid":`datasource-body-mock-${f}`,spellcheck:"false",readonly:A.value,value:G.value[f]??we(n),onInput:R=>Be(f,R.target.value),onKeydown:l[15]||(l[15]=Y(()=>{},["stop"]))},null,40,el)):(r(),c("input",{key:3,class:"ce-datasource-tool__input","data-testid":`datasource-body-mock-${f}`,type:n.dataType==="number"?"number":"text",readonly:A.value,placeholder:k(u)("datasource.fields.mock"),value:G.value[f]??we(n),onInput:R=>Be(f,R.target.value),onKeydown:l[16]||(l[16]=Y(()=>{},["stop"]))},null,40,tl)),e.edit?(r(),c("button",{key:4,class:"ce-datasource-tool__remove",type:"button","data-testid":`datasource-body-remove-${f}`,"aria-label":k(u)("datasource.actions.remove"),onClick:R=>Ut(f)},h(k(u)("datasource.actions.remove")),9,al)):L("",!0),Z.value[f]?(r(),c("p",{key:5,class:"ce-datasource-tool__body-error","data-testid":`datasource-body-error-${f}`},h(Z.value[f]),9,ol)):L("",!0)]))),128))])])),i("div",ll,[i("div",null,[i("div",nl,h(k(u)("datasource.sections.generateFields")),1),i("p",sl,h(k(u)("datasource.help.generateFields")),1)]),i("div",rl,[e.edit?(r(),c("button",{key:0,class:"ce-datasource-tool__schema-button",type:"button","data-testid":"datasource-json-schema-parse-button",disabled:z.value,onClick:Yt},h(z.value?k(u)("datasource.actions.generatingFields"):k(u)("datasource.actions.generateFields")),9,cl)):L("",!0),v.value?(r(),c("span",il,h(k(u)("datasource.fields.generatedFields"))+": "+h(oe.value.length),1)):L("",!0)]),D.value?(r(),c("p",dl,h(D.value),1)):L("",!0)]),i("div",ul,[i("div",pl,[i("div",null,[i("div",ml,h(k(u)("datasource.sections.fieldSelection")),1),i("p",yl,h(k(u)("datasource.help.fieldSelection")),1)]),v.value?(r(),c("input",{key:0,class:"ce-datasource-tool__input ce-datasource-tool__schema-search","data-testid":"datasource-schema-search",type:"search",placeholder:k(u)("datasource.fields.searchFields"),value:K.value,onInput:l[17]||(l[17]=n=>K.value=n.target.value),onKeydown:l[18]||(l[18]=Y(()=>{},["stop"]))},null,40,fl)):L("",!0)]),i("div",vl,[i("button",{type:"button",class:te(["ce-datasource-tool__tab",{"ce-datasource-tool__tab--active":j.value==="list"}]),"data-testid":"datasource-schema-tab-list",onClick:l[19]||(l[19]=n=>j.value="list")},h(k(u)("datasource.tabs.list")),3),i("button",{type:"button",class:te(["ce-datasource-tool__tab",{"ce-datasource-tool__tab--active":j.value==="form"}]),"data-testid":"datasource-schema-tab-form",onClick:l[20]||(l[20]=n=>j.value="form")},h(k(u)("datasource.tabs.form")),3),i("button",{type:"button",class:te(["ce-datasource-tool__tab",{"ce-datasource-tool__tab--active":j.value==="advanced"}]),"data-testid":"datasource-schema-tab-advanced",onClick:l[21]||(l[21]=n=>j.value="advanced")},h(k(u)("datasource.tabs.advanced")),3)]),j.value==="list"?(r(),c("div",hl,[v.value?le.value.length?(r(),c("label",bl,[i("span",gl,h(k(u)("datasource.fields.recordPath")),1),i("select",{class:"ce-datasource-tool__input","data-testid":"datasource-list-record-path",disabled:A.value,value:ce.value,onChange:l[22]||(l[22]=n=>Xt(n.target.value))},[(r(!0),c(V,null,W(le.value,n=>(r(),c("option",{key:n.path||"root",value:n.path},h(t(n.path)),9,wl))),128))],40,kl)])):(r(),c("p",Cl,h(k(u)("datasource.noListRecord")),1)):(r(),c("p",_l,h(k(u)("datasource.emptySchema")),1)),ee.value.length?(r(),c("div",Tl,[i("div",xl,h(k(u)("datasource.fields.selectedFields"))+": "+h(ne.value),1),(r(!0),c(V,null,W(ee.value,n=>(r(),c("label",{key:n.path,class:"ce-datasource-tool__schema-field","data-testid":`datasource-list-field-${n.path}`},[i("input",{class:"ce-datasource-tool__checkbox",type:"checkbox",disabled:A.value,checked:n.enabled,"data-testid":`datasource-list-field-enabled-${n.path}`,onChange:f=>rt("list",n.path,f.target.checked)},null,40,Sl),i("span",El,[i("input",{class:"ce-datasource-tool__input ce-datasource-tool__field-label-input",type:"text",readonly:A.value,value:n.label,"data-testid":`datasource-list-field-label-${n.path}`,onInput:f=>st("list",n.path,f.target.value),onKeydown:l[23]||(l[23]=Y(()=>{},["stop"]))},null,40,Nl),i("span",Dl,h(n.path),1)]),i("span",Pl,[i("span",Il,h(S(n.type)),1),i("span",Al,h(T(n.componentHint)),1),n.required?(r(),c("span",Ml,h(k(u)("datasource.fields.required")),1)):L("",!0)])],8,$l))),128))])):L("",!0)])):j.value==="form"?(r(),c("div",Ol,[Q.value.length?(r(),c("div",Bl,[i("div",Rl,h(k(u)("datasource.fields.selectedFields"))+": "+h(ue.value),1),(r(!0),c(V,null,W(Q.value,n=>(r(),c("label",{key:n.path,class:"ce-datasource-tool__schema-field","data-testid":`datasource-form-field-${n.path}`},[i("input",{class:"ce-datasource-tool__checkbox",type:"checkbox",disabled:A.value,checked:n.enabled,"data-testid":`datasource-form-field-enabled-${n.path}`,onChange:f=>rt("form",n.path,f.target.checked)},null,40,zl),i("span",Fl,[i("input",{class:"ce-datasource-tool__input ce-datasource-tool__field-label-input",type:"text",readonly:A.value,value:n.label,"data-testid":`datasource-form-field-label-${n.path}`,onInput:f=>st("form",n.path,f.target.value),onKeydown:l[24]||(l[24]=Y(()=>{},["stop"]))},null,40,Vl),i("span",jl,h(n.path),1)]),i("span",Jl,[i("span",Hl,h(S(n.type)),1),i("span",ql,h(T(n.componentHint)),1),n.required?(r(),c("span",Kl,h(k(u)("datasource.fields.required")),1)):L("",!0)])],8,Ll))),128))])):(r(),c("p",Ul,h(k(u)("datasource.noFormFields")),1))])):(r(),c("div",Wl,[v.value?(r(),c("div",Gl,[(r(!0),c(V,null,W(q.value,n=>(r(),c("div",{key:n.path||"root",class:"ce-datasource-tool__schema-node",style:pe({paddingLeft:`${n.depth*18}px`}),"data-testid":`datasource-schema-node-${p(n.path)}`},[i("span",Yl,h(n.name),1),i("span",Zl,h(n.displayPath),1),i("span",Ql,h(S(n.type)),1),n.required?(r(),c("span",en,h(k(u)("datasource.fields.required")),1)):L("",!0)],12,Xl))),128))])):L("",!0),i("label",tn,[i("span",an,h(k(u)("datasource.fields.jsonSchema")),1),i("textarea",{class:"ce-datasource-tool__textarea ce-datasource-tool__textarea--schema","data-testid":"datasource-json-schema",spellcheck:"false",readonly:A.value,value:w.value,onInput:jt,onKeydown:l[25]||(l[25]=Y(()=>{},["stop"]))},null,40,on)])]))])]))}}),wt=Se(nn,[["__scopeId","data-v-b51983e4"]]);function sn(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID().slice(0,10):Math.random().toString(36).slice(2,12)}function rn(e){return JSON.parse(JSON.stringify(e))}function Pt(e){return typeof e!="object"||e===null||Array.isArray(e)?{}:rn(e)}function _e(e){if(typeof e!="object"||e===null||Array.isArray(e))return;const a=e;if(!(typeof a.type!="string"||typeof a.data!="object"||a.data===null||Array.isArray(a.data)))return{id:typeof a.id=="string"&&a.id?a.id:sn(),type:a.type,data:Pt(a.data)}}function Te(e){return{id:e.id,type:e.type,data:Pt(e.data)}}const It=ke({toolbox:{get title(){return P.t("editorSelector.toolboxTitle")},icon:'<svg width="18" height="18" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><rect x="4" y="5" width="16" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="2"/><path d="M8 9h8M8 13h5" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><path d="M16 15l2 2 3-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'},createInitialProps:()=>({value:void 0}),normalizeProps:e=>({edit:e.edit??!1,value:_e(e.value),excludeToolNames:Array.isArray(e.excludeToolNames)?e.excludeToolNames.filter(a=>typeof a=="string"):[]}),serialize:e=>{const a=_e(e.value);return a?{value:a}:{}}}),cn=["innerHTML"],dn={key:1,class:"overflow-auto"},un={key:3,class:"overflow-auto rounded bg-slate-100 p-2 text-xs dark:bg-slate-800"},Me=ge({__name:"EditorPreviewBlock",props:{block:{},compactTable:{type:Boolean,default:!1}},setup(e){const a=e,u=U(()=>a.compactTable?"min-w-full border-collapse text-xs":"min-w-full border-collapse text-sm"),_=U(()=>a.compactTable?"border border-slate-200 px-2 py-1 text-left align-top dark:border-slate-700":"border border-slate-200 px-3 py-2 text-left align-top dark:border-slate-700");function x(v){const w=v.data.content;return Array.isArray(w)?w.filter(D=>Array.isArray(D)):[]}function N(v,w){const D=v.data.withHeadings;return w===0&&D===!0}function O(v){return An(v)}function d(v){const w=Oe(v);return(w==null?void 0:w.component)??null}function m(v){var D;const w=Oe(v.type);return w?{...w.normalizeProps({...((D=w.createInitialProps)==null?void 0:D.call(w))??{},...v.data,edit:!1})}:{edit:!1,...v.data}}return(v,w)=>e.block.type==="paragraph"?(r(),c("p",{key:0,class:"text-sm leading-6",innerHTML:e.block.data.text},null,8,cn)):e.block.type==="table"?(r(),c("div",dn,[i("table",{class:te(u.value)},[i("tbody",null,[(r(!0),c(V,null,W(x(e.block),(D,z)=>(r(),c("tr",{key:`table-${z}`,class:"border-b border-slate-200 dark:border-slate-700"},[(r(!0),c(V,null,W(D,(B,j)=>(r(),be(Ie(N(e.block,z)?"th":"td"),{key:`table-${z}-${j}`,class:te(_.value),innerHTML:B},null,8,["class","innerHTML"]))),128))]))),128))])],2)])):O(e.block.type)?(r(),be(Ie(d(e.block.type)),ba(Qe({key:2},m(e.block))),null,16)):(r(),c("pre",un,h(e.block),1))}}),pn={key:1,class:"ce-editor-selector-tool__preview","data-testid":"preview-editor-selector-value"},mn=ge({__name:"MEditorSelector",props:{edit:{type:Boolean,default:!1},value:{default:void 0},excludeToolNames:{},onChange:{},onToolChange:{}},setup(e){const a="MEditorSelector",u=new Set(["paragraph","table","columns"]),_=e,{t:x,localeValue:N}=xe(),O=X(null),d=X(null),m=X(_e(_.value)),v=U(()=>m.value!==void 0);let w=null,D=!1,z=null,B=null,j=null,K=$(m.value);function $(t){return{blocks:t?[Te(t)]:[]}}function G(t){return t?JSON.stringify(t):""}function Z(){const t=new Set([a]);return(_.excludeToolNames??[]).forEach(s=>{t.add(s)}),t}function A(t){return!Z().has(t)&&!u.has(t)&&!!Oe(t)}function ae(t){if(A(t.type))return _e(t)}function oe(t){const b=(Array.isArray(t.blocks)?t.blocks:[]).map(E=>ae(E)).filter(E=>E!==void 0);return b[b.length-1]}function le(t,s){const b=Array.isArray(t.blocks)?t.blocks:[];return s?b.length!==1?!0:G(ae(b[0]))!==G(s):b.some(E=>A(E.type))}function I(t){var b,E;const s={edit:_.edit,value:t?Te(t):void 0};(b=_.onToolChange)==null||b.call(_,s),(E=_.onChange)==null||E.call(_,s)}async function J(t){const s=w;if(s){D=!0,K=$(t);try{await s.blocks.render(K)}finally{await ve(),D=!1}}}async function q(t){if(D)return;const s=oe(t),b=G(m.value),E=G(s);m.value=s?Te(s):void 0,K=$(m.value),b!==E&&I(m.value),le(t,m.value)&&await J(m.value)}function ee(){B!==null&&(window.clearTimeout(B),B=null)}function Q(){!w||D||(ee(),B=window.setTimeout(async()=>{if(B=null,!(!w||D))try{const t=await w.save();await q(t)}catch{}},0))}function ce(){const t=d.value;t&&(ne(),z=new MutationObserver(()=>{Q()}),z.observe(t,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),t.addEventListener("input",Q),t.addEventListener("change",Q),t.addEventListener("click",Q))}function ne(){const t=d.value;z==null||z.disconnect(),z=null,ee(),t==null||t.removeEventListener("input",Q),t==null||t.removeEventListener("change",Q),t==null||t.removeEventListener("click",Q)}function ue(t){return t.querySelector(".codex-editor > .ce-toolbar")}function g(t){return t.closest('[data-testid="editor-form-tool"]')??t.closest('[data-testid="editor-panel"]')??document}function C(){const t=O.value;t&&g(t).querySelectorAll(".ce-editor-selector-tool").forEach(s=>{if(s===t)return;const b=ue(s);b==null||b.classList.remove("ce-toolbar--opened")})}function S(){O.value&&C()}function T(){j!==null&&(window.clearTimeout(j),j=null)}function se(){T(),j=window.setTimeout(()=>{j=null,S()},0)}async function re(){if(!_.edit||!d.value||w)return;K=$(m.value);const t=Rt({edit:!0},{exclude:Z()});w=new He({holder:d.value,placeholder:x("editorSelector.placeholder"),tools:t,data:K,minHeight:0,i18n:{messages:Et(N.value)},onChange:async()=>{if(!w)return;const s=await w.save();await q(s)}}),ce()}async function y(){const t=w;if(t){w=null,ne();try{const s=await t.save();m.value=oe(s),K=$(m.value)}catch{K=$(m.value)}t.destroy()}}async function p(){await y(),await ve(),await re()}return Ye(async()=>{await re()}),ie(()=>_.value,async t=>{const s=_e(t);G(s)!==G(m.value)&&(m.value=s,K=$(s),w&&await J(s))},{deep:!0}),ie(()=>_.edit,async t=>{if(t){await ve(),await re();return}await y()}),ie(N,async()=>{w&&await p()}),ie(()=>_.excludeToolNames,async()=>{w&&await p()},{deep:!0}),Ze(async()=>{T(),await y()}),(t,s)=>(r(),c("div",{ref_key:"rootRef",ref:O,class:te(["ce-editor-selector-tool",{"ce-editor-selector-tool--filled":v.value}]),"data-testid":"editor-selector-tool",onMouseenter:se,onMousemove:se},[e.edit?(r(),c("div",{key:0,class:te(["ce-editor-selector-tool__editor-shell",{"ce-editor-selector-tool__editor-shell--filled":v.value}]),"data-testid":"editor-selector-shell"},[i("div",{ref_key:"holderRef",ref:d,class:"ce-editor-selector-tool__editor","data-testid":"editor-selector-surface"},null,512)],2)):(r(),c("div",pn,[m.value?(r(),be(Me,{key:0,block:m.value},null,8,["block"])):L("",!0)]))],34))}}),At=Se(mn,[["__scopeId","data-v-865609b6"]]),yn=Object.freeze(Object.defineProperty({__proto__:null,default:At,mEditorSelectorEditorTool:It},Symbol.toStringTag,{value:"Module"})),fn={key:0,class:"ce-form-item-tool__edit-shell","data-testid":"form-item-edit-shell"},vn={class:"ce-form-item-tool__body"},hn={class:"ce-form-item-tool__label","data-testid":"form-item-label-preview"},_n={class:"ce-form-item-tool__editor","data-testid":"form-item-editor-field"},bn={key:1,class:"ce-form-item-tool__body"},gn={class:"ce-form-item-tool__label","data-testid":"preview-form-item-label"},kn={class:"ce-form-item-tool__editor","data-testid":"preview-form-item-editor"},wn={key:1,class:"ce-form-item-tool__empty"};function Mt(){return`field_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10)}`}function Ot(){return P.t("formItem.defaultLabelName")}function Xe(e){return e==="Horizontal"?"Horizontal":"Vertical"}function Cn(e){return typeof e=="string"&&e.trim()?e:Ot()}function Tn(e,a){return typeof e=="string"&&e.trim()?e.trim():a||Mt()}function xn(e){return e?Te(e):void 0}function $e(e,a){return{edit:e.edit??!1,labelName:Cn(e.labelName),variableName:Tn(e.variableName,a),editor:_e(e.editor),layout:Xe(e.layout)}}function $n(e){const a=$e(e);return{labelName:a.labelName,variableName:a.variableName,...a.editor?{editor:Te(a.editor)}:{},layout:a.layout}}const Sn=ke({toolbox:{get title(){return P.t("formItem.toolboxTitle")},icon:'<svg width="18" height="18" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><rect x="4" y="5" width="16" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="2"/><path d="M8 9h8M8 13h3" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><circle cx="16" cy="13" r="2" fill="none" stroke="currentColor" stroke-width="2"/></svg>'},propertyPanel:{get title(){return P.t("formItem.propertyPanelTitle")},get fields(){return[{key:"labelName",label:P.t("formItem.properties.labelName"),placeholder:P.t("formItem.placeholders.labelName")},{key:"variableName",label:P.t("formItem.properties.variableName"),placeholder:P.t("formItem.placeholders.variableName")},{key:"layout",label:P.t("formItem.properties.layout"),type:"select",options:[{label:P.t("formItem.layouts.vertical"),value:"Vertical"},{label:P.t("formItem.layouts.horizontal"),value:"Horizontal"}]}]}},createInitialProps:()=>({labelName:Ot(),variableName:Mt(),editor:void 0,layout:"Vertical"}),normalizeProps:e=>$e(e),serialize:$n}),En=ge({__name:"MFormItem",props:{edit:{type:Boolean,default:!1},labelName:{},variableName:{},editor:{default:void 0},layout:{default:"Vertical"},onChange:{},onToolChange:{}},setup(e){const a=e,{t:u}=xe(),_=["MFormItem","MForm"],x=St($e(a));function N(){var v,w;const m={edit:a.edit,labelName:x.labelName,variableName:x.variableName,editor:xn(x.editor),layout:Xe(x.layout)};(v=a.onToolChange)==null||v.call(a,m),(w=a.onChange)==null||w.call(a,m)}function O(m){m.labelName!==void 0&&(x.labelName=m.labelName),m.variableName!==void 0&&(x.variableName=m.variableName),"editor"in m&&(x.editor=_e(m.editor)),m.layout!==void 0&&(x.layout=Xe(m.layout)),N()}function d(m){O({editor:m.value})}return ie(()=>({labelName:a.labelName,variableName:a.variableName,editor:a.editor,layout:a.layout,edit:a.edit}),m=>{Object.assign(x,$e(m,x.variableName))},{deep:!0}),(m,v)=>(r(),c("div",{class:te(["ce-form-item-tool",{"ce-form-item-tool--edit":e.edit,"ce-form-item-tool--horizontal":x.layout==="Horizontal"}]),"data-testid":"editor-form-item-tool"},[e.edit?(r(),c("div",fn,[i("div",vn,[i("div",hn,h(x.labelName),1),i("div",_n,[Nt(At,{edit:!0,value:x.editor,"exclude-tool-names":_,"on-change":d},null,8,["value"])])])])):(r(),c("div",bn,[i("div",gn,h(x.labelName),1),i("div",kn,[x.editor?(r(),be(Me,{key:0,block:x.editor},null,8,["block"])):(r(),c("span",wn,h(k(u)("formItem.emptyEditor")),1))])]))],2))}}),Ct=Se(En,[["__scopeId","data-v-e6b491c3"]]);function Nn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Bt(e){const a=$e({...e,edit:!1});return{labelName:a.labelName,variableName:a.variableName,...a.editor?{editor:Te(a.editor)}:{},layout:a.layout}}function Dn(e){if(Nn(e))return Bt(e)}function Tt(e){return Array.isArray(e)?e.map(a=>Dn(a)).filter(a=>a!==void 0):[]}const Pn=ke({toolbox:{get title(){return P.t("form.toolboxTitle")},icon:'<svg width="18" height="18" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><rect x="4" y="4" width="16" height="16" rx="2" fill="none" stroke="currentColor" stroke-width="2"/><path d="M8 8h8M8 12h8M8 16h4" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>'},createInitialProps:()=>({items:[]}),normalizeProps:e=>({edit:e.edit??!1,items:Tt(e.items)}),serialize:e=>({items:Tt(e.items).map(a=>Bt(a))})}),In=ke({toolbox:{get title(){return P.t("page.toolboxTitle")},icon:'<svg width="18" height="18" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><rect x="4" y="3" width="16" height="18" rx="2" ry="2" fill="none" stroke="currentColor" stroke-width="2"/><path d="M8 8h8M8 12h8M8 16h5" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>'},createInitialProps:()=>({edit:!1,value:[]}),normalizeProps:e=>({edit:e.edit??!1,value:Array.isArray(e.value)?e.value:[]}),serialize:e=>({value:e.value})});function ye(e){const a=e.name||e.__name;if(!a)throw new Error("Editor component is missing both name and __name.");return a}const et={MPage:{component:de(Ve(()=>je(()=>import("./MPage-PbJKUfhk.js"),__vite__mapDeps([0,1,2,3])))),...In},MEditorSelector:{component:de(Ve(()=>je(()=>Promise.resolve().then(()=>yn),void 0))),...It},MForm:{component:de(Ve(()=>je(()=>import("./MForm-Ct41vjbV.js"),__vite__mapDeps([4,2,1,3,5])))),...Pn},[ye(bt)]:{component:de(bt),...wa},[ye(_t)]:{component:de(_t),...ka},[ye(gt)]:{component:de(gt),...Fa},[ye(kt)]:{component:de(kt),...lo},[ye(wt)]:{component:de(wt),...ln},[ye(Ct)]:{component:de(Ct),...Sn},[ye(ht)]:{component:de(ht),...ga}};function Oe(e){return et[e]}function An(e){return e in et}function Mn(){return et}const xt=new Map;class On{static create(a){const u=xt.get(a);if(u)return u;const _=Oe(a);if(!_)throw new Error(`EditorToolFactory could not find a registered component for "${a}".`);class x{constructor({data:d,config:m}){Ce(this,"state");Ce(this,"wrapper",null);Ce(this,"contentRoot",null);Ce(this,"vueApp",null);Ce(this,"propertyDialog",null);const v={...m??{},...d??{}};if(typeof v.edit!="boolean")throw new Error(`EditorToolFactory requires config.edit to be explicitly set for "${a}".`);this.state=_.normalizeProps({...v})}static get toolbox(){return _.toolbox}render(){const d=document.createElement("div");d.className="mokelay-editor-tool",d.dataset.toolName=a,d.dataset.testid=`editor-tool-${a}`;const m=document.createElement("div");return m.className="mokelay-editor-tool__content",m.dataset.testid=`editor-tool-content-${a}`,d.appendChild(m),this.wrapper=d,this.contentRoot=m,this.createPropertyDialog(),this.mountVueApp(),d}destroy(){var d;this.unmountVueApp(),(d=this.propertyDialog)==null||d.remove(),this.propertyDialog=null,this.contentRoot=null,this.wrapper=null}save(){return _.serialize(this.state)}renderSettings(){var d;return(d=_.propertyPanel)!=null&&d.fields.length?{icon:'<svg width="17" height="17" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M19.14 12.94C19.18 12.63 19.2 12.32 19.2 12C19.2 11.68 19.18 11.36 19.13 11.06L21.11 9.51C21.29 9.37 21.34 9.11 21.23 8.9L19.35 5.64C19.24 5.43 18.99 5.35 18.77 5.42L16.44 6.17C15.96 5.8 15.44 5.48 14.87 5.23L14.51 2.75C14.48 2.52 14.28 2.35 14.04 2.35H10.28C10.04 2.35 9.84 2.52 9.81 2.75L9.45 5.23C8.88 5.48 8.36 5.81 7.88 6.17L5.55 5.42C5.33 5.35 5.08 5.43 4.97 5.64L3.09 8.9C2.98 9.11 3.03 9.37 3.21 9.51L5.19 11.06C5.14 11.36 5.12 11.68 5.12 12C5.12 12.32 5.14 12.64 5.19 12.94L3.21 14.49C3.03 14.63 2.98 14.89 3.09 15.1L4.97 18.36C5.08 18.57 5.33 18.65 5.55 18.58L7.88 17.83C8.36 18.2 8.88 18.52 9.45 18.77L9.81 21.25C9.84 21.48 10.04 21.65 10.28 21.65H14.04C14.28 21.65 14.48 21.48 14.51 21.25L14.87 18.77C15.44 18.52 15.96 18.19 16.44 17.83L18.77 18.58C18.99 18.65 19.24 18.57 19.35 18.36L21.23 15.1C21.34 14.89 21.29 14.63 21.11 14.49L19.14 12.94ZM12.16 15.6C10.17 15.6 8.56 13.99 8.56 12C8.56 10.01 10.17 8.4 12.16 8.4C14.15 8.4 15.76 10.01 15.76 12C15.76 13.99 14.15 15.6 12.16 15.6Z" fill="currentColor"/></svg>',title:P.t("editor.properties"),onActivate:()=>{this.openPropertyDialog()},closeOnActivate:!0}:[]}mountVueApp(){this.contentRoot&&(this.unmountVueApp(),this.vueApp=qe(_.component,{...this.state,onToolChange:d=>{Object.assign(this.state,d)},onChange:d=>{Object.assign(this.state,d)}}),this.vueApp.mount(this.contentRoot))}unmountVueApp(){var d;(d=this.vueApp)==null||d.unmount(),this.vueApp=null}createPropertyDialog(){var w;if(!this.wrapper||!((w=_.propertyPanel)!=null&&w.fields.length))return;const d=document.createElement("dialog");d.className="mokelay-editor-tool__property-dialog",d.dataset.testid="tool-property-dialog",d.dataset.toolName=a;const m=_.propertyPanel.title||P.t("editor.propertyDialogTitle"),v=_.propertyPanel.fields.map(D=>this.renderPropertyField(D)).join("");d.innerHTML=`
3
+ <form method="dialog" class="mokelay-editor-tool__property-panel" data-testid="tool-property-panel">
4
+ <div class="mokelay-editor-tool__property-header">
5
+ <h3 class="mokelay-editor-tool__property-title" data-testid="tool-property-title">${this.escapeHtml(m)}</h3>
6
+ <button type="submit" class="mokelay-editor-tool__property-close" data-testid="tool-property-close">${this.escapeHtml(P.t("editor.close"))}</button>
7
+ </div>
8
+ <div class="mokelay-editor-tool__property-body" data-testid="tool-property-body">
9
+ ${v}
10
+ </div>
11
+ </form>
12
+ `,this.wrapper.appendChild(d),this.propertyDialog=d,this.bindPropertyInputs()}openPropertyDialog(){this.propertyDialog&&(this.syncPropertyDialogValues(),this.propertyDialog.open||this.propertyDialog.showModal())}syncPropertyDialogValues(){this.propertyDialog&&this.propertyDialog.querySelectorAll("[data-property-key]").forEach(d=>{const m=d.dataset.propertyKey;if(!m)return;const v=this.getPropertyFieldValue(m);if(d instanceof HTMLInputElement&&d.type==="checkbox"){d.checked=v===!0;return}d.value=typeof v=="string"?v:""})}updateProperty(d,m){this.state[d]=m,this.mountVueApp()}getPropertyFieldValue(d){return this.state[d]}escapeHtml(d){return d.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}renderPropertyField(d){if(d.type==="checkbox")return`
13
+ <label class="mokelay-editor-tool__property-field mokelay-editor-tool__property-field--checkbox">
14
+ <input
15
+ class="mokelay-editor-tool__property-checkbox"
16
+ data-testid="tool-property-input-${d.key}"
17
+ data-property-key="${d.key}"
18
+ data-property-type="checkbox"
19
+ type="checkbox"
20
+ ${this.getPropertyFieldValue(d.key)===!0?"checked":""}
21
+ />
22
+ <span class="mokelay-editor-tool__property-label">${this.escapeHtml(d.label)}</span>
23
+ </label>
24
+ `;if(d.type==="select"){const v=this.getPropertyFieldValue(d.key),w=(d.options??[]).map(D=>`
25
+ <option value="${this.escapeHtml(D.value)}" ${v===D.value?"selected":""}>${this.escapeHtml(D.label)}</option>
26
+ `).join("");return`
27
+ <label class="mokelay-editor-tool__property-field">
28
+ <span class="mokelay-editor-tool__property-label">${this.escapeHtml(d.label)}</span>
29
+ <select
30
+ class="mokelay-editor-tool__property-input"
31
+ data-testid="tool-property-input-${d.key}"
32
+ data-property-key="${d.key}"
33
+ data-property-type="select"
34
+ >
35
+ ${w}
36
+ </select>
37
+ </label>
38
+ `}const m=this.getPropertyFieldValue(d.key);return`
39
+ <label class="mokelay-editor-tool__property-field">
40
+ <span class="mokelay-editor-tool__property-label">${this.escapeHtml(d.label)}</span>
41
+ <input
42
+ class="mokelay-editor-tool__property-input"
43
+ data-testid="tool-property-input-${d.key}"
44
+ data-property-key="${d.key}"
45
+ data-property-type="text"
46
+ type="text"
47
+ value="${this.escapeHtml(typeof m=="string"?m:"")}"
48
+ placeholder="${this.escapeHtml(d.placeholder??"")}"
49
+ />
50
+ </label>
51
+ `}bindPropertyInputs(){this.propertyDialog&&this.propertyDialog.querySelectorAll("[data-property-key]").forEach(d=>{const m=d instanceof HTMLInputElement?d.type==="checkbox"?"change":"input":"change";d.addEventListener(m,()=>{const v=d.dataset.propertyKey;v&&this.updateProperty(v,this.readPropertyInputValue(d))})})}readPropertyInputValue(d){return d instanceof HTMLInputElement&&d.type==="checkbox"?d.checked:d.value}}const N=x;return xt.set(a,N),N}}function Rt(e={},a={}){const u=new Set(a.exclude??[]);return Object.fromEntries(Object.entries(Mn()).filter(([_])=>!u.has(_)).map(([_,x])=>{var N;return[_,{class:On.create(_),config:x.normalizeProps({...((N=x.createInitialProps)==null?void 0:N.call(x))??{},...e})}]}))}const Bn={key:1,"data-testid":"preview-blocks",class:"space-y-1"},Rn=["data-testid"],Ln={key:1,"data-testid":"preview-columns",class:"grid gap-3 md:grid-cols-2"},zn=["data-testid"],Fn=["data-testid"],Hn=ge({__name:"MPage",props:{edit:{type:Boolean,default:!1},value:{default:()=>[]},onToolChange:{}},emits:["change"],setup(e,{expose:a,emit:u}){const _=e,x=u,N=U(()=>_.edit);let O=null,d=!1,m=!1,v={blocks:_.value};const{t:w,localeValue:D}=xe(),z=X(null),B=U(()=>Array.isArray(_.value)?_.value:[]);function j(I){const J=I.data.cols;return Array.isArray(J)?J.filter(q=>typeof q=="object"&&q!==null):[]}function K(I){return Array.isArray(I.blocks)?I.blocks:[]}function $(I){return{blocks:I}}function G(I,J){return JSON.stringify(I)===JSON.stringify(J)}function Z(I){var q;const J={edit:_.edit,value:I};(q=_.onToolChange)==null||q.call(_,J),m=!0,x("change",I)}async function A(){if(!z.value||!N.value||O)return;const I={...Rt({edit:!0}),table:{class:ta,inlineToolbar:!0}};O=new He({holder:z.value,placeholder:w("editor.placeholder"),tools:{...I,columns:{class:aa,config:{EditorJsLibrary:He,tools:I}}},data:v,i18n:{messages:Et(D.value)},onChange:async()=>{if(!O)return;const J=await O.save();v=J,!d&&Z(J.blocks)}})}async function ae(){const I=O;if(I){O=null;try{v=await I.save()}catch{v=$(_.value)}I.destroy()}}async function oe(){await ae(),await ve(),await A()}async function le(){if(!O)return v;const I=await O.save();return v=I,I}return a({saveEditor:le}),Ye(async()=>{await A()}),ie(()=>_.value,async I=>{if(m){m=!1;return}const J=Array.isArray(I)?I:[],q=Array.isArray(v.blocks)?v.blocks:[];G(J,q)||(d=!0,v=$(J),O&&await oe(),d=!1)},{deep:!0}),ie(D,async()=>{O&&await oe()}),ie(N,async I=>{if(I){await ve(),await A();return}await ae()}),Ze(async()=>{await ae()}),(I,J)=>N.value?(r(),c("div",{key:0,ref_key:"holderRef",ref:z,"data-testid":"editor-surface",class:"min-h-0 flex-1 rounded-lg border border-slate-300 bg-slate-50 py-3 pr-3 pl-11 dark:border-slate-700 dark:bg-slate-950"},null,512)):(r(),c("div",Bn,[(r(!0),c(V,null,W(B.value,(q,ee)=>(r(),c("div",{key:ee,"data-testid":`preview-block-${q.type}`,class:"p-0"},[q.type!=="columns"?(r(),be(Me,{key:0,block:q},null,8,["block"])):q.type==="columns"?(r(),c("div",Ln,[(r(!0),c(V,null,W(j(q),(Q,ce)=>(r(),c("div",{key:`columns-${ee}-${ce}`,"data-testid":`preview-column-${ce}`,class:"space-y-2 p-2"},[(r(!0),c(V,null,W(K(Q),(ne,ue)=>(r(),c("div",{key:`columns-${ee}-${ce}-${ue}`,"data-testid":`preview-column-block-${ne.type}`,class:"p-2"},[Nt(Me,{block:ne,"compact-table":""},null,8,["block"])],8,Fn))),128))],8,zn))),128))])):L("",!0)],8,Rn))),128))]))}}),qn="mokelay-editor-config";export{qn as M,Hn as _,Ct as a,Bt as b,Te as c,Dn as d,Oe as e,_e as f,Mn as g,$e as h,Pn as i,Sn as m,Tt as n,$n as s};
@@ -0,0 +1,7 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="192" height="192" viewBox="0 0 192 192" fill="none">
2
+ <rect width="192" height="192" rx="42" fill="#020617"/>
3
+ <rect x="36" y="32" width="120" height="128" rx="16" fill="#0F172A" stroke="#334155" stroke-width="6"/>
4
+ <path d="M58 68H134" stroke="#38BDF8" stroke-width="10" stroke-linecap="round"/>
5
+ <path d="M58 96H118" stroke="#818CF8" stroke-width="10" stroke-linecap="round"/>
6
+ <path d="M58 124H104" stroke="#34D399" stroke-width="10" stroke-linecap="round"/>
7
+ </svg>
@@ -0,0 +1,7 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512" fill="none">
2
+ <rect width="512" height="512" rx="112" fill="#020617"/>
3
+ <rect x="96" y="84" width="320" height="344" rx="42" fill="#0F172A" stroke="#334155" stroke-width="16"/>
4
+ <path d="M154 182H358" stroke="#38BDF8" stroke-width="28" stroke-linecap="round"/>
5
+ <path d="M154 258H330" stroke="#818CF8" stroke-width="28" stroke-linecap="round"/>
6
+ <path d="M154 334H292" stroke="#34D399" stroke-width="28" stroke-linecap="round"/>
7
+ </svg>
package/index.html ADDED
@@ -0,0 +1,18 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <meta name="theme-color" content="#020617" />
7
+ <link rel="manifest" href="/manifest.webmanifest" />
8
+ <link rel="icon" href="/icons/icon-192.svg" type="image/svg+xml" />
9
+ <link rel="apple-touch-icon" href="/icons/icon-192.svg" />
10
+ <title>Mokelay Editor</title>
11
+ <script type="module" crossorigin src="/assets/index-C0VPLP4t.js"></script>
12
+ <link rel="modulepreload" crossorigin href="/assets/editorjs-hCuh8vdW.js">
13
+ <link rel="stylesheet" crossorigin href="/assets/index-qSOXU8wC.css">
14
+ </head>
15
+ <body class="bg-slate-950">
16
+ <div id="app"></div>
17
+ </body>
18
+ </html>
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "Mokelay Editor",
3
+ "short_name": "Mokelay",
4
+ "description": "A lightweight editor for quickly composing and previewing content.",
5
+ "start_url": "/",
6
+ "scope": "/",
7
+ "display": "standalone",
8
+ "background_color": "#020617",
9
+ "theme_color": "#020617",
10
+ "icons": [
11
+ {
12
+ "src": "/icons/icon-192.svg",
13
+ "sizes": "192x192",
14
+ "type": "image/svg+xml",
15
+ "purpose": "any maskable"
16
+ },
17
+ {
18
+ "src": "/icons/icon-512.svg",
19
+ "sizes": "512x512",
20
+ "type": "image/svg+xml",
21
+ "purpose": "any maskable"
22
+ }
23
+ ]
24
+ }
package/package.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "mokelay-editor",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "private": false
6
+ }
package/sw.js ADDED
@@ -0,0 +1,97 @@
1
+ const CACHE_PREFIX = 'mokelay-editor';
2
+ const SW_VERSION = new URL(self.location.href).searchParams.get('v') || 'dev';
3
+ const CACHE_VERSION = `${CACHE_PREFIX}-${SW_VERSION}`;
4
+ const APP_SHELL = ['/', '/index.html', '/manifest.webmanifest'];
5
+
6
+ function isValidNavigationShellResponse(response) {
7
+ if (!response || !response.ok) {
8
+ return false;
9
+ }
10
+
11
+ const contentType = response.headers.get('content-type') || '';
12
+ return contentType.includes('text/html');
13
+ }
14
+
15
+ self.addEventListener('install', (event) => {
16
+ event.waitUntil(
17
+ caches.open(CACHE_VERSION).then((cache) => cache.addAll(APP_SHELL))
18
+ );
19
+ self.skipWaiting();
20
+ });
21
+
22
+ self.addEventListener('activate', (event) => {
23
+ event.waitUntil(
24
+ caches
25
+ .keys()
26
+ .then((keys) =>
27
+ Promise.all(
28
+ keys
29
+ .filter((key) => key.startsWith(CACHE_PREFIX) && key !== CACHE_VERSION)
30
+ .map((key) => caches.delete(key))
31
+ )
32
+ )
33
+ .then(() => self.clients.claim())
34
+ );
35
+ });
36
+
37
+ self.addEventListener('message', (event) => {
38
+ if (event.data?.type === 'SKIP_WAITING') {
39
+ self.skipWaiting();
40
+ }
41
+ });
42
+
43
+ self.addEventListener('fetch', (event) => {
44
+ if (event.request.method !== 'GET') {
45
+ return;
46
+ }
47
+
48
+ const requestUrl = new URL(event.request.url);
49
+ if (requestUrl.origin !== self.location.origin) {
50
+ return;
51
+ }
52
+
53
+ if (event.request.mode === 'navigate') {
54
+ event.respondWith(
55
+ fetch(event.request)
56
+ .then((response) => {
57
+ if (isValidNavigationShellResponse(response)) {
58
+ const copy = response.clone();
59
+ caches.open(CACHE_VERSION).then((cache) => cache.put('/index.html', copy));
60
+ }
61
+ return response;
62
+ })
63
+ .catch(async () => {
64
+ const cached = await caches.match('/index.html');
65
+ if (cached) {
66
+ return cached;
67
+ }
68
+ return caches.match('/');
69
+ })
70
+ );
71
+ return;
72
+ }
73
+
74
+ if (
75
+ requestUrl.pathname.startsWith('/@vite/') ||
76
+ requestUrl.pathname.startsWith('/src/') ||
77
+ requestUrl.searchParams.has('t')
78
+ ) {
79
+ return;
80
+ }
81
+
82
+ event.respondWith(
83
+ caches.match(event.request).then((cachedResponse) => {
84
+ const networkFetch = fetch(event.request)
85
+ .then((networkResponse) => {
86
+ if (networkResponse.ok) {
87
+ const copy = networkResponse.clone();
88
+ caches.open(CACHE_VERSION).then((cache) => cache.put(event.request, copy));
89
+ }
90
+ return networkResponse;
91
+ })
92
+ .catch(() => cachedResponse);
93
+
94
+ return cachedResponse || networkFetch;
95
+ })
96
+ );
97
+ });