@micacms/editor-ui 0.4.0 → 0.5.0-rc.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.
- package/dist/assets/ChangesView-CSjnT0fh.js +7 -0
- package/dist/assets/ChangesView-CSjnT0fh.js.map +1 -0
- package/dist/assets/{CollectionView-D3W4tRXa.js → CollectionView-BlLAhVVi.js} +2 -2
- package/dist/assets/{CollectionView-D3W4tRXa.js.map → CollectionView-BlLAhVVi.js.map} +1 -1
- package/dist/assets/{ConfirmDialog.vue_vue_type_script_setup_true_lang-BhOQwoeA.js → ConfirmDialog.vue_vue_type_script_setup_true_lang-C073kW3p.js} +2 -2
- package/dist/assets/{ConfirmDialog.vue_vue_type_script_setup_true_lang-BhOQwoeA.js.map → ConfirmDialog.vue_vue_type_script_setup_true_lang-C073kW3p.js.map} +1 -1
- package/dist/assets/DashboardView-BpelkVGe.js +2 -0
- package/dist/assets/DashboardView-BpelkVGe.js.map +1 -0
- package/dist/assets/EntryView-DZuhqJnd.js +2 -0
- package/dist/assets/EntryView-DZuhqJnd.js.map +1 -0
- package/dist/assets/{LoginView-BCrrdqnf.js → LoginView-BmnX2zOD.js} +2 -2
- package/dist/assets/{LoginView-BCrrdqnf.js.map → LoginView-BmnX2zOD.js.map} +1 -1
- package/dist/assets/{MediaView-KlQHfWAi.js → MediaView-Dp2botAQ.js} +2 -2
- package/dist/assets/{MediaView-KlQHfWAi.js.map → MediaView-Dp2botAQ.js.map} +1 -1
- package/dist/assets/{NotFoundView-C9bEHUGC.js → NotFoundView-ByEOgkxm.js} +2 -2
- package/dist/assets/{NotFoundView-C9bEHUGC.js.map → NotFoundView-ByEOgkxm.js.map} +1 -1
- package/dist/assets/{ObjectField-gxr2a2pp.js → ObjectField-BSITpnGH.js} +2 -2
- package/dist/assets/{ObjectField-gxr2a2pp.js.map → ObjectField-BSITpnGH.js.map} +1 -1
- package/dist/assets/{PageHeader.vue_vue_type_script_setup_true_lang-B-fBJAjn.js → PageHeader.vue_vue_type_script_setup_true_lang-DJWhe1Ye.js} +2 -2
- package/dist/assets/{PageHeader.vue_vue_type_script_setup_true_lang-B-fBJAjn.js.map → PageHeader.vue_vue_type_script_setup_true_lang-DJWhe1Ye.js.map} +1 -1
- package/dist/assets/{RepeaterField-obOWml_P.js → RepeaterField-BnXDf3wL.js} +2 -2
- package/dist/assets/{RepeaterField-obOWml_P.js.map → RepeaterField-BnXDf3wL.js.map} +1 -1
- package/dist/assets/SingletonView-Cb8Qq_gr.js +2 -0
- package/dist/assets/SingletonView-Cb8Qq_gr.js.map +1 -0
- package/dist/assets/{SystemView-CBvzzAoO.css → SystemView-AMhNiUgh.css} +1 -1
- package/dist/assets/SystemView-C6RAZvd2.js +3 -0
- package/dist/assets/SystemView-C6RAZvd2.js.map +1 -0
- package/dist/assets/{arrow-right-DJTAYrz5.js → arrow-right-DD5BWXHV.js} +2 -2
- package/dist/assets/{arrow-right-DJTAYrz5.js.map → arrow-right-DD5BWXHV.js.map} +1 -1
- package/dist/assets/{arrow-up-CibOjHj-.js → arrow-up-Bdxg9_RJ.js} +2 -2
- package/dist/assets/{arrow-up-CibOjHj-.js.map → arrow-up-Bdxg9_RJ.js.map} +1 -1
- package/dist/assets/{chevron-down-Bmt8sf-v.js → chevron-down-CcJtiSTR.js} +2 -2
- package/dist/assets/{chevron-down-Bmt8sf-v.js.map → chevron-down-CcJtiSTR.js.map} +1 -1
- package/dist/assets/{index-Colfqb-9.js → index-BsOOwFCf.js} +9 -9
- package/dist/assets/index-BsOOwFCf.js.map +1 -0
- package/dist/assets/{plus-D_aoCFbi.js → plus-CgaTSYYb.js} +2 -2
- package/dist/assets/{plus-D_aoCFbi.js.map → plus-CgaTSYYb.js.map} +1 -1
- package/dist/assets/{useField-BDSV5ZPo.js → useField-BxptRsz_.js} +2 -2
- package/dist/assets/{useField-BDSV5ZPo.js.map → useField-BxptRsz_.js.map} +1 -1
- package/dist/assets/{useUnsavedChanges-B0WVqgI4.js → useUnsavedChanges-FB5XcFfI.js} +4 -4
- package/dist/assets/{useUnsavedChanges-B0WVqgI4.js.map → useUnsavedChanges-FB5XcFfI.js.map} +1 -1
- package/dist/index.html +1 -1
- package/package.json +2 -2
- package/dist/assets/ChangesView-DoLhwPxu.js +0 -7
- package/dist/assets/ChangesView-DoLhwPxu.js.map +0 -1
- package/dist/assets/DashboardView-JZ2Eaw1_.js +0 -2
- package/dist/assets/DashboardView-JZ2Eaw1_.js.map +0 -1
- package/dist/assets/EntryView-BwERaZkJ.js +0 -2
- package/dist/assets/EntryView-BwERaZkJ.js.map +0 -1
- package/dist/assets/SingletonView-BNJCcl7V.js +0 -2
- package/dist/assets/SingletonView-BNJCcl7V.js.map +0 -1
- package/dist/assets/SystemView-CB8CT0Pa.js +0 -3
- package/dist/assets/SystemView-CB8CT0Pa.js.map +0 -1
- package/dist/assets/index-Colfqb-9.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{D as e}from"./index-
|
|
1
|
+
import{D as e}from"./index-BsOOwFCf.js";/**
|
|
2
2
|
* @license @lucide/vue v1.37.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/const o=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],t=e("plus",o);export{t as P};
|
|
7
|
-
//# sourceMappingURL=plus-
|
|
7
|
+
//# sourceMappingURL=plus-CgaTSYYb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plus-
|
|
1
|
+
{"version":3,"file":"plus-CgaTSYYb.js","sources":["../../../../common/temp/node_modules/.pnpm/@lucide+vue@1.37.0_vue@3.5.42_typescript@5.9.3_/node_modules/@lucide/vue/dist/esm/icons/plus.mjs"],"sourcesContent":["/**\n * @license @lucide/vue v1.37.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M5 12h14\", key: \"1ays0h\" }],\n [\"path\", { d: \"M12 5v14\", key: \"s699le\" }]\n];\nconst Plus = createLucideIcon(\"plus\", __iconNode);\n\nexport { __iconNode, Plus as default };\n//# sourceMappingURL=plus.mjs.map\n"],"names":["__iconNode","Plus","createLucideIcon"],"mappings":"wCAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GASA,MAAMA,EAAa,CACjB,CAAC,OAAQ,CAAE,EAAG,WAAY,IAAK,QAAQ,CAAE,EACzC,CAAC,OAAQ,CAAE,EAAG,WAAY,IAAK,QAAQ,CAAE,CAC3C,EACMC,EAAOC,EAAiB,OAAQF,CAAU","x_google_ignoreList":[0]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as l}from"./index-
|
|
2
|
-
//# sourceMappingURL=useField-
|
|
1
|
+
import{g as l}from"./index-BsOOwFCf.js";let f=0;function g(e){const n=`field-${++f}`,s=`${n}-hint`,o=`${n}-error`,i=l(()=>e.field.label??p(h(e.path))),r=l(()=>{var a;const t=(a=e.issues)==null?void 0:a.find(d=>d.path===e.path);return(t==null?void 0:t.message)??null}),u=l(()=>{const t=[e.field.description?s:null,r.value?o:null].filter(Boolean);return t.length>0?t.join(" "):void 0});return{inputId:n,label:i,error:r,describedBy:u,hintId:s,errorId:o}}function h(e){return e.split(".").at(-1)??e}function p(e){const n=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ");return n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()}const c={full:"col-span-12",half:"col-span-12 sm:col-span-6",third:"col-span-12 sm:col-span-4"};function $(e){return c[e.width??"full"]??c.full}export{p as h,g as u,$ as w};
|
|
2
|
+
//# sourceMappingURL=useField-BxptRsz_.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useField-
|
|
1
|
+
{"version":3,"file":"useField-BxptRsz_.js","sources":["../../src/composables/useField.ts"],"sourcesContent":["/**\n * Shared plumbing for every field component: a stable input id, the label to\n * show, and the server-side issue that belongs to this exact path.\n */\n\nimport { computed, type ComputedRef } from \"vue\";\n\nimport type { AnyField, FieldIssue } from \"@micacms/core\";\n\nlet sequence = 0;\n\nexport interface FieldProps {\n field: AnyField;\n /** Dotted path, e.g. `seo.metaTitle` or `facts.2.label`. */\n path: string;\n /** Flat issue list for the whole form; each field picks out its own. */\n issues?: FieldIssue[];\n disabled?: boolean;\n}\n\nexport interface UseField {\n inputId: string;\n label: ComputedRef<string>;\n error: ComputedRef<string | null>;\n describedBy: ComputedRef<string | undefined>;\n hintId: string;\n errorId: string;\n}\n\nexport function useField(props: FieldProps): UseField {\n const inputId = `field-${++sequence}`;\n const hintId = `${inputId}-hint`;\n const errorId = `${inputId}-error`;\n\n const label = computed(() => props.field.label ?? humanise(lastSegment(props.path)));\n\n const error = computed(() => {\n const match = props.issues?.find((issue) => issue.path === props.path);\n return match?.message ?? null;\n });\n\n const describedBy = computed(() => {\n const parts = [props.field.description ? hintId : null, error.value ? errorId : null].filter(\n Boolean,\n );\n return parts.length > 0 ? parts.join(\" \") : undefined;\n });\n\n return { inputId, label, error, describedBy, hintId, errorId };\n}\n\nfunction lastSegment(path: string): string {\n return path.split(\".\").at(-1) ?? path;\n}\n\n/** `metaTitle` → `Meta title`, used when a field declares no label. */\nexport function humanise(key: string): string {\n const spaced = key.replace(/([a-z0-9])([A-Z])/g, \"$1 $2\").replace(/[_-]+/g, \" \");\n return spaced.charAt(0).toUpperCase() + spaced.slice(1).toLowerCase();\n}\n\nconst WIDTHS: Record<string, string> = {\n full: \"col-span-12\",\n half: \"col-span-12 sm:col-span-6\",\n third: \"col-span-12 sm:col-span-4\",\n};\n\nexport function widthClass(field: AnyField): string {\n return WIDTHS[field.width ?? \"full\"] ?? WIDTHS.full!;\n}\n"],"names":["sequence","useField","props","inputId","hintId","errorId","label","computed","humanise","lastSegment","error","match","_a","issue","describedBy","parts","path","key","spaced","WIDTHS","widthClass","field"],"mappings":"wCASA,IAAIA,EAAW,EAoBR,SAASC,EAASC,EAA6B,CACpD,MAAMC,EAAU,SAAS,EAAEH,CAAQ,GAC7BI,EAAS,GAAGD,CAAO,QACnBE,EAAU,GAAGF,CAAO,SAEpBG,EAAQC,EAAS,IAAML,EAAM,MAAM,OAASM,EAASC,EAAYP,EAAM,IAAI,CAAC,CAAC,EAE7EQ,EAAQH,EAAS,IAAM,OAC3B,MAAMI,GAAQC,EAAAV,EAAM,SAAN,YAAAU,EAAc,KAAMC,GAAUA,EAAM,OAASX,EAAM,MACjE,OAAOS,GAAA,YAAAA,EAAO,UAAW,IAC3B,CAAC,EAEKG,EAAcP,EAAS,IAAM,CACjC,MAAMQ,EAAQ,CAACb,EAAM,MAAM,YAAcE,EAAS,KAAMM,EAAM,MAAQL,EAAU,IAAI,EAAE,OACpF,OAAA,EAEF,OAAOU,EAAM,OAAS,EAAIA,EAAM,KAAK,GAAG,EAAI,MAC9C,CAAC,EAED,MAAO,CAAE,QAAAZ,EAAS,MAAAG,EAAO,MAAAI,EAAO,YAAAI,EAAa,OAAAV,EAAQ,QAAAC,CAAA,CACvD,CAEA,SAASI,EAAYO,EAAsB,CACzC,OAAOA,EAAK,MAAM,GAAG,EAAE,GAAG,EAAE,GAAKA,CACnC,CAGO,SAASR,EAASS,EAAqB,CAC5C,MAAMC,EAASD,EAAI,QAAQ,qBAAsB,OAAO,EAAE,QAAQ,SAAU,GAAG,EAC/E,OAAOC,EAAO,OAAO,CAAC,EAAE,cAAgBA,EAAO,MAAM,CAAC,EAAE,YAAA,CAC1D,CAEA,MAAMC,EAAiC,CACrC,KAAM,cACN,KAAM,4BACN,MAAO,2BACT,EAEO,SAASC,EAAWC,EAAyB,CAClD,OAAOF,EAAOE,EAAM,OAAS,MAAM,GAAKF,EAAO,IACjD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ObjectField-
|
|
2
|
-
import{D as gh,d as Pe,h as q,c as W,a as j,l as N,t as Q,b as ge,g as ee,e as _o,E as yh,C as Ae,x as rt,w as gt,F as Ye,k as ut,G as bh,q as si,H as Ou,I as Yi,T as kh,s as vh,v as xh,j as Rt,X as Nu,z as $n,i as gr,r as je,A as ql,n as Ch,o as To,y as Ah,J as wh,K as Eh,L as Sh,M as Dh,N as _h,O as Th,P as Vl,Q as jl,R as Mh,S as Oh,U as Nh,V as Ih,W as Bh}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ObjectField-BSITpnGH.js","assets/index-BsOOwFCf.js","assets/index-bRiiEobC.css","assets/useField-BxptRsz_.js","assets/chevron-down-CcJtiSTR.js","assets/arrow-right-DD5BWXHV.js","assets/plus-CgaTSYYb.js","assets/RepeaterField-BnXDf3wL.js","assets/arrow-up-Bdxg9_RJ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{D as gh,d as Pe,h as q,c as W,a as j,l as N,t as Q,b as ge,g as ee,e as _o,E as yh,C as Ae,x as rt,w as gt,F as Ye,k as ut,G as bh,q as si,H as Ou,I as Yi,T as kh,s as vh,v as xh,j as Rt,X as Nu,z as $n,i as gr,r as je,A as ql,n as Ch,o as To,y as Ah,J as wh,K as Eh,L as Sh,M as Dh,N as _h,O as Th,P as Vl,Q as jl,R as Mh,S as Oh,U as Nh,V as Ih,W as Bh}from"./index-BsOOwFCf.js";import{u as ft,w as Hl}from"./useField-BxptRsz_.js";import{A as Fh}from"./arrow-right-DD5BWXHV.js";import{P as Rh}from"./plus-CgaTSYYb.js";/**
|
|
3
3
|
* @license @lucide/vue v1.37.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
@@ -141,5 +141,5 @@ ${o}
|
|
|
141
141
|
|
|
142
142
|
`);return!s||!o?!1:r.chain().command(({tr:l})=>(l.delete(n.pos-2,n.pos),!0)).exitCode().run()},ArrowDown:({editor:r})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=r,{selection:t,doc:n}=e,{$from:i,empty:s}=t;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const l=i.after();return l===void 0?!1:n.nodeAt(l)?r.commands.command(({tr:u})=>(u.setSelection(te.near(n.resolve(l))),!0)):r.commands.exitCode()}}},addInputRules(){return[ho({find:Jv,type:this.type,getAttributes:r=>({language:r[1]})}),ho({find:Gv,type:this.type,getAttributes:r=>({language:r[1]})})]},addProseMirrorPlugins(){return[new Le({key:new nt("codeBlockVSCodeHandler"),props:{handlePaste:(r,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),n=e.clipboardData.getData("vscode-editor-data"),i=n?JSON.parse(n):void 0,s=i==null?void 0:i.mode;if(!t||!s)return!1;const{tr:o,schema:l}=r.state,a=l.text(t.replace(/\r\n?/g,`
|
|
143
143
|
`));return o.replaceSelectionWith(this.type.create({language:s},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(Y.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),r.dispatch(o),!0}}})]}}),Yv=bt.create({name:"doc",topNode:!0,content:"block+"});function Qv(r={}){return new Le({view(e){return new Xv(e,r)}})}class Xv{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(n=t.width)!==null&&n!==void 0?n:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc)if(this.lastDragEvent){let n=this.computeTarget(this.lastDragEvent);n==this.cursorPos?this.updateOverlay():this.setCursor(n)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,l=s.height/i.offsetHeight;if(t){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let m=h.getBoundingClientRect(),p=d?m.bottom:m.top;d&&f&&(p=(p+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*l;n={left:m.left,right:m.right,top:p-g,bottom:p+g}}}}if(!n){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;n={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let u,c;if(!a||a==document.body&&getComputedStyle(a).position=="static")u=-pageXOffset,c=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;u=d.left-a.scrollLeft*f,c=d.top-a.scrollTop*h}this.element.style.left=(n.left-u)/o+"px",this.element.style.top=(n.top-c)/l+"px",this.element.style.width=(n.right-n.left)/o+"px",this.element.style.height=(n.bottom-n.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=n&&n.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(!t||s)return null;let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=ac(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}return o}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const ex=We.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Qv(this.options)]}});class ve extends te{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return ve.valid(n)?new ve(n):te.near(n)}content(){return H.empty}eq(e){return e instanceof ve&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ve(e.resolve(t.pos))}getBookmark(){return new vl(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!tx(e)||!rx(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&ve.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let a=e.doc.resolve(i);if(ve.valid(a))return a}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!G.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),n=!1;continue e}break}s=o,i+=t;let l=e.doc.resolve(i);if(ve.valid(l))return l}return null}}}ve.prototype.visible=!1;ve.findFrom=ve.findGapCursorFrom;te.jsonID("gapcursor",ve);class vl{constructor(e){this.pos=e}map(e){return new vl(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ve.valid(t)?new ve(t):te.near(t)}}function of(r){return r.isAtom||r.spec.isolating||r.spec.createGapCursor}function tx(r){for(let e=r.depth;e>=0;e--){let t=r.index(e),n=r.node(e);if(t==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||of(i.type))return!0;if(i.inlineContent)return!1}}return!0}function rx(r){for(let e=r.depth;e>=0;e--){let t=r.indexAfter(e),n=r.node(e);if(t==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||of(i.type))return!0;if(i.inlineContent)return!1}}return!0}function nx(){return new Le({props:{decorations:lx,createSelectionBetween(r,e,t){return e.pos==t.pos&&ve.valid(t)?new ve(t):null},handleClick:sx,handleKeyDown:ix,handleDOMEvents:{beforeinput:ox}}})}const ix=Xc({ArrowLeft:Yn("horiz",-1),ArrowRight:Yn("horiz",1),ArrowUp:Yn("vert",-1),ArrowDown:Yn("vert",1)});function Yn(r,e){const t=r=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,i,s){let o=n.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof Y){if(!s.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=n.doc.resolve(e>0?l.after():l.before())}let u=ve.findGapCursorFrom(l,e,a);return u?(i&&i(n.tr.setSelection(new ve(u))),!0):!1}}function sx(r,e,t){if(!r||!r.editable)return!1;let n=r.state.doc.resolve(e);if(!ve.valid(n))return!1;let i=r.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&G.isSelectable(r.state.doc.nodeAt(i.inside))?!1:(r.dispatch(r.state.tr.setSelection(new ve(n))),!0)}function ox(r,e){if(e.inputType!="insertCompositionText"||!(r.state.selection instanceof ve))return!1;let{$from:t}=r.state.selection,n=t.parent.contentMatchAt(t.index()).findWrapping(r.state.schema.nodes.text);if(!n)return!1;let i=R.empty;for(let o=n.length-1;o>=0;o--)i=R.from(n[o].createAndFill(null,i));let s=r.state.tr.replace(t.pos,t.pos,new H(i,0,0));return s.setSelection(Y.near(s.doc.resolve(t.pos+1))),r.dispatch(s),!1}function lx(r){if(!(r.selection instanceof ve))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Ee.create(r.doc,[at.widget(r.selection.head,e,{key:"gapcursor"})])}const ax=We.create({name:"gapCursor",addProseMirrorPlugins(){return[nx()]},extendNodeSchema(r){var e;const t={name:r.name,options:r.options,storage:r.storage};return{allowGapCursor:(e=ie(J(r,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),ux=bt.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:r}){return["br",$e(this.options.HTMLAttributes,r)]},renderText(){return`
|
|
144
|
-
`},addCommands(){return{setHardBreak:()=>({commands:r,chain:e,state:t,editor:n})=>r.first([()=>r.exitCode(),()=>r.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=n.extensionManager,a=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&a&&o){const d=a.filter(f=>l.includes(f.type.name));u.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),cx=bt.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(r=>({tag:`h${r}`,attrs:{level:r}}))},renderHTML({node:r,HTMLAttributes:e}){return[`h${this.options.levels.includes(r.attrs.level)?r.attrs.level:this.options.levels[0]}`,$e(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:r=>({commands:e})=>this.options.levels.includes(r.level)?e.setNode(this.name,r):!1,toggleHeading:r=>({commands:e})=>this.options.levels.includes(r.level)?e.toggleNode(this.name,"paragraph",r):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((r,e)=>({...r,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(r=>ho({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${r}})\\s$`),type:this.type,getAttributes:{level:r}}))}});var Zi=200,_e=function(){};_e.prototype.append=function(e){return e.length?(e=_e.from(e),!this.length&&e||e.length<Zi&&this.leafAppend(e)||this.length<Zi&&e.leafPrepend(this)||this.appendInner(e)):this};_e.prototype.prepend=function(e){return e.length?_e.from(e).append(this):this};_e.prototype.appendInner=function(e){return new dx(this,e)};_e.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?_e.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};_e.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};_e.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};_e.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,n),i};_e.from=function(e){return e instanceof _e?e:e&&e.length?new lf(e):_e.empty};var lf=(function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Zi)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Zi)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(_e);_e.empty=new lf([]);var dx=(function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(n,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(n,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(n,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(n,Math.min(i,l),s,o)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(n,i):n>=s?this.right.slice(n-s,i-s):this.left.slice(n,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(_e);const fx=500;class pt{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,s;t&&(i=this.remapping(n,this.items.length),s=i.maps.length);let o=e.tr,l,a,u=[],c=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(n,f+1),s=i.maps.length),s--,c.push(d);return}if(i){c.push(new At(d.map));let h=d.step.map(i.slice(s)),m;h&&o.maybeStep(h).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],u.push(new At(m,void 0,void 0,u.length+c.length))),s--,m&&i.appendMap(m,s)}else o.maybeStep(d.step);if(d.selection)return l=i?d.selection.map(i.slice(s)):d.selection,a=new pt(this.items.slice(0,n).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,n,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),f=new At(e.mapping.maps[c],d,t),h;(h=a&&a.merge(f))&&(f=h,c?s.pop():l=l.slice(0,l.length-1)),s.push(f),t&&(o++,t=void 0),i||(a=f)}let u=o-n.depth;return u>px&&(l=hx(l,u),o-=u),new pt(l.append(s),o)}remapping(e,t){let n=new mn;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,o)},e,t),n}addMaps(e){return this.eventCount==0?this:new pt(this.items.append(e.map(t=>new At(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=t;this.items.forEach(f=>{let h=s.getMirror(--a);if(h==null)return;o=Math.min(o,h);let m=s.maps[h];if(f.step){let p=e.steps[h].invert(e.docs[h]),g=f.selection&&f.selection.map(s.slice(a+1,h));g&&l++,n.push(new At(m,p,g))}else n.push(new At(m))},i);let u=[];for(let f=t;f<o;f++)u.push(new At(s.maps[f]));let c=this.items.slice(0,i).append(u).append(n),d=new pt(c,l);return d.emptyItemCount()>fx&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(n)),u=a&&a.getMap();if(n--,u&&t.appendMap(u,n),a){let c=o.selection&&o.selection.map(t.slice(n));c&&s++;let d=new At(u.invert(),a,c),f,h=i.length-1;(f=i.length&&i[h].merge(d))?i[h]=f:i.push(d)}}else o.map&&n--},this.items.length,0),new pt(_e.from(i.reverse()),s)}}pt.empty=new pt(_e.empty,0);function hx(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class At{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new At(t.getMap().invert(),t,this.selection)}}}class Kt{constructor(e,t,n,i,s){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=s}}const px=20;function mx(r,e,t,n){let i=t.getMeta(Cr),s;if(i)return i.historyState;t.getMeta(bx)&&(r=new Kt(r.done,r.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(o&&o.getMeta(Cr))return o.getMeta(Cr).redo?new Kt(r.done.addTransform(t,void 0,n,ii(e)),r.undone,Su(t.mapping.maps),r.prevTime,r.prevComposition):new Kt(r.done,r.undone.addTransform(t,void 0,n,ii(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=r.prevTime==0||!o&&r.prevComposition!=l&&(r.prevTime<(t.time||0)-n.newGroupDelay||!gx(t,r.prevRanges)),u=o?Vs(r.prevRanges,t.mapping):Su(t.mapping.maps);return new Kt(r.done.addTransform(t,a?e.selection.getBookmark():void 0,n,ii(e)),pt.empty,u,t.time,l??r.prevComposition)}else return(s=t.getMeta("rebased"))?new Kt(r.done.rebased(t,s),r.undone.rebased(t,s),Vs(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new Kt(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),Vs(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function gx(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let s=0;s<e.length;s+=2)n<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function Su(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,s,o)=>e.push(s,o));return e}function Vs(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),s=e.map(r[n+1],-1);i<=s&&t.push(i,s)}return t}function yx(r,e,t){let n=ii(e),i=Cr.get(e).spec.config,s=(t?r.undone:r.done).popEvent(e,n);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(t?r.done:r.undone).addTransform(s.transform,e.selection.getBookmark(),i,n),a=new Kt(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(Cr,{redo:t,historyState:a})}let js=!1,Du=null;function ii(r){let e=r.plugins;if(Du!=e){js=!1,Du=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){js=!0;break}}return js}const Cr=new nt("history"),bx=new nt("closeHistory");function kx(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new Le({key:Cr,state:{init(){return new Kt(pt.empty,pt.empty,null,0,-1)},apply(e,t,n){return mx(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?uf:n=="historyRedo"?cf:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function af(r,e){return(t,n)=>{let i=Cr.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let s=yx(i,t,r);s&&n(e?s.scrollIntoView():s)}return!0}}const uf=af(!1,!0),cf=af(!0,!0),vx=We.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>uf(r,e),redo:()=>({state:r,dispatch:e})=>cf(r,e)}},addProseMirrorPlugins(){return[kx(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),xx=bt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:r}){return["hr",$e(this.options.HTMLAttributes,r)]},addCommands(){return{setHorizontalRule:()=>({chain:r,state:e})=>{if(!my(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$from:n,$to:i}=t,s=r();return n.parentOffset===0?s.insertContentAt({from:Math.max(n.pos-1,0),to:i.pos},{type:this.name}):R1(t)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:o,dispatch:l})=>{var a;if(l){const{$to:u}=o.selection,c=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(Y.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(G.create(o.doc,u.pos)):o.setSelection(Y.create(o.doc,u.pos));else{const d=(a=u.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();d&&(o.insert(c,d),o.setSelection(Y.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[py({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Cx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Ax=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,wx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Ex=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Sx=qt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:r=>r.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:r=>r.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:r}){return["em",$e(this.options.HTMLAttributes,r),0]},addCommands(){return{setItalic:()=>({commands:r})=>r.setMark(this.name),toggleItalic:()=>({commands:r})=>r.toggleMark(this.name),unsetItalic:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[jr({find:Cx,type:this.type}),jr({find:wx,type:this.type})]},addPasteRules(){return[Sr({find:Ax,type:this.type}),Sr({find:Ex,type:this.type})]}}),Dx=bt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:r}){return["li",$e(this.options.HTMLAttributes,r),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),_x="listItem",_u="textStyle",Tu=/^(\d+)\.\s$/,Tx=bt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:r=>r.hasAttribute("start")?parseInt(r.getAttribute("start")||"",10):1},type:{default:null,parseHTML:r=>r.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:r}){const{start:e,...t}=r;return e===1?["ol",$e(this.options.HTMLAttributes,t),0]:["ol",$e(this.options.HTMLAttributes,r),0]},addCommands(){return{toggleOrderedList:()=>({commands:r,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(_x,this.editor.getAttributes(_u)).run():r.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let r=Cn({find:Tu,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(r=Cn({find:Tu,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(_u)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[r]}}),Mx=bt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:r}){return["p",$e(this.options.HTMLAttributes,r),0]},addCommands(){return{setParagraph:()=>({commands:r})=>r.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Ox=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Nx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Ix=qt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:r=>r.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:r}){return["s",$e(this.options.HTMLAttributes,r),0]},addCommands(){return{setStrike:()=>({commands:r})=>r.setMark(this.name),toggleStrike:()=>({commands:r})=>r.toggleMark(this.name),unsetStrike:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[jr({find:Ox,type:this.type})]},addPasteRules(){return[Sr({find:Nx,type:this.type})]}}),Bx=bt.create({name:"text",group:"inline"}),Fx=We.create({name:"starterKit",addExtensions(){const r=[];return this.options.bold!==!1&&r.push(Vv.configure(this.options.bold)),this.options.blockquote!==!1&&r.push($v.configure(this.options.blockquote)),this.options.bulletList!==!1&&r.push(Hv.configure(this.options.bulletList)),this.options.code!==!1&&r.push(Kv.configure(this.options.code)),this.options.codeBlock!==!1&&r.push(Zv.configure(this.options.codeBlock)),this.options.document!==!1&&r.push(Yv.configure(this.options.document)),this.options.dropcursor!==!1&&r.push(ex.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&r.push(ax.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&r.push(ux.configure(this.options.hardBreak)),this.options.heading!==!1&&r.push(cx.configure(this.options.heading)),this.options.history!==!1&&r.push(vx.configure(this.options.history)),this.options.horizontalRule!==!1&&r.push(xx.configure(this.options.horizontalRule)),this.options.italic!==!1&&r.push(Sx.configure(this.options.italic)),this.options.listItem!==!1&&r.push(Dx.configure(this.options.listItem)),this.options.orderedList!==!1&&r.push(Tx.configure(this.options.orderedList)),this.options.paragraph!==!1&&r.push(Mx.configure(this.options.paragraph)),this.options.strike!==!1&&r.push(Ix.configure(this.options.strike)),this.options.text!==!1&&r.push(Bx.configure(this.options.text)),r}});function Rx(r){const e=t=>r.includes(t);return[Fx.configure({heading:e("heading")?{levels:[2,3]}:!1,bulletList:e("bulletList")?{}:!1,orderedList:e("orderedList")?{}:!1,blockquote:e("blockquote")?{}:!1,horizontalRule:e("horizontalRule")?{}:!1,strike:e("strike")?{}:!1}),...e("link")?[Fv.configure({openOnClick:!1,autolink:!0,protocols:["http","https","mailto","tel"],HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}})]:[]]}const $x=["aria-label"],Px=["title","aria-label","aria-pressed","disabled","onClick"],Lx=Pe({__name:"RichTextField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(r,{emit:e}){const t=r,n=e,i=ee(()=>t.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=ft(t),d=["bold","italic","heading","bulletList","orderedList","link"],f=ee(()=>i.value.toolbar??d),h=y=>f.value.includes(y),m=by({content:yu(typeof t.modelValue=="string"?t.modelValue:""),editable:!(t.disabled||i.value.readonly),injectCSS:!1,extensions:Rx(f.value),editorProps:{attributes:{id:s,role:"textbox","aria-multiline":"true","aria-label":o.value}},onUpdate({editor:y}){const x=y.isEmpty?null:mu(y.getJSON()),k=typeof t.modelValue=="string"?t.modelValue:null;gu(x,k)||n("update:modelValue",x)}});si(()=>t.modelValue,y=>{const x=m.value;if(!x||x.isFocused)return;const k=typeof y=="string"?y:"",A=x.isEmpty?"":mu(x.getJSON());gu(k,A)||x.commands.setContent(yu(k),!1)}),si(()=>t.disabled,y=>{var x;return(x=m.value)==null?void 0:x.setEditable(!(y||i.value.readonly))}),Yi(()=>{var y;return(y=m.value)==null?void 0:y.destroy()});function p(){const y=m.value;if(!y)return;const x=y.getAttributes("link").href,k=window.prompt("Link address",x??"https://");if(k!==null){if(k===""){y.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!/^(https?:|mailto:|tel:|\/)/i.test(k)){window.alert("Links must start with http://, https://, mailto:, tel: or /");return}y.chain().focus().extendMarkRange("link").setLink({href:k}).run()}}const g=ee(()=>{const y=m.value;return y?[{feature:"bold",label:"Bold",glyph:"B",isActive:()=>y.isActive("bold"),run:()=>y.chain().focus().toggleBold().run()},{feature:"italic",label:"Italic",glyph:"I",isActive:()=>y.isActive("italic"),run:()=>y.chain().focus().toggleItalic().run()},{feature:"strike",label:"Strikethrough",glyph:"S",isActive:()=>y.isActive("strike"),run:()=>y.chain().focus().toggleStrike().run()},{feature:"heading",label:"Heading",glyph:"H2",isActive:()=>y.isActive("heading",{level:2}),run:()=>y.chain().focus().toggleHeading({level:2}).run()},{feature:"heading",label:"Subheading",glyph:"H3",isActive:()=>y.isActive("heading",{level:3}),run:()=>y.chain().focus().toggleHeading({level:3}).run()},{feature:"bulletList",label:"Bulleted list",glyph:"•",isActive:()=>y.isActive("bulletList"),run:()=>y.chain().focus().toggleBulletList().run()},{feature:"orderedList",label:"Numbered list",glyph:"1.",isActive:()=>y.isActive("orderedList"),run:()=>y.chain().focus().toggleOrderedList().run()},{feature:"blockquote",label:"Quote",glyph:"❝",isActive:()=>y.isActive("blockquote"),run:()=>y.chain().focus().toggleBlockquote().run()},{feature:"link",label:"Link",glyph:"🔗",isActive:()=>y.isActive("link"),run:p},{feature:"horizontalRule",label:"Divider",glyph:"—",isActive:()=>!1,run:()=>y.chain().focus().setHorizontalRule().run()}].filter(k=>h(k.feature)):[]});return(y,x)=>(q(),rt(yt,{"input-id":N(s),label:N(o),description:i.value.description,required:i.value.required,error:N(l),"hint-id":N(u),"error-id":N(c)},{default:gt(()=>[j("div",{class:Ae(["rich-text overflow-hidden rounded-sm border bg-surface focus-within:ring-2 focus-within:ring-ink/10",N(l)?"border-danger":"border-line focus-within:border-ink"])},[j("div",{class:"flex flex-wrap items-center gap-0.5 border-b border-line bg-canvas/60 px-1.5 py-1",role:"toolbar","aria-label":`${N(o)} formatting`},[(q(!0),W(Ye,null,ut(g.value,k=>(q(),W("button",{key:k.label,type:"button",title:k.label,"aria-label":k.label,"aria-pressed":k.isActive(),disabled:r.disabled||i.value.readonly,class:Ae(["h-7 min-w-7 rounded px-1.5 text-xs font-semibold transition",k.isActive()?"bg-ink text-surface":"text-muted hover:bg-raised hover:text-ink"]),onClick:A=>k.run()},Q(k.glyph),11,Px))),128))],8,$x),Rt(N(yy),{editor:N(m),"aria-describedby":N(a)},null,8,["editor","aria-describedby"])],2)]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),zx=["aria-describedby"],qx={class:"sr-only"},Vx=["checked","disabled","onChange"],jx=["id","value","required","disabled","aria-invalid","aria-describedby"],Hx={value:""},Ux=["value"],Wx=Pe({__name:"SelectField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(r,{emit:e}){const t=r,n=e,i=ee(()=>t.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=ft(t),d=ee(()=>Array.isArray(t.modelValue)?t.modelValue:typeof t.modelValue=="string"?[t.modelValue]:[]);function f(h){const m=d.value.includes(h)?d.value.filter(p=>p!==h):[...d.value,h];n("update:modelValue",m)}return(h,m)=>(q(),rt(yt,{"input-id":N(s),label:N(o),description:i.value.description,required:i.value.required,error:N(l),"hint-id":N(u),"error-id":N(c)},{default:gt(()=>[i.value.multiple?(q(),W("fieldset",{key:0,class:"space-y-1.5","aria-describedby":N(a)},[j("legend",qx,Q(N(o)),1),(q(!0),W(Ye,null,ut(i.value.options,p=>(q(),W("label",{key:p.value,class:"flex cursor-pointer items-center gap-2.5 rounded-sm border border-line bg-raised px-3 py-2 text-sm hover:bg-canvas"},[j("input",{type:"checkbox",checked:d.value.includes(p.value),disabled:r.disabled||i.value.readonly,class:"h-4 w-4 rounded-sm border-line text-accent focus:ring-ink/20",onChange:g=>f(p.value)},null,40,Vx),_o(" "+Q(p.label),1)]))),128))],8,zx)):(q(),W("select",{key:1,id:N(s),value:d.value[0]??"",required:i.value.required,disabled:r.disabled||i.value.readonly,"aria-invalid":N(l)?"true":void 0,"aria-describedby":N(a),class:Ae(["input",N(l)&&"input-invalid"]),onChange:m[0]||(m[0]=p=>n("update:modelValue",p.target.value||null))},[j("option",Hx,Q(i.value.required?"Choose…":"Not set"),1),(q(!0),W(Ye,null,ut(i.value.options,p=>(q(),W("option",{key:p.value,value:p.value},Q(p.label),9,Ux))),128))],42,jx))]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),Kx={class:"flex items-stretch"},Jx=["id","value","maxlength","disabled","aria-invalid","aria-describedby"],Gx=["disabled"],Zx={key:0,class:"field-hint"},Yx=Pe({__name:"SlugField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{},source:{},collection:{},exceptSlug:{}},emits:["update:modelValue"],setup(r,{emit:e}){const t=r,n=e,i=ee(()=>t.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=ft(t),d=ee(()=>typeof t.modelValue=="string"?t.modelValue:""),f=je(d.value!=="");let h;si(()=>t.source,g=>{if(!(f.value||!i.value.from||!t.collection)){if(!(g!=null&&g.trim())){n("update:modelValue",null);return}clearTimeout(h),h=setTimeout(async()=>{try{const{slug:y}=await gr.entries.suggestSlug(t.collection,g,t.exceptSlug);f.value||n("update:modelValue",y||null)}catch{}},300)}});function m(g){f.value=!0;const y=g.target.value;n("update:modelValue",y===""?null:y)}function p(){var g;f.value=!1,n("update:modelValue",null),(g=t.source)!=null&&g.trim()&&t.collection&&gr.entries.suggestSlug(t.collection,t.source,t.exceptSlug).then(({slug:y})=>n("update:modelValue",y||null))}return(g,y)=>(q(),rt(yt,{"input-id":N(s),label:N(o),description:i.value.description,required:i.value.required,error:N(l),"hint-id":N(u),"error-id":N(c)},{default:gt(()=>[j("div",Kx,[y[0]||(y[0]=j("span",{class:"inline-flex select-none items-center rounded-l-sm border border-r-0 border-line bg-canvas px-3 font-mono text-sm text-muted","aria-hidden":"true"}," / ",-1)),j("input",{id:N(s),type:"text",value:d.value,maxlength:i.value.maxLength??96,disabled:r.disabled||i.value.readonly,"aria-invalid":N(l)?"true":void 0,"aria-describedby":N(a),class:Ae(["input rounded-l-none font-mono text-[13px]",N(l)&&"input-invalid"]),spellcheck:"false",autocomplete:"off",onInput:m},null,42,Jx),f.value&&i.value.from?(q(),W("button",{key:0,type:"button",class:"btn-ghost ml-2 shrink-0 whitespace-nowrap",disabled:r.disabled,onClick:p}," Reset ",8,Gx)):ge("",!0)]),!f.value&&i.value.from?(q(),W("p",Zx," Generated from the "+Q(i.value.from)+". Edit it to set your own. ",1)):ge("",!0)]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),Qx=["id","type","value","placeholder","maxlength","required","disabled","aria-invalid","aria-describedby"],Xx={key:0,class:"mt-1 text-right text-xs text-muted"},Hs=Pe({__name:"TextField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(r,{emit:e}){const t=r,n=e,i=ee(()=>t.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=ft(t),d=ee(()=>i.value.kind==="email"?"email":i.value.kind==="url"?"url":"text"),f=ee(()=>typeof t.modelValue=="string"?t.modelValue:""),h=ee(()=>"maxLength"in i.value?i.value.maxLength??null:null),m=ee(()=>h.value!==null&&f.value.length>h.value*.7);function p(g){const y=g.target.value;n("update:modelValue",y===""?null:y)}return(g,y)=>(q(),rt(yt,{"input-id":N(s),label:N(o),description:i.value.description,required:i.value.required,error:N(l),"hint-id":N(u),"error-id":N(c)},{default:gt(()=>[j("input",{id:N(s),type:d.value,value:f.value,placeholder:"placeholder"in i.value?i.value.placeholder:void 0,maxlength:h.value??void 0,required:i.value.required,disabled:r.disabled||i.value.readonly,"aria-invalid":N(l)?"true":void 0,"aria-describedby":N(a),class:Ae(["input",N(l)&&"input-invalid"]),autocomplete:"off",onInput:p},null,42,Qx),m.value?(q(),W("p",Xx,Q(f.value.length)+" / "+Q(h.value),1)):ge("",!0)]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),eC=["id","value","rows","placeholder","maxlength","required","disabled","aria-invalid","aria-describedby"],tC={key:0,class:"mt-1 text-right text-xs text-muted"},rC=Pe({__name:"TextareaField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(r,{emit:e}){const t=r,n=e,i=ee(()=>t.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=ft(t),d=ee(()=>typeof t.modelValue=="string"?t.modelValue:""),f=ee(()=>i.value.maxLength!==void 0&&d.value.length>i.value.maxLength*.7);function h(m){const p=m.target.value;n("update:modelValue",p===""?null:p)}return(m,p)=>(q(),rt(yt,{"input-id":N(s),label:N(o),description:i.value.description,required:i.value.required,error:N(l),"hint-id":N(u),"error-id":N(c)},{default:gt(()=>[j("textarea",{id:N(s),value:d.value,rows:i.value.rows??4,placeholder:i.value.placeholder,maxlength:i.value.maxLength,required:i.value.required,disabled:r.disabled||i.value.readonly,"aria-invalid":N(l)?"true":void 0,"aria-describedby":N(a),class:Ae(["input resize-y",N(l)&&"input-invalid"]),onInput:h},null,42,eC),f.value?(q(),W("p",tC,Q(d.value.length)+" / "+Q(i.value.maxLength),1)):ge("",!0)]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),nC={text:Hs,textarea:rC,richText:Lx,number:im,boolean:Wh,date:yp,email:Hs,url:Hs,slug:Yx,select:Wx,object:Vl(()=>jl(()=>import("./ObjectField-gxr2a2pp.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),repeater:Vl(()=>jl(()=>import("./RepeaterField-obOWml_P.js"),__vite__mapDeps([7,1,2,3,4,8,6,5]))),relation:pm,media:em,color:ip,coordinates:hp},Mu=Pe({__name:"FieldRenderer",props:{field:{},path:{},modelValue:{},issues:{},disabled:{type:Boolean},collection:{},entrySlug:{},source:{}},emits:["update:modelValue"],setup(r,{emit:e}){const t=r,n=e,i=ee(()=>nC[t.field.kind]),s=ee(()=>t.field.kind==="slug"?{source:t.source,collection:t.collection,exceptSlug:t.entrySlug}:{});return(o,l)=>r.field.hidden?ge("",!0):(q(),rt(Oh(i.value),Mh({key:0,field:r.field,path:r.path,issues:r.issues,disabled:r.disabled,"model-value":r.modelValue},s.value,{"onUpdate:modelValue":l[0]||(l[0]=a=>n("update:modelValue",a))}),null,16,["field","path","issues","disabled","model-value"]))}}),iC={class:"space-y-6"},sC={key:0,class:"card p-4 sm:p-5"},oC={class:"px-1 font-mono text-[11px] font-medium uppercase tracking-[.08em] text-muted"},lC={class:"mt-3 grid grid-cols-12 gap-x-4 gap-y-5"},aC={key:1,class:"grid grid-cols-12 gap-x-4 gap-y-5"},mC=Pe({__name:"FieldList",props:{fields:{},modelValue:{},path:{},issues:{},disabled:{type:Boolean},collection:{},entrySlug:{}},emits:["update:modelValue"],setup(r,{emit:e}){const t=r,n=e,i=ee(()=>{const a=[];for(const[u,c]of Object.entries(t.fields)){if(c.hidden)continue;const d=c.group??null,f=a.at(-1);f&&f.name===d?f.entries.push({key:u,field:c}):a.push({name:d,entries:[{key:u,field:c}]})}return a}),s=a=>t.path?`${t.path}.${a}`:a;function o(a,u){n("update:modelValue",{...t.modelValue,[a]:u})}function l(a){if(a.kind!=="slug"||!a.from)return null;const u=t.modelValue[a.from];return typeof u=="string"?u:null}return(a,u)=>(q(),W("div",iC,[(q(!0),W(Ye,null,ut(i.value,(c,d)=>(q(),W(Ye,{key:`${c.name??"ungrouped"}-${d}`},[c.name?(q(),W("fieldset",sC,[j("legend",oC,Q(c.name),1),j("div",lC,[(q(!0),W(Ye,null,ut(c.entries,f=>(q(),W("div",{key:f.key,class:Ae(N(Hl)(f.field))},[Rt(Mu,{field:f.field,path:s(f.key),"model-value":r.modelValue[f.key],issues:r.issues,disabled:r.disabled,collection:r.collection,"entry-slug":r.entrySlug,source:l(f.field),"onUpdate:modelValue":h=>o(f.key,h)},null,8,["field","path","model-value","issues","disabled","collection","entry-slug","source","onUpdate:modelValue"])],2))),128))])])):(q(),W("div",aC,[(q(!0),W(Ye,null,ut(c.entries,f=>(q(),W("div",{key:f.key,class:Ae(N(Hl)(f.field))},[Rt(Mu,{field:f.field,path:s(f.key),"model-value":r.modelValue[f.key],issues:r.issues,disabled:r.disabled,collection:r.collection,"entry-slug":r.entrySlug,source:l(f.field),"onUpdate:modelValue":h=>o(f.key,h)},null,8,["field","path","model-value","issues","disabled","collection","entry-slug","source","onUpdate:modelValue"])],2))),128))]))],64))),128))]))}}),uC="You have unsaved changes. Leave without saving?";function gC(r){const e=je(Us(r.value)),t=je(!0),n=ee(()=>t.value&&Us(r.value)!==e.value);function i(){e.value=Us(r.value)}function s(){t.value=!1}function o(a){n.value&&a.preventDefault()}To(()=>window.addEventListener("beforeunload",o)),Nh(()=>window.removeEventListener("beforeunload",o));const l=()=>!n.value||window.confirm(uC);return Ih(l),Bh(l),{dirty:n,markClean:i,release:s}}function Us(r){return JSON.stringify(r,(e,t)=>{if(t===null||typeof t!="object"||Array.isArray(t))return t;const n=t,i={};for(const s of Object.keys(n).sort())i[s]=n[s];return i})}export{mC as _,Lh as d,gC as u,Ul as w};
|
|
145
|
-
//# sourceMappingURL=useUnsavedChanges-
|
|
144
|
+
`},addCommands(){return{setHardBreak:()=>({commands:r,chain:e,state:t,editor:n})=>r.first([()=>r.exitCode(),()=>r.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=n.extensionManager,a=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&a&&o){const d=a.filter(f=>l.includes(f.type.name));u.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),cx=bt.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(r=>({tag:`h${r}`,attrs:{level:r}}))},renderHTML({node:r,HTMLAttributes:e}){return[`h${this.options.levels.includes(r.attrs.level)?r.attrs.level:this.options.levels[0]}`,$e(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:r=>({commands:e})=>this.options.levels.includes(r.level)?e.setNode(this.name,r):!1,toggleHeading:r=>({commands:e})=>this.options.levels.includes(r.level)?e.toggleNode(this.name,"paragraph",r):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((r,e)=>({...r,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(r=>ho({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${r}})\\s$`),type:this.type,getAttributes:{level:r}}))}});var Zi=200,_e=function(){};_e.prototype.append=function(e){return e.length?(e=_e.from(e),!this.length&&e||e.length<Zi&&this.leafAppend(e)||this.length<Zi&&e.leafPrepend(this)||this.appendInner(e)):this};_e.prototype.prepend=function(e){return e.length?_e.from(e).append(this):this};_e.prototype.appendInner=function(e){return new dx(this,e)};_e.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?_e.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};_e.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};_e.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};_e.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,n),i};_e.from=function(e){return e instanceof _e?e:e&&e.length?new lf(e):_e.empty};var lf=(function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Zi)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Zi)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(_e);_e.empty=new lf([]);var dx=(function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(n,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(n,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(n,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(n,Math.min(i,l),s,o)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(n,i):n>=s?this.right.slice(n-s,i-s):this.left.slice(n,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(_e);const fx=500;class pt{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,s;t&&(i=this.remapping(n,this.items.length),s=i.maps.length);let o=e.tr,l,a,u=[],c=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(n,f+1),s=i.maps.length),s--,c.push(d);return}if(i){c.push(new At(d.map));let h=d.step.map(i.slice(s)),m;h&&o.maybeStep(h).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],u.push(new At(m,void 0,void 0,u.length+c.length))),s--,m&&i.appendMap(m,s)}else o.maybeStep(d.step);if(d.selection)return l=i?d.selection.map(i.slice(s)):d.selection,a=new pt(this.items.slice(0,n).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,n,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),f=new At(e.mapping.maps[c],d,t),h;(h=a&&a.merge(f))&&(f=h,c?s.pop():l=l.slice(0,l.length-1)),s.push(f),t&&(o++,t=void 0),i||(a=f)}let u=o-n.depth;return u>px&&(l=hx(l,u),o-=u),new pt(l.append(s),o)}remapping(e,t){let n=new mn;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,o)},e,t),n}addMaps(e){return this.eventCount==0?this:new pt(this.items.append(e.map(t=>new At(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=t;this.items.forEach(f=>{let h=s.getMirror(--a);if(h==null)return;o=Math.min(o,h);let m=s.maps[h];if(f.step){let p=e.steps[h].invert(e.docs[h]),g=f.selection&&f.selection.map(s.slice(a+1,h));g&&l++,n.push(new At(m,p,g))}else n.push(new At(m))},i);let u=[];for(let f=t;f<o;f++)u.push(new At(s.maps[f]));let c=this.items.slice(0,i).append(u).append(n),d=new pt(c,l);return d.emptyItemCount()>fx&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(n)),u=a&&a.getMap();if(n--,u&&t.appendMap(u,n),a){let c=o.selection&&o.selection.map(t.slice(n));c&&s++;let d=new At(u.invert(),a,c),f,h=i.length-1;(f=i.length&&i[h].merge(d))?i[h]=f:i.push(d)}}else o.map&&n--},this.items.length,0),new pt(_e.from(i.reverse()),s)}}pt.empty=new pt(_e.empty,0);function hx(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class At{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new At(t.getMap().invert(),t,this.selection)}}}class Kt{constructor(e,t,n,i,s){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=s}}const px=20;function mx(r,e,t,n){let i=t.getMeta(Cr),s;if(i)return i.historyState;t.getMeta(bx)&&(r=new Kt(r.done,r.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(o&&o.getMeta(Cr))return o.getMeta(Cr).redo?new Kt(r.done.addTransform(t,void 0,n,ii(e)),r.undone,Su(t.mapping.maps),r.prevTime,r.prevComposition):new Kt(r.done,r.undone.addTransform(t,void 0,n,ii(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=r.prevTime==0||!o&&r.prevComposition!=l&&(r.prevTime<(t.time||0)-n.newGroupDelay||!gx(t,r.prevRanges)),u=o?Vs(r.prevRanges,t.mapping):Su(t.mapping.maps);return new Kt(r.done.addTransform(t,a?e.selection.getBookmark():void 0,n,ii(e)),pt.empty,u,t.time,l??r.prevComposition)}else return(s=t.getMeta("rebased"))?new Kt(r.done.rebased(t,s),r.undone.rebased(t,s),Vs(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new Kt(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),Vs(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function gx(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let s=0;s<e.length;s+=2)n<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function Su(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,s,o)=>e.push(s,o));return e}function Vs(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),s=e.map(r[n+1],-1);i<=s&&t.push(i,s)}return t}function yx(r,e,t){let n=ii(e),i=Cr.get(e).spec.config,s=(t?r.undone:r.done).popEvent(e,n);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(t?r.done:r.undone).addTransform(s.transform,e.selection.getBookmark(),i,n),a=new Kt(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(Cr,{redo:t,historyState:a})}let js=!1,Du=null;function ii(r){let e=r.plugins;if(Du!=e){js=!1,Du=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){js=!0;break}}return js}const Cr=new nt("history"),bx=new nt("closeHistory");function kx(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new Le({key:Cr,state:{init(){return new Kt(pt.empty,pt.empty,null,0,-1)},apply(e,t,n){return mx(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?uf:n=="historyRedo"?cf:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function af(r,e){return(t,n)=>{let i=Cr.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let s=yx(i,t,r);s&&n(e?s.scrollIntoView():s)}return!0}}const uf=af(!1,!0),cf=af(!0,!0),vx=We.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>uf(r,e),redo:()=>({state:r,dispatch:e})=>cf(r,e)}},addProseMirrorPlugins(){return[kx(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),xx=bt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:r}){return["hr",$e(this.options.HTMLAttributes,r)]},addCommands(){return{setHorizontalRule:()=>({chain:r,state:e})=>{if(!my(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$from:n,$to:i}=t,s=r();return n.parentOffset===0?s.insertContentAt({from:Math.max(n.pos-1,0),to:i.pos},{type:this.name}):R1(t)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:o,dispatch:l})=>{var a;if(l){const{$to:u}=o.selection,c=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(Y.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(G.create(o.doc,u.pos)):o.setSelection(Y.create(o.doc,u.pos));else{const d=(a=u.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();d&&(o.insert(c,d),o.setSelection(Y.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[py({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Cx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Ax=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,wx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Ex=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Sx=qt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:r=>r.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:r=>r.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:r}){return["em",$e(this.options.HTMLAttributes,r),0]},addCommands(){return{setItalic:()=>({commands:r})=>r.setMark(this.name),toggleItalic:()=>({commands:r})=>r.toggleMark(this.name),unsetItalic:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[jr({find:Cx,type:this.type}),jr({find:wx,type:this.type})]},addPasteRules(){return[Sr({find:Ax,type:this.type}),Sr({find:Ex,type:this.type})]}}),Dx=bt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:r}){return["li",$e(this.options.HTMLAttributes,r),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),_x="listItem",_u="textStyle",Tu=/^(\d+)\.\s$/,Tx=bt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:r=>r.hasAttribute("start")?parseInt(r.getAttribute("start")||"",10):1},type:{default:null,parseHTML:r=>r.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:r}){const{start:e,...t}=r;return e===1?["ol",$e(this.options.HTMLAttributes,t),0]:["ol",$e(this.options.HTMLAttributes,r),0]},addCommands(){return{toggleOrderedList:()=>({commands:r,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(_x,this.editor.getAttributes(_u)).run():r.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let r=Cn({find:Tu,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(r=Cn({find:Tu,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(_u)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[r]}}),Mx=bt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:r}){return["p",$e(this.options.HTMLAttributes,r),0]},addCommands(){return{setParagraph:()=>({commands:r})=>r.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Ox=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Nx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Ix=qt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:r=>r.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:r}){return["s",$e(this.options.HTMLAttributes,r),0]},addCommands(){return{setStrike:()=>({commands:r})=>r.setMark(this.name),toggleStrike:()=>({commands:r})=>r.toggleMark(this.name),unsetStrike:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[jr({find:Ox,type:this.type})]},addPasteRules(){return[Sr({find:Nx,type:this.type})]}}),Bx=bt.create({name:"text",group:"inline"}),Fx=We.create({name:"starterKit",addExtensions(){const r=[];return this.options.bold!==!1&&r.push(Vv.configure(this.options.bold)),this.options.blockquote!==!1&&r.push($v.configure(this.options.blockquote)),this.options.bulletList!==!1&&r.push(Hv.configure(this.options.bulletList)),this.options.code!==!1&&r.push(Kv.configure(this.options.code)),this.options.codeBlock!==!1&&r.push(Zv.configure(this.options.codeBlock)),this.options.document!==!1&&r.push(Yv.configure(this.options.document)),this.options.dropcursor!==!1&&r.push(ex.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&r.push(ax.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&r.push(ux.configure(this.options.hardBreak)),this.options.heading!==!1&&r.push(cx.configure(this.options.heading)),this.options.history!==!1&&r.push(vx.configure(this.options.history)),this.options.horizontalRule!==!1&&r.push(xx.configure(this.options.horizontalRule)),this.options.italic!==!1&&r.push(Sx.configure(this.options.italic)),this.options.listItem!==!1&&r.push(Dx.configure(this.options.listItem)),this.options.orderedList!==!1&&r.push(Tx.configure(this.options.orderedList)),this.options.paragraph!==!1&&r.push(Mx.configure(this.options.paragraph)),this.options.strike!==!1&&r.push(Ix.configure(this.options.strike)),this.options.text!==!1&&r.push(Bx.configure(this.options.text)),r}});function Rx(r){const e=t=>r.includes(t);return[Fx.configure({heading:e("heading")?{levels:[2,3]}:!1,bulletList:e("bulletList")?{}:!1,orderedList:e("orderedList")?{}:!1,blockquote:e("blockquote")?{}:!1,horizontalRule:e("horizontalRule")?{}:!1,strike:e("strike")?{}:!1}),...e("link")?[Fv.configure({openOnClick:!1,autolink:!0,protocols:["http","https","mailto","tel"],HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}})]:[]]}const $x=["aria-label"],Px=["title","aria-label","aria-pressed","disabled","onClick"],Lx=Pe({__name:"RichTextField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(r,{emit:e}){const t=r,n=e,i=ee(()=>t.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=ft(t),d=["bold","italic","heading","bulletList","orderedList","link"],f=ee(()=>i.value.toolbar??d),h=y=>f.value.includes(y),m=by({content:yu(typeof t.modelValue=="string"?t.modelValue:""),editable:!(t.disabled||i.value.readonly),injectCSS:!1,extensions:Rx(f.value),editorProps:{attributes:{id:s,role:"textbox","aria-multiline":"true","aria-label":o.value}},onUpdate({editor:y}){const x=y.isEmpty?null:mu(y.getJSON()),k=typeof t.modelValue=="string"?t.modelValue:null;gu(x,k)||n("update:modelValue",x)}});si(()=>t.modelValue,y=>{const x=m.value;if(!x||x.isFocused)return;const k=typeof y=="string"?y:"",A=x.isEmpty?"":mu(x.getJSON());gu(k,A)||x.commands.setContent(yu(k),!1)}),si(()=>t.disabled,y=>{var x;return(x=m.value)==null?void 0:x.setEditable(!(y||i.value.readonly))}),Yi(()=>{var y;return(y=m.value)==null?void 0:y.destroy()});function p(){const y=m.value;if(!y)return;const x=y.getAttributes("link").href,k=window.prompt("Link address",x??"https://");if(k!==null){if(k===""){y.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!/^(https?:|mailto:|tel:|\/)/i.test(k)){window.alert("Links must start with http://, https://, mailto:, tel: or /");return}y.chain().focus().extendMarkRange("link").setLink({href:k}).run()}}const g=ee(()=>{const y=m.value;return y?[{feature:"bold",label:"Bold",glyph:"B",isActive:()=>y.isActive("bold"),run:()=>y.chain().focus().toggleBold().run()},{feature:"italic",label:"Italic",glyph:"I",isActive:()=>y.isActive("italic"),run:()=>y.chain().focus().toggleItalic().run()},{feature:"strike",label:"Strikethrough",glyph:"S",isActive:()=>y.isActive("strike"),run:()=>y.chain().focus().toggleStrike().run()},{feature:"heading",label:"Heading",glyph:"H2",isActive:()=>y.isActive("heading",{level:2}),run:()=>y.chain().focus().toggleHeading({level:2}).run()},{feature:"heading",label:"Subheading",glyph:"H3",isActive:()=>y.isActive("heading",{level:3}),run:()=>y.chain().focus().toggleHeading({level:3}).run()},{feature:"bulletList",label:"Bulleted list",glyph:"•",isActive:()=>y.isActive("bulletList"),run:()=>y.chain().focus().toggleBulletList().run()},{feature:"orderedList",label:"Numbered list",glyph:"1.",isActive:()=>y.isActive("orderedList"),run:()=>y.chain().focus().toggleOrderedList().run()},{feature:"blockquote",label:"Quote",glyph:"❝",isActive:()=>y.isActive("blockquote"),run:()=>y.chain().focus().toggleBlockquote().run()},{feature:"link",label:"Link",glyph:"🔗",isActive:()=>y.isActive("link"),run:p},{feature:"horizontalRule",label:"Divider",glyph:"—",isActive:()=>!1,run:()=>y.chain().focus().setHorizontalRule().run()}].filter(k=>h(k.feature)):[]});return(y,x)=>(q(),rt(yt,{"input-id":N(s),label:N(o),description:i.value.description,required:i.value.required,error:N(l),"hint-id":N(u),"error-id":N(c)},{default:gt(()=>[j("div",{class:Ae(["rich-text overflow-hidden rounded-sm border bg-surface focus-within:ring-2 focus-within:ring-ink/10",N(l)?"border-danger":"border-line focus-within:border-ink"])},[j("div",{class:"flex flex-wrap items-center gap-0.5 border-b border-line bg-canvas/60 px-1.5 py-1",role:"toolbar","aria-label":`${N(o)} formatting`},[(q(!0),W(Ye,null,ut(g.value,k=>(q(),W("button",{key:k.label,type:"button",title:k.label,"aria-label":k.label,"aria-pressed":k.isActive(),disabled:r.disabled||i.value.readonly,class:Ae(["h-7 min-w-7 rounded px-1.5 text-xs font-semibold transition",k.isActive()?"bg-ink text-surface":"text-muted hover:bg-raised hover:text-ink"]),onClick:A=>k.run()},Q(k.glyph),11,Px))),128))],8,$x),Rt(N(yy),{editor:N(m),"aria-describedby":N(a)},null,8,["editor","aria-describedby"])],2)]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),zx=["aria-describedby"],qx={class:"sr-only"},Vx=["checked","disabled","onChange"],jx=["id","value","required","disabled","aria-invalid","aria-describedby"],Hx={value:""},Ux=["value"],Wx=Pe({__name:"SelectField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(r,{emit:e}){const t=r,n=e,i=ee(()=>t.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=ft(t),d=ee(()=>Array.isArray(t.modelValue)?t.modelValue:typeof t.modelValue=="string"?[t.modelValue]:[]);function f(h){const m=d.value.includes(h)?d.value.filter(p=>p!==h):[...d.value,h];n("update:modelValue",m)}return(h,m)=>(q(),rt(yt,{"input-id":N(s),label:N(o),description:i.value.description,required:i.value.required,error:N(l),"hint-id":N(u),"error-id":N(c)},{default:gt(()=>[i.value.multiple?(q(),W("fieldset",{key:0,class:"space-y-1.5","aria-describedby":N(a)},[j("legend",qx,Q(N(o)),1),(q(!0),W(Ye,null,ut(i.value.options,p=>(q(),W("label",{key:p.value,class:"flex cursor-pointer items-center gap-2.5 rounded-sm border border-line bg-raised px-3 py-2 text-sm hover:bg-canvas"},[j("input",{type:"checkbox",checked:d.value.includes(p.value),disabled:r.disabled||i.value.readonly,class:"h-4 w-4 rounded-sm border-line text-accent focus:ring-ink/20",onChange:g=>f(p.value)},null,40,Vx),_o(" "+Q(p.label),1)]))),128))],8,zx)):(q(),W("select",{key:1,id:N(s),value:d.value[0]??"",required:i.value.required,disabled:r.disabled||i.value.readonly,"aria-invalid":N(l)?"true":void 0,"aria-describedby":N(a),class:Ae(["input",N(l)&&"input-invalid"]),onChange:m[0]||(m[0]=p=>n("update:modelValue",p.target.value||null))},[j("option",Hx,Q(i.value.required?"Choose…":"Not set"),1),(q(!0),W(Ye,null,ut(i.value.options,p=>(q(),W("option",{key:p.value,value:p.value},Q(p.label),9,Ux))),128))],42,jx))]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),Kx={class:"flex items-stretch"},Jx=["id","value","maxlength","disabled","aria-invalid","aria-describedby"],Gx=["disabled"],Zx={key:0,class:"field-hint"},Yx=Pe({__name:"SlugField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{},source:{},collection:{},exceptSlug:{}},emits:["update:modelValue"],setup(r,{emit:e}){const t=r,n=e,i=ee(()=>t.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=ft(t),d=ee(()=>typeof t.modelValue=="string"?t.modelValue:""),f=je(d.value!=="");let h;si(()=>t.source,g=>{if(!(f.value||!i.value.from||!t.collection)){if(!(g!=null&&g.trim())){n("update:modelValue",null);return}clearTimeout(h),h=setTimeout(async()=>{try{const{slug:y}=await gr.entries.suggestSlug(t.collection,g,t.exceptSlug);f.value||n("update:modelValue",y||null)}catch{}},300)}});function m(g){f.value=!0;const y=g.target.value;n("update:modelValue",y===""?null:y)}function p(){var g;f.value=!1,n("update:modelValue",null),(g=t.source)!=null&&g.trim()&&t.collection&&gr.entries.suggestSlug(t.collection,t.source,t.exceptSlug).then(({slug:y})=>n("update:modelValue",y||null))}return(g,y)=>(q(),rt(yt,{"input-id":N(s),label:N(o),description:i.value.description,required:i.value.required,error:N(l),"hint-id":N(u),"error-id":N(c)},{default:gt(()=>[j("div",Kx,[y[0]||(y[0]=j("span",{class:"inline-flex select-none items-center rounded-l-sm border border-r-0 border-line bg-canvas px-3 font-mono text-sm text-muted","aria-hidden":"true"}," / ",-1)),j("input",{id:N(s),type:"text",value:d.value,maxlength:i.value.maxLength??96,disabled:r.disabled||i.value.readonly,"aria-invalid":N(l)?"true":void 0,"aria-describedby":N(a),class:Ae(["input rounded-l-none font-mono text-[13px]",N(l)&&"input-invalid"]),spellcheck:"false",autocomplete:"off",onInput:m},null,42,Jx),f.value&&i.value.from?(q(),W("button",{key:0,type:"button",class:"btn-ghost ml-2 shrink-0 whitespace-nowrap",disabled:r.disabled,onClick:p}," Reset ",8,Gx)):ge("",!0)]),!f.value&&i.value.from?(q(),W("p",Zx," Generated from the "+Q(i.value.from)+". Edit it to set your own. ",1)):ge("",!0)]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),Qx=["id","type","value","placeholder","maxlength","required","disabled","aria-invalid","aria-describedby"],Xx={key:0,class:"mt-1 text-right text-xs text-muted"},Hs=Pe({__name:"TextField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(r,{emit:e}){const t=r,n=e,i=ee(()=>t.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=ft(t),d=ee(()=>i.value.kind==="email"?"email":i.value.kind==="url"?"url":"text"),f=ee(()=>typeof t.modelValue=="string"?t.modelValue:""),h=ee(()=>"maxLength"in i.value?i.value.maxLength??null:null),m=ee(()=>h.value!==null&&f.value.length>h.value*.7);function p(g){const y=g.target.value;n("update:modelValue",y===""?null:y)}return(g,y)=>(q(),rt(yt,{"input-id":N(s),label:N(o),description:i.value.description,required:i.value.required,error:N(l),"hint-id":N(u),"error-id":N(c)},{default:gt(()=>[j("input",{id:N(s),type:d.value,value:f.value,placeholder:"placeholder"in i.value?i.value.placeholder:void 0,maxlength:h.value??void 0,required:i.value.required,disabled:r.disabled||i.value.readonly,"aria-invalid":N(l)?"true":void 0,"aria-describedby":N(a),class:Ae(["input",N(l)&&"input-invalid"]),autocomplete:"off",onInput:p},null,42,Qx),m.value?(q(),W("p",Xx,Q(f.value.length)+" / "+Q(h.value),1)):ge("",!0)]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),eC=["id","value","rows","placeholder","maxlength","required","disabled","aria-invalid","aria-describedby"],tC={key:0,class:"mt-1 text-right text-xs text-muted"},rC=Pe({__name:"TextareaField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(r,{emit:e}){const t=r,n=e,i=ee(()=>t.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=ft(t),d=ee(()=>typeof t.modelValue=="string"?t.modelValue:""),f=ee(()=>i.value.maxLength!==void 0&&d.value.length>i.value.maxLength*.7);function h(m){const p=m.target.value;n("update:modelValue",p===""?null:p)}return(m,p)=>(q(),rt(yt,{"input-id":N(s),label:N(o),description:i.value.description,required:i.value.required,error:N(l),"hint-id":N(u),"error-id":N(c)},{default:gt(()=>[j("textarea",{id:N(s),value:d.value,rows:i.value.rows??4,placeholder:i.value.placeholder,maxlength:i.value.maxLength,required:i.value.required,disabled:r.disabled||i.value.readonly,"aria-invalid":N(l)?"true":void 0,"aria-describedby":N(a),class:Ae(["input resize-y",N(l)&&"input-invalid"]),onInput:h},null,42,eC),f.value?(q(),W("p",tC,Q(d.value.length)+" / "+Q(i.value.maxLength),1)):ge("",!0)]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),nC={text:Hs,textarea:rC,richText:Lx,number:im,boolean:Wh,date:yp,email:Hs,url:Hs,slug:Yx,select:Wx,object:Vl(()=>jl(()=>import("./ObjectField-BSITpnGH.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),repeater:Vl(()=>jl(()=>import("./RepeaterField-BnXDf3wL.js"),__vite__mapDeps([7,1,2,3,4,8,6,5]))),relation:pm,media:em,color:ip,coordinates:hp},Mu=Pe({__name:"FieldRenderer",props:{field:{},path:{},modelValue:{},issues:{},disabled:{type:Boolean},collection:{},entrySlug:{},source:{}},emits:["update:modelValue"],setup(r,{emit:e}){const t=r,n=e,i=ee(()=>nC[t.field.kind]),s=ee(()=>t.field.kind==="slug"?{source:t.source,collection:t.collection,exceptSlug:t.entrySlug}:{});return(o,l)=>r.field.hidden?ge("",!0):(q(),rt(Oh(i.value),Mh({key:0,field:r.field,path:r.path,issues:r.issues,disabled:r.disabled,"model-value":r.modelValue},s.value,{"onUpdate:modelValue":l[0]||(l[0]=a=>n("update:modelValue",a))}),null,16,["field","path","issues","disabled","model-value"]))}}),iC={class:"space-y-6"},sC={key:0,class:"card p-4 sm:p-5"},oC={class:"px-1 font-mono text-[11px] font-medium uppercase tracking-[.08em] text-muted"},lC={class:"mt-3 grid grid-cols-12 gap-x-4 gap-y-5"},aC={key:1,class:"grid grid-cols-12 gap-x-4 gap-y-5"},mC=Pe({__name:"FieldList",props:{fields:{},modelValue:{},path:{},issues:{},disabled:{type:Boolean},collection:{},entrySlug:{}},emits:["update:modelValue"],setup(r,{emit:e}){const t=r,n=e,i=ee(()=>{const a=[];for(const[u,c]of Object.entries(t.fields)){if(c.hidden)continue;const d=c.group??null,f=a.at(-1);f&&f.name===d?f.entries.push({key:u,field:c}):a.push({name:d,entries:[{key:u,field:c}]})}return a}),s=a=>t.path?`${t.path}.${a}`:a;function o(a,u){n("update:modelValue",{...t.modelValue,[a]:u})}function l(a){if(a.kind!=="slug"||!a.from)return null;const u=t.modelValue[a.from];return typeof u=="string"?u:null}return(a,u)=>(q(),W("div",iC,[(q(!0),W(Ye,null,ut(i.value,(c,d)=>(q(),W(Ye,{key:`${c.name??"ungrouped"}-${d}`},[c.name?(q(),W("fieldset",sC,[j("legend",oC,Q(c.name),1),j("div",lC,[(q(!0),W(Ye,null,ut(c.entries,f=>(q(),W("div",{key:f.key,class:Ae(N(Hl)(f.field))},[Rt(Mu,{field:f.field,path:s(f.key),"model-value":r.modelValue[f.key],issues:r.issues,disabled:r.disabled,collection:r.collection,"entry-slug":r.entrySlug,source:l(f.field),"onUpdate:modelValue":h=>o(f.key,h)},null,8,["field","path","model-value","issues","disabled","collection","entry-slug","source","onUpdate:modelValue"])],2))),128))])])):(q(),W("div",aC,[(q(!0),W(Ye,null,ut(c.entries,f=>(q(),W("div",{key:f.key,class:Ae(N(Hl)(f.field))},[Rt(Mu,{field:f.field,path:s(f.key),"model-value":r.modelValue[f.key],issues:r.issues,disabled:r.disabled,collection:r.collection,"entry-slug":r.entrySlug,source:l(f.field),"onUpdate:modelValue":h=>o(f.key,h)},null,8,["field","path","model-value","issues","disabled","collection","entry-slug","source","onUpdate:modelValue"])],2))),128))]))],64))),128))]))}}),uC="You have unsaved changes. Leave without saving?";function gC(r){const e=je(Us(r.value)),t=je(!0),n=ee(()=>t.value&&Us(r.value)!==e.value);function i(){e.value=Us(r.value)}function s(){t.value=!1}function o(a){n.value&&a.preventDefault()}To(()=>window.addEventListener("beforeunload",o)),Nh(()=>window.removeEventListener("beforeunload",o));const l=()=>!n.value||window.confirm(uC);return Ih(l),Bh(l),{dirty:n,markClean:i,release:s}}function Us(r){return JSON.stringify(r,(e,t)=>{if(t===null||typeof t!="object"||Array.isArray(t))return t;const n=t,i={};for(const s of Object.keys(n).sort())i[s]=n[s];return i})}export{mC as _,Lh as d,gC as u,Ul as w};
|
|
145
|
+
//# sourceMappingURL=useUnsavedChanges-FB5XcFfI.js.map
|