@micacms/editor-ui 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/assets/{ChangesView-D7n3k873.js → ChangesView-DoLhwPxu.js} +2 -2
  2. package/dist/assets/{ChangesView-D7n3k873.js.map → ChangesView-DoLhwPxu.js.map} +1 -1
  3. package/dist/assets/{CollectionView-Cu_ytsrZ.js → CollectionView-D3W4tRXa.js} +2 -2
  4. package/dist/assets/{CollectionView-Cu_ytsrZ.js.map → CollectionView-D3W4tRXa.js.map} +1 -1
  5. package/dist/assets/{ConfirmDialog.vue_vue_type_script_setup_true_lang-C4yhYMWf.js → ConfirmDialog.vue_vue_type_script_setup_true_lang-BhOQwoeA.js} +2 -2
  6. package/dist/assets/{ConfirmDialog.vue_vue_type_script_setup_true_lang-C4yhYMWf.js.map → ConfirmDialog.vue_vue_type_script_setup_true_lang-BhOQwoeA.js.map} +1 -1
  7. package/dist/assets/{DashboardView-7y5LY2BH.js → DashboardView-JZ2Eaw1_.js} +2 -2
  8. package/dist/assets/{DashboardView-7y5LY2BH.js.map → DashboardView-JZ2Eaw1_.js.map} +1 -1
  9. package/dist/assets/{EntryView-IyBqYorV.js → EntryView-BwERaZkJ.js} +2 -2
  10. package/dist/assets/{EntryView-IyBqYorV.js.map → EntryView-BwERaZkJ.js.map} +1 -1
  11. package/dist/assets/InterVariable-DiVDrmQJ.woff2 +0 -0
  12. package/dist/assets/LoginView-BCrrdqnf.js +2 -0
  13. package/dist/assets/LoginView-BCrrdqnf.js.map +1 -0
  14. package/dist/assets/{MediaView-BVODAshv.js → MediaView-KlQHfWAi.js} +2 -2
  15. package/dist/assets/{MediaView-BVODAshv.js.map → MediaView-KlQHfWAi.js.map} +1 -1
  16. package/dist/assets/{NotFoundView-K-fMCruW.js → NotFoundView-C9bEHUGC.js} +2 -2
  17. package/dist/assets/{NotFoundView-K-fMCruW.js.map → NotFoundView-C9bEHUGC.js.map} +1 -1
  18. package/dist/assets/{ObjectField-CAJPaAKa.js → ObjectField-gxr2a2pp.js} +2 -2
  19. package/dist/assets/{ObjectField-CAJPaAKa.js.map → ObjectField-gxr2a2pp.js.map} +1 -1
  20. package/dist/assets/{PageHeader.vue_vue_type_script_setup_true_lang-IPw0xrLa.js → PageHeader.vue_vue_type_script_setup_true_lang-B-fBJAjn.js} +2 -2
  21. package/dist/assets/{PageHeader.vue_vue_type_script_setup_true_lang-IPw0xrLa.js.map → PageHeader.vue_vue_type_script_setup_true_lang-B-fBJAjn.js.map} +1 -1
  22. package/dist/assets/{RepeaterField-BAnvha76.js → RepeaterField-obOWml_P.js} +2 -2
  23. package/dist/assets/{RepeaterField-BAnvha76.js.map → RepeaterField-obOWml_P.js.map} +1 -1
  24. package/dist/assets/{SingletonView-C3AqQe6a.js → SingletonView-BNJCcl7V.js} +2 -2
  25. package/dist/assets/{SingletonView-C3AqQe6a.js.map → SingletonView-BNJCcl7V.js.map} +1 -1
  26. package/dist/assets/{SystemView-DKA_QdVz.js → SystemView-CB8CT0Pa.js} +2 -2
  27. package/dist/assets/{SystemView-DKA_QdVz.js.map → SystemView-CB8CT0Pa.js.map} +1 -1
  28. package/dist/assets/{arrow-right-s8aI3aOk.js → arrow-right-DJTAYrz5.js} +2 -2
  29. package/dist/assets/{arrow-right-s8aI3aOk.js.map → arrow-right-DJTAYrz5.js.map} +1 -1
  30. package/dist/assets/{arrow-up-BeQh5rSe.js → arrow-up-CibOjHj-.js} +2 -2
  31. package/dist/assets/{arrow-up-BeQh5rSe.js.map → arrow-up-CibOjHj-.js.map} +1 -1
  32. package/dist/assets/{chevron-down-BgnDSY3E.js → chevron-down-Bmt8sf-v.js} +2 -2
  33. package/dist/assets/{chevron-down-BgnDSY3E.js.map → chevron-down-Bmt8sf-v.js.map} +1 -1
  34. package/dist/assets/{index-9WVbsgdk.js → index-Colfqb-9.js} +26 -26
  35. package/dist/assets/index-Colfqb-9.js.map +1 -0
  36. package/dist/assets/index-bRiiEobC.css +1 -0
  37. package/dist/assets/{plus-D6xxK_qW.js → plus-D_aoCFbi.js} +2 -2
  38. package/dist/assets/{plus-D6xxK_qW.js.map → plus-D_aoCFbi.js.map} +1 -1
  39. package/dist/assets/{useField-CQv2TS4g.js → useField-BDSV5ZPo.js} +2 -2
  40. package/dist/assets/{useField-CQv2TS4g.js.map → useField-BDSV5ZPo.js.map} +1 -1
  41. package/dist/assets/{useUnsavedChanges-bO5Ha9y6.js → useUnsavedChanges-B0WVqgI4.js} +5 -5
  42. package/dist/assets/useUnsavedChanges-B0WVqgI4.js.map +1 -0
  43. package/dist/fonts/InterVariable-LICENSE.txt +92 -0
  44. package/dist/index.html +2 -2
  45. package/package.json +2 -2
  46. package/dist/assets/LoginView-C8sJvqmb.js +0 -2
  47. package/dist/assets/LoginView-C8sJvqmb.js.map +0 -1
  48. package/dist/assets/index-9WVbsgdk.js.map +0 -1
  49. package/dist/assets/index-DDeMbcSl.css +0 -1
  50. package/dist/assets/useUnsavedChanges-bO5Ha9y6.js.map +0 -1
@@ -1,10 +1,10 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ObjectField-CAJPaAKa.js","assets/index-9WVbsgdk.js","assets/index-DDeMbcSl.css","assets/useField-CQv2TS4g.js","assets/chevron-down-BgnDSY3E.js","assets/arrow-right-s8aI3aOk.js","assets/plus-D6xxK_qW.js","assets/RepeaterField-BAnvha76.js","assets/arrow-up-BeQh5rSe.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-9WVbsgdk.js";import{u as ft,w as Hl}from"./useField-CQv2TS4g.js";import{A as Fh}from"./arrow-right-s8aI3aOk.js";import{P as Rh}from"./plus-D6xxK_qW.js";/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ObjectField-gxr2a2pp.js","assets/index-Colfqb-9.js","assets/index-bRiiEobC.css","assets/useField-BDSV5ZPo.js","assets/chevron-down-Bmt8sf-v.js","assets/arrow-right-DJTAYrz5.js","assets/plus-D_aoCFbi.js","assets/RepeaterField-obOWml_P.js","assets/arrow-up-CibOjHj-.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-Colfqb-9.js";import{u as ft,w as Hl}from"./useField-BDSV5ZPo.js";import{A as Fh}from"./arrow-right-DJTAYrz5.js";import{P as Rh}from"./plus-D_aoCFbi.js";/**
3
3
  * @license @lucide/vue v1.37.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
6
6
  * See the LICENSE file in the root directory of this source tree.
7
- */const $h=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Ph=gh("arrow-left",$h);function Iu(r){switch(r.kind){case"boolean":return r.default??!1;case"repeater":return[];case"object":return Lh(r.fields);case"select":return r.multiple?Array.isArray(r.default)?r.default:[]:typeof r.default=="string"?r.default:null;case"media":case"relation":return r.multiple?[]:null;case"text":case"textarea":case"richText":case"email":case"url":case"color":case"date":return r.default??null;case"number":return r.default??null;case"slug":case"coordinates":return null}}function Lh(r){const e={};for(const[t,n]of Object.entries(r))e[t]=Iu(n);return e}function Ul(r,e){const t=e??{},n={};for(const[i,s]of Object.entries(r)){const o=t[i];if(o===void 0){n[i]=Iu(s);continue}if(s.kind==="object"){n[i]=Ul(s.fields,o??{});continue}if(s.kind==="repeater"){const l=Array.isArray(o)?o:[];n[i]=l.map(a=>Ul(s.fields,a));continue}n[i]=o}return n}const zh=["for"],qh=["id","checked","disabled","aria-describedby"],Vh={class:"min-w-0"},jh={class:"block text-sm font-medium"},Hh=["id"],Uh=["id"],Wh=Pe({__name:"BooleanField",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(()=>t.modelValue===!0);return(f,h)=>(q(),W("div",null,[j("label",{for:N(s),class:"flex cursor-pointer items-start gap-3 rounded-sm border border-line bg-raised p-3 transition hover:bg-canvas has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-60"},[j("input",{id:N(s),type:"checkbox",checked:d.value,disabled:r.disabled||i.value.readonly,"aria-describedby":N(a),class:"mt-0.5 h-4 w-4 shrink-0 rounded-sm border-line text-accent focus:ring-ink/20",onChange:h[0]||(h[0]=m=>n("update:modelValue",m.target.checked))},null,40,qh),j("span",Vh,[j("span",jh,Q(N(o)),1),i.value.description?(q(),W("span",{key:0,id:N(u),class:"block text-xs text-muted"},Q(i.value.description),9,Hh)):ge("",!0)])],8,zh),N(l)?(q(),W("p",{key:0,id:N(c),class:"field-error"},Q(N(l)),9,Uh)):ge("",!0)]))}}),Kh=["for"],Jh={key:0,class:"text-danger","aria-hidden":"true"},Gh={key:1,class:"sr-only"},Zh=["id"],Yh=["id"],yt=Pe({__name:"FieldShell",props:{inputId:{},label:{},description:{},required:{type:Boolean},error:{},hintId:{},errorId:{},bare:{type:Boolean}},setup(r){return(e,t)=>(q(),W("div",null,[r.bare?ge("",!0):(q(),W("label",{key:0,for:r.inputId,class:"field-label"},[_o(Q(r.label)+" ",1),r.required?(q(),W("span",Jh,"*")):ge("",!0),r.required?(q(),W("span",Gh,"(required)")):ge("",!0)],8,Kh)),j("div",{class:Ae(r.bare?"":"mt-1.5")},[yh(e.$slots,"default")],2),r.description?(q(),W("p",{key:1,id:r.hintId,class:"field-hint"},Q(r.description),9,Zh)):ge("",!0),r.error?(q(),W("p",{key:2,id:r.errorId,class:"field-error"},Q(r.error),9,Yh)):ge("",!0)]))}}),Qh={class:"flex items-center gap-2"},Xh=["value","disabled","aria-label"],ep=["id","value","disabled","aria-invalid","aria-describedby"],tp={key:0,class:"mt-2 flex flex-wrap gap-1.5"},rp=["title","disabled","aria-pressed","onClick"],np={class:"sr-only"},ip=Pe({__name:"ColorField",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(()=>/^#[0-9a-f]{6}$/i.test(d.value)?d.value:"#000000");function h(m){n("update:modelValue",m===""?null:m)}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(()=>{var g;return[j("div",Qh,[j("input",{type:"color",value:f.value,disabled:r.disabled||i.value.readonly,"aria-label":`${N(o)} colour picker`,class:"h-9.5 w-12 shrink-0 cursor-pointer rounded-sm border border-line bg-raised p-1",onInput:p[0]||(p[0]=y=>h(y.target.value))},null,40,Xh),j("input",{id:N(s),type:"text",value:d.value,placeholder:"#1a2b3c",spellcheck:"false",disabled:r.disabled||i.value.readonly,"aria-invalid":N(l)?"true":void 0,"aria-describedby":N(a),class:Ae(["input font-mono text-[13px] uppercase",N(l)&&"input-invalid"]),onInput:p[1]||(p[1]=y=>h(y.target.value.trim()))},null,42,ep)]),(g=i.value.presets)!=null&&g.length?(q(),W("div",tp,[(q(!0),W(Ye,null,ut(i.value.presets,y=>(q(),W("button",{key:y,type:"button",title:y,disabled:r.disabled||i.value.readonly,"aria-pressed":d.value.toLowerCase()===y.toLowerCase(),class:Ae(["h-7 w-7 rounded-full border transition",d.value.toLowerCase()===y.toLowerCase()?"border-ink ring-2 ring-ink/15":"border-line hover:scale-110"]),style:bh({backgroundColor:y}),onClick:x=>h(y)},[j("span",np,"Use "+Q(y),1)],14,rp))),128))])):ge("",!0)]}),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),sp={class:"grid grid-cols-2 gap-2"},op=["for"],lp=["id","value","disabled","aria-describedby"],ap=["for"],up=["id","value","disabled"],cp={key:0,class:"field-error"},dp={class:"mt-1.5 flex items-center gap-3 text-xs text-muted"},fp=["href"],hp=Pe({__name:"CoordinatesField",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(()=>{const g=t.modelValue;if(!g||typeof g!="object")return null;const{lat:y,lng:x}=g;return typeof y=="number"&&typeof x=="number"?{lat:y,lng:x}:null}),f=g=>{var y,x;return((x=(y=t.issues)==null?void 0:y.find(k=>k.path===`${t.path}.${g}`))==null?void 0:x.message)??null};function h(g,y){const x=Number(y),k=d.value??{lat:0,lng:0};if(y.trim()===""){n("update:modelValue",null);return}Number.isFinite(x)&&n("update:modelValue",{...k,[g]:x})}function m(g){var k;const y=((k=g.clipboardData)==null?void 0:k.getData("text"))??"",x=/^\s*(-?\d+(?:\.\d+)?)\s*[,;\s]\s*(-?\d+(?:\.\d+)?)\s*$/.exec(y);x&&(g.preventDefault(),n("update:modelValue",{lat:Number(x[1]),lng:Number(x[2])}))}const p=ee(()=>d.value?`https://www.openstreetmap.org/?mlat=${d.value.lat}&mlon=${d.value.lng}#map=16/${d.value.lat}/${d.value.lng}`: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(()=>{var x,k;return[j("div",sp,[j("div",null,[j("label",{for:`${N(s)}-lat`,class:"sr-only"},"Latitude",8,op),j("input",{id:`${N(s)}-lat`,type:"number",step:"any",min:"-90",max:"90",placeholder:"Latitude",value:((x=d.value)==null?void 0:x.lat)??"",disabled:r.disabled||i.value.readonly,"aria-describedby":N(a),class:Ae(["input font-mono text-[13px]",f("lat")&&"input-invalid"]),onInput:y[0]||(y[0]=A=>h("lat",A.target.value)),onPaste:m},null,42,lp)]),j("div",null,[j("label",{for:`${N(s)}-lng`,class:"sr-only"},"Longitude",8,ap),j("input",{id:`${N(s)}-lng`,type:"number",step:"any",min:"-180",max:"180",placeholder:"Longitude",value:((k=d.value)==null?void 0:k.lng)??"",disabled:r.disabled||i.value.readonly,class:Ae(["input font-mono text-[13px]",f("lng")&&"input-invalid"]),onInput:y[1]||(y[1]=A=>h("lng",A.target.value)),onPaste:m},null,42,up)])]),f("lat")||f("lng")?(q(),W("p",cp,Q(f("lat")??f("lng")),1)):ge("",!0),j("div",dp,[y[3]||(y[3]=j("span",null,'Paste "47.3769, 8.5417" into either box to fill both.',-1)),p.value?(q(),W("a",{key:0,href:p.value,target:"_blank",rel:"noopener noreferrer",class:"font-medium text-accent underline underline-offset-2"}," Check on the map ",8,fp)):ge("",!0),d.value?(q(),W("button",{key:1,type:"button",class:"ml-auto font-medium hover:text-ink",onClick:y[2]||(y[2]=A=>n("update:modelValue",null))}," Clear ")):ge("",!0)])]}),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),pp={class:"flex items-center gap-2"},mp=["id","type","value","min","max","required","disabled","aria-invalid","aria-describedby"],gp=["disabled"],yp=Pe({__name:"DateField",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(()=>{const m=t.modelValue;if(typeof m!="string"||m==="")return"";if(!i.value.includeTime)return m.slice(0,10);const p=new Date(m);if(Number.isNaN(p.getTime()))return"";const g=y=>String(y).padStart(2,"0");return`${p.getFullYear()}-${g(p.getMonth()+1)}-${g(p.getDate())}T${g(p.getHours())}:${g(p.getMinutes())}`});function f(m){const p=m.target.value;if(!p){n("update:modelValue",null);return}if(!i.value.includeTime){n("update:modelValue",p);return}const g=new Date(p);n("update:modelValue",Number.isNaN(g.getTime())?null:g.toISOString())}function h(){const m=new Date;n("update:modelValue",i.value.includeTime?m.toISOString():m.toISOString().slice(0,10))}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("div",pp,[j("input",{id:N(s),type:i.value.includeTime?"datetime-local":"date",value:d.value,min:i.value.min,max:i.value.max,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"]),onInput:f},null,42,mp),j("button",{type:"button",class:"btn-secondary shrink-0",disabled:r.disabled||i.value.readonly,onClick:h}," Today ",8,gp)])]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),bp={class:"flex items-center gap-3 border-b border-line px-5 py-3.5"},kp={class:"mb-4 flex cursor-pointer flex-col items-center justify-center gap-1 rounded-md border border-dashed border-line-strong bg-canvas/50 px-4 py-6 text-center transition hover:border-ink/40"},vp=["accept","multiple","disabled"],xp={class:"text-sm font-medium"},Cp={class:"text-xs text-muted"},Ap={key:0,class:"py-8 text-center text-sm text-muted"},wp={key:1,class:"py-8 text-center text-sm text-muted"},Ep={key:2,class:"grid grid-cols-2 gap-3 sm:grid-cols-4 lg:grid-cols-5"},Sp=["aria-pressed","onClick"],Dp={class:"block aspect-4/3 bg-canvas"},_p=["src"],Tp={key:1,class:"flex h-full w-full items-center justify-center text-xs font-medium uppercase text-muted"},Mp={class:"block px-2 py-1.5"},Op={class:"block truncate text-xs font-medium"},Np=["title"],Ip={class:"block text-[11px] text-muted"},Bp={key:0,class:"flex items-center justify-between gap-3 border-t border-line px-5 py-3"},Fp={class:"text-sm text-muted"},Rp={class:"flex gap-2"},$p=["disabled"],Pp=Pe({__name:"MediaPicker",props:{open:{type:Boolean},accept:{default:"any"},multiple:{type:Boolean,default:!1},selected:{default:()=>[]}},emits:["close","choose"],setup(r,{emit:e}){const t=r,n=e,i=Ch(),s=je([]),o=je(!1),l=je(!1),a=je(""),u=je([]),c=je(null),d=je(null),f=je(!1);let h=null;const m=ee(()=>t.accept==="image"?"image/*":t.accept==="document"?"application/pdf":void 0),p=ee(()=>{const T=a.value.trim().toLowerCase();return s.value.filter(I=>t.accept==="image"&&!y(I)||t.accept==="document"&&y(I)?!1:!T||I.path.toLowerCase().includes(T))}),g=ee(()=>u.value.length>0),y=T=>T.mimeType.startsWith("image/");async function x(){o.value=!0;try{s.value=(await gr.media.list()).items}catch(T){i.error(T instanceof ql?T.message:"Could not load the media library.")}finally{o.value=!1}}si(()=>t.open,async T=>{var I,O;if(!T){document.body.style.overflow="",h==null||h.focus();return}h=document.activeElement,document.body.style.overflow="hidden",u.value=[],a.value="",await x(),await Ou(),(O=(I=c.value)==null?void 0:I.querySelector("input, button"))==null||O.focus()}),Yi(()=>{document.body.style.overflow=""});function k(T){if(!t.multiple){n("choose",[T]),n("close");return}u.value=u.value.includes(T.path)?u.value.filter(I=>I!==T.path):[...u.value,T.path]}function A(){const T=new Map(s.value.map(O=>[O.path,O])),I=u.value.map(O=>T.get(O)).filter(O=>O!==void 0);n("choose",I),n("close")}async function v(T){const I=Array.from(T??[]);if(I.length!==0){l.value=!0;try{const{items:O}=await gr.media.upload(I,{accept:t.accept});if(!t.multiple){O[0]&&n("choose",[O[0]]),n("close");return}await x(),u.value=[...u.value,...O.map(z=>z.path)],i.success(`Uploaded ${O.length} file${O.length===1?"":"s"}.`)}catch(O){i.error(O instanceof ql?O.message:"The upload failed.")}finally{l.value=!1,d.value&&(d.value.value="")}}}function S(T){var I;f.value=!1,v(((I=T.dataTransfer)==null?void 0:I.files)??null)}function D(T){if(T.key==="Escape"){n("close");return}if(T.key!=="Tab"||!c.value)return;const I=c.value.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])'),O=I[0],z=I[I.length-1];!O||!z||(T.shiftKey&&document.activeElement===O?(T.preventDefault(),z.focus()):!T.shiftKey&&document.activeElement===z&&(T.preventDefault(),O.focus()))}const _=T=>T<1024*1024?`${Math.round(T/1024)} KB`:`${(T/1024/1024).toFixed(1)} MB`,$=T=>{const I=T.split("/");return I.pop(),I.join("/")||"/"};return(T,I)=>(q(),rt(kh,{to:"body"},[r.open?(q(),W("div",{key:0,class:"fixed inset-0 z-50 flex items-end justify-center bg-ink/40 p-0 sm:items-center sm:p-6",onClick:I[6]||(I[6]=$n(O=>n("close"),["self"])),onKeydown:D},[j("div",{ref_key:"dialog",ref:c,role:"dialog","aria-modal":"true","aria-labelledby":"media-picker-title",class:"flex max-h-[90vh] w-full max-w-4xl flex-col rounded-t-xl border border-line bg-raised shadow-2xl sm:rounded-xl"},[j("header",bp,[I[8]||(I[8]=j("h2",{id:"media-picker-title",class:"text-base font-semibold"},"Media",-1)),vh(j("input",{"onUpdate:modelValue":I[0]||(I[0]=O=>a.value=O),type:"search",placeholder:"Search files…",class:"input ml-auto max-w-56","aria-label":"Search media"},null,512),[[xh,a.value]]),j("button",{type:"button",class:"btn-ghost -mr-2 px-2",onClick:I[1]||(I[1]=O=>n("close"))},[Rt(N(Nu),{size:20,"aria-hidden":"true"}),I[7]||(I[7]=j("span",{class:"sr-only"},"Close",-1))])]),j("div",{class:Ae(["min-h-0 flex-1 overflow-y-auto p-5",f.value&&"bg-accent-soft"]),onDragover:I[3]||(I[3]=$n(O=>f.value=!0,["prevent"])),onDragleave:I[4]||(I[4]=$n(O=>f.value=!1,["prevent"])),onDrop:$n(S,["prevent"])},[j("label",kp,[j("input",{ref_key:"fileInput",ref:d,type:"file",class:"sr-only",accept:m.value,multiple:r.multiple,disabled:l.value,onChange:I[2]||(I[2]=O=>v(O.target.files))},null,40,vp),j("span",xp,Q(l.value?"Uploading…":"Drop files here, or choose from your device"),1),j("span",Cp,Q(r.accept==="image"?"Images":r.accept==="document"?"PDF documents":"Images and documents"),1)]),o.value?(q(),W("p",Ap,"Loading…")):p.value.length===0?(q(),W("p",wp,Q(a.value?`Nothing matches "${a.value}".`:"No files yet."),1)):(q(),W("ul",Ep,[(q(!0),W(Ye,null,ut(p.value,O=>(q(),W("li",{key:O.path},[j("button",{type:"button","aria-pressed":u.value.includes(O.path)||r.selected.includes(O.path),class:Ae(["group block w-full overflow-hidden rounded-lg border text-left transition",u.value.includes(O.path)?"border-accent ring-2 ring-accent/25":r.selected.includes(O.path)?"border-accent/50":"border-line hover:border-accent/40"]),onClick:z=>k(O)},[j("span",Dp,[y(O)?(q(),W("img",{key:0,src:N(gr).media.url(O.path),alt:"",loading:"lazy",class:"h-full w-full object-cover"},null,8,_p)):(q(),W("span",Tp,Q(O.mimeType.split("/")[1]),1))]),j("span",Mp,[j("span",Op,Q(O.filename),1),j("span",{class:"block truncate text-[11px] text-muted",title:O.path},Q($(O.path)),9,Np),j("span",Ip,Q(O.width?`${O.width}×${O.height} · `:"")+Q(_(O.size)),1)])],10,Sp)]))),128))]))],34),r.multiple?(q(),W("footer",Bp,[j("span",Fp,Q(u.value.length)+" selected ",1),j("div",Rp,[j("button",{type:"button",class:"btn-secondary",onClick:I[5]||(I[5]=O=>n("close"))},"Cancel"),j("button",{type:"button",class:"btn-primary",disabled:!g.value,onClick:A}," Add "+Q(u.value.length||""),9,$p)])])):ge("",!0)],512)],32)):ge("",!0)]))}}),Lp=["aria-describedby"],zp={class:"aspect-4/3"},qp=["src"],Vp={key:1,class:"flex h-full w-full flex-col items-center justify-center gap-1 p-2 text-center"},jp={class:"text-[11px] font-semibold uppercase text-muted"},Hp=["title"],Up={class:"absolute inset-x-0 top-0 flex justify-end gap-0.5 bg-gradient-to-b from-ink/50 to-transparent p-1 opacity-0 transition group-hover:opacity-100 group-focus-within:opacity-100"},Wp=["disabled","onClick"],Kp={class:"sr-only"},Jp=["disabled","onClick"],Gp={class:"sr-only"},Zp=["disabled","onClick"],Yp={class:"sr-only"},Qp=["id","disabled"],Xp={key:1,class:"ml-2 text-xs text-muted"},em=Pe({__name:"MediaField",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=je(!1),f=ee(()=>i.value.multiple?Array.isArray(t.modelValue)?t.modelValue:[]:typeof t.modelValue=="string"&&t.modelValue?[t.modelValue]:[]),h=ee(()=>f.value.map(x=>({path:x,filename:x.split("/").pop()??x,url:gr.media.url(x),isImage:/\.(jpe?g|png|webp|avif|gif|svg)$/i.test(x)}))),m=ee(()=>i.value.multiple&&i.value.max!==void 0&&f.value.length>=i.value.max);function p(x){var A;if(!i.value.multiple){n("update:modelValue",((A=x[0])==null?void 0:A.path)??null);return}const k=[...f.value];for(const v of x)k.includes(v.path)||k.push(v.path);n("update:modelValue",i.value.max?k.slice(0,i.value.max):k)}function g(x){if(!i.value.multiple){n("update:modelValue",null);return}n("update:modelValue",f.value.filter((k,A)=>A!==x))}function y(x,k){const A=x+k;if(A<0||A>=f.value.length)return;const v=[...f.value];[v[x],v[A]]=[v[A],v[x]],n("update:modelValue",v)}return(x,k)=>(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",{"aria-describedby":N(a)},[h.value.length?(q(),W("ul",{key:0,class:Ae(["mb-2 gap-2",i.value.multiple?"grid grid-cols-3 sm:grid-cols-5":"flex"])},[(q(!0),W(Ye,null,ut(h.value,(A,v)=>(q(),W("li",{key:`${A.path}-${v}`,class:Ae(["group relative overflow-hidden rounded-lg border border-line bg-canvas",i.value.multiple?"":"w-40"])},[j("div",zp,[A.isImage?(q(),W("img",{key:0,src:A.url,alt:"",class:"h-full w-full object-cover"},null,8,qp)):(q(),W("div",Vp,[j("span",jp,Q(A.filename.split(".").pop()),1)]))]),j("p",{class:"truncate px-1.5 py-1 text-[11px] text-muted",title:A.path},Q(A.filename),9,Hp),j("div",Up,[i.value.multiple&&v>0?(q(),W("button",{key:0,type:"button",class:"rounded-sm bg-raised/90 px-1.5 text-xs font-semibold hover:bg-raised",disabled:r.disabled,onClick:S=>y(v,-1)},[Rt(N(Ph),{size:14,"aria-hidden":"true"}),j("span",Kp,"Move "+Q(A.filename)+" earlier",1)],8,Wp)):ge("",!0),i.value.multiple&&v<h.value.length-1?(q(),W("button",{key:1,type:"button",class:"rounded-sm bg-raised/90 px-1.5 text-xs font-semibold hover:bg-raised",disabled:r.disabled,onClick:S=>y(v,1)},[Rt(N(Fh),{size:14,"aria-hidden":"true"}),j("span",Gp,"Move "+Q(A.filename)+" later",1)],8,Jp)):ge("",!0),j("button",{type:"button",class:"rounded-sm bg-raised/90 px-1.5 text-xs font-semibold text-danger hover:bg-raised",disabled:r.disabled,onClick:S=>g(v)},[Rt(N(Nu),{size:14,"aria-hidden":"true"}),j("span",Yp,"Remove "+Q(A.filename),1)],8,Zp)])],2))),128))],2)):ge("",!0),j("button",{id:N(s),type:"button",class:"btn-secondary",disabled:r.disabled||i.value.readonly||m.value,onClick:k[0]||(k[0]=A=>d.value=!0)},[Rt(N(Rh),{size:16,"aria-hidden":"true"}),_o(" "+Q(h.value.length&&!i.value.multiple?"Replace":"Add"),1)],8,Qp),m.value?(q(),W("span",Xp," Maximum of "+Q(i.value.max)+" reached. ",1)):ge("",!0)],8,Lp),Rt(Pp,{open:d.value,accept:i.value.accept??"any",multiple:i.value.multiple,selected:f.value,onClose:k[1]||(k[1]=A=>d.value=!1),onChoose:p},null,8,["open","accept","multiple","selected"])]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),tm={class:"relative"},rm=["id","value","min","max","step","required","disabled","aria-invalid","aria-describedby"],nm={key:0,class:"pointer-events-none absolute inset-y-0 right-3 flex items-center text-sm text-muted"},im=Pe({__name:"NumberField",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=="number"?String(t.modelValue):"");function f(h){const m=h.target.value;if(m.trim()===""){n("update:modelValue",null);return}const p=Number(m);n("update:modelValue",Number.isFinite(p)?p:null)}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(()=>[j("div",tm,[j("input",{id:N(s),type:"number",inputmode:"decimal",value:d.value,min:i.value.min,max:i.value.max,step:i.value.step??(i.value.integer?1:"any"),required:i.value.required,disabled:r.disabled||i.value.readonly,"aria-invalid":N(l)?"true":void 0,"aria-describedby":N(a),class:Ae(["input",i.value.unit&&"pr-12",N(l)&&"input-invalid"]),onInput:f},null,42,rm),i.value.unit?(q(),W("span",nm,Q(i.value.unit),1)):ge("",!0)])]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),sm={key:0,class:"text-sm text-muted"},om={key:1,class:"text-sm text-muted"},lm=["aria-describedby"],am={class:"sr-only"},um=["checked","disabled","onChange"],cm={class:"min-w-0 flex-1 truncate"},dm={class:"shrink-0 font-mono text-[11px] text-muted"},fm=["id","value","disabled","aria-invalid","aria-describedby"],hm=["value"],pm=Pe({__name:"RelationField",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=Ah(),f=je([]),h=je(!0),m=ee(()=>{var k;return((k=d.collection(i.value.collection))==null?void 0:k.label)??i.value.collection});To(async()=>{try{f.value=(await gr.entries.list(i.value.collection)).items}finally{h.value=!1}});const p=ee(()=>i.value.multiple?Array.isArray(t.modelValue)?t.modelValue:[]:typeof t.modelValue=="string"?[t.modelValue]:[]),g=k=>{var A;return((A=f.value.find(v=>v.slug===k))==null?void 0:A.title)??k},y=k=>!h.value&&!f.value.some(A=>A.slug===k);function x(k){const A=p.value.includes(k)?p.value.filter(v=>v!==k):[...p.value,k];n("update:modelValue",A)}return(k,A)=>(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(()=>[h.value?(q(),W("p",sm,"Loading "+Q(m.value)+"…",1)):f.value.length===0?(q(),W("p",om," There are no entries in "+Q(m.value)+" yet. ",1)):(q(),W(Ye,{key:2},[i.value.multiple?(q(),W("fieldset",{key:0,class:"space-y-1.5","aria-describedby":N(a)},[j("legend",am,Q(N(o)),1),(q(!0),W(Ye,null,ut(f.value,v=>(q(),W("label",{key:v.slug,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:p.value.includes(v.slug),disabled:r.disabled||i.value.readonly,class:"h-4 w-4 rounded-sm border-line text-accent focus:ring-ink/20",onChange:S=>x(v.slug)},null,40,um),j("span",cm,Q(v.title),1),j("span",dm,Q(v.slug),1)]))),128))],8,lm)):(q(),W("select",{key:1,id:N(s),value:p.value[0]??"",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:A[0]||(A[0]=v=>n("update:modelValue",v.target.value||null))},[A[1]||(A[1]=j("option",{value:""},"Not set",-1)),(q(!0),W(Ye,null,ut(f.value,v=>(q(),W("option",{key:v.slug,value:v.slug},Q(v.title),9,hm))),128))],42,fm))],64)),(q(!0),W(Ye,null,ut(p.value.filter(y),v=>(q(),W("p",{key:v,class:"field-error"},' "'+Q(g(v))+'" is no longer in '+Q(m.value)+". ",1))),128))]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}});function Ne(r){this.content=r}Ne.prototype={constructor:Ne,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),s=n.content.slice();return i==-1?s.push(t||r,e):(s[i+1]=e,t&&(s[i]=t)),new Ne(s)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ne(t)},addToStart:function(r,e){return new Ne([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new Ne(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),s=n.find(r);return i.splice(s==-1?i.length:s,0,e,t),new Ne(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=Ne.from(r),r.size?new Ne(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=Ne.from(r),r.size?new Ne(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=Ne.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}};Ne.from=function(r){if(r instanceof Ne)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new Ne(e)};function Bu(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),s=e.child(n);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){let o=i.text,l=s.text,a=0;for(;o[a]==l[a];a++)t++;return a&&a<o.length&&a<l.length&&$u(o.charCodeAt(a-1))&&Ru(o.charCodeAt(a))&&t--,t}if(i.content.size||s.content.size){let o=Bu(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Fu(r,e,t,n){for(let i=r.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:n};let o=r.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,n-=a;continue}if(!o.sameMarkup(l))return{a:t,b:n};if(o.isText&&o.text!=l.text){let u=o.text,c=l.text,d=u.length,f=c.length;for(;d>0&&f>0&&u[d-1]==c[f-1];)d--,f--,t--,n--;return d&&f&&d<u.length&&$u(u.charCodeAt(d-1))&&Ru(u.charCodeAt(d))&&(t++,n++),{a:t,b:n}}if(o.content.size||l.content.size){let u=Fu(o.content,l.content,t-1,n-1);if(u)return u}t-=a,n-=a}}function Ru(r){return r>=56320&&r<57344}function $u(r){return r>=55296&&r<56320}class R{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],u=l+a.nodeSize;if(u>e&&n(a,i+l,s||null,o)!==!1&&a.content.size){let c=l+1;a.nodesBetween(Math.max(0,e-c),Math.min(a.content.size,t-c),n,i+c)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let u=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&n&&(o?o=!1:s+=n),s+=u},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new R(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),n.push(l),i+=l.nodeSize),o=a}return new R(n,i)}cutByIndex(e,t){return e==t?R.empty:e==0&&t==this.content.length?this:new R(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new R(i,s)}addToStart(e){return new R([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new R(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return Bu(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Fu(this,e,t,n)}findIndex(e){if(e==0)return Pn(0,e);if(e==this.size)return Pn(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let i=this.child(t),s=n+i.nodeSize;if(s>=e)return s==e?Pn(t+1,s):Pn(t,n);n=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return R.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return R.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return R.empty;let t,n=0;for(let i=0;i<e.length;i++){let s=e[i];n+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new R(t||e,n)}static from(e){if(!e)return R.empty;if(e instanceof R)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new R([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}R.empty=new R([],0);const ys={index:0,offset:0};function Pn(r,e){return ys.index=r,ys.offset=e,ys}function oi(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!oi(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!oi(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let fe=class Ws{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!n&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(s)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&oi(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=n.create(t.attrs);return n.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ws.none;if(e instanceof Ws)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};fe.none=[];class fn extends Error{}class H{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Lu(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return n&&new H(n,this.openStart,this.openEnd)}removeBetween(e,t){return new H(Pu(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return H.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new H(R.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)n++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new H(e,n,i)}}H.empty=new H(R.empty,0,0);function Pu(r,e,t){let{index:n,offset:i}=r.findIndex(e),s=r.maybeChild(n),{index:o,offset:l}=r.findIndex(t);if(i==e||s.isText){if(l!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,s.copy(Pu(s.content,e-i-1,t-i-1)))}function Lu(r,e,t,n,i,s){let{index:o,offset:l}=r.findIndex(e),a=r.maybeChild(o);if(l==e||a.isText)return s&&n<=0&&i<=0&&!s.canReplace(o,o,t)?null:r.cut(0,e).append(t).append(r.cut(e));let u=Lu(a.content,e-l-1,t,o==0?n-1:0,o==r.childCount-1?i-1:0,a);return u&&r.replaceChild(o,a.copy(u))}function mm(r,e,t){if(t.openStart>r.depth)throw new fn("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new fn("Inconsistent open depths");return zu(r,e,t,0)}function zu(r,e,t,n){let i=r.index(n),s=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=zu(r,e,t,n+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,l=o.content;return br(o,l.cut(0,r.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=gm(t,r);return br(s,Vu(r,o,l,e,n))}else return br(s,li(r,e,n))}function qu(r,e){if(!e.type.compatibleContent(r.type))throw new fn("Cannot join "+e.type.name+" onto "+r.type.name)}function Ks(r,e,t){let n=r.node(t);return qu(n,e.node(t)),n}function yr(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function tn(r,e,t,n){let i=(e||r).node(t),s=0,o=e?e.index(t):i.childCount;r&&(s=r.index(t),r.depth>t?s++:r.textOffset&&(yr(r.nodeAfter,n),s++));for(let l=s;l<o;l++)yr(i.child(l),n);e&&e.depth==t&&e.textOffset&&yr(e.nodeBefore,n)}function br(r,e){if(!r.type.validContent(e))throw new fn("Invalid content for node "+r.type.name);return r.copy(e)}function Vu(r,e,t,n,i){let s=r.depth>i&&Ks(r,e,i+1),o=n.depth>i&&Ks(t,n,i+1),l=[];return tn(null,r,i,l),s&&o&&e.index(i)==t.index(i)?(qu(s,o),yr(br(s,Vu(r,e,t,n,i+1)),l)):(s&&yr(br(s,li(r,e,i+1)),l),tn(e,t,i,l),o&&yr(br(o,li(t,n,i+1)),l)),tn(n,null,i,l),new R(l)}function li(r,e,t){let n=[];if(tn(null,r,t,n),r.depth>t){let i=Ks(r,e,t+1);yr(br(i,li(r,e,t+1)),n)}return tn(e,null,t,n),new R(n)}function gm(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(R.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class hn{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=e.child(t);return n?e.child(t).cut(n):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=n.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return fe.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let l=n;n=i,i=l}let s=n.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<n.length;s++)n[s].type.spec.inclusive===!1&&(!i||!n[s].isInSet(i.marks))&&(n=n[s--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new ai(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),u=s-a;if(n.push(o,l,i+a),!u||(o=o.child(l),o.isText))break;s=u-1,i+=a+1}return new hn(t,n,s)}static resolveCached(e,t){let n=Wl.get(e);if(n)for(let s=0;s<n.elts.length;s++){let o=n.elts[s];if(o.pos==t)return o}else Wl.set(e,n=new ym);let i=n.elts[n.i]=hn.resolve(e,t);return n.i=(n.i+1)%bm,i}}class ym{constructor(){this.elts=[],this.i=0}}const bm=12,Wl=new WeakMap;class ai{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const km=Object.create(null);let Yt=class Js{constructor(e,t,n,i=fe.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||R.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,i=0){this.content.nodesBetween(e,t,n,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,i){return this.content.textBetween(e,t,n,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&oi(this.attrs,t||e.defaultAttrs||km)&&fe.sameSet(this.marks,n||fe.none)}copy(e=null){return e==this.content?this:new Js(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Js(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return H.empty;let i=this.resolve(e),s=this.resolve(t),o=n?0:i.sharedDepth(t),l=i.start(o),u=i.node(o).content.cut(i.pos-l,s.pos-l);return new H(u,i.depth-o,s.depth-o)}replace(e,t,n){return mm(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return hn.resolveCached(this,e)}resolveNoCache(e){return hn.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(n.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),ju(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=R.empty,i=0,s=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(n.child(a).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(n),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=fe.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!fe.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let i=R.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,n);return s.type.checkAttrs(s.attrs),s}};Yt.prototype.text=void 0;class ui extends Yt{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ju(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ui(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ui(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function ju(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class Ar{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new vm(e,t);if(n.next==null)return Ar.empty;let i=Hu(n);n.next&&n.err("Unexpected trailing text");let s=Dm(Sm(i));return _m(s,n),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let i=this;for(let s=t;i&&s<n;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let i=[this];function s(o,l){let a=o.matchFragment(e,n);if(a&&(!t||a.validEnd))return R.from(l.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:c,next:d}=o.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=s(d,l.concat(c));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let i=n.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(n.push({match:l.contentMatch,type:l,via:i}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let s=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)s+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return s}).join(`
7
+ */const $h=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Ph=gh("arrow-left",$h);function Iu(r){switch(r.kind){case"boolean":return r.default??!1;case"repeater":return[];case"object":return Lh(r.fields);case"select":return r.multiple?Array.isArray(r.default)?r.default:[]:typeof r.default=="string"?r.default:null;case"media":case"relation":return r.multiple?[]:null;case"text":case"textarea":case"richText":case"email":case"url":case"color":case"date":return r.default??null;case"number":return r.default??null;case"slug":case"coordinates":return null}}function Lh(r){const e={};for(const[t,n]of Object.entries(r))e[t]=Iu(n);return e}function Ul(r,e){const t=e??{},n={};for(const[i,s]of Object.entries(r)){const o=t[i];if(o===void 0){n[i]=Iu(s);continue}if(s.kind==="object"){n[i]=Ul(s.fields,o??{});continue}if(s.kind==="repeater"){const l=Array.isArray(o)?o:[];n[i]=l.map(a=>Ul(s.fields,a));continue}n[i]=o}return n}const zh=["for"],qh=["id","checked","disabled","aria-describedby"],Vh={class:"min-w-0"},jh={class:"block text-sm font-medium"},Hh=["id"],Uh=["id"],Wh=Pe({__name:"BooleanField",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(()=>t.modelValue===!0);return(f,h)=>(q(),W("div",null,[j("label",{for:N(s),class:"flex cursor-pointer items-start gap-3 rounded-sm border border-line bg-raised p-3 transition hover:bg-canvas has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-60"},[j("input",{id:N(s),type:"checkbox",checked:d.value,disabled:r.disabled||i.value.readonly,"aria-describedby":N(a),class:"mt-0.5 h-4 w-4 shrink-0 rounded-sm border-line text-accent focus:ring-ink/20",onChange:h[0]||(h[0]=m=>n("update:modelValue",m.target.checked))},null,40,qh),j("span",Vh,[j("span",jh,Q(N(o)),1),i.value.description?(q(),W("span",{key:0,id:N(u),class:"block text-xs text-muted"},Q(i.value.description),9,Hh)):ge("",!0)])],8,zh),N(l)?(q(),W("p",{key:0,id:N(c),class:"field-error"},Q(N(l)),9,Uh)):ge("",!0)]))}}),Kh=["for"],Jh={key:0,class:"text-danger","aria-hidden":"true"},Gh={key:1,class:"sr-only"},Zh=["id"],Yh=["id"],yt=Pe({__name:"FieldShell",props:{inputId:{},label:{},description:{},required:{type:Boolean},error:{},hintId:{},errorId:{},bare:{type:Boolean}},setup(r){return(e,t)=>(q(),W("div",null,[r.bare?ge("",!0):(q(),W("label",{key:0,for:r.inputId,class:"field-label"},[_o(Q(r.label)+" ",1),r.required?(q(),W("span",Jh,"*")):ge("",!0),r.required?(q(),W("span",Gh,"(required)")):ge("",!0)],8,Kh)),j("div",{class:Ae(r.bare?"":"mt-1.5")},[yh(e.$slots,"default")],2),r.description?(q(),W("p",{key:1,id:r.hintId,class:"field-hint"},Q(r.description),9,Zh)):ge("",!0),r.error?(q(),W("p",{key:2,id:r.errorId,class:"field-error"},Q(r.error),9,Yh)):ge("",!0)]))}}),Qh={class:"flex items-center gap-2"},Xh=["value","disabled","aria-label"],ep=["id","value","disabled","aria-invalid","aria-describedby"],tp={key:0,class:"mt-2 flex flex-wrap gap-1.5"},rp=["title","disabled","aria-pressed","onClick"],np={class:"sr-only"},ip=Pe({__name:"ColorField",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(()=>/^#[0-9a-f]{6}$/i.test(d.value)?d.value:"#000000");function h(m){n("update:modelValue",m===""?null:m)}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(()=>{var g;return[j("div",Qh,[j("input",{type:"color",value:f.value,disabled:r.disabled||i.value.readonly,"aria-label":`${N(o)} colour picker`,class:"h-9.5 w-12 shrink-0 cursor-pointer rounded-sm border border-line bg-raised p-1",onInput:p[0]||(p[0]=y=>h(y.target.value))},null,40,Xh),j("input",{id:N(s),type:"text",value:d.value,placeholder:"#1a2b3c",spellcheck:"false",disabled:r.disabled||i.value.readonly,"aria-invalid":N(l)?"true":void 0,"aria-describedby":N(a),class:Ae(["input font-mono text-[13px] uppercase",N(l)&&"input-invalid"]),onInput:p[1]||(p[1]=y=>h(y.target.value.trim()))},null,42,ep)]),(g=i.value.presets)!=null&&g.length?(q(),W("div",tp,[(q(!0),W(Ye,null,ut(i.value.presets,y=>(q(),W("button",{key:y,type:"button",title:y,disabled:r.disabled||i.value.readonly,"aria-pressed":d.value.toLowerCase()===y.toLowerCase(),class:Ae(["h-7 w-7 rounded-full border transition",d.value.toLowerCase()===y.toLowerCase()?"border-ink ring-2 ring-ink/15":"border-line hover:scale-110"]),style:bh({backgroundColor:y}),onClick:x=>h(y)},[j("span",np,"Use "+Q(y),1)],14,rp))),128))])):ge("",!0)]}),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),sp={class:"grid grid-cols-2 gap-2"},op=["for"],lp=["id","value","disabled","aria-describedby"],ap=["for"],up=["id","value","disabled"],cp={key:0,class:"field-error"},dp={class:"mt-1.5 flex items-center gap-3 text-xs text-muted"},fp=["href"],hp=Pe({__name:"CoordinatesField",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(()=>{const g=t.modelValue;if(!g||typeof g!="object")return null;const{lat:y,lng:x}=g;return typeof y=="number"&&typeof x=="number"?{lat:y,lng:x}:null}),f=g=>{var y,x;return((x=(y=t.issues)==null?void 0:y.find(k=>k.path===`${t.path}.${g}`))==null?void 0:x.message)??null};function h(g,y){const x=Number(y),k=d.value??{lat:0,lng:0};if(y.trim()===""){n("update:modelValue",null);return}Number.isFinite(x)&&n("update:modelValue",{...k,[g]:x})}function m(g){var k;const y=((k=g.clipboardData)==null?void 0:k.getData("text"))??"",x=/^\s*(-?\d+(?:\.\d+)?)\s*[,;\s]\s*(-?\d+(?:\.\d+)?)\s*$/.exec(y);x&&(g.preventDefault(),n("update:modelValue",{lat:Number(x[1]),lng:Number(x[2])}))}const p=ee(()=>d.value?`https://www.openstreetmap.org/?mlat=${d.value.lat}&mlon=${d.value.lng}#map=16/${d.value.lat}/${d.value.lng}`: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(()=>{var x,k;return[j("div",sp,[j("div",null,[j("label",{for:`${N(s)}-lat`,class:"sr-only"},"Latitude",8,op),j("input",{id:`${N(s)}-lat`,type:"number",step:"any",min:"-90",max:"90",placeholder:"Latitude",value:((x=d.value)==null?void 0:x.lat)??"",disabled:r.disabled||i.value.readonly,"aria-describedby":N(a),class:Ae(["input font-mono text-[13px]",f("lat")&&"input-invalid"]),onInput:y[0]||(y[0]=A=>h("lat",A.target.value)),onPaste:m},null,42,lp)]),j("div",null,[j("label",{for:`${N(s)}-lng`,class:"sr-only"},"Longitude",8,ap),j("input",{id:`${N(s)}-lng`,type:"number",step:"any",min:"-180",max:"180",placeholder:"Longitude",value:((k=d.value)==null?void 0:k.lng)??"",disabled:r.disabled||i.value.readonly,class:Ae(["input font-mono text-[13px]",f("lng")&&"input-invalid"]),onInput:y[1]||(y[1]=A=>h("lng",A.target.value)),onPaste:m},null,42,up)])]),f("lat")||f("lng")?(q(),W("p",cp,Q(f("lat")??f("lng")),1)):ge("",!0),j("div",dp,[y[3]||(y[3]=j("span",null,'Paste "47.3769, 8.5417" into either box to fill both.',-1)),p.value?(q(),W("a",{key:0,href:p.value,target:"_blank",rel:"noopener noreferrer",class:"font-medium text-accent underline underline-offset-2"}," Check on the map ",8,fp)):ge("",!0),d.value?(q(),W("button",{key:1,type:"button",class:"ml-auto font-medium hover:text-ink",onClick:y[2]||(y[2]=A=>n("update:modelValue",null))}," Clear ")):ge("",!0)])]}),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),pp={class:"flex items-center gap-2"},mp=["id","type","value","min","max","required","disabled","aria-invalid","aria-describedby"],gp=["disabled"],yp=Pe({__name:"DateField",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(()=>{const m=t.modelValue;if(typeof m!="string"||m==="")return"";if(!i.value.includeTime)return m.slice(0,10);const p=new Date(m);if(Number.isNaN(p.getTime()))return"";const g=y=>String(y).padStart(2,"0");return`${p.getFullYear()}-${g(p.getMonth()+1)}-${g(p.getDate())}T${g(p.getHours())}:${g(p.getMinutes())}`});function f(m){const p=m.target.value;if(!p){n("update:modelValue",null);return}if(!i.value.includeTime){n("update:modelValue",p);return}const g=new Date(p);n("update:modelValue",Number.isNaN(g.getTime())?null:g.toISOString())}function h(){const m=new Date;n("update:modelValue",i.value.includeTime?m.toISOString():m.toISOString().slice(0,10))}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("div",pp,[j("input",{id:N(s),type:i.value.includeTime?"datetime-local":"date",value:d.value,min:i.value.min,max:i.value.max,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"]),onInput:f},null,42,mp),j("button",{type:"button",class:"btn-secondary shrink-0",disabled:r.disabled||i.value.readonly,onClick:h}," Today ",8,gp)])]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),bp={class:"flex items-center gap-3 border-b border-line px-5 py-3.5"},kp={class:"mb-4 flex cursor-pointer flex-col items-center justify-center gap-1 rounded-md border border-dashed border-line-strong bg-canvas/50 px-4 py-6 text-center transition hover:border-ink/40"},vp=["accept","multiple","disabled"],xp={class:"text-sm font-medium"},Cp={class:"text-xs text-muted"},Ap={key:0,class:"py-8 text-center text-sm text-muted"},wp={key:1,class:"py-8 text-center text-sm text-muted"},Ep={key:2,class:"grid grid-cols-2 gap-3 sm:grid-cols-4 lg:grid-cols-5"},Sp=["aria-pressed","onClick"],Dp={class:"block aspect-4/3 bg-canvas"},_p=["src"],Tp={key:1,class:"flex h-full w-full items-center justify-center text-xs font-medium uppercase text-muted"},Mp={class:"block px-2 py-1.5"},Op={class:"block truncate text-xs font-medium"},Np=["title"],Ip={class:"block text-[11px] text-muted"},Bp={key:0,class:"flex items-center justify-between gap-3 border-t border-line px-5 py-3"},Fp={class:"text-sm text-muted"},Rp={class:"flex gap-2"},$p=["disabled"],Pp=Pe({__name:"MediaPicker",props:{open:{type:Boolean},accept:{default:"any"},multiple:{type:Boolean,default:!1},selected:{default:()=>[]}},emits:["close","choose"],setup(r,{emit:e}){const t=r,n=e,i=Ch(),s=je([]),o=je(!1),l=je(!1),a=je(""),u=je([]),c=je(null),d=je(null),f=je(!1);let h=null;const m=ee(()=>t.accept==="image"?"image/*":t.accept==="document"?"application/pdf":void 0),p=ee(()=>{const T=a.value.trim().toLowerCase();return s.value.filter(I=>t.accept==="image"&&!y(I)||t.accept==="document"&&y(I)?!1:!T||I.path.toLowerCase().includes(T))}),g=ee(()=>u.value.length>0),y=T=>T.mimeType.startsWith("image/");async function x(){o.value=!0;try{s.value=(await gr.media.list()).items}catch(T){i.error(T instanceof ql?T.message:"Could not load the media library.")}finally{o.value=!1}}si(()=>t.open,async T=>{var I,O;if(!T){document.body.style.overflow="",h==null||h.focus();return}h=document.activeElement,document.body.style.overflow="hidden",u.value=[],a.value="",await x(),await Ou(),(O=(I=c.value)==null?void 0:I.querySelector("input, button"))==null||O.focus()}),Yi(()=>{document.body.style.overflow=""});function k(T){if(!t.multiple){n("choose",[T]),n("close");return}u.value=u.value.includes(T.path)?u.value.filter(I=>I!==T.path):[...u.value,T.path]}function A(){const T=new Map(s.value.map(O=>[O.path,O])),I=u.value.map(O=>T.get(O)).filter(O=>O!==void 0);n("choose",I),n("close")}async function v(T){const I=Array.from(T??[]);if(I.length!==0){l.value=!0;try{const{items:O}=await gr.media.upload(I,{accept:t.accept});if(!t.multiple){O[0]&&n("choose",[O[0]]),n("close");return}await x(),u.value=[...u.value,...O.map(z=>z.path)],i.success(`Uploaded ${O.length} file${O.length===1?"":"s"}.`)}catch(O){i.error(O instanceof ql?O.message:"The upload failed.")}finally{l.value=!1,d.value&&(d.value.value="")}}}function S(T){var I;f.value=!1,v(((I=T.dataTransfer)==null?void 0:I.files)??null)}function D(T){if(T.key==="Escape"){n("close");return}if(T.key!=="Tab"||!c.value)return;const I=c.value.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])'),O=I[0],z=I[I.length-1];!O||!z||(T.shiftKey&&document.activeElement===O?(T.preventDefault(),z.focus()):!T.shiftKey&&document.activeElement===z&&(T.preventDefault(),O.focus()))}const _=T=>T<1024*1024?`${Math.round(T/1024)} KB`:`${(T/1024/1024).toFixed(1)} MB`,$=T=>{const I=T.split("/");return I.pop(),I.join("/")||"/"};return(T,I)=>(q(),rt(kh,{to:"body"},[r.open?(q(),W("div",{key:0,class:"fixed inset-0 z-50 flex items-end justify-center bg-ink/40 p-0 sm:items-center sm:p-6",onClick:I[6]||(I[6]=$n(O=>n("close"),["self"])),onKeydown:D},[j("div",{ref_key:"dialog",ref:c,role:"dialog","aria-modal":"true","aria-labelledby":"media-picker-title",class:"flex max-h-[90vh] w-full max-w-4xl flex-col rounded-t-xl border border-line bg-raised shadow-2xl sm:rounded-xl"},[j("header",bp,[I[8]||(I[8]=j("h2",{id:"media-picker-title",class:"text-base font-semibold"},"Media",-1)),vh(j("input",{"onUpdate:modelValue":I[0]||(I[0]=O=>a.value=O),type:"search",placeholder:"Search files…",class:"input ml-auto max-w-56","aria-label":"Search media"},null,512),[[xh,a.value]]),j("button",{type:"button",class:"btn-ghost -mr-2 px-2",onClick:I[1]||(I[1]=O=>n("close"))},[Rt(N(Nu),{size:20,"aria-hidden":"true"}),I[7]||(I[7]=j("span",{class:"sr-only"},"Close",-1))])]),j("div",{class:Ae(["min-h-0 flex-1 overflow-y-auto p-5",f.value&&"bg-accent-soft"]),onDragover:I[3]||(I[3]=$n(O=>f.value=!0,["prevent"])),onDragleave:I[4]||(I[4]=$n(O=>f.value=!1,["prevent"])),onDrop:$n(S,["prevent"])},[j("label",kp,[j("input",{ref_key:"fileInput",ref:d,type:"file",class:"sr-only",accept:m.value,multiple:r.multiple,disabled:l.value,onChange:I[2]||(I[2]=O=>v(O.target.files))},null,40,vp),j("span",xp,Q(l.value?"Uploading…":"Drop files here, or choose from your device"),1),j("span",Cp,Q(r.accept==="image"?"Images":r.accept==="document"?"PDF documents":"Images and documents"),1)]),o.value?(q(),W("p",Ap,"Loading…")):p.value.length===0?(q(),W("p",wp,Q(a.value?`Nothing matches "${a.value}".`:"No files yet."),1)):(q(),W("ul",Ep,[(q(!0),W(Ye,null,ut(p.value,O=>(q(),W("li",{key:O.path},[j("button",{type:"button","aria-pressed":u.value.includes(O.path)||r.selected.includes(O.path),class:Ae(["group block w-full overflow-hidden rounded-lg border text-left transition",u.value.includes(O.path)?"border-accent ring-2 ring-accent/25":r.selected.includes(O.path)?"border-accent/50":"border-line hover:border-accent/40"]),onClick:z=>k(O)},[j("span",Dp,[y(O)?(q(),W("img",{key:0,src:N(gr).media.url(O.path),alt:"",loading:"lazy",class:"h-full w-full object-cover"},null,8,_p)):(q(),W("span",Tp,Q(O.mimeType.split("/")[1]),1))]),j("span",Mp,[j("span",Op,Q(O.filename),1),j("span",{class:"block truncate text-[11px] text-muted",title:O.path},Q($(O.path)),9,Np),j("span",Ip,Q(O.width?`${O.width}×${O.height} · `:"")+Q(_(O.size)),1)])],10,Sp)]))),128))]))],34),r.multiple?(q(),W("footer",Bp,[j("span",Fp,Q(u.value.length)+" selected ",1),j("div",Rp,[j("button",{type:"button",class:"btn-secondary",onClick:I[5]||(I[5]=O=>n("close"))},"Cancel"),j("button",{type:"button",class:"btn-primary",disabled:!g.value,onClick:A}," Add "+Q(u.value.length||""),9,$p)])])):ge("",!0)],512)],32)):ge("",!0)]))}}),Lp=["aria-describedby"],zp={class:"aspect-4/3"},qp=["src"],Vp={key:1,class:"flex h-full w-full flex-col items-center justify-center gap-1 p-2 text-center"},jp={class:"text-[11px] font-semibold uppercase text-muted"},Hp=["title"],Up={class:"absolute inset-x-0 top-0 flex justify-end gap-0.5 bg-gradient-to-b from-ink/50 to-transparent p-1 opacity-0 transition group-hover:opacity-100 group-focus-within:opacity-100"},Wp=["disabled","onClick"],Kp={class:"sr-only"},Jp=["disabled","onClick"],Gp={class:"sr-only"},Zp=["disabled","onClick"],Yp={class:"sr-only"},Qp=["id","disabled"],Xp={key:1,class:"ml-2 text-xs text-muted"},em=Pe({__name:"MediaField",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=je(!1),f=ee(()=>i.value.multiple?Array.isArray(t.modelValue)?t.modelValue:[]:typeof t.modelValue=="string"&&t.modelValue?[t.modelValue]:[]),h=ee(()=>f.value.map(x=>({path:x,filename:x.split("/").pop()??x,url:gr.media.url(x),isImage:/\.(jpe?g|png|webp|avif|gif)$/i.test(x)}))),m=ee(()=>i.value.multiple&&i.value.max!==void 0&&f.value.length>=i.value.max);function p(x){var A;if(!i.value.multiple){n("update:modelValue",((A=x[0])==null?void 0:A.path)??null);return}const k=[...f.value];for(const v of x)k.includes(v.path)||k.push(v.path);n("update:modelValue",i.value.max?k.slice(0,i.value.max):k)}function g(x){if(!i.value.multiple){n("update:modelValue",null);return}n("update:modelValue",f.value.filter((k,A)=>A!==x))}function y(x,k){const A=x+k;if(A<0||A>=f.value.length)return;const v=[...f.value];[v[x],v[A]]=[v[A],v[x]],n("update:modelValue",v)}return(x,k)=>(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",{"aria-describedby":N(a)},[h.value.length?(q(),W("ul",{key:0,class:Ae(["mb-2 gap-2",i.value.multiple?"grid grid-cols-3 sm:grid-cols-5":"flex"])},[(q(!0),W(Ye,null,ut(h.value,(A,v)=>(q(),W("li",{key:`${A.path}-${v}`,class:Ae(["group relative overflow-hidden rounded-lg border border-line bg-canvas",i.value.multiple?"":"w-40"])},[j("div",zp,[A.isImage?(q(),W("img",{key:0,src:A.url,alt:"",class:"h-full w-full object-cover"},null,8,qp)):(q(),W("div",Vp,[j("span",jp,Q(A.filename.split(".").pop()),1)]))]),j("p",{class:"truncate px-1.5 py-1 text-[11px] text-muted",title:A.path},Q(A.filename),9,Hp),j("div",Up,[i.value.multiple&&v>0?(q(),W("button",{key:0,type:"button",class:"rounded-sm bg-raised/90 px-1.5 text-xs font-semibold hover:bg-raised",disabled:r.disabled,onClick:S=>y(v,-1)},[Rt(N(Ph),{size:14,"aria-hidden":"true"}),j("span",Kp,"Move "+Q(A.filename)+" earlier",1)],8,Wp)):ge("",!0),i.value.multiple&&v<h.value.length-1?(q(),W("button",{key:1,type:"button",class:"rounded-sm bg-raised/90 px-1.5 text-xs font-semibold hover:bg-raised",disabled:r.disabled,onClick:S=>y(v,1)},[Rt(N(Fh),{size:14,"aria-hidden":"true"}),j("span",Gp,"Move "+Q(A.filename)+" later",1)],8,Jp)):ge("",!0),j("button",{type:"button",class:"rounded-sm bg-raised/90 px-1.5 text-xs font-semibold text-danger hover:bg-raised",disabled:r.disabled,onClick:S=>g(v)},[Rt(N(Nu),{size:14,"aria-hidden":"true"}),j("span",Yp,"Remove "+Q(A.filename),1)],8,Zp)])],2))),128))],2)):ge("",!0),j("button",{id:N(s),type:"button",class:"btn-secondary",disabled:r.disabled||i.value.readonly||m.value,onClick:k[0]||(k[0]=A=>d.value=!0)},[Rt(N(Rh),{size:16,"aria-hidden":"true"}),_o(" "+Q(h.value.length&&!i.value.multiple?"Replace":"Add"),1)],8,Qp),m.value?(q(),W("span",Xp," Maximum of "+Q(i.value.max)+" reached. ",1)):ge("",!0)],8,Lp),Rt(Pp,{open:d.value,accept:i.value.accept??"any",multiple:i.value.multiple,selected:f.value,onClose:k[1]||(k[1]=A=>d.value=!1),onChoose:p},null,8,["open","accept","multiple","selected"])]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),tm={class:"relative"},rm=["id","value","min","max","step","required","disabled","aria-invalid","aria-describedby"],nm={key:0,class:"pointer-events-none absolute inset-y-0 right-3 flex items-center text-sm text-muted"},im=Pe({__name:"NumberField",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=="number"?String(t.modelValue):"");function f(h){const m=h.target.value;if(m.trim()===""){n("update:modelValue",null);return}const p=Number(m);n("update:modelValue",Number.isFinite(p)?p:null)}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(()=>[j("div",tm,[j("input",{id:N(s),type:"number",inputmode:"decimal",value:d.value,min:i.value.min,max:i.value.max,step:i.value.step??(i.value.integer?1:"any"),required:i.value.required,disabled:r.disabled||i.value.readonly,"aria-invalid":N(l)?"true":void 0,"aria-describedby":N(a),class:Ae(["input",i.value.unit&&"pr-12",N(l)&&"input-invalid"]),onInput:f},null,42,rm),i.value.unit?(q(),W("span",nm,Q(i.value.unit),1)):ge("",!0)])]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),sm={key:0,class:"text-sm text-muted"},om={key:1,class:"text-sm text-muted"},lm=["aria-describedby"],am={class:"sr-only"},um=["checked","disabled","onChange"],cm={class:"min-w-0 flex-1 truncate"},dm={class:"shrink-0 font-mono text-[11px] text-muted"},fm=["id","value","disabled","aria-invalid","aria-describedby"],hm=["value"],pm=Pe({__name:"RelationField",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=Ah(),f=je([]),h=je(!0),m=ee(()=>{var k;return((k=d.collection(i.value.collection))==null?void 0:k.label)??i.value.collection});To(async()=>{try{f.value=(await gr.entries.list(i.value.collection)).items}finally{h.value=!1}});const p=ee(()=>i.value.multiple?Array.isArray(t.modelValue)?t.modelValue:[]:typeof t.modelValue=="string"?[t.modelValue]:[]),g=k=>{var A;return((A=f.value.find(v=>v.slug===k))==null?void 0:A.title)??k},y=k=>!h.value&&!f.value.some(A=>A.slug===k);function x(k){const A=p.value.includes(k)?p.value.filter(v=>v!==k):[...p.value,k];n("update:modelValue",A)}return(k,A)=>(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(()=>[h.value?(q(),W("p",sm,"Loading "+Q(m.value)+"…",1)):f.value.length===0?(q(),W("p",om," There are no entries in "+Q(m.value)+" yet. ",1)):(q(),W(Ye,{key:2},[i.value.multiple?(q(),W("fieldset",{key:0,class:"space-y-1.5","aria-describedby":N(a)},[j("legend",am,Q(N(o)),1),(q(!0),W(Ye,null,ut(f.value,v=>(q(),W("label",{key:v.slug,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:p.value.includes(v.slug),disabled:r.disabled||i.value.readonly,class:"h-4 w-4 rounded-sm border-line text-accent focus:ring-ink/20",onChange:S=>x(v.slug)},null,40,um),j("span",cm,Q(v.title),1),j("span",dm,Q(v.slug),1)]))),128))],8,lm)):(q(),W("select",{key:1,id:N(s),value:p.value[0]??"",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:A[0]||(A[0]=v=>n("update:modelValue",v.target.value||null))},[A[1]||(A[1]=j("option",{value:""},"Not set",-1)),(q(!0),W(Ye,null,ut(f.value,v=>(q(),W("option",{key:v.slug,value:v.slug},Q(v.title),9,hm))),128))],42,fm))],64)),(q(!0),W(Ye,null,ut(p.value.filter(y),v=>(q(),W("p",{key:v,class:"field-error"},' "'+Q(g(v))+'" is no longer in '+Q(m.value)+". ",1))),128))]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}});function Ne(r){this.content=r}Ne.prototype={constructor:Ne,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),s=n.content.slice();return i==-1?s.push(t||r,e):(s[i+1]=e,t&&(s[i]=t)),new Ne(s)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ne(t)},addToStart:function(r,e){return new Ne([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new Ne(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),s=n.find(r);return i.splice(s==-1?i.length:s,0,e,t),new Ne(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=Ne.from(r),r.size?new Ne(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=Ne.from(r),r.size?new Ne(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=Ne.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}};Ne.from=function(r){if(r instanceof Ne)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new Ne(e)};function Bu(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),s=e.child(n);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){let o=i.text,l=s.text,a=0;for(;o[a]==l[a];a++)t++;return a&&a<o.length&&a<l.length&&$u(o.charCodeAt(a-1))&&Ru(o.charCodeAt(a))&&t--,t}if(i.content.size||s.content.size){let o=Bu(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Fu(r,e,t,n){for(let i=r.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:n};let o=r.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,n-=a;continue}if(!o.sameMarkup(l))return{a:t,b:n};if(o.isText&&o.text!=l.text){let u=o.text,c=l.text,d=u.length,f=c.length;for(;d>0&&f>0&&u[d-1]==c[f-1];)d--,f--,t--,n--;return d&&f&&d<u.length&&$u(u.charCodeAt(d-1))&&Ru(u.charCodeAt(d))&&(t++,n++),{a:t,b:n}}if(o.content.size||l.content.size){let u=Fu(o.content,l.content,t-1,n-1);if(u)return u}t-=a,n-=a}}function Ru(r){return r>=56320&&r<57344}function $u(r){return r>=55296&&r<56320}class R{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],u=l+a.nodeSize;if(u>e&&n(a,i+l,s||null,o)!==!1&&a.content.size){let c=l+1;a.nodesBetween(Math.max(0,e-c),Math.min(a.content.size,t-c),n,i+c)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let u=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&n&&(o?o=!1:s+=n),s+=u},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new R(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),n.push(l),i+=l.nodeSize),o=a}return new R(n,i)}cutByIndex(e,t){return e==t?R.empty:e==0&&t==this.content.length?this:new R(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new R(i,s)}addToStart(e){return new R([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new R(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return Bu(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Fu(this,e,t,n)}findIndex(e){if(e==0)return Pn(0,e);if(e==this.size)return Pn(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let i=this.child(t),s=n+i.nodeSize;if(s>=e)return s==e?Pn(t+1,s):Pn(t,n);n=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return R.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return R.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return R.empty;let t,n=0;for(let i=0;i<e.length;i++){let s=e[i];n+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new R(t||e,n)}static from(e){if(!e)return R.empty;if(e instanceof R)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new R([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}R.empty=new R([],0);const ys={index:0,offset:0};function Pn(r,e){return ys.index=r,ys.offset=e,ys}function oi(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!oi(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!oi(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let fe=class Ws{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!n&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(s)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&oi(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=n.create(t.attrs);return n.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ws.none;if(e instanceof Ws)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};fe.none=[];class fn extends Error{}class H{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Lu(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return n&&new H(n,this.openStart,this.openEnd)}removeBetween(e,t){return new H(Pu(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return H.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new H(R.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)n++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new H(e,n,i)}}H.empty=new H(R.empty,0,0);function Pu(r,e,t){let{index:n,offset:i}=r.findIndex(e),s=r.maybeChild(n),{index:o,offset:l}=r.findIndex(t);if(i==e||s.isText){if(l!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,s.copy(Pu(s.content,e-i-1,t-i-1)))}function Lu(r,e,t,n,i,s){let{index:o,offset:l}=r.findIndex(e),a=r.maybeChild(o);if(l==e||a.isText)return s&&n<=0&&i<=0&&!s.canReplace(o,o,t)?null:r.cut(0,e).append(t).append(r.cut(e));let u=Lu(a.content,e-l-1,t,o==0?n-1:0,o==r.childCount-1?i-1:0,a);return u&&r.replaceChild(o,a.copy(u))}function mm(r,e,t){if(t.openStart>r.depth)throw new fn("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new fn("Inconsistent open depths");return zu(r,e,t,0)}function zu(r,e,t,n){let i=r.index(n),s=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=zu(r,e,t,n+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,l=o.content;return br(o,l.cut(0,r.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=gm(t,r);return br(s,Vu(r,o,l,e,n))}else return br(s,li(r,e,n))}function qu(r,e){if(!e.type.compatibleContent(r.type))throw new fn("Cannot join "+e.type.name+" onto "+r.type.name)}function Ks(r,e,t){let n=r.node(t);return qu(n,e.node(t)),n}function yr(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function tn(r,e,t,n){let i=(e||r).node(t),s=0,o=e?e.index(t):i.childCount;r&&(s=r.index(t),r.depth>t?s++:r.textOffset&&(yr(r.nodeAfter,n),s++));for(let l=s;l<o;l++)yr(i.child(l),n);e&&e.depth==t&&e.textOffset&&yr(e.nodeBefore,n)}function br(r,e){if(!r.type.validContent(e))throw new fn("Invalid content for node "+r.type.name);return r.copy(e)}function Vu(r,e,t,n,i){let s=r.depth>i&&Ks(r,e,i+1),o=n.depth>i&&Ks(t,n,i+1),l=[];return tn(null,r,i,l),s&&o&&e.index(i)==t.index(i)?(qu(s,o),yr(br(s,Vu(r,e,t,n,i+1)),l)):(s&&yr(br(s,li(r,e,i+1)),l),tn(e,t,i,l),o&&yr(br(o,li(t,n,i+1)),l)),tn(n,null,i,l),new R(l)}function li(r,e,t){let n=[];if(tn(null,r,t,n),r.depth>t){let i=Ks(r,e,t+1);yr(br(i,li(r,e,t+1)),n)}return tn(e,null,t,n),new R(n)}function gm(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(R.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class hn{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=e.child(t);return n?e.child(t).cut(n):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=n.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return fe.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let l=n;n=i,i=l}let s=n.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<n.length;s++)n[s].type.spec.inclusive===!1&&(!i||!n[s].isInSet(i.marks))&&(n=n[s--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new ai(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),u=s-a;if(n.push(o,l,i+a),!u||(o=o.child(l),o.isText))break;s=u-1,i+=a+1}return new hn(t,n,s)}static resolveCached(e,t){let n=Wl.get(e);if(n)for(let s=0;s<n.elts.length;s++){let o=n.elts[s];if(o.pos==t)return o}else Wl.set(e,n=new ym);let i=n.elts[n.i]=hn.resolve(e,t);return n.i=(n.i+1)%bm,i}}class ym{constructor(){this.elts=[],this.i=0}}const bm=12,Wl=new WeakMap;class ai{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const km=Object.create(null);let Yt=class Js{constructor(e,t,n,i=fe.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||R.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,i=0){this.content.nodesBetween(e,t,n,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,i){return this.content.textBetween(e,t,n,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&oi(this.attrs,t||e.defaultAttrs||km)&&fe.sameSet(this.marks,n||fe.none)}copy(e=null){return e==this.content?this:new Js(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Js(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return H.empty;let i=this.resolve(e),s=this.resolve(t),o=n?0:i.sharedDepth(t),l=i.start(o),u=i.node(o).content.cut(i.pos-l,s.pos-l);return new H(u,i.depth-o,s.depth-o)}replace(e,t,n){return mm(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return hn.resolveCached(this,e)}resolveNoCache(e){return hn.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(n.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),ju(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=R.empty,i=0,s=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(n.child(a).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(n),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=fe.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!fe.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let i=R.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,n);return s.type.checkAttrs(s.attrs),s}};Yt.prototype.text=void 0;class ui extends Yt{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ju(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ui(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ui(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function ju(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class Ar{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new vm(e,t);if(n.next==null)return Ar.empty;let i=Hu(n);n.next&&n.err("Unexpected trailing text");let s=Dm(Sm(i));return _m(s,n),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let i=this;for(let s=t;i&&s<n;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let i=[this];function s(o,l){let a=o.matchFragment(e,n);if(a&&(!t||a.validEnd))return R.from(l.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:c,next:d}=o.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=s(d,l.concat(c));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let i=n.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(n.push({match:l.contentMatch,type:l,via:i}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let s=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)s+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return s}).join(`
8
8
  `)}}Ar.empty=new Ar(!0);class vm{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Hu(r){let e=[];do e.push(xm(r));while(r.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function xm(r){let e=[];do e.push(Cm(r));while(r.next&&r.next!=")"&&r.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Cm(r){let e=Em(r);for(;;)if(r.eat("+"))e={type:"plus",expr:e};else if(r.eat("*"))e={type:"star",expr:e};else if(r.eat("?"))e={type:"opt",expr:e};else if(r.eat("{"))e=Am(r,e);else break;return e}function Kl(r){/\D/.test(r.next)&&r.err("Expected number, got '"+r.next+"'");let e=Number(r.next);return r.pos++,e}function Am(r,e){let t=Kl(r),n=t;return r.eat(",")&&(r.next!="}"?n=Kl(r):n=-1),r.eat("}")||r.err("Unclosed braced range"),{type:"range",min:t,max:n,expr:e}}function wm(r,e){let t=r.nodeTypes,n=t[e];if(n)return[n];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&r.err("No node type or group '"+e+"' found"),i}function Em(r){if(r.eat("(")){let e=Hu(r);return r.eat(")")||r.err("Missing closing paren"),e}else if(/\W/.test(r.next))r.err("Unexpected token '"+r.next+"'");else{let e=wm(r,r.next).map(t=>(r.inline==null?r.inline=t.isInline:r.inline!=t.isInline&&r.err("Mixing inline and block content"),{type:"name",value:t}));return r.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Sm(r){let e=[[]];return i(s(r,0),t()),e;function t(){return e.push([])-1}function n(o,l,a){let u={term:a,to:l};return e[o].push(u),u}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,u)=>a.concat(s(u,l)),[]);if(o.type=="seq")for(let a=0;;a++){let u=s(o.exprs[a],l);if(a==o.exprs.length-1)return u;i(u,l=t())}else if(o.type=="star"){let a=t();return n(l,a),i(s(o.expr,a),a),[n(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[n(a)]}else{if(o.type=="opt")return[n(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let u=0;u<o.min;u++){let c=t();i(s(o.expr,a),c),a=c}if(o.max==-1)i(s(o.expr,a),a);else for(let u=o.min;u<o.max;u++){let c=t();n(a,c),i(s(o.expr,a),c),a=c}return[n(a)]}else{if(o.type=="name")return[n(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Uu(r,e){return e-r}function Jl(r,e){let t=[];return n(e),t.sort(Uu);function n(i){let s=r[i];if(s.length==1&&!s[0].term)return n(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:l,to:a}=s[o];!l&&t.indexOf(a)==-1&&n(a)}}}function Dm(r){let e=Object.create(null);return t(Jl(r,0));function t(n){let i=[];n.forEach(o=>{r[o].forEach(({term:l,to:a})=>{if(!l)return;let u;for(let c=0;c<i.length;c++)i[c][0]==l&&(u=i[c][1]);Jl(r,a).forEach(c=>{u||i.push([l,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let s=e[n.join(",")]=new Ar(n.indexOf(r.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(Uu);s.next.push({type:i[o][0],next:e[l.join(",")]||t(l)})}return s}}function _m(r,e){for(let t=0,n=[r];t<n.length;t++){let i=n[t],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:a,next:u}=i.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),n.indexOf(u)==-1&&n.push(u)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Wu(r){let e=Object.create(null);for(let t in r){let n=r[t];if(!n.hasDefault)return null;e[t]=n.default}return e}function Ku(r,e){let t=Object.create(null);for(let n in r){let i=e&&e[n];if(i===void 0){let s=r[n];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+n)}t[n]=i}return t}function Ju(r,e,t,n){for(let i in e)if(!(i in r))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${n}`);for(let i in r)r[i].validate&&r[i].validate(e[i])}function Gu(r,e){let t=Object.create(null);if(e)for(let n in e)t[n]=new Mm(r,n,e[n]);return t}let Gl=class Zu{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=Gu(e,n.attrs),this.defaultAttrs=Wu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ar.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Ku(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Yt(this,this.computeAttrs(e),R.from(t),fe.setFrom(n))}createChecked(e=null,t,n){return t=R.from(t),this.checkContent(t),new Yt(this,this.computeAttrs(e),t,fe.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=R.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(R.empty,!0);return s?new Yt(this,e,t.append(s),fe.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ju(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:fe.none:e}static compile(e,t){let n=Object.create(null);e.forEach((s,o)=>n[s]=new Zu(s,t,o));let i=t.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let s in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function Tm(r,e,t){let n=t.split("|");return i=>{let s=i===null?"null":typeof i;if(n.indexOf(s)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${r}, got ${s}`)}}class Mm{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?Tm(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class Qi{constructor(e,t,n,i){this.name=e,this.rank=t,this.schema=n,this.spec=i,this.attrs=Gu(e,i.attrs),this.excluded=null;let s=Wu(this.attrs);this.instance=s?new fe(this,s):null}create(e=null){return!e&&this.instance?this.instance:new fe(this,Ku(this.attrs,e))}static compile(e,t){let n=Object.create(null),i=0;return e.forEach((s,o)=>n[s]=new Qi(s,i++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Ju(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Yu{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Ne.from(e.nodes),t.marks=Ne.from(e.marks||{}),this.nodes=Gl.compile(this.spec.nodes,this),this.marks=Qi.compile(this.spec.marks,this);let n=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=n[o]||(n[o]=Ar.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?Zl(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Zl(this,o.split(" "))}this.nodeFromJSON=i=>Yt.fromJSON(this,i),this.markFromJSON=i=>fe.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Gl){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,n,i)}text(e,t){let n=this.nodes.text;return new ui(n,n.defaultAttrs,e,fe.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Zl(r,e){let t=[];for(let n=0;n<e.length;n++){let i=e[n],s=r.marks[i],o=s;if(s)t.push(s);else for(let l in r.marks){let a=r.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return t}function Om(r){return r.tag!=null}function Nm(r){return r.style!=null}class Qt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(i=>{if(Om(i))this.tags.push(i);else if(Nm(i)){let s=/[^=]*/.exec(i.style)[0];n.indexOf(s)<0&&n.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let n=new Ql(this,t,!1);return n.addAll(e,fe.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Ql(this,t,!0);return n.addAll(e,fe.none,t.from,t.to),H.maxOpen(n.finish())}matchTag(e,t,n){for(let i=n?this.tags.indexOf(n)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(Fm(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,n,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!n.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function n(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{n(o=Xl(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{n(o=Xl(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Qt(e,Qt.schemaRules(e)))}}const Qu={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Im={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Xu={ol:!0,ul:!0},pn=1,Gs=2,rn=4;function Yl(r,e,t){return e!=null?(e?pn:0)|(e==="full"?Gs:0):r&&r.whitespace=="pre"?pn|Gs:t&~rn}class Ln{constructor(e,t,n,i,s,o){this.type=e,this.attrs=t,this.marks=n,this.solid=i,this.options=o,this.content=[],this.activeMarks=fe.none,this.match=s||(o&rn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(R.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let n=this.type.contentMatch,i;return(i=n.findWrapping(e.type))?(this.match=n,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&pn)){let n=this.content[this.content.length-1],i;if(n&&n.isText&&(i=/[ \t\r\n\u000c]+$/.exec(n.text))){let s=n;n.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=R.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(R.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Qu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ql{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=Yl(null,t.preserveWhitespace,0)|(n?rn:0);i?s=new Ln(i.type,i.attrs,fe.none,!0,t.topMatch||i.type.contentMatch,o):n?s=new Ln(null,null,fe.none,!0,null,o):s=new Ln(e.schema.topNodeType,null,fe.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,i=this.top,s=i.options&Gs?"full":this.localPreserveWS||(i.options&pn)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(s)if(s==="full")n=n.replace(/\r\n?/g,`
9
9
  `);else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=n.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(o.text(l[a]),t,!/\S/.test(l[a]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let l=i.content[i.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;Xu.hasOwnProperty(o)&&this.parser.normalizeLists&&Bm(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,n));e:if(a?a.ignore:Im.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let u,c=this.needsBlock;if(Qu.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),u=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=a&&a.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),u&&this.sync(s),this.needsBlock=c}else{let u=this.readStyles(e,t);u&&this.addElementByRule(e,a,u,a.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
10
10
  `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=n.getPropertyValue(s);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(s,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(u=>!a.clearMark(u)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,n,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let a=this.enter(o,t.attrs||null,n,t.preserveWhitespace);a&&(s=!0,n=a)}else{let a=this.parser.schema.marks[t.mark];n=n.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,n,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,n,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,n),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,t,n,i){let s=n||0;for(let o=n?e.childNodes[n]:e.firstChild,l=i==null?null:e.childNodes[i];o!=l;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,n){let i,s;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],u=a.findWrapping(e);if(u&&(!i||i.length>u.length+l)&&(i=u,s=a,!u.length))break;if(a.solid){if(n)break;l+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,n);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=fe.none;for(let l of i.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):ea(l.type,e.type))&&(o=l.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,n,i){let s=this.findPlace(e.create(t),n,!1);return s&&(s=this.enterInner(e,t,n,!0,i)),s}enterInner(e,t,n,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=Yl(e,s,o.options);o.options&rn&&o.content.length==0&&(l|=rn);let a=fe.none;return n=n.filter(u=>(o.type?o.type.allowsMarkType(u.type):ea(u.type,e))?(a=u.addToSet(a),!1):!0),this.nodes.push(new Ln(e,t,a,i,null,l)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=pn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let i=n.length-1;i>=0;i--)e+=n[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(n?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,i=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),s=-(n?n.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let u=t[l];if(u==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let c=a>0||a==0&&i?this.nodes[a].type:n&&a>=s?n.node(a-s).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let n=this.parser.schema.nodes[t];if(n.isTextblock&&n.defaultAttrs)return n}}}function Bm(r){for(let e=r.firstChild,t=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&Xu.hasOwnProperty(n)&&t?(t.appendChild(e),e=t):n=="li"?t=e:n&&(t=null)}}function Fm(r,e){return(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,e)}function Xl(r){let e={};for(let t in r)e[t]=r[t];return e}function ea(r,e){let t=e.schema.nodes;for(let n in t){let i=t[n];if(!i.allowsMarkType(r))continue;let s=[],o=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:u,next:c}=l.edge(a);if(u==e||s.indexOf(c)<0&&o(c))return!0}};if(o(i.contentMatch))return!0}}class Dr{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=zn(t).createDocumentFragment());let i=n,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,a=0;for(;l<s.length&&a<o.marks.length;){let u=o.marks[a];if(!this.marks[u.type.name]){a++;continue}if(!u.eq(s[l][0])||u.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)i=s.pop()[1];for(;a<o.marks.length;){let u=o.marks[a++],c=this.serializeMark(u,o.isInline,t);c&&(s.push([u,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),n}serializeNodeInner(e,t){if(e.isText)return zn(t).createTextNode(e.text);let{dom:n,contentDOM:i}=Qn(zn(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(n),n=s.dom)}return n}serializeMark(e,t,n={}){let i=this.marks[e.type.name];return i&&Qn(zn(n),i(e,t),null,e.attrs)}static renderSpec(e,t,n=null,i){return typeof t=="string"?{dom:e.createTextNode(t)}:Qn(e,t,n,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Dr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=ta(e.nodes);return t.text||(t.text=n=>n.text),t}static marksFromSchema(e){return ta(e.marks)}}function ta(r){let e={};for(let t in r){let n=r[t].spec.toDOM;n&&(e[t]=n)}return e}function zn(r){return r.document||window.document}const ra=new WeakMap;function Rm(r){let e=ra.get(r);return e===void 0&&ra.set(r,e=$m(r)),e}function $m(r){let e=null;function t(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let i=0;i<n.length;i++)t(n[i]);else for(let i in n)t(n[i])}return t(r),e}function Qn(r,e,t,n){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(s=Rm(n))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let l,a=t?r.createElementNS(t,i):r.createElement(i),u=e[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let d in u)if(u[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),u[d]):d=="style"&&a.style?a.style.cssText=u[d]:a.setAttribute(d,u[d])}}for(let d=c;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else if(typeof f=="string")a.appendChild(r.createTextNode(f));else{let{dom:h,contentDOM:m}=Qn(r,f,t,n);if(a.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const ec=65535,tc=Math.pow(2,16);function Pm(r,e){return r+e*tc}function na(r){return r&ec}function Lm(r){return(r-(r&ec))/tc}const rc=1,nc=2,Xn=4,ic=8;class Zs{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&ic)>0}get deletedBefore(){return(this.delInfo&(rc|Xn))>0}get deletedAfter(){return(this.delInfo&(nc|Xn))>0}get deletedAcross(){return(this.delInfo&Xn)>0}}class et{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&et.empty)return et.empty}recover(e){let t=0,n=na(e);if(!this.inverted)for(let i=0;i<n;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[n*3]+t+Lm(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let u=this.ranges[l+s],c=this.ranges[l+o],d=a+u;if(e<=d){let f=u?e==a?-1:e==d?1:t:t,h=a+i+(f<0?0:c);if(n)return h;let m=e==(t<0?a:d)?null:Pm(l/3,e-a),p=e==a?nc:e==d?rc:Xn;return(t<0?e!=a:e!=d)&&(p|=ic),new Zs(h,p,m)}i+=c-u}return n?e+i:new Zs(e+i,0,null)}touches(e,t){let n=0,i=na(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?n:0);if(a>e)break;let u=this.ranges[l+s],c=a+u;if(e<=c&&l==i*3)return!0;n+=this.ranges[l+o]-u}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],l=o-(this.inverted?s:0),a=o+(this.inverted?0:s),u=this.ranges[i+t],c=this.ranges[i+n];e(l,l+u,a,a+c),s+=c-u}}invert(){return new et(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?et.empty:new et(e<0?[0,-e,0]:[0,0,e])}}et.empty=new et([]);class mn{constructor(e,t,n=0,i=e?e.length:0){this.mirror=t,this.from=n,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new mn(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?n+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?n-i-1:void 0)}}invert(){let e=new mn;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this._maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return n?e:new Zs(e,i,null)}}const bs=Object.create(null);class Ve{getMap(){return et.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=bs[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in bs)throw new RangeError("Duplicate use of step JSON ID "+e);return bs[e]=t,t.prototype.jsonID=e,t}}class Ce{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Ce(e,null)}static fail(e){return new Ce(null,e)}static fromReplace(e,t,n,i){try{return Ce.ok(e.replace(t,n,i))}catch(s){if(s instanceof fn)return Ce.fail(s.message);throw s}}}function Mo(r,e,t){let n=[];for(let i=0;i<r.childCount;i++){let s=r.child(i);s.content.size&&(s=s.copy(Mo(s.content,e,s))),s.isInline&&(s=e(s,t,i)),n.push(s)}return R.fromArray(n)}class Gt extends Ve{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),i=n.node(n.sharedDepth(this.to)),s=new H(Mo(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return Ce.fromReplace(e,this.from,this.to,s)}invert(){return new wt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Gt(t.pos,n.pos,this.mark)}merge(e){return e instanceof Gt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Gt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Gt(t.from,t.to,e.markFromJSON(t.mark))}}Ve.jsonID("addMark",Gt);class wt extends Ve{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new H(Mo(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return Ce.fromReplace(e,this.from,this.to,n)}invert(){return new Gt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new wt(t.pos,n.pos,this.mark)}merge(e){return e instanceof wt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new wt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new wt(t.from,t.to,e.markFromJSON(t.mark))}}Ve.jsonID("removeMark",wt);class Zt extends Ve{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Ce.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Ce.fromReplace(e,this.pos,this.pos+1,new H(R.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(n))return new Zt(this.pos,t.marks[i]);return new Zt(this.pos,this.mark)}}return new wr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Zt(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Zt(t.pos,e.markFromJSON(t.mark))}}Ve.jsonID("addNodeMark",Zt);class wr extends Ve{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Ce.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Ce.fromReplace(e,this.pos,this.pos+1,new H(R.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Zt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new wr(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new wr(t.pos,e.markFromJSON(t.mark))}}Ve.jsonID("removeNodeMark",wr);class xe extends Ve{constructor(e,t,n,i=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=i}apply(e){return this.structure&&Ys(e,this.from,this.to)?Ce.fail("Structure replace would overwrite content"):Ce.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new et([this.from,this.to-this.from,this.slice.size])}invert(e){return new xe(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&xe.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new xe(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof xe)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new xe(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new xe(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new xe(t.from,t.to,H.fromJSON(e,t.slice),!!t.structure)}}xe.MAP_BIAS=1;Ve.jsonID("replace",xe);class De extends Ve{constructor(e,t,n,i,s,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=i,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Ys(e,this.from,this.gapFrom)||Ys(e,this.gapTo,this.to)))return Ce.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Ce.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?Ce.fromReplace(e,this.from,this.to,n):Ce.fail("Content does not fit in gap")}getMap(){return new et([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new De(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||i<t.pos||s>n.pos?null:new De(t.pos,n.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new De(t.from,t.to,t.gapFrom,t.gapTo,H.fromJSON(e,t.slice),t.insert,!!t.structure)}}Ve.jsonID("replaceAround",De);function Ys(r,e,t){let n=r.resolve(e),i=t-e,s=n.depth;for(;i>0&&s>0&&n.indexAfter(s)==n.node(s).childCount;)s--,i--;if(i>0){let o=n.node(s).maybeChild(n.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function zm(r,e,t,n){let i=[],s=[],o,l;r.doc.nodesBetween(e,t,(a,u,c)=>{if(!a.isInline)return;let d=a.marks;if(!n.isInSet(d)&&c.type.allowsMarkType(n.type)){let f=Math.max(u,e),h=Math.min(u+a.nodeSize,t),m=n.addToSet(d);for(let p=0;p<d.length;p++)d[p].isInSet(m)||(o&&o.to==f&&o.mark.eq(d[p])?o.to=h:i.push(o=new wt(f,h,d[p])));l&&l.to==f?l.to=h:s.push(l=new Gt(f,h,n))}}),i.forEach(a=>r.step(a)),s.forEach(a=>r.step(a))}function qm(r,e,t,n){let i=[],s=0;r.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(n instanceof Qi){let u=o.marks,c;for(;c=n.isInSet(u);)(a||(a=[])).push(c),u=c.removeFromSet(u)}else n?n.isInSet(o.marks)&&(a=[n]):a=o.marks;if(a&&a.length){let u=Math.min(l+o.nodeSize,t);for(let c=0;c<a.length;c++){let d=a[c],f;for(let h=0;h<i.length;h++){let m=i[h];m.step==s-1&&d.eq(i[h].style)&&(f=m)}f?(f.to=u,f.step=s):i.push({style:d,from:Math.max(l,e),to:u,step:s})}}}),i.forEach(o=>r.step(new wt(o.from,o.to,o.style)))}function Oo(r,e,t,n=t.contentMatch,i=!0){let s=r.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<s.childCount;a++){let u=s.child(a),c=l+u.nodeSize,d=n.matchType(u.type);if(!d)o.push(new xe(l,c,H.empty));else{n=d;for(let f=0;f<u.marks.length;f++)t.allowsMarkType(u.marks[f].type)||r.step(new wt(l,c,u.marks[f]));if(i&&u.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(u.text);)m||(m=new H(R.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),o.push(new xe(l+f.index,l+f.index+f[0].length,m))}}l=c}if(!n.validEnd){let a=n.fillBefore(R.empty,!0);r.replace(l,l,new H(a,0,0))}for(let a=o.length-1;a>=0;a--)r.step(o[a])}function Vm(r,e,t){return(e==0||r.canReplace(e,r.childCount))&&(t==r.childCount||r.canReplace(0,t))}function Hr(r){let t=r.parent.content.cutByIndex(r.startIndex,r.endIndex);for(let n=r.depth,i=0,s=0;;--n){let o=r.$from.node(n),l=r.$from.index(n)+i,a=r.$to.indexAfter(n)-s;if(n<r.depth&&o.canReplace(l,a,t))return n;if(n==0||o.type.spec.isolating||!Vm(o,l,a))break;l&&(i=1),a<o.childCount&&(s=1)}return null}function jm(r,e,t){let{$from:n,$to:i,depth:s}=e,o=n.before(s+1),l=i.after(s+1),a=o,u=l,c=R.empty,d=0;for(let m=s,p=!1;m>t;m--)p||n.index(m)>0?(p=!0,c=R.from(n.node(m).copy(c)),d++):a--;let f=R.empty,h=0;for(let m=s,p=!1;m>t;m--)p||i.after(m+1)<i.end(m)?(p=!0,f=R.from(i.node(m).copy(f)),h++):u++;r.step(new De(a,u,o,l,new H(c.append(f),d,h),c.size-d,!0))}function No(r,e,t=null,n=r){let i=Hm(r,e),s=i&&Um(n,e);return s?i.map(ia).concat({type:e,attrs:t}).concat(s.map(ia)):null}function ia(r){return{type:r,attrs:null}}function Hm(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.contentMatchAt(n).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(n,i,o)?s:null}function Um(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.child(n),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let u=n;a&&u<i;u++)a=a.matchType(t.child(u).type);return!a||!a.validEnd?null:o}function Wm(r,e,t){let n=R.empty;for(let o=t.length-1;o>=0;o--){if(n.size){let l=t[o].type.contentMatch.matchFragment(n);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=R.from(t[o].type.create(t[o].attrs,n))}let i=e.start,s=e.end;r.step(new De(i,s,i,s,new H(n,0,0),t.length,!0))}function Km(r,e,t,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=r.steps.length;r.doc.nodesBetween(e,t,(o,l)=>{let a=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(n,a)&&Jm(r.doc,r.mapping.slice(s).map(l),n)){let u=null;if(n.schema.linebreakReplacement){let h=n.whitespace=="pre",m=!!n.contentMatch.matchType(n.schema.linebreakReplacement);h&&!m?u=!1:!h&&m&&(u=!0)}u===!1&&oc(r,o,l,s),Oo(r,r.mapping.slice(s).map(l,1),n,void 0,u===null);let c=r.mapping.slice(s),d=c.map(l,1),f=c.map(l+o.nodeSize,1);return r.step(new De(d,f,d+1,f-1,new H(R.from(n.create(a,null,o.marks)),0,0),1,!0)),u===!0&&sc(r,o,l,s),!1}})}function sc(r,e,t,n){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=r.mapping.slice(n).map(t+1+s+o.index);r.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function oc(r,e,t,n){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=r.mapping.slice(n).map(t+1+s);r.replaceWith(o,o+1,e.type.schema.text(`
@@ -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),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-CAJPaAKa.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),repeater:Vl(()=>jl(()=>import("./RepeaterField-BAnvha76.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-bO5Ha9y6.js.map
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-B0WVqgI4.js.map