@fewangsit/wangsvue 1.5.229-alpha.4 → 1.5.229-alpha.5

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.
@@ -91,7 +91,7 @@ export type TimelineItem = {
91
91
  detail?: KeyValue | DetailType | SlotDetailType;
92
92
  };
93
93
 
94
- export type TimelineProps = {
94
+ export interface TimelineProps {
95
95
  value: TimelineItem[];
96
96
  /**
97
97
  * Whether the detail values should be aligned with each other or not.
@@ -108,7 +108,7 @@ export type TimelineProps = {
108
108
  * @defaultValue false
109
109
  */
110
110
  noFormatDate?: boolean;
111
- };
111
+ }
112
112
 
113
113
  export interface TimelineSlots {
114
114
  /**
@@ -1,6 +1,6 @@
1
1
  import { ClassComponent } from '../ts-helpers.d';
2
2
 
3
- export type TooltipSpanProps = {
3
+ export interface TooltipSpanProps {
4
4
  /**
5
5
  * The full text to be displayed on the tooltip.
6
6
  * The tooltip will only be shown if the text is truncated.
@@ -13,7 +13,7 @@ export type TooltipSpanProps = {
13
13
  * @default 36
14
14
  */
15
15
  length?: number;
16
- };
16
+ }
17
17
 
18
18
  declare class TooltipSpan extends ClassComponent<
19
19
  TooltipSpanProps,
package/wangsvue.es.js CHANGED
@@ -30027,7 +30027,7 @@ const _4 = /* @__PURE__ */ Ae({
30027
30027
  singleSelection: {},
30028
30028
  singleSelectionModifiers: {}
30029
30029
  }),
30030
- emits: /* @__PURE__ */ ut(["toggleOption", "doubleClick", "selectData", "rowSelect", "page", "sort", "update:selectedData", "update:singleSelection", "cellEdited", "input", "rowReorder"], ["update:singleSelection"]),
30030
+ emits: /* @__PURE__ */ ut(["update:singleSelection", "cellEdited", "input", "rowReorder", "toggleOption", "doubleClick", "selectData", "rowSelect", "page", "sort", "update:selectedData"], ["update:singleSelection"]),
30031
30031
  setup(n, { emit: e }) {
30032
30032
  const t = n, i = e, s = Mt(n, "singleSelection"), { defaultProps: o, locale: r } = bn("DataTable"), a = W(() => oo(t, o)), l = Me("preset", {}).datatable, u = [10, 25, 50, 100], c = Me("useToastConfig"), d = $d(c), { setLoading: p } = Xn(), f = `${window.location.pathname.replace("/", "").split("/").join("-")}-${t.tableName}`, m = re(t.data ?? []), g = z(t.data ?? []), v = re({}), b = re(t.columns), y = re(), T = re(), k = z([]), S = z(), _ = z(0), j = z(!1), M = z(!1), E = z(0), I = z(0), $ = z(0), P = z(!1), V = z(), q = re(), me = re(), G = re([]), F = z({}), le = z(), Se = z(), $e = z(), xe = z(), de = z(1), te = z(10), fe = z(0), Fe = re({}), _e = W(
30033
30033
  () => !!ke.value.child.length
package/wangsvue.js CHANGED
@@ -30027,7 +30027,7 @@ const _4 = /* @__PURE__ */ Ae({
30027
30027
  singleSelection: {},
30028
30028
  singleSelectionModifiers: {}
30029
30029
  }),
30030
- emits: /* @__PURE__ */ ut(["toggleOption", "doubleClick", "selectData", "rowSelect", "page", "sort", "update:selectedData", "update:singleSelection", "cellEdited", "input", "rowReorder"], ["update:singleSelection"]),
30030
+ emits: /* @__PURE__ */ ut(["update:singleSelection", "cellEdited", "input", "rowReorder", "toggleOption", "doubleClick", "selectData", "rowSelect", "page", "sort", "update:selectedData"], ["update:singleSelection"]),
30031
30031
  setup(n, { emit: e }) {
30032
30032
  const t = n, i = e, s = Mt(n, "singleSelection"), { defaultProps: o, locale: r } = bn("DataTable"), a = W(() => oo(t, o)), l = Me("preset", {}).datatable, u = [10, 25, 50, 100], c = Me("useToastConfig"), d = $d(c), { setLoading: p } = Xn(), f = `${window.location.pathname.replace("/", "").split("/").join("-")}-${t.tableName}`, m = re(t.data ?? []), g = z(t.data ?? []), v = re({}), b = re(t.columns), y = re(), T = re(), k = z([]), S = z(), _ = z(0), j = z(!1), M = z(!1), E = z(0), I = z(0), $ = z(0), P = z(!1), V = z(), q = re(), me = re(), G = re([]), F = z({}), le = z(), Se = z(), $e = z(), xe = z(), de = z(1), te = z(10), fe = z(0), Fe = re({}), _e = W(
30033
30033
  () => !!ke.value.child.length
@@ -196,7 +196,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
196
196
  `).concat(s,`
197
197
  }
198
198
  }
199
- `)}this.styleElement.innerHTML=t}},destroyStyle:function(){this.styleElement&&(document.head.removeChild(this.styleElement),this.styleElement=null)}},computed:{attributeSelector:function(){return vi()}},components:{ToastMessage:nj,Portal:Ko}};function ed(n){"@babel/helpers - typeof";return ed=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ed(n)}function oj(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),t.push.apply(t,i)}return t}function aj(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?oj(Object(t),!0).forEach(function(i){KF(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):oj(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}function KF(n,e,t){return e=WF(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function WF(n){var e=qF(n,"string");return ed(e)=="symbol"?e:String(e)}function qF(n,e){if(ed(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(ed(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function GF(n,e,t,i,s,o){var a=Ct("ToastMessage"),r=Ct("Portal");return h(),D(r,null,{default:Y(function(){return[w("div",M({ref:"container",class:n.cx("root"),style:n.sx("root",!0,{position:n.position})},n.ptmi("root")),[A(E1,M({name:"p-toast-message",tag:"div",onEnter:o.onEnter,onLeave:o.onLeave},aj(aj({},n.ptm("message")),n.ptm("transition"))),{default:Y(function(){return[(h(!0),C(re,null,Ye(s.messages,function(l){return h(),D(a,{key:l.id,message:l,templates:n.$slots,closeIcon:n.closeIcon,infoIcon:n.infoIcon,warnIcon:n.warnIcon,errorIcon:n.errorIcon,successIcon:n.successIcon,closeButtonProps:n.closeButtonProps,onClose:e[0]||(e[0]=function(u){return o.remove(u)}),pt:n.pt},null,8,["message","templates","closeIcon","infoIcon","warnIcon","errorIcon","successIcon","closeButtonProps","pt"])}),128))]}),_:1},16,["onEnter","onLeave"])],16)]}),_:1})}sj.render=GF;const rj=Ve("Toast",Ie({__name:"Toast",props:{group:{default:"default-toast"},position:{default:"bottom-right"},autoZIndex:{type:Boolean},baseZIndex:{default:9980},breakpoints:{},message:{},icon:{},pt:{},ptOptions:{},unstyled:{type:Boolean}},emits:["close","lifeEnd"],setup(n){const e=n;Pt(()=>{pt.on("toast:add",s)}),qh(()=>{window.toastGroups&&window.toastGroups.includes(e.group)?i.value=!1:(window.toastGroups=[e.group,...window.toastGroups??[]],i.value=!0)}),Cs(()=>{var o;window.toastGroups=(o=window.toastGroups)==null?void 0:o.filter(a=>a!==e.group),pt.off("toast:add",s)});const t=z(),i=z(!1),s=o=>{o.group===e.group&&(t.value=o),o.error&&console.error(o.error)};return(o,a)=>i.value?(h(),D(O(sj),M({key:0},o.$props,{"data-group":o.$props.group,onClose:a[0]||(a[0]=r=>o.$emit("close",r)),onLifeEnd:a[1]||(a[1]=r=>o.$emit("lifeEnd",r))}),pi({icon:Y(()=>{var r,l,u;return[(r=t.value)!=null&&r.icon?(h(),D(Ke,{key:0,class:Pe(["w-5 h-5 text-inherit",(l=t.value)==null?void 0:l.iconClass]),icon:(u=t.value)==null?void 0:u.icon},null,8,["class","icon"])):N("",!0)]}),_:2},[o.$slots.container?{name:"container",fn:Y(({message:r,closeCallback:l})=>[Se(o.$slots,"container",{closeCallback:l,message:r})]),key:"0"}:void 0,o.$slots.message?{name:"message",fn:Y(({message:r})=>[Se(o.$slots,"message",{message:r})]),key:"1"}:void 0]),1040,["data-group"])):N("",!0)}})),JF=["colspan","rowspan"],YF={class:"flex"},lj=Ie({__name:"HeaderCell",props:{col:{},defaultHeaderRowSpan:{},sortBy:{},sortOrder:{},preset:{}},setup(n){return(e,t)=>(h(),C("th",{class:Pe([e.col.headerClass,e.col.class]),colspan:e.col.colspan,rowspan:e.col.rowspan??e.defaultHeaderRowSpan},[w("span",ht(Ut(e.preset.headercellcontent)),[w("span",YF,[st(U(e.col.header)+" ",1),e.col.info?(h(),D(Ke,{key:0,info:e.col.info,severity:e.col.infoSeverity,class:"w-[10px] h-[10px]",icon:"info"},null,8,["info","severity"])):N("",!0)]),e.col.sortable?(h(),D(Ke,{key:0,icon:!e.sortBy||e.sortBy!=e.col.field?"arrow-up-down":e.sortOrder==1?"sort-asc":"sort-desc",class:"text-base"},null,8,["icon"])):N("",!0)],16)],10,JF))}}),ZF=Ie({__name:"MultiRow",props:{attributes:{}},setup(n){const e=n,t=xe("preset",{}).datatable;return(i,s)=>{var o;return h(),C("div",ht(Ut((o=O(t))==null?void 0:o.multirowcontainer({props:e}))),[(h(!0),C(re,null,Ye(i.attributes,(a,r)=>{var l;return h(),C("span",M({key:r,ref_for:!0},(l=O(t))==null?void 0:l.multirow({context:{firstIndex:r===0}}),{class:a.class,"data-wv-section":"multi-row"}),[a.bodyComponent?(h(),D(Bt(a.bodyComponent.component),M({key:0,modelValue:a.bodyComponent.model,"onUpdate:modelValue":u=>a.bodyComponent.model=u,ref_for:!0},a.bodyComponent.props,{class:a.class,disabled:a.bodyComponent.disabled},lr(a.bodyComponent.events?a.bodyComponent.events:{}),{onClick:s[0]||(s[0]=It(()=>{},["stop"]))}),null,16,["modelValue","onUpdate:modelValue","class","disabled"])):(h(),C(re,{key:1},[st(U(a.value),1)],64))],16)}),128))],16)}}}),QF=["id"],XF=["rowspan"],eV=["rowspan"],tV=["rowspan"],nV=["id","rowspan"],iV={key:0},sV=["colspan"],oV=["id","draggable","onClick","onDblclick","onDragenter","onDragstart"],aV=["onClick"],rV=["colspan"],lV=["colspan"],uV=["colspan"],cV=["colspan"],dV=["colspan"],pV=["contenteditable","onBlur","onKeypress"],fV={key:1},mV={key:2},hV=["colspan"],gV=Ie({__name:"DataTable",props:dt({treeTable:{type:Boolean},childTableProps:{},tableName:{default:"datatable"},tableTitle:{default:void 0},columns:{},useOption:{type:Boolean,default:!0},data:{},dataKey:{default:"_id"},disableKey:{default:"isDefault"},includeCheckDisabledRows:{type:Boolean},highlightKey:{},disableAllRows:{type:Boolean},search:{},tag:{},defaultQueryParams:{},fetchFunction:{},rows:{},isSelectedAll:{type:Boolean},filters:{},lazy:{type:Boolean,default:!0},loading:{type:Boolean},selectionType:{default:"checkbox"},useSelection:{type:Boolean},selectedData:{},expandedRows:{},usePaginator:{type:Boolean},options:{default:()=>[]},singleSelect:{type:Boolean},customColumn:{type:Boolean,default:!0},scrollHeight:{},rowHeight:{default:"fixed"},reorderable:{type:Boolean},globalFilterFields:{},totalDisabledRows:{},excelToastErrorMessage:{},emptyTableMessage:{},singleSelection:{}},{singleSelection:{},singleSelectionModifiers:{}}),emits:dt(["toggleOption","doubleClick","selectData","rowSelect","page","sort","update:selectedData","update:singleSelection","cellEdited","input","rowReorder"],["update:singleSelection"]),setup(n,{emit:e}){const t=n,i=e,s=Mt(n,"singleSelection"),{defaultProps:o,locale:a}=kn("DataTable"),r=W(()=>Xs(t,o)),l=xe("preset",{}).datatable,u=[10,25,50,100],c=xe("useToastConfig"),d=Xu(c),{setLoading:p}=Xn(),f=`${window.location.pathname.replace("/","").split("/").join("-")}-${t.tableName}`,m=oe(t.data??[]),g=z(t.data??[]),v=oe({}),b=oe(t.columns),y=oe(),T=oe(),k=z([]),S=z(),_=z(0),j=z(!1),x=z(!1),E=z(0),I=z(0),$=z(0),P=z(!1),V=z(),q=oe(),me=oe(),G=oe([]),F=z({}),ue=z(),je=z(),Le=z(),Me=z(),de=z(1),te=z(10),fe=z(0),Fe=oe({}),_e=W(()=>!!ke.value.child.length),We=W(()=>_e.value?2:1),ke=W(()=>{const ne={parent:[],child:[]};for(const Oe of b.value)if(Oe.parentHeader){ne.child.push(Oe);const Xe=ne.parent.find(kt=>kt.field===Oe.parentHeader.field);Xe?Xe.colspan&&Xe.colspan++:ne.parent.push({...Oe.parentHeader,colspan:1,rowspan:1})}else ne.parent.push(Oe);return ne}),se=W(()=>{var ne,Oe;return(ne=t.childTableProps)!=null&&ne.columns?(Oe=t.childTableProps)==null?void 0:Oe.columns.filter(Xe=>{var kt;return!Xe.parentColumnsFields||((kt=Xe.parentColumnsFields)==null?void 0:kt.some(K=>b.value.some(H=>H.field===K)))}):b.value}),ye=W(()=>b.value.length+(t.selectionType==="checkbox"?1:0)+(t.useOption?1:0)+(t.reorderable?1:0)+(t.treeTable?1:0)),L=W(()=>({...t.defaultQueryParams,search:t.lazy?ue.value:t.search,tag:t.lazy?je.value:void 0,page:t.usePaginator?de.value:void 0,limit:t.usePaginator?te.value:void 0,sortOrder:Me.value,sortBy:Le.value,...t.lazy?F.value:t.filters})),R=W(()=>{var Oe;const ne=(Oe=m.value)==null?void 0:Oe.filter(Xe=>{var kt;return((kt=Xe.children)==null?void 0:kt.length)||Xe.hasChildren});return(ne==null?void 0:ne.length)&&ne.every(Xe=>v.value[Xe[t.dataKey]]>0)}),pe=W(()=>{var H,ee,Ae,qe,$e;if(t.disableAllRows||!((H=ct())!=null&&H.length)||t.selectionType!=="checkbox"||((ee=B.value)==null?void 0:ee.length)===m.value.length)return!1;const ne=(Ae=k.value)==null?void 0:Ae.length,Oe=((qe=Et(ct()))==null?void 0:qe.map(be=>be[t.dataKey]))??[],Xe=(($e=k.value)==null?void 0:$e.map(be=>be[t.dataKey]))??[],kt=Xe.length?dR(Oe,Xe):!1,K=ne>0&&ne===(fe.value??0)-(B.value.length??0);return kt||K}),B=W(()=>Tn(t.data??ct()??[])),Q=W(()=>j.value||t.loading),Te=W(()=>{var ne;return t.useOption||((ne=t.childTableProps)==null?void 0:ne.useOption)||t.customColumn}),ze=W(()=>{var ne;return!Q.value&&!((ne=m.value)!=null&&ne.length)}),Ze=W(()=>t.lazy&&t.fetchFunction||!t.usePaginator?m.value:m.value.slice((de.value-1)*te.value,de.value*te.value)),Ne=ne=>Object.keys(v.value).includes(ne),le=ne=>B.value.includes(ne),Ee=ne=>t.selectionType==="checkbox"?!!k.value.find(Oe=>Oe[t.dataKey]===ne):Ue(ne),Ue=ne=>{var Oe;return ne!==void 0&&((Oe=s.value)==null?void 0:Oe[t.dataKey])===ne},ct=ne=>(m.value??[]).filter(Oe=>!Oe.childRowHeader&&!Oe.childRow),yt=async(ne,Oe,Xe)=>{var K,H;if(Ne(ne[t.dataKey])===Xe)return;const kt=Xe??!Ne(ne[t.dataKey]);if(!x.value)if(!kt)m.value.splice(Oe+1,v.value[ne[t.dataKey]]),delete v.value[ne[t.dataKey]];else{v.value[ne[t.dataKey]]=1;let{children:ee}=ne;if((K=t.childTableProps)!=null&&K.fetchFunction&&ne.hasChildren)try{m.value.splice(Oe+1,0,{childRow:!0,loadingRow:!0}),x.value=!0;const Ae=await((H=t.childTableProps)==null?void 0:H.fetchFunction(ne));ee=Ae==null?void 0:Ae.data}catch(Ae){console.error("🚀 ~ toggleRowExpand ~ error:",Ae)}finally{m.value.splice(Oe+1,1),x.value=!1}if(Oe>=0&&(ee!=null&&ee.length)){const Ae=ee.flatMap(qe=>[{childRowHeader:!0,header:qe.groupHeader},...(qe.groupItems??[]).map(be=>({childRow:!0,...be}))]);v.value[ne[t.dataKey]]=Ae.length,m.value.splice(Oe+1,0,...Ae)}else m.value.splice(Oe+1,0,{childRow:!0,noDataRow:!0})}},Tt=ne=>{t.includeCheckDisabledRows?k.value=ne?ct():ct().filter(Oe=>le(Oe[t.dataKey])):k.value=ne?Et(ct()):[]},Nt=(ne,Oe,Xe)=>{if(!Oe.childRow&&!Oe.childRowHeader&&!le(Oe[t.dataKey])&&t.selectionType!=="none"){const kt=Ee(Oe[t.dataKey]);i("rowSelect",{originalEvent:ne,data:Oe,index:Xe}),t.selectionType==="checkbox"?kt?k.value=k.value.filter(K=>K[t.dataKey]!=Oe[t.dataKey]):k.value=[...k.value,Oe]:s.value=kt?void 0:Oe}},Be=async()=>{var Oe;const ne=!R.value;if(!x.value){let Xe=0;for(const kt of m.value)((Oe=kt.children)!=null&&Oe.length||kt.hasChildren)&&await yt(kt,Xe,ne),Xe++}},ge=async(ne,Oe)=>{const Xe=ne.target,kt=Xe.tagName.toLowerCase()==="button"?Xe:Xe.parentElement;i("toggleOption",Oe);const K={...ne,currentTarget:ne.currentTarget??ne.target};it(),await Xt(()=>{var H;kt!=null&&kt.classList.contains("option-button-active")?it():((H=me.value)==null||H.toggle(K),it(),kt==null||kt.classList.add("option-button-active"))})},J=(ne,Oe,Xe)=>({[(typeof ne.bodySelectedClass=="function"?ne.bodySelectedClass(Oe):ne.bodySelectedClass)??""]:Ee(Oe[Xe])}),X=async(ne,Oe,Xe)=>{var K,H,ee,Ae;if(!Xe.preset)return;const kt=()=>gl(Oe,Xe.field,!Qn(Oe,Xe.field));if(Xe.preset.type==="checkbox"?(H=(K=Xe.preset).onCheck)==null||H.call(K,ne,Oe,kt):Xe.preset.type==="toggle"&&((Ae=(ee=Xe.preset).onToggle)==null||Ae.call(ee,ne,Oe,kt)),"confirmDialogProps"in Xe.preset){const{showWhen:qe}=Yt(Xe.preset,Oe[Xe.field],Oe)??{};typeof qe=="function"?Fe.value[Oe[t.dataKey]+Xe.field]=await qe(Oe,ne):Fe.value[Oe[t.dataKey]+Xe.field]=!qe||qe==="active"&&ne||qe==="inactive"&&!ne}},ce=ne=>ne.draggable!==!1&&!ne.childRow&&!ne.childRowHeader&&t.reorderable&&!Me.value,Je=(ne,Oe,Xe)=>{if(Oe.childRow||Oe.childRowHeader)return;v.value={};const{dataTransfer:kt}=ne;V.value=Oe,S.value={item:Oe,fromIndex:Xe},kt&&(kt.dropEffect="move",kt.effectAllowed="move",kt.setData("id",Oe._id),kt.setData("index",Xe.toString()))},lt=(ne,Oe)=>{var Xe,kt,K,H;if(ne.preventDefault(),ce(Oe)){const ee=ne.target,Ae=ee.tagName==="TR"?ee:ee.closest("tr");if(Ae==null||Ae.classList.add("bg-primary-50"),Ae==null||Ae.classList.add("dark:bg-grayscale-800"),(Xe=Ae==null?void 0:Ae.nextElementSibling)==null||Xe.classList.remove("bg-primary-50"),(kt=Ae==null?void 0:Ae.nextElementSibling)==null||kt.classList.remove("dark:bg-grayscale-800"),(K=Ae==null?void 0:Ae.previousElementSibling)==null||K.classList.remove("bg-primary-50"),(H=Ae==null?void 0:Ae.previousElementSibling)==null||H.classList.remove("dark:bg-grayscale-800"),!Ae||!V.value)return;const qe=G.value.findIndex(be=>{var rt;return be._id===((rt=V.value)==null?void 0:rt._id)}),$e=G.value.findIndex(be=>be._id===Ae.id);qe!==-1&&$e!==-1&&(S.value&&(S.value.toIndex=$e),[G.value[qe],G.value[$e]]=[G.value[$e],G.value[qe]],De())}},he=()=>{S.value&&i("rowReorder",S.value),V.value=void 0,P.value=!1,S.value=void 0},De=()=>{m.value=[...G.value]},it=()=>{const ne=document.querySelectorAll(".option-button-active");ne==null||ne.forEach(Oe=>{Oe.classList.remove("option-button-active")})},St=()=>{Le.value=void 0,Me.value=void 0},jt=()=>{de.value=1,$.value++},xt=()=>{te.value=t.rows??10,de.value=1,$.value++},Jt=()=>{xt(),St()},an=async()=>{I.value++,$.value++,Jt(),t.lazy?await Qe():mn()},mn=()=>{let ne=[...g.value??[]];const Oe=F.value,Xe=Object.entries(Oe);try{ne=Xe.length?ne.filter(kt=>Xe.every(([K,{value:H,matchMode:ee}])=>{const Ae=Qn(kt,K);switch(ee){case"IN":return Array.isArray(H)?H.includes(Ae):!1;case"CONTAINS":return Ae&&H?Ae.toString().toLowerCase().includes(H):!1;case"EQUALS":return Ae?Ae.toString()===H.toString():!1;case"BETWEEN":return Array.isArray(H)&&H.length===2?!isNaN(Ae)&&(H[0]==null||Ae>=H[0])&&(H[1]==null||Ae<=H[1]):!1;case"DATE_BETWEEN":return Array.isArray(H)?+new Date(Ae)>=H[0]&&+new Date(Ae)<=H[1]:!1;default:return!1}})):g.value}catch(kt){console.error("🚀 ~ applyStaticFilter ~ error:",kt)}bn(ne)},bn=ne=>{var Oe;try{m.value=(Oe=ue.value)!=null&&Oe.length?ne.filter(Xe=>{const kt=JSON.stringify(Xe);return new RegExp(ue.value,"i").test(kt)||ue.value.split(/\s+/).filter(Boolean).every(K=>new RegExp(K,"i").test(kt))}):ne}catch(Xe){console.error("🚀 ~ applyStaticSearch ~ error:",Xe)}},ae=async ne=>{te.value=ne.rows,de.value=ne.page+1,t.lazy&&t.fetchFunction&&await Qe(),Object.keys(v.value).forEach(Oe=>{const Xe=m.value.findIndex(kt=>kt[t.dataKey]==Oe);Xe>=0&&yt(m.value[Xe],Xe,!0)})},Re=(ne,Oe)=>{ne!==Le.value&&(Me.value=void 0),Le.value=ne,Me.value?Me.value==-1?(Me.value=void 0,Le.value=void 0):Me.value=-1:Me.value=1,i("sort",{sortOrder:Me.value,sortField:Le.value,originalEvent:Oe,rows:te.value}),jt(),t.lazy&&t.fetchFunction?Qe():nt()},nt=()=>{const ne=[...m.value??[]],Oe=new Map;if(!Me.value){m.value=g.value??[];return}for(const kt of ne)Oe.set(kt,Ge.resolveFieldData(kt,Le.value));const Xe=new Intl.Collator(void 0,{numeric:!0}).compare;ne.sort((kt,K)=>{const H=Oe.get(kt),ee=Oe.get(K);return Ge.sort(H,ee,Me.value,Xe,-1)}),m.value=ne},Qe=async()=>{var ne;try{j.value=!0;const Oe=await((ne=t.fetchFunction)==null?void 0:ne.call(t,L.value)),{data:Xe=[],totalRecords:kt=0}=(Oe==null?void 0:Oe.data)??{};m.value=Xe,G.value=[...m.value],fe.value=kt}catch(Oe){console.error("🚀 ~ reFetch ~ error:",Oe)}finally{j.value=!1,v.value={}}},rn=async()=>{var Xe;const ne=As(L.value);delete ne.page,delete ne.limit;const Oe=await((Xe=t.fetchFunction)==null?void 0:Xe.call(t,ne));if(Oe instanceof Error)throw Oe;return(Oe==null?void 0:Oe.data)??{data:[],totalRecords:0}},_n=async ne=>{if(t.tableName===ne.tableName)try{j.value=!0;const{data:Oe,totalRecords:Xe=0}=t.lazy?await rn():{totalRecords:(t.data??[]).length,data:t.data},kt=Tn(Oe);k.value=t.includeCheckDisabledRows?Oe??[]:Et(Oe,kt),fe.value=Xe}finally{j.value=!1}},mt=(ne,Oe)=>l==null?void 0:l.headercell({props:t,context:{sortOrder:Me.value,customColumn:Oe,sorted:Le.value&&Le.value===(ne==null?void 0:ne.field),sortable:ne==null?void 0:ne.sortable,isParentHeader:(ne==null?void 0:ne.rowspan)===1}}),bt=ne=>{(!ne.tableName||ne.tableName===t.tableName)&&Xt(()=>{E.value++,Qe()})},Et=(ne,Oe)=>(ne??[]).filter(Xe=>!(Oe??B.value).includes(Xe[t.dataKey])),Tn=(ne=[])=>t.disableAllRows?ne.map(Oe=>Oe[t.dataKey]):ne.filter(Oe=>Oe[t.disableKey]).map(Oe=>Oe[t.dataKey]),xn=async({tableName:ne,multiTableNames:Oe,fileName:Xe,additionalTexts:kt})=>{var qe;if(ne!==t.tableName&&!(Oe!=null&&Oe.includes(t.tableName)))return;const H=b.value.filter($e=>$e.visible!==!1).filter($e=>!$e.excluded),ee=H.map($e=>$e.header??$e.exportHeader??"-"),Ae=()=>Xe.trim().replace(/[^a-zA-Z0-9\s]/g,"-").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/-+$/,"");try{if(pt.off("data-table:download",ie),ne===t.tableName){p(!0,a.downloadingMessage);const{data:$e}=t.fetchFunction?await rn():{data:t.data},be=U1($e,H,a);if(Oe!=null&&Oe.length){pt.emit("button-download:multi-tables",{table:{headers:ee,data:be,tableName:ne,tableTitle:t.tableTitle}});return}await lg({tables:[{headers:ee,data:be,tableName:ne,tableTitle:t.tableTitle}],fileName:Ae(),additionalTexts:kt})}}catch($e){console.error("🚀 ~ downloadExcel error:",$e),d.removeAllGroups(),d.add({message:((qe=r.value.excelToastErrorMessage)==null?void 0:qe.replace("{fileName}",Xe))??"Data gagal diunduh.",error:$e,group:"download"})}finally{p(!1),pt.on("data-table:download",ie)}};Pt(async()=>{var ne;t.fetchFunction&&(await Qe(),vt()),(ne=t.selectedData)!=null&&ne.length&&(k.value=t.selectedData),fo()}),ho(()=>{mo()}),He(()=>t.columns,()=>{t.customColumn||(b.value=t.columns),_.value++}),He(()=>t.data,ne=>{m.value=ne??[],g.value=ne??[],pt.emit("data-table:updated",{tableName:t.tableName,data:ne}),fe.value=ne==null?void 0:ne.length},{immediate:!0}),He(fe,ne=>{ut(ne)}),He(k,ne=>{i("selectData",ne),i("update:selectedData",ne),pt.emit("data-table:update-selected-data",{tableName:t.tableName,data:ne})},{deep:!0});const fo=()=>{pt.on("data-table:apply-filter",Po),pt.on("search-table",ha),pt.on("search-by-scan-table",ws),pt.on("data-table:clear-selected-data",Z),pt.on("data-table:select-all-record",qs),pt.on("data-table:download",ie),pt.on("data-table:import-excel-to-json",Zt)},mo=()=>{pt.off("data-table:update",bt),pt.off("data-table:apply-filter",Po),pt.off("search-table",ha),pt.off("search-by-scan-table",ws),pt.off("data-table:clear-selected-data",Z),pt.off("data-table:select-all-record",qs),pt.off("data-table:download",ie),pt.off("data-table:import-excel-to-json",Zt)},Po=ne=>{ne.tableName===t.tableName&&(F.value=ne.filter,an())},ha=ne=>{ne.tableName===t.tableName&&(ue.value=ne.search,an())},ws=ne=>{ne.tableName===t.tableName&&(je.value=ne.tag,an())},qs=ne=>{ne.tableName===t.tableName&&_n(ne)},Z=ne=>{ne.tableName===t.tableName&&(k.value=[])},ie=ne=>{var Oe;(ne.tableName===t.tableName||(Oe=ne.multiTableNames)!=null&&Oe.includes(t.tableName))&&xn(ne)},ve=ne=>{ne.code.includes("Digit")||ne.code.includes("Numpad")||["ArrowLeft","ArrowRight","Backspace","Delete"].includes(ne.code)||ne.preventDefault()},ut=ne=>{const Oe=t.includeCheckDisabledRows?0:(B.value.length||t.totalDisabledRows)??0,Xe={total:(ne??fe.value??0)-Oe,tableName:t.tableName};pt.emit("data-table:update-total-record",Xe)},vt=()=>{pt.on("data-table:update",bt)},Zt=ne=>{ne.tableName===t.tableName&&(m.value=ne.data,G.value=[...m.value],fe.value=ne.data.length)},Yt=(ne,Oe,Xe)=>typeof(ne==null?void 0:ne.confirmDialogProps)=="function"?ne==null?void 0:ne.confirmDialogProps(Oe,Xe):ne==null?void 0:ne.confirmDialogProps;return(ne,Oe)=>{var Xe,kt,K;return h(),C("div",ht(Ut((Xe=O(l))==null?void 0:Xe.root)),[w("div",ht(Ut((kt=O(l))==null?void 0:kt.tablewrapper)),[A(O(uR),M({"auto-hide":!1},(K=O(l))==null?void 0:K.scrollheightwrapper({props:t}),{class:"custom-scrollbar [&_.simplebar-track]:bg-grayscale-100 dark:[&_.simplebar-track]:bg-grayscale-800"}),{default:Y(()=>{var H,ee,Ae,qe,$e;return[(h(),C("table",M({id:O(f)},(H=O(l))==null?void 0:H.table,{key:I.value,ref:y.value}),[w("thead",ht(Ut(O(l).thead)),[w("tr",ht(Ut(O(l).headerrow)),[ne.reorderable&&!Me.value?(h(),C("th",M({key:0},O(l).headercellreorderable,{class:mt().class,rowspan:We.value}),null,16,XF)):N("",!0),ne.selectionType==="checkbox"?(h(),C("th",M({key:1},O(l).headercellcheckbox,{class:mt().class,rowspan:We.value}),[A(yo,M((ee=O(l))==null?void 0:ee.headercheckbox({context:{isSelectedAll:pe.value}}),{"model-value":pe.value,"onUpdate:modelValue":Oe[0]||(Oe[0]=be=>Tt(!!be)),binary:""}),null,16,["model-value"])],16,eV)):N("",!0),ne.treeTable?(h(),C("th",M({key:2},O(l).headertoggler,{class:mt().class,rowspan:We.value}),[A(Ce,M({onClick:Be},O(l).headertogglerbutton({context:{isExpandedAll:R.value}}),{icon:"arrow-down",text:""}),null,16)],16,tV)):N("",!0),(h(!0),C(re,null,Ye(ke.value.parent,be=>(h(),D(lj,M({key:be.field,ref_for:!0},mt(be),{col:be,"default-header-row-span":We.value,preset:O(l),"sort-by":Le.value,"sort-order":Me.value,onClick:rt=>be.sortable?Re(be.field,rt):null}),null,16,["col","default-header-row-span","preset","sort-by","sort-order","onClick"]))),128)),Te.value?(h(),C("th",M({key:3},mt(void 0,t.customColumn),{id:`column-visibility-toggle-${O(f)}`,rowspan:We.value,onClick:Oe[1]||(Oe[1]=(...be)=>{var rt,en;return((rt=q.value)==null?void 0:rt.toggleMenu)&&((en=q.value)==null?void 0:en.toggleMenu(...be))})}),[t.customColumn?(h(),D(Ke,M({key:0},O(l).columnvisibilityicon,{icon:"ellipsis-h","tooltip-pos":"left"}),null,16)):N("",!0)],16,nV)):N("",!0)],16),ke.value.child.length?(h(),C("tr",ht(M({key:0},O(l).headerrow)),[(h(!0),C(re,null,Ye(ke.value.child,be=>(h(),D(lj,M({key:be.field,ref_for:!0},mt(be),{col:be,"default-header-row-span":We.value,preset:O(l),"sort-by":Le.value,"sort-order":Me.value,onClick:rt=>be.sortable?Re(be.field,rt):null}),null,16,["col","default-header-row-span","preset","sort-by","sort-order","onClick"]))),128))],16)):N("",!0)],16),w("tbody",ht(Ut((Ae=O(l))==null?void 0:Ae.tbody)),[Q.value?(h(),C("tr",iV,[w("td",M({colspan:ye.value},(qe=O(l))==null?void 0:qe.bodycell),[(h(!0),C(re,null,Ye(O(l).invisiblelottiewrapper?2:1,be=>(h(),C("div",M({key:be,ref_for:!0},be===1?O(l).loadingtablewrapper:O(l).invisiblelottiewrapper),[A(ns,M({animation:"loading-table",ref_for:!0},O(l).loadingtablelottie),null,16)],16))),128))],16,sV)])):ze.value?(h(),C("tr",mV,[w("td",M({colspan:ye.value},($e=O(l))==null?void 0:$e.bodycell),[(h(!0),C(re,null,Ye(O(l).invisiblelottiewrapper?2:1,be=>(h(),C("div",M({key:be,ref_for:!0},be===1?O(l).nodatalottiewrapper:O(l).invisiblelottiewrapper),[A(ns,M({animation:"no-data",ref_for:!0},O(l).nodatalottie),null,16),r.value.emptyTableMessage?(h(),C("span",M({key:0,ref_for:!0},O(l).nodatamessage),U(r.value.emptyTableMessage),17)):N("",!0)],16))),128))],16,hV)])):(h(!0),C(re,{key:1},Ye(Ze.value,(be,rt)=>{var en,gn,Zn,Qi,fs,Fi,Ss,rp,lp,up,$h;return h(),C(re,{key:`${rt}-${be[ne.dataKey]}`},[w("tr",M({id:be._id,draggable:ce(be),ref_for:!0},(en=O(l))==null?void 0:en.bodyrow({context:{highlighted:be[ne.highlightKey??""],selected:Ee(be[ne.dataKey]),disabled:le(be[ne.dataKey]),draggable:ce(be),dragging:P.value},props:t}),{onClick:tt=>Nt(tt,be,rt),onDblclick:tt=>{var $o;return ne.treeTable&&(($o=be.children)!=null&&$o.length||be.hasChildren)?yt(be,rt):ne.$emit("doubleClick",be)},onDrag:Oe[11]||(Oe[11]=tt=>P.value=!0),onDragenter:It(tt=>lt(tt,be),["prevent"]),onDragleave:Oe[12]||(Oe[12]=It(()=>{},["prevent"])),onDragover:Oe[13]||(Oe[13]=It(()=>{},["prevent"])),onDragstart:tt=>Je(tt,be,rt),onDrop:he}),[ne.reorderable&&!Me.value?(h(),C("td",M({key:0,ref_for:!0},(gn=O(l))==null?void 0:gn.bodycell),[!be.childRow&&!be.childRowHeader?(h(),D(Ke,{key:0,class:"draggableicon",icon:"dragable-menu"})):N("",!0)],16)):N("",!0),ne.selectionType==="checkbox"?(h(),C("td",M({key:1,ref_for:!0},(Zn=O(l))==null?void 0:Zn.bodycell,{onClick:Oe[3]||(Oe[3]=It(()=>{},["stop"]))}),[!be.childRow&&!be.childRowHeader?(h(),D(yo,M({key:0,ref_for:!0},(Qi=O(l))==null?void 0:Qi.rowcheckbox,{modelValue:k.value,"onUpdate:modelValue":Oe[2]||(Oe[2]=tt=>k.value=tt),binary:!1,disabled:le(be[ne.dataKey]),value:be}),null,16,["modelValue","disabled","value"])):N("",!0)],16)):N("",!0),ne.treeTable?(h(),C("td",M({key:2,ref_for:!0},(fs=O(l))==null?void 0:fs.bodycell,{onClick:tt=>{(be.childRow||be.childRowHeader)&&tt.stopPropagation()}}),[(Fi=be.children)!=null&&Fi.length||be.hasChildren?(h(),D(Ce,M({key:0,onClick:It(tt=>yt(be,rt),["stop"]),ref_for:!0},O(l).rowtogglerbutton({context:{isRowExpanded:Ne(be[ne.dataKey])}}),{icon:"arrow-down",text:""}),null,16,["onClick"])):N("",!0)],16,aV)):N("",!0),(()=>{var tt;return be.childRowHeader&&((tt=t.childTableProps)==null?void 0:tt.useColumnsHeader)})()?(h(),C(re,{key:3},[(h(!0),C(re,null,Ye(se.value,tt=>{var $o,al;return h(),C("td",{key:tt.header,class:Pe([($o=O(l))==null?void 0:$o.bodycell.class,"font-semibold text-xs"]),colspan:tt.colspan??((al=tt.parentColumnsFields)==null?void 0:al.length),onClick:Oe[4]||(Oe[4]=It(()=>{},["stop"]))},U(tt.header),11,rV)}),128)),Te.value?(h(),C("td",{key:0,class:Pe(O(l).bodycell.class),onClick:Oe[5]||(Oe[5]=It(()=>{},["stop"]))},null,2)):N("",!0)],64)):be.childRowHeader?(h(),C("td",M({key:4,ref_for:!0},O(l).childrowheader,{class:(Ss=O(l))==null?void 0:Ss.bodycell.class,colspan:t.columns.length+1,onClick:Oe[6]||(Oe[6]=It(()=>{},["stop"]))}),U(be.header),17,lV)):be.loadingRow?(h(),C("td",{key:5,class:Pe((rp=O(l))==null?void 0:rp.bodycell.class),colspan:t.columns.length+1,onClick:Oe[7]||(Oe[7]=It(()=>{},["stop"]))},[w("div",M({ref_for:!0},O(l).loadingtablewrapper),[A(ns,M({animation:"loading-table",ref_for:!0},O(l).loadingtablelottie),null,16)],16)],10,uV)):be.noDataRow?(h(),C("td",{key:6,class:Pe((lp=O(l))==null?void 0:lp.bodycell.class),colspan:t.columns.length+1,onClick:Oe[8]||(Oe[8]=It(()=>{},["stop"]))},[w("div",M({ref_for:!0},O(l).nodatalottiewrapper),[A(ns,M({animation:"no-data",ref_for:!0},O(l).nodatalottie),null,16),r.value.emptyTableMessage?(h(),C("span",M({key:0,ref_for:!0},O(l).nodatamessage),U(r.value.emptyTableMessage),17)):N("",!0)],16)],10,cV)):(h(),C(re,{key:7},[(h(!0),C(re,null,Ye(be.childRow?se.value:b.value,tt=>{var $o,al,rl,cp,js,Lh,Lu,Ht,dp,di,On,ll,Lo,Nu,Bu,ft,At,Qt;return h(),C("td",M({key:tt.field,class:[{"!py-0":tt.editable,"!px-0":(($o=tt.preset)==null?void 0:$o.type)==="multirow"},typeof tt.bodyClass=="function"?tt.bodyClass(be):tt.bodyClass,J(tt,be,ne.dataKey),tt.class],colspan:tt.colspan??((al=tt.parentColumnsFields)==null?void 0:al.length),ref_for:!0},(rl=O(l))==null?void 0:rl.bodycell),[((cp=tt.preset)==null?void 0:cp.type)==="toggle"||((js=tt.preset)==null?void 0:js.type)==="checkbox"?(h(),C(re,{key:0},[((Lh=tt.preset)==null?void 0:Lh.type)==="toggle"?(h(),D(h2,{key:0,disabled:le(be[ne.dataKey])||(typeof((Lu=tt.preset)==null?void 0:Lu.disabled)=="function"?(Ht=tt.preset)==null?void 0:Ht.disabled(be):(dp=tt.preset)==null?void 0:dp.disabled),"input-id":be[ne.dataKey],"model-value":O(Qn)(be,tt.field),onClick:Oe[9]||(Oe[9]=It(()=>{},["stop"])),"onUpdate:modelValue":Ft=>{O(gl)(be,tt.field,Ft),X(Ft,be,tt)}},null,8,["disabled","input-id","model-value","onUpdate:modelValue"])):N("",!0),((di=tt.preset)==null?void 0:di.type)==="checkbox"?(h(),D(yo,{key:1,disabled:le(be[ne.dataKey])||(typeof((On=tt.preset)==null?void 0:On.disabled)=="function"?(ll=tt.preset)==null?void 0:ll.disabled(be):(Lo=tt.preset)==null?void 0:Lo.disabled),"input-id":be[ne.dataKey],"model-value":O(Qn)(be,tt.field),onClick:Oe[10]||(Oe[10]=It(()=>{},["stop"])),"onUpdate:modelValue":Ft=>{O(gl)(be,tt.field,!!Ft),X(!!Ft,be,tt)},binary:""},null,8,["disabled","input-id","model-value","onUpdate:modelValue"])):N("",!0),(Nu=tt.preset)!=null&&Nu.confirmDialogProps?(h(),D(mi,M({key:2,list:[be],visible:!!Fe.value[be[ne.dataKey]+tt.field],onClose:()=>{var Cn,ni,Nh;const Ft=()=>O(gl)(be,tt.field,!O(Qn)(be,tt.field));((Cn=Yt(tt.preset,be[tt.field],be))==null?void 0:Cn.actionable)==!1&&"onConfirm"in tt.preset?(Nh=(ni=tt.preset).onConfirm)==null||Nh.call(ni,be[tt.field],be,Ft):Ft()},onConfirm:Ft=>{var Cn,ni;return(ni=(Cn=tt.preset)==null?void 0:Cn.onConfirm)==null?void 0:ni.call(Cn,be[tt.field],be,()=>O(gl)(be,tt.field,!O(Qn)(be,tt.field)))},"onUpdate:visible":Ft=>Fe.value[be[ne.dataKey]+tt.field]=Ft,actionable:"",ref_for:!0},Yt(tt.preset,be[tt.field],be)),null,16,["list","visible","onClose","onConfirm","onUpdate:visible"])):N("",!0)],64)):((Bu=tt.preset)==null?void 0:Bu.type)==="multirow"?(h(),D(ZF,{key:1,attributes:((At=(ft=tt.preset)==null?void 0:ft.fieldAttributes)==null?void 0:At.call(ft,be))??[]},null,8,["attributes"])):tt.editable?(h(),C("span",M({key:2,ref_for:!0},O(l).celleditableelement,{contenteditable:tt.editable,onBlur:Ft=>{ne.$emit("cellEdited",{item:be,field:tt.field,index:rt,value:Ft.target.innerText})},onKeypress:Ft=>{tt.numberInputOnly&&ve(Ft)}}),U(O(Qn)(be,tt.field)||"-"),17,pV)):tt.bodyComponent||tt.bodyClass||tt.bodyTemplate||tt.dateFormatOptions?(h(),C(re,{key:3},[tt.bodyComponent?(h(),D(Bt(tt.bodyComponent(be,rt).component),M({key:0,modelValue:tt.bodyComponent(be,rt).model,"onUpdate:modelValue":Ft=>tt.bodyComponent(be,rt).model=Ft,disabled:tt.bodyComponent(be,rt).disabled,ref_for:!0},tt.bodyComponent(be,rt).props,lr(tt.bodyComponent(be,rt).events?tt.bodyComponent(be,rt).events:{}),{onChange:Ft=>{var Cn,ni;return(ni=(Cn=tt.bodyComponent(be,rt)).onChange)==null?void 0:ni.call(Cn,be)},onClick:Ft=>{tt.bodyComponent(be,rt).stop!==!1&&Ft.stopPropagation()},"onUpdate:modelValue":Ft=>{var Cn,ni;return(ni=(Cn=tt.bodyComponent(be,rt)).onChange)==null?void 0:ni.call(Cn,be)}}),null,16,["modelValue","onUpdate:modelValue","disabled","onChange","onClick"])):(h(),C("span",fV,[tt.bodyTemplate?(h(),C(re,{key:0},[st(U(((Qt=tt.bodyTemplate)==null?void 0:Qt.call(tt,be,rt))||"-"),1)],64)):tt.dateFormatOptions?(h(),C(re,{key:1},[st(U(O(rg)(new Date(O(Qn)(be,tt.field)),tt.dateFormatOptions)),1)],64)):(h(),C(re,{key:2},[st(U(O(Qn)(be,tt.field)||"-"),1)],64))]))],64)):(h(),C(re,{key:4},[st(U(O(Qn)(be,tt.field)??"-"),1)],64))],16,dV)}),128)),Te.value?(h(),C("td",M({key:0,ref_for:!0,ref_key:"rowSingleActionCell",ref:T},(up=O(l))==null?void 0:up.rowsingleactioncell({props:t,context:{selected:Ee(be[ne.dataKey]),highlighted:be[ne.highlightKey??""]}}),{class:O(l).bodycell.class}),[!be.childRow&&ne.useOption||be.childRow&&(($h=t.childTableProps)!=null&&$h.useOption)?(h(),C("div",M({key:0,ref_for:!0},O(l).singleactionwrapper),[A(Ce,M({id:"button-action-"+be[t.dataKey],ref_for:!0},O(l).singleactionbutton({props:t}),{disabled:ne.disableAllRows,onClick:It(tt=>ge(tt,be),["stop"]),icon:"ellipsis-h",outlined:"",size:"small","tooltip-pos":"left",type:"button"}),null,16,["id","disabled","onClick"])],16)):N("",!0)],16)):N("",!0)],64))],16,oV),Se(ne.$slots,"row-subcontent",{item:be},void 0,!0)],64)}),128))],16)],16,QF))]}),_:3},16)],16),ne.usePaginator?_t((h(),D(O(w0),M({key:$.value,rows:te.value,"onUpdate:rows":Oe[14]||(Oe[14]=H=>te.value=H)},O(l).paginator({context:{totalRecords:fe.value}}),{"current-page-report-template":fe.value?O(a).paginationReportFound:O(a).paginationReportNotFound,"rows-per-page-options":u,"total-records":fe.value,onPage:ae}),{firstpagelinkicon:Y(()=>[A(Ke,{icon:"round-keyboard-double-arrow-left"})]),lastpagelinkicon:Y(()=>[A(Ke,{icon:"round-keyboard-double-arrow-right"})]),prevpagelinkicon:Y(()=>[A(Ke,{icon:"round-keyboard-arrow-left"})]),nextpagelinkicon:Y(()=>[A(Ke,{icon:"round-keyboard-arrow-right"})]),_:1},16,["rows","current-page-report-template","total-records"])),[[En,!Q.value]]):N("",!0),A(kc,{id:"single-action-menu",ref_key:"optionMenu",ref:me,model:ne.options,onFocus:O(cR),"append-to":"body","auto-z-index":"",popup:""},null,8,["model","onFocus"]),t.customColumn?(h(),D(gF,{key:_.value,ref_key:"customColumn",ref:q,"visible-columns":b.value,"onUpdate:visibleColumns":Oe[15]||(Oe[15]=H=>b.value=H),"default-columns":ne.columns.filter(H=>H.visible!==!1),"table-id":O(f)},null,8,["visible-columns","default-columns","table-id"])):N("",!0),A(rj,{group:"download"})],16)}}}),td=(n,e)=>{const t=n.__vccOpts||n;for(const[i,s]of e)t[i]=s;return t},ss=Ve("DataTable",td(gV,[["__scopeId","data-v-6e13706f"]])),Hl=Ve("Form",Ie({__name:"Form",props:{buttonsTemplate:{},disableSubmit:{type:Boolean},cancelBtnLabel:{default:"Batal"},clearBtnLabel:{default:"Bersihkan Field"},columnPerRow:{},hideFooter:{type:Boolean},hideStayCheckbox:{type:Boolean},invalid:{type:Boolean},resetAfterSubmit:{type:Boolean,default:!0},saveBtnLabel:{default:"Simpan"},submitBtnLabel:{default:"Simpan"},stayCheckboxLabel:{default:"Tetap di halaman ini"},validatorMessage:{default:"Please input all required field!"},validateOnSave:{type:Boolean,default:!1},cancelBtnSeverity:{default:"secondary"},saveBtnSeverity:{default:"success"},submitBtnSeverity:{default:"success"}},emits:["cancel","clear","save","submit"],setup(n,{expose:e,emit:t}){const i=n,s=t;Pt(()=>{if(j.value){const G=i.columnPerRow??1;j.value.style.gridTemplateColumns=`repeat(${G}, minmax(0, 1fr))`,E()}});const o=xe("preset",{}).form,{handleSubmit:a,values:r,resetForm:l,errors:u,resetField:c,setValues:d,setFieldValue:p,setErrors:f}=Ap(),m=z(!1),g=oe(),v=z(!1),b=z(!1),y=z(0),T=oe(),k=z(!1),S=z(!1),_=z(!1),j=oe(null),x=oe(null);Wn("isSubmitting",k);const E=()=>{var G;if(T.value){const F=(G=T.value)==null?void 0:G.offsetHeight;x.value&&(x.value.style.height=`calc(100% + ${F+20}px)`)}},I=()=>{k.value=!0,_.value=!0,b.value||(v.value=!0)},$=()=>{k.value=!0,S.value=!0,i.validateOnSave?(b.value||(v.value=!0),P()):V()},P=a(G=>{if(!i.invalid){const F=me(G),ue={stayAfterSubmit:m.value,formValues:F};S.value?s("save",ue):s("submit",ue),v.value=!1,S.value=!1,i.resetAfterSubmit&&(y.value+=1,l())}k.value=!1},()=>{k.value=!1}),V=()=>{const G=me(r),F={stayAfterSubmit:m.value,formValues:G};s("save",F),k.value=!1},q=()=>{l(),y.value++,s("clear"),v.value=!1,_.value=!1},me=G=>{const F=G,ue=Object.keys(F);for(const je of ue)typeof F[je]=="string"&&(F[je]=F[je].trim());return F};return He(r,()=>{_.value=!1},{deep:!0}),e({stayAfterSubmit:m,submit:P,onSubmitClicked:I,onSaveClicked:$,showValidator:v,formElement:g,clearField:q,resetField:c,errors:u,setOuterFieldsWrapperHeight:E,setValues:d,setFieldValue:p,setErrors:f,values:r,isSubmitClicked:_}),(G,F)=>{var ue,je,Le,Me,de,te,fe,Fe,_e,We,ke,se,ye,L,R;return h(),C("form",M({ref_key:"formElement",ref:g},(ue=O(o))==null?void 0:ue.root({props:i}),{onInput:F[2]||(F[2]=pe=>v.value=!1),onSubmit:F[3]||(F[3]=It((...pe)=>O(P)&&O(P)(...pe),["prevent"]))}),[w("div",{ref_key:"outerFieldsWrapper",ref:x},[w("div",M({ref_key:"fieldsWrapper",ref:j},(je=O(o))==null?void 0:je["fields-wrapper"]),[Se(G.$slots,"fields",{key:y.value,formValues:O(r)})],16)],512),G.hideFooter?N("",!0):(h(),C("div",M({key:0,ref_key:"footer",ref:T},(Le=O(o))==null?void 0:Le.footer),[G.hideStayCheckbox?N("",!0):(h(),C("div",ht(M({key:0},(Me=O(o))==null?void 0:Me.staycheckbox)),[A(yo,{modelValue:m.value,"onUpdate:modelValue":F[0]||(F[0]=pe=>m.value=pe),label:G.stayCheckboxLabel},null,8,["modelValue","label"])],16)),w("div",M({id:"footer-actions-wrapper"},(de=O(o))==null?void 0:de["action-buttons"]),[_t(A(fi,M((te=O(o))==null?void 0:te["validator-message"],{message:G.validatorMessage}),null,16,["message"]),[[En,v.value||i.invalid]]),w("div",ht(Ut((fe=O(o))==null?void 0:fe["button-wrapper"])),[(Fe=i.buttonsTemplate)!=null&&Fe.includes("cancel")?(h(),D(Ce,M({key:0},(_e=O(o))==null?void 0:_e["cancel-button"],{label:G.cancelBtnLabel,severity:G.cancelBtnSeverity,onClick:F[1]||(F[1]=pe=>G.$emit("cancel")),"data-test":"cancel-button",text:"",type:"button"}),null,16,["label","severity"])):N("",!0),(We=i.buttonsTemplate)!=null&&We.includes("clear")?(h(),D(Ce,M({key:1},(ke=O(o))==null?void 0:ke["clear-button"],{label:G.clearBtnLabel,onClick:q,text:"",type:"button"}),null,16,["label"])):N("",!0),(se=i.buttonsTemplate)!=null&&se.includes("save")?(h(),D(Ce,M({key:2},(ye=O(o))==null?void 0:ye["save-button"],{label:G.saveBtnLabel,severity:G.saveBtnSeverity,onClick:$,outlined:"",type:"button"}),null,16,["label","severity"])):N("",!0),(L=i.buttonsTemplate)!=null&&L.includes("submit")?(h(),D(Ce,M({key:3},(R=O(o))==null?void 0:R["submit-button"],{disabled:G.disableSubmit,label:G.submitBtnLabel,severity:G.submitBtnSeverity,onClick:I,type:"submit"}),null,16,["disabled","label","severity"])):N("",!0)],16)],16)],16))],16)}}})),ri=Ve("DialogForm",Ie({__name:"DialogForm",props:{buttonsTemplate:{},header:{},visible:{type:Boolean},asideRightWidth:{default:260},class:{},cancelBtnLabel:{},clearBtnLabel:{},closable:{type:Boolean,default:!0},closeOnSubmit:{type:Boolean,default:!0},contentClass:{},dateHeader:{},headerIcon:{},invalid:{type:Boolean},resetAfterSubmit:{type:Boolean,default:!0},severity:{},showStayCheckbox:{type:Boolean,default:void 0},stayCheckboxLabel:{},submitBtnLabel:{},validatorMessage:{},validationFunction:{},width:{default:"small"},disableSubmit:{type:Boolean},columnPerRow:{default:1},hideFooter:{type:Boolean},hideStayCheckbox:{type:Boolean},saveBtnLabel:{},validateOnSave:{type:Boolean},cancelBtnSeverity:{},saveBtnSeverity:{},submitBtnSeverity:{}},emits:["clear","close","hide","show","submit","update:visible"],setup(n,{expose:e,emit:t}){const i=n,s=t,o=zu(),{locale:a}=kn("DialogForm"),r=xe("preset",{}).dialog,l=xe("preset",{}).dialogform,u=oe(),c=oe(),d=z(0),p=z(!1),f=z(!1),m=oe({stayAfterSubmit:!1,formValues:{}}),g=W(()=>{const S=o["aside-right"]&&f.value?i.asideRightWidth:0;return`calc(${{small:400,medium:500,large:572,"semi-xlarge":600,xlarge:800}[i.width]}px + ${S}px)`}),v=()=>{s("update:visible",!1),s("close")},b=()=>{u.value&&!i.invalid&&!i.validatorMessage&&(u.value.onSubmitClicked(),u.value.submit())},y=()=>{u.value&&u.value.clearField(),s("clear")},T=async S=>{i.validationFunction&&await i.validationFunction(S.formValues),!i.invalid&&!i.validatorMessage&&(m.value=S,o.confirm?p.value=!0:k())},k=async S=>{const{stayAfterSubmit:_}=m.value;if(!_&&i.closeOnSubmit&&s("update:visible",!1),o.confirm)try{await(S==null?void 0:S(m.value))}catch(j){console.error(j)}else s("submit",m.value);i.resetAfterSubmit&&y()};return e({form:u,clearField:y,setValues:S=>{var _;(_=u.value)==null||_.setValues(S)},setFieldValue:(S,_,j)=>{var x;(x=u.value)==null||x.setFieldValue(S,_,j)},setErrors:S=>{var _;(_=u.value)==null||_.setErrors(S)}}),(S,_)=>{var j,x,E,I;return h(),D(O(wl),M({ref_key:"dialogForm",ref:c},(j=O(l))==null?void 0:j.root,{class:i.class,closable:S.closable,draggable:!1,header:S.header,pt:{root:{class:[...(x=O(r))==null?void 0:x.root({state:{}}).class,...(E=O(l))==null?void 0:E.root.class],style:(I=O(l))==null?void 0:I.root.style(g.value)}},visible:S.visible,onHide:_[3]||(_[3]=$=>s("hide")),onShow:_[4]||(_[4]=$=>s("show")),"onUpdate:visible":_[5]||(_[5]=$=>s("update:visible",!!$)),modal:""}),{container:Y(()=>{var $,P,V,q,me,G,F,ue,je,Le;return[w("div",ht(Ut(($=O(l))==null?void 0:$.container(f.value))),[w("section",M((P=O(l))==null?void 0:P.mainsection,{id:"main"}),[w("div",ht(Ut((V=O(l))==null?void 0:V.header)),[Se(S.$slots,"header",{},()=>{var Me,de,te,fe;return[S.headerIcon?(h(),D(Ke,M({key:0},(Me=O(l))==null?void 0:Me.headericon,{icon:S.headerIcon,severity:S.severity,"aria-label":"Header Icon"}),null,16,["icon","severity"])):N("",!0),w("h3",ht(Ut((de=O(l))==null?void 0:de.headertitle)),U(S.header),17),S.$slots["aside-right"]?(h(),D(Ce,M({key:1},(te=O(l))==null?void 0:te.expandasidebutton,{label:f.value?O(a).asideRightExpandedButtonLabel:O(a).asideRightCollapsedButtonLabel,onClick:_[0]||(_[0]=Fe=>f.value=!f.value),text:""}),null,16,["label"])):N("",!0),S.closable?(h(),D(Ce,M({key:2,onClick:v},(fe=O(l))==null?void 0:fe.closedialog,{icon:"close","icon-class":"w-[22px] h-[22px]",rounded:"",severity:"secondary",text:""}),null,16)):N("",!0)]})],16),A(Hl,M((q=O(l))==null?void 0:q.form,{ref_key:"form",ref:u,"buttons-template":S.buttonsTemplate,"column-per-row":S.columnPerRow,"reset-after-submit":S.resetAfterSubmit,onSubmit:T,"hide-footer":""}),{fields:Y(({formValues:Me})=>[Se(S.$slots,"fields",{key:d.value,formValues:Me})]),_:3},16,["buttons-template","column-per-row","reset-after-submit"]),Se(S.$slots,"confirm",{hide:()=>p.value=!1,submit:k,visible:p.value}),w("div",ht(Ut((me=O(l))==null?void 0:me.footer)),[S.showStayCheckbox?(h(),D(yo,M({key:0},(G=O(l))==null?void 0:G.staycheckbox,{label:S.stayCheckboxLabel??O(a).stayCheckboxLabel,"model-value":(F=u.value)==null?void 0:F.stayAfterSubmit,"onUpdate:modelValue":_[1]||(_[1]=Me=>u.value&&(u.value.stayAfterSubmit=Me))}),null,16,["label","model-value"])):N("",!0),_t(A(fi,M((ue=O(l))==null?void 0:ue.validatormessage,{format:!1,message:S.validatorMessage}),null,16,["message"]),[[En,S.invalid&&S.validatorMessage]]),i.buttonsTemplate.length?(h(),C("div",ht(M({key:1},(je=O(l))==null?void 0:je.footerbutton)),[Se(S.$slots,"actionButtons",{submit:b},()=>{var Me,de,te,fe,Fe,_e;return[(Me=i.buttonsTemplate)!=null&&Me.includes("cancel")?(h(),D(Ce,M({key:0},(de=O(l))==null?void 0:de.cancelbtn,{label:S.cancelBtnLabel??O(a).cancelBtnLabel,onClick:_[2]||(_[2]=We=>(s("close"),s("update:visible",!1))),severity:"secondary",text:""}),null,16,["label"])):N("",!0),(te=i.buttonsTemplate)!=null&&te.includes("clear")?(h(),D(Ce,M({key:1},(fe=O(l))==null?void 0:fe.clearfield,{label:S.clearBtnLabel??O(a).clearBtnLabel,onClick:y,class:"whitespace-nowrap",text:""}),null,16,["label"])):N("",!0),(Fe=i.buttonsTemplate)!=null&&Fe.includes("submit")?(h(),D(Ce,M({key:2},(_e=O(l))==null?void 0:_e.savesubmitbutton,{label:S.submitBtnLabel??O(a).submitBtnLabel,severity:i.severity==="primary"?void 0:i.severity??"success",onClick:b}),null,16,["label","severity"])):N("",!0)]})],16)):N("",!0)],16)],16),S.$slots["aside-right"]?(h(),C("aside",ht(M({key:0},(Le=O(l))==null?void 0:Le.asidesection(f.value,S.asideRightWidth))),[Se(S.$slots,"aside-right")],16)):N("",!0)],16)]}),_:3},16,["class","closable","header","pt","visible"])}}})),uj=n=>n!=null&&n.length?typeof(n==null?void 0:n[0])=="string"?n:n==null?void 0:n.filter(e=>e.visible!==!1):[],hi=Ve("Dropdown",Ie({__name:"Dropdown",props:{modelValue:{type:[String,Number,Boolean,Object],default:void 0},initialValue:{type:[String,Number,Boolean,Object],default:void 0},label:{},options:{},allowNullOption:{type:Boolean,default:void 0},unselectOnReselect:{type:Boolean},optionLabel:{},optionValue:{},valueType:{default:"plain"},badgeValueProps:{},inputBorder:{},dataKey:{},useValidator:{type:Boolean},mandatory:{type:Boolean},showOptionalText:{type:Boolean,default:void 0},validatorMessage:{},formatValidatorMessage:{type:Boolean,default:!0},invalid:{type:Boolean},fieldName:{},placeholder:{},loading:{type:Boolean},fieldInfo:{},disabled:{type:Boolean},filter:{type:Boolean,default:!0},filterPlaceholder:{},panelMaxContent:{type:Boolean,default:!1}},emits:["update:modelValue","show","fieldInfoClick"],setup(n,{expose:e,emit:t}){const i=n,s=t;Pt(()=>{y()});const{locale:o,defaultProps:a}=kn("Dropdown"),r=W(()=>Xs(i,a)),l=xe("preset",{}).dropdown,u=xe("preset",{}).inputgroupaddon,c=oe(),d=z(!1),p=z(!1),f=W(()=>i.invalid||!!m.errorMessage),m=Sn({value:i.initialValue!==void 0?i.initialValue:i.modelValue}),g=W(()=>{var j;return o.emptySelectionErrorMessage.replace("{label}",i.label).replace("{formattedLabel}",(j=ov(i.label))==null?void 0:j.toLowerCase())}),v=W(()=>uj(i.options)),b=W(()=>{var j;return i.loading?o.loadingPlaceholder:i.placeholder??((j=o.inputPlaceholder)==null?void 0:j.replace("{label}",i.label??"").replace("{lowercaseLabel}",(i.label??"").toLowerCase()))}),y=()=>{i.useValidator&&(Object.assign(m,ii(i.fieldName??"dropdown",j=>!(j!=null&&j!=="")&&i.mandatory?typeof i.validatorMessage=="object"&&"empty"in i.validatorMessage?i.validatorMessage.empty:i.validatorMessage??g.value:Xt(T))),i.initialValue!==void 0&&(m.value=i.initialValue),i.invalid&&m.validate())},T=()=>i.validatorMessage&&i.invalid?i.validatorMessage:!0,k=j=>{const{value:x}=j;i.unselectOnReselect?p.value=!0:s("update:modelValue",x)},S=()=>{if(i.optionValue){const j=v.value.find(x=>{if(typeof x!="string")return i.dataKey?m.value[i.dataKey]===x[i.optionValue??""][i.dataKey]:Tg(As(x[i.optionValue??""]),As(m.value))});if(j&&typeof j!="string")return j[i.optionLabel??""]}else if(m.value&&typeof m.value=="object"&&i.optionLabel&&i.optionLabel in m.value)return m.value[i.optionLabel];return m.value},_=()=>{c.value&&c.value.show()};return He(()=>i.initialValue,j=>{m.value=j},{once:!0}),He(()=>i.modelValue,j=>{m.value=j}),He(()=>m.value,(j,x)=>{setTimeout(()=>{i.unselectOnReselect&&p.value&&(Tg(j,x)&&j!==void 0&&(m.value=void 0),p.value=!1,s("update:modelValue",m.value))},0)}),e({showOverlay:_}),(j,x)=>(h(),D(Di,{info:j.fieldInfo,label:i.label,mandatory:i.mandatory,"show-optional-text":j.showOptionalText,onInfoClick:x[3]||(x[3]=E=>j.$emit("fieldInfoClick"))},{default:Y(()=>[A(Yo,{class:Pe([{"grid grid-cols-[max-content,1fr,max-content]":j.$slots["addon-left"]&&j.$slots["addon-right"],"grid grid-cols-[1fr,max-content]":!j.$slots["addon-left"]&&j.$slots["addon-right"],"grid grid-cols-[max-content,1fr]":j.$slots["addon-left"]&&!j.$slots["addon-right"]}]),disabled:i.disabled,invalid:f.value,ring:j.inputBorder},{default:Y(()=>{var E,I,$,P,V;return[j.$slots["addon-left"]?(h(),D(O(Tr),{key:0,disabled:i.disabled},{default:Y(()=>[Se(j.$slots,"addon-left")]),_:3},8,["disabled"])):N("",!0),A(O(Ia),M({ref_key:"dropdown",ref:c},i,{modelValue:m.value,"onUpdate:modelValue":x[0]||(x[0]=q=>m.value=q),"aria-describedby":i.label+"error","filter-placeholder":i.filterPlaceholder||O(o).filterPlaceholder,invalid:f.value,options:v.value,placeholder:b.value,pt:{list:(E=O(l))==null?void 0:E.list({props:i}),panel:(I=O(l))==null?void 0:I.panel({props:i}),virtualScroller:($=O(l))==null?void 0:$.virtualScroller({props:i}),wrapper:(P=O(l))==null?void 0:P.wrapper({props:i})},"virtual-scroller-options":((V=v.value)==null?void 0:V.length)>10?{itemSize:32}:void 0,onChange:k,onHide:x[1]||(x[1]=q=>d.value=!1),onShow:x[2]||(x[2]=q=>(j.$emit("show"),d.value=!0))}),pi({dropdownicon:Y(()=>[A(Ke,ht(Ut(O(l).dropdownicon({state:{isShowOverlay:d.value}}))),null,16)]),loadingicon:Y(()=>[A(Ke,ht(Ut(O(l).loadingicon)),null,16)]),filtericon:Y(()=>[A(Ke,ht(Ut(O(l).filtericon)),null,16)]),_:2},[j.loading?{name:"value",fn:Y(({placeholder:q})=>[w("span",ht(Ut(O(l).loadingplaceholder)),U(q),17)]),key:"0"}:{name:"value",fn:Y(q=>[(r.value.allowNullOption?q.value!==void 0:q.value!=null)?Se(j.$slots,"value",{key:0,originalValue:q.value,value:S()},()=>[j.valueType==="badge"?(h(),D(yr,M({key:0},j.badgeValueProps,{label:S()}),null,16,["label"])):(h(),C(re,{key:1},[st(U(S()),1)],64))]):(h(),C(re,{key:1},[st(U(q.placeholder),1)],64))]),key:"1"},j.$slots.option?{name:"option",fn:Y(({option:q})=>[Se(j.$slots,"option",{option:q})]),key:"2"}:void 0,j.$slots.footer?{name:"footer",fn:Y(({value:q,options:me})=>[Se(j.$slots,"footer",{options:me,value:q})]),key:"3"}:void 0]),1040,["modelValue","aria-describedby","filter-placeholder","invalid","options","placeholder","pt","virtual-scroller-options"]),j.$slots["addon-right"]?(h(),D(O(Tr),{key:1,pt:{root:O(u).root({props:{class:[{"!text-general-200":i.disabled}]}})}},{default:Y(()=>[Se(j.$slots,"addon-right")]),_:3},8,["pt"])):N("",!0)]}),_:3},8,["class","disabled","invalid","ring"]),A(fi,{id:i.label+"error",message:m.errorMessage},null,8,["id","message"])]),_:3},8,["info","label","mandatory","show-optional-text"]))}}));function Ci(n){this.content=n}Ci.prototype={constructor:Ci,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var i=t&&t!=n?this.remove(t):this,s=i.find(n),o=i.content.slice();return s==-1?o.push(t||n,e):(o[s+1]=e,t&&(o[s]=t)),new Ci(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ci(t)},addToStart:function(n,e){return new Ci([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Ci(t)},addBefore:function(n,e,t){var i=this.remove(e),s=i.content.slice(),o=i.find(n);return s.splice(o==-1?s.length:o,0,e,t),new Ci(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Ci.from(n),n.size?new Ci(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ci.from(n),n.size?new Ci(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Ci.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},Ci.from=function(n){if(n instanceof Ci)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ci(e)};function cj(n,e,t){for(let i=0;;i++){if(i==n.childCount||i==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(i),o=e.child(i);if(s==o){t+=s.nodeSize;continue}if(!s.sameMarkup(o))return t;if(s.isText&&s.text!=o.text){for(let a=0;s.text[a]==o.text[a];a++)t++;return t}if(s.content.size||o.content.size){let a=cj(s.content,o.content,t+1);if(a!=null)return a}t+=s.nodeSize}}function dj(n,e,t,i){for(let s=n.childCount,o=e.childCount;;){if(s==0||o==0)return s==o?null:{a:t,b:i};let a=n.child(--s),r=e.child(--o),l=a.nodeSize;if(a==r){t-=l,i-=l;continue}if(!a.sameMarkup(r))return{a:t,b:i};if(a.isText&&a.text!=r.text){let u=0,c=Math.min(a.text.length,r.text.length);for(;u<c&&a.text[a.text.length-u-1]==r.text[r.text.length-u-1];)u++,t--,i--;return{a:t,b:i}}if(a.content.size||r.content.size){let u=dj(a.content,r.content,t-1,i-1);if(u)return u}t-=l,i-=l}}class et{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let i=0;i<e.length;i++)this.size+=e[i].nodeSize}nodesBetween(e,t,i,s=0,o){for(let a=0,r=0;r<t;a++){let l=this.content[a],u=r+l.nodeSize;if(u>e&&i(l,s+r,o||null,a)!==!1&&l.content.size){let c=r+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,t-c),i,s+c)}r=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,i,s){let o="",a=!0;return this.nodesBetween(e,t,(r,l)=>{let u=r.isText?r.text.slice(Math.max(e,l)-l,t-l):r.isLeaf?s?typeof s=="function"?s(r):s:r.type.spec.leafText?r.type.spec.leafText(r):"":"";r.isBlock&&(r.isLeaf&&u||r.isTextblock)&&i&&(a?a=!1:o+=i),o+=u},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,i=e.firstChild,s=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(i)&&(s[s.length-1]=t.withText(t.text+i.text),o=1);o<e.content.length;o++)s.push(e.content[o]);return new et(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let i=[],s=0;if(t>e)for(let o=0,a=0;a<t;o++){let r=this.content[o],l=a+r.nodeSize;l>e&&((a<e||l>t)&&(r.isText?r=r.cut(Math.max(0,e-a),Math.min(r.text.length,t-a)):r=r.cut(Math.max(0,e-a-1),Math.min(r.content.size,t-a-1))),i.push(r),s+=r.nodeSize),a=l}return new et(i,s)}cutByIndex(e,t){return e==t?et.empty:e==0&&t==this.content.length?this:new et(this.content.slice(e,t))}replaceChild(e,t){let i=this.content[e];if(i==t)return this;let s=this.content.slice(),o=this.size+t.nodeSize-i.nodeSize;return s[e]=t,new et(s,o)}addToStart(e){return new et([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new et(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,i=0;t<this.content.length;t++){let s=this.content[t];e(s,i,t),i+=s.nodeSize}}findDiffStart(e,t=0){return cj(this,e,t)}findDiffEnd(e,t=this.size,i=e.size){return dj(this,e,t,i)}findIndex(e,t=-1){if(e==0)return kf(0,e);if(e==this.size)return kf(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let i=0,s=0;;i++){let o=this.child(i),a=s+o.nodeSize;if(a>=e)return a==e||t>0?kf(i+1,a):kf(i,s);s=a}}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 et.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new et(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return et.empty;let t,i=0;for(let s=0;s<e.length;s++){let o=e[s];i+=o.nodeSize,s&&o.isText&&e[s-1].sameMarkup(o)?(t||(t=e.slice(0,s)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new et(t||e,i)}static from(e){if(!e)return et.empty;if(e instanceof et)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new et([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}et.empty=new et([],0);const C0={index:0,offset:0};function kf(n,e){return C0.index=n,C0.offset=e,C0}function wf(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!wf(n[i],e[i]))return!1}else{for(let i in n)if(!(i in e)||!wf(n[i],e[i]))return!1;for(let i in e)if(!(i in n))return!1}return!0}let An=class O1{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,i=!1;for(let s=0;s<e.length;s++){let o=e[s];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,s));else{if(o.type.excludes(this.type))return e;!i&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),i=!0),t&&t.push(o)}}return t||(t=e.slice()),i||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&&wf(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 i=e.marks[t.type];if(!i)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=i.create(t.attrs);return i.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++)if(!e[i].eq(t[i]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return O1.none;if(e instanceof O1)return[e];let t=e.slice();return t.sort((i,s)=>i.type.rank-s.type.rank),t}};An.none=[];class Sf extends Error{}class wt{constructor(e,t,i){this.content=e,this.openStart=t,this.openEnd=i}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let i=fj(this.content,e+this.openStart,t);return i&&new wt(i,this.openStart,this.openEnd)}removeBetween(e,t){return new wt(pj(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 wt.empty;let i=t.openStart||0,s=t.openEnd||0;if(typeof i!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new wt(et.fromJSON(e,t.content),i,s)}static maxOpen(e,t=!0){let i=0,s=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)i++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)s++;return new wt(e,i,s)}}wt.empty=new wt(et.empty,0,0);function pj(n,e,t){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i),{index:a,offset:r}=n.findIndex(t);if(s==e||o.isText){if(r!=t&&!n.child(a).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(i!=a)throw new RangeError("Removing non-flat range");return n.replaceChild(i,o.copy(pj(o.content,e-s-1,t-s-1)))}function fj(n,e,t,i){let{index:s,offset:o}=n.findIndex(e),a=n.maybeChild(s);if(o==e||a.isText)return n.cut(0,e).append(t).append(n.cut(e));let r=fj(a.content,e-o-1,t);return r&&n.replaceChild(s,a.copy(r))}function vV(n,e,t){if(t.openStart>n.depth)throw new Sf("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Sf("Inconsistent open depths");return mj(n,e,t,0)}function mj(n,e,t,i){let s=n.index(i),o=n.node(i);if(s==e.index(i)&&i<n.depth-t.openStart){let a=mj(n,e,t,i+1);return o.copy(o.content.replaceChild(s,a))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==i&&e.depth==i){let a=n.parent,r=a.content;return Ar(a,r.cut(0,n.parentOffset).append(t.content).append(r.cut(e.parentOffset)))}else{let{start:a,end:r}=yV(t,n);return Ar(o,gj(n,a,r,e,i))}else return Ar(o,jf(n,e,i))}function hj(n,e){if(!e.type.compatibleContent(n.type))throw new Sf("Cannot join "+e.type.name+" onto "+n.type.name)}function T0(n,e,t){let i=n.node(t);return hj(i,e.node(t)),i}function Ir(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function nd(n,e,t,i){let s=(e||n).node(t),o=0,a=e?e.index(t):s.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(Ir(n.nodeAfter,i),o++));for(let r=o;r<a;r++)Ir(s.child(r),i);e&&e.depth==t&&e.textOffset&&Ir(e.nodeBefore,i)}function Ar(n,e){return n.type.checkContent(e),n.copy(e)}function gj(n,e,t,i,s){let o=n.depth>s&&T0(n,e,s+1),a=i.depth>s&&T0(t,i,s+1),r=[];return nd(null,n,s,r),o&&a&&e.index(s)==t.index(s)?(hj(o,a),Ir(Ar(o,gj(n,e,t,i,s+1)),r)):(o&&Ir(Ar(o,jf(n,e,s+1)),r),nd(e,t,s,r),a&&Ir(Ar(a,jf(t,i,s+1)),r)),nd(i,null,s,r),new et(r)}function jf(n,e,t){let i=[];if(nd(null,n,t,i),n.depth>t){let s=T0(n,e,t+1);Ir(Ar(s,jf(n,e,t+1)),i)}return nd(e,null,t,i),new et(i)}function yV(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)s=e.node(o).copy(et.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class id{constructor(e,t,i){this.pos=e,this.path=t,this.parentOffset=i,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 i=this.pos-this.path[this.path.length-1],s=e.child(t);return i?e.child(t).cut(i):s}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 i=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)s+=i.child(o).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return An.none;if(this.textOffset)return e.child(t).marks;let i=e.maybeChild(t-1),s=e.maybeChild(t);if(!i){let r=i;i=s,s=r}let o=i.marks;for(var a=0;a<o.length;a++)o[a].type.spec.inclusive===!1&&(!s||!o[a].isInSet(s.marks))&&(o=o[a--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let i=t.marks,s=e.parent.maybeChild(e.index());for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}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 i=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);i>=0;i--)if(e.pos<=this.end(i)&&(!t||t(this.node(i))))return new Cf(this,e,i);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 i=[],s=0,o=t;for(let a=e;;){let{index:r,offset:l}=a.content.findIndex(o),u=o-l;if(i.push(a,r,s+l),!u||(a=a.child(r),a.isText))break;o=u-1,s+=l+1}return new id(t,i,o)}static resolveCached(e,t){let i=vj.get(e);if(i)for(let o=0;o<i.elts.length;o++){let a=i.elts[o];if(a.pos==t)return a}else vj.set(e,i=new bV);let s=i.elts[i.i]=id.resolve(e,t);return i.i=(i.i+1)%_V,s}}class bV{constructor(){this.elts=[],this.i=0}}const _V=12,vj=new WeakMap;class Cf{constructor(e,t,i){this.$from=e,this.$to=t,this.depth=i}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 kV=Object.create(null);let Na=class I1{constructor(e,t,i,s=An.none){this.type=e,this.attrs=t,this.marks=s,this.content=i||et.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,i,s=0){this.content.nodesBetween(e,t,i,s,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,i,s){return this.content.textBetween(e,t,i,s)}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,i){return this.type==e&&wf(this.attrs,t||e.defaultAttrs||kV)&&An.sameSet(this.marks,i||An.none)}copy(e=null){return e==this.content?this:new I1(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new I1(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,i=!1){if(e==t)return wt.empty;let s=this.resolve(e),o=this.resolve(t),a=i?0:s.sharedDepth(t),r=s.start(a),u=s.node(a).content.cut(s.pos-r,o.pos-r);return new wt(u,s.depth-a,o.depth-a)}replace(e,t,i){return vV(this.resolve(e),this.resolve(t),i)}nodeAt(e){for(let t=this;;){let{index:i,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(i),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:i}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:i}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:i}=this.content.findIndex(e);if(i<e)return{node:this.content.child(t),index:t,offset:i};let s=this.content.child(t-1);return{node:s,index:t-1,offset:i-s.nodeSize}}resolve(e){return id.resolveCached(this,e)}resolveNoCache(e){return id.resolve(this,e)}rangeHasMark(e,t,i){let s=!1;return t>e&&this.nodesBetween(e,t,o=>(i.isInSet(o.marks)&&(s=!0),!s)),s}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()+")"),yj(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,i=et.empty,s=0,o=i.childCount){let a=this.contentMatchAt(e).matchFragment(i,s,o),r=a&&a.matchFragment(this.content,t);if(!r||!r.validEnd)return!1;for(let l=s;l<o;l++)if(!this.type.allowsMarks(i.child(l).marks))return!1;return!0}canReplaceWith(e,t,i,s){if(s&&!this.type.allowsMarks(s))return!1;let o=this.contentMatchAt(e).matchType(i),a=o&&o.matchFragment(this.content,t);return a?a.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=An.none;for(let t=0;t<this.marks.length;t++){let i=this.marks[t];i.type.checkAttrs(i.attrs),e=i.addToSet(e)}if(!An.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 i;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");i=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,i)}let s=et.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,s,i);return o.type.checkAttrs(o.attrs),o}};Na.prototype.text=void 0;class Tf extends Na{constructor(e,t,i,s){if(super(e,t,null,s),!i)throw new RangeError("Empty text nodes are not allowed");this.text=i}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):yj(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 Tf(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Tf(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 yj(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Mr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let i=new wV(e,t);if(i.next==null)return Mr.empty;let s=bj(i);i.next&&i.err("Unexpected trailing text");let o=AV(IV(s));return MV(o,i),o}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,i=e.childCount){let s=this;for(let o=t;s&&o<i;o++)s=s.matchType(e.child(o).type);return s}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 i=0;i<e.next.length;i++)if(this.next[t].type==e.next[i].type)return!0;return!1}fillBefore(e,t=!1,i=0){let s=[this];function o(a,r){let l=a.matchFragment(e,i);if(l&&(!t||l.validEnd))return et.from(r.map(u=>u.createAndFill()));for(let u=0;u<a.next.length;u++){let{type:c,next:d}=a.next[u];if(!(c.isText||c.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let p=o(d,r.concat(c));if(p)return p}}return null}return o(this,[])}findWrapping(e){for(let i=0;i<this.wrapCache.length;i+=2)if(this.wrapCache[i]==e)return this.wrapCache[i+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),i=[{match:this,type:null,via:null}];for(;i.length;){let s=i.shift(),o=s.match;if(o.matchType(e)){let a=[];for(let r=s;r.type;r=r.via)a.push(r.type);return a.reverse()}for(let a=0;a<o.next.length;a++){let{type:r,next:l}=o.next[a];!r.isLeaf&&!r.hasRequiredAttrs()&&!(r.name in t)&&(!s.type||l.validEnd)&&(i.push({match:r.contentMatch,type:r,via:s}),t[r.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(i){e.push(i);for(let s=0;s<i.next.length;s++)e.indexOf(i.next[s].next)==-1&&t(i.next[s].next)}return t(this),e.map((i,s)=>{let o=s+(i.validEnd?"*":" ")+" ";for(let a=0;a<i.next.length;a++)o+=(a?", ":"")+i.next[a].type.name+"->"+e.indexOf(i.next[a].next);return o}).join(`
199
+ `)}this.styleElement.innerHTML=t}},destroyStyle:function(){this.styleElement&&(document.head.removeChild(this.styleElement),this.styleElement=null)}},computed:{attributeSelector:function(){return vi()}},components:{ToastMessage:nj,Portal:Ko}};function ed(n){"@babel/helpers - typeof";return ed=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ed(n)}function oj(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),t.push.apply(t,i)}return t}function aj(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?oj(Object(t),!0).forEach(function(i){KF(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):oj(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}function KF(n,e,t){return e=WF(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function WF(n){var e=qF(n,"string");return ed(e)=="symbol"?e:String(e)}function qF(n,e){if(ed(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(ed(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function GF(n,e,t,i,s,o){var a=Ct("ToastMessage"),r=Ct("Portal");return h(),D(r,null,{default:Y(function(){return[w("div",M({ref:"container",class:n.cx("root"),style:n.sx("root",!0,{position:n.position})},n.ptmi("root")),[A(E1,M({name:"p-toast-message",tag:"div",onEnter:o.onEnter,onLeave:o.onLeave},aj(aj({},n.ptm("message")),n.ptm("transition"))),{default:Y(function(){return[(h(!0),C(re,null,Ye(s.messages,function(l){return h(),D(a,{key:l.id,message:l,templates:n.$slots,closeIcon:n.closeIcon,infoIcon:n.infoIcon,warnIcon:n.warnIcon,errorIcon:n.errorIcon,successIcon:n.successIcon,closeButtonProps:n.closeButtonProps,onClose:e[0]||(e[0]=function(u){return o.remove(u)}),pt:n.pt},null,8,["message","templates","closeIcon","infoIcon","warnIcon","errorIcon","successIcon","closeButtonProps","pt"])}),128))]}),_:1},16,["onEnter","onLeave"])],16)]}),_:1})}sj.render=GF;const rj=Ve("Toast",Ie({__name:"Toast",props:{group:{default:"default-toast"},position:{default:"bottom-right"},autoZIndex:{type:Boolean},baseZIndex:{default:9980},breakpoints:{},message:{},icon:{},pt:{},ptOptions:{},unstyled:{type:Boolean}},emits:["close","lifeEnd"],setup(n){const e=n;Pt(()=>{pt.on("toast:add",s)}),qh(()=>{window.toastGroups&&window.toastGroups.includes(e.group)?i.value=!1:(window.toastGroups=[e.group,...window.toastGroups??[]],i.value=!0)}),Cs(()=>{var o;window.toastGroups=(o=window.toastGroups)==null?void 0:o.filter(a=>a!==e.group),pt.off("toast:add",s)});const t=z(),i=z(!1),s=o=>{o.group===e.group&&(t.value=o),o.error&&console.error(o.error)};return(o,a)=>i.value?(h(),D(O(sj),M({key:0},o.$props,{"data-group":o.$props.group,onClose:a[0]||(a[0]=r=>o.$emit("close",r)),onLifeEnd:a[1]||(a[1]=r=>o.$emit("lifeEnd",r))}),pi({icon:Y(()=>{var r,l,u;return[(r=t.value)!=null&&r.icon?(h(),D(Ke,{key:0,class:Pe(["w-5 h-5 text-inherit",(l=t.value)==null?void 0:l.iconClass]),icon:(u=t.value)==null?void 0:u.icon},null,8,["class","icon"])):N("",!0)]}),_:2},[o.$slots.container?{name:"container",fn:Y(({message:r,closeCallback:l})=>[Se(o.$slots,"container",{closeCallback:l,message:r})]),key:"0"}:void 0,o.$slots.message?{name:"message",fn:Y(({message:r})=>[Se(o.$slots,"message",{message:r})]),key:"1"}:void 0]),1040,["data-group"])):N("",!0)}})),JF=["colspan","rowspan"],YF={class:"flex"},lj=Ie({__name:"HeaderCell",props:{col:{},defaultHeaderRowSpan:{},sortBy:{},sortOrder:{},preset:{}},setup(n){return(e,t)=>(h(),C("th",{class:Pe([e.col.headerClass,e.col.class]),colspan:e.col.colspan,rowspan:e.col.rowspan??e.defaultHeaderRowSpan},[w("span",ht(Ut(e.preset.headercellcontent)),[w("span",YF,[st(U(e.col.header)+" ",1),e.col.info?(h(),D(Ke,{key:0,info:e.col.info,severity:e.col.infoSeverity,class:"w-[10px] h-[10px]",icon:"info"},null,8,["info","severity"])):N("",!0)]),e.col.sortable?(h(),D(Ke,{key:0,icon:!e.sortBy||e.sortBy!=e.col.field?"arrow-up-down":e.sortOrder==1?"sort-asc":"sort-desc",class:"text-base"},null,8,["icon"])):N("",!0)],16)],10,JF))}}),ZF=Ie({__name:"MultiRow",props:{attributes:{}},setup(n){const e=n,t=xe("preset",{}).datatable;return(i,s)=>{var o;return h(),C("div",ht(Ut((o=O(t))==null?void 0:o.multirowcontainer({props:e}))),[(h(!0),C(re,null,Ye(i.attributes,(a,r)=>{var l;return h(),C("span",M({key:r,ref_for:!0},(l=O(t))==null?void 0:l.multirow({context:{firstIndex:r===0}}),{class:a.class,"data-wv-section":"multi-row"}),[a.bodyComponent?(h(),D(Bt(a.bodyComponent.component),M({key:0,modelValue:a.bodyComponent.model,"onUpdate:modelValue":u=>a.bodyComponent.model=u,ref_for:!0},a.bodyComponent.props,{class:a.class,disabled:a.bodyComponent.disabled},lr(a.bodyComponent.events?a.bodyComponent.events:{}),{onClick:s[0]||(s[0]=It(()=>{},["stop"]))}),null,16,["modelValue","onUpdate:modelValue","class","disabled"])):(h(),C(re,{key:1},[st(U(a.value),1)],64))],16)}),128))],16)}}}),QF=["id"],XF=["rowspan"],eV=["rowspan"],tV=["rowspan"],nV=["id","rowspan"],iV={key:0},sV=["colspan"],oV=["id","draggable","onClick","onDblclick","onDragenter","onDragstart"],aV=["onClick"],rV=["colspan"],lV=["colspan"],uV=["colspan"],cV=["colspan"],dV=["colspan"],pV=["contenteditable","onBlur","onKeypress"],fV={key:1},mV={key:2},hV=["colspan"],gV=Ie({__name:"DataTable",props:dt({treeTable:{type:Boolean},childTableProps:{},tableName:{default:"datatable"},tableTitle:{default:void 0},columns:{},useOption:{type:Boolean,default:!0},data:{},dataKey:{default:"_id"},disableKey:{default:"isDefault"},includeCheckDisabledRows:{type:Boolean},highlightKey:{},disableAllRows:{type:Boolean},search:{},tag:{},defaultQueryParams:{},fetchFunction:{},rows:{},isSelectedAll:{type:Boolean},filters:{},lazy:{type:Boolean,default:!0},loading:{type:Boolean},selectionType:{default:"checkbox"},useSelection:{type:Boolean},selectedData:{},expandedRows:{},usePaginator:{type:Boolean},options:{default:()=>[]},singleSelect:{type:Boolean},customColumn:{type:Boolean,default:!0},scrollHeight:{},rowHeight:{default:"fixed"},reorderable:{type:Boolean},globalFilterFields:{},totalDisabledRows:{},excelToastErrorMessage:{},emptyTableMessage:{},singleSelection:{}},{singleSelection:{},singleSelectionModifiers:{}}),emits:dt(["update:singleSelection","cellEdited","input","rowReorder","toggleOption","doubleClick","selectData","rowSelect","page","sort","update:selectedData"],["update:singleSelection"]),setup(n,{emit:e}){const t=n,i=e,s=Mt(n,"singleSelection"),{defaultProps:o,locale:a}=kn("DataTable"),r=W(()=>Xs(t,o)),l=xe("preset",{}).datatable,u=[10,25,50,100],c=xe("useToastConfig"),d=Xu(c),{setLoading:p}=Xn(),f=`${window.location.pathname.replace("/","").split("/").join("-")}-${t.tableName}`,m=oe(t.data??[]),g=z(t.data??[]),v=oe({}),b=oe(t.columns),y=oe(),T=oe(),k=z([]),S=z(),_=z(0),j=z(!1),x=z(!1),E=z(0),I=z(0),$=z(0),P=z(!1),V=z(),q=oe(),me=oe(),G=oe([]),F=z({}),ue=z(),je=z(),Le=z(),Me=z(),de=z(1),te=z(10),fe=z(0),Fe=oe({}),_e=W(()=>!!ke.value.child.length),We=W(()=>_e.value?2:1),ke=W(()=>{const ne={parent:[],child:[]};for(const Oe of b.value)if(Oe.parentHeader){ne.child.push(Oe);const Xe=ne.parent.find(kt=>kt.field===Oe.parentHeader.field);Xe?Xe.colspan&&Xe.colspan++:ne.parent.push({...Oe.parentHeader,colspan:1,rowspan:1})}else ne.parent.push(Oe);return ne}),se=W(()=>{var ne,Oe;return(ne=t.childTableProps)!=null&&ne.columns?(Oe=t.childTableProps)==null?void 0:Oe.columns.filter(Xe=>{var kt;return!Xe.parentColumnsFields||((kt=Xe.parentColumnsFields)==null?void 0:kt.some(K=>b.value.some(H=>H.field===K)))}):b.value}),ye=W(()=>b.value.length+(t.selectionType==="checkbox"?1:0)+(t.useOption?1:0)+(t.reorderable?1:0)+(t.treeTable?1:0)),L=W(()=>({...t.defaultQueryParams,search:t.lazy?ue.value:t.search,tag:t.lazy?je.value:void 0,page:t.usePaginator?de.value:void 0,limit:t.usePaginator?te.value:void 0,sortOrder:Me.value,sortBy:Le.value,...t.lazy?F.value:t.filters})),R=W(()=>{var Oe;const ne=(Oe=m.value)==null?void 0:Oe.filter(Xe=>{var kt;return((kt=Xe.children)==null?void 0:kt.length)||Xe.hasChildren});return(ne==null?void 0:ne.length)&&ne.every(Xe=>v.value[Xe[t.dataKey]]>0)}),pe=W(()=>{var H,ee,Ae,qe,$e;if(t.disableAllRows||!((H=ct())!=null&&H.length)||t.selectionType!=="checkbox"||((ee=B.value)==null?void 0:ee.length)===m.value.length)return!1;const ne=(Ae=k.value)==null?void 0:Ae.length,Oe=((qe=Et(ct()))==null?void 0:qe.map(be=>be[t.dataKey]))??[],Xe=(($e=k.value)==null?void 0:$e.map(be=>be[t.dataKey]))??[],kt=Xe.length?dR(Oe,Xe):!1,K=ne>0&&ne===(fe.value??0)-(B.value.length??0);return kt||K}),B=W(()=>Tn(t.data??ct()??[])),Q=W(()=>j.value||t.loading),Te=W(()=>{var ne;return t.useOption||((ne=t.childTableProps)==null?void 0:ne.useOption)||t.customColumn}),ze=W(()=>{var ne;return!Q.value&&!((ne=m.value)!=null&&ne.length)}),Ze=W(()=>t.lazy&&t.fetchFunction||!t.usePaginator?m.value:m.value.slice((de.value-1)*te.value,de.value*te.value)),Ne=ne=>Object.keys(v.value).includes(ne),le=ne=>B.value.includes(ne),Ee=ne=>t.selectionType==="checkbox"?!!k.value.find(Oe=>Oe[t.dataKey]===ne):Ue(ne),Ue=ne=>{var Oe;return ne!==void 0&&((Oe=s.value)==null?void 0:Oe[t.dataKey])===ne},ct=ne=>(m.value??[]).filter(Oe=>!Oe.childRowHeader&&!Oe.childRow),yt=async(ne,Oe,Xe)=>{var K,H;if(Ne(ne[t.dataKey])===Xe)return;const kt=Xe??!Ne(ne[t.dataKey]);if(!x.value)if(!kt)m.value.splice(Oe+1,v.value[ne[t.dataKey]]),delete v.value[ne[t.dataKey]];else{v.value[ne[t.dataKey]]=1;let{children:ee}=ne;if((K=t.childTableProps)!=null&&K.fetchFunction&&ne.hasChildren)try{m.value.splice(Oe+1,0,{childRow:!0,loadingRow:!0}),x.value=!0;const Ae=await((H=t.childTableProps)==null?void 0:H.fetchFunction(ne));ee=Ae==null?void 0:Ae.data}catch(Ae){console.error("🚀 ~ toggleRowExpand ~ error:",Ae)}finally{m.value.splice(Oe+1,1),x.value=!1}if(Oe>=0&&(ee!=null&&ee.length)){const Ae=ee.flatMap(qe=>[{childRowHeader:!0,header:qe.groupHeader},...(qe.groupItems??[]).map(be=>({childRow:!0,...be}))]);v.value[ne[t.dataKey]]=Ae.length,m.value.splice(Oe+1,0,...Ae)}else m.value.splice(Oe+1,0,{childRow:!0,noDataRow:!0})}},Tt=ne=>{t.includeCheckDisabledRows?k.value=ne?ct():ct().filter(Oe=>le(Oe[t.dataKey])):k.value=ne?Et(ct()):[]},Nt=(ne,Oe,Xe)=>{if(!Oe.childRow&&!Oe.childRowHeader&&!le(Oe[t.dataKey])&&t.selectionType!=="none"){const kt=Ee(Oe[t.dataKey]);i("rowSelect",{originalEvent:ne,data:Oe,index:Xe}),t.selectionType==="checkbox"?kt?k.value=k.value.filter(K=>K[t.dataKey]!=Oe[t.dataKey]):k.value=[...k.value,Oe]:s.value=kt?void 0:Oe}},Be=async()=>{var Oe;const ne=!R.value;if(!x.value){let Xe=0;for(const kt of m.value)((Oe=kt.children)!=null&&Oe.length||kt.hasChildren)&&await yt(kt,Xe,ne),Xe++}},ge=async(ne,Oe)=>{const Xe=ne.target,kt=Xe.tagName.toLowerCase()==="button"?Xe:Xe.parentElement;i("toggleOption",Oe);const K={...ne,currentTarget:ne.currentTarget??ne.target};it(),await Xt(()=>{var H;kt!=null&&kt.classList.contains("option-button-active")?it():((H=me.value)==null||H.toggle(K),it(),kt==null||kt.classList.add("option-button-active"))})},J=(ne,Oe,Xe)=>({[(typeof ne.bodySelectedClass=="function"?ne.bodySelectedClass(Oe):ne.bodySelectedClass)??""]:Ee(Oe[Xe])}),X=async(ne,Oe,Xe)=>{var K,H,ee,Ae;if(!Xe.preset)return;const kt=()=>gl(Oe,Xe.field,!Qn(Oe,Xe.field));if(Xe.preset.type==="checkbox"?(H=(K=Xe.preset).onCheck)==null||H.call(K,ne,Oe,kt):Xe.preset.type==="toggle"&&((Ae=(ee=Xe.preset).onToggle)==null||Ae.call(ee,ne,Oe,kt)),"confirmDialogProps"in Xe.preset){const{showWhen:qe}=Yt(Xe.preset,Oe[Xe.field],Oe)??{};typeof qe=="function"?Fe.value[Oe[t.dataKey]+Xe.field]=await qe(Oe,ne):Fe.value[Oe[t.dataKey]+Xe.field]=!qe||qe==="active"&&ne||qe==="inactive"&&!ne}},ce=ne=>ne.draggable!==!1&&!ne.childRow&&!ne.childRowHeader&&t.reorderable&&!Me.value,Je=(ne,Oe,Xe)=>{if(Oe.childRow||Oe.childRowHeader)return;v.value={};const{dataTransfer:kt}=ne;V.value=Oe,S.value={item:Oe,fromIndex:Xe},kt&&(kt.dropEffect="move",kt.effectAllowed="move",kt.setData("id",Oe._id),kt.setData("index",Xe.toString()))},lt=(ne,Oe)=>{var Xe,kt,K,H;if(ne.preventDefault(),ce(Oe)){const ee=ne.target,Ae=ee.tagName==="TR"?ee:ee.closest("tr");if(Ae==null||Ae.classList.add("bg-primary-50"),Ae==null||Ae.classList.add("dark:bg-grayscale-800"),(Xe=Ae==null?void 0:Ae.nextElementSibling)==null||Xe.classList.remove("bg-primary-50"),(kt=Ae==null?void 0:Ae.nextElementSibling)==null||kt.classList.remove("dark:bg-grayscale-800"),(K=Ae==null?void 0:Ae.previousElementSibling)==null||K.classList.remove("bg-primary-50"),(H=Ae==null?void 0:Ae.previousElementSibling)==null||H.classList.remove("dark:bg-grayscale-800"),!Ae||!V.value)return;const qe=G.value.findIndex(be=>{var rt;return be._id===((rt=V.value)==null?void 0:rt._id)}),$e=G.value.findIndex(be=>be._id===Ae.id);qe!==-1&&$e!==-1&&(S.value&&(S.value.toIndex=$e),[G.value[qe],G.value[$e]]=[G.value[$e],G.value[qe]],De())}},he=()=>{S.value&&i("rowReorder",S.value),V.value=void 0,P.value=!1,S.value=void 0},De=()=>{m.value=[...G.value]},it=()=>{const ne=document.querySelectorAll(".option-button-active");ne==null||ne.forEach(Oe=>{Oe.classList.remove("option-button-active")})},St=()=>{Le.value=void 0,Me.value=void 0},jt=()=>{de.value=1,$.value++},xt=()=>{te.value=t.rows??10,de.value=1,$.value++},Jt=()=>{xt(),St()},an=async()=>{I.value++,$.value++,Jt(),t.lazy?await Qe():mn()},mn=()=>{let ne=[...g.value??[]];const Oe=F.value,Xe=Object.entries(Oe);try{ne=Xe.length?ne.filter(kt=>Xe.every(([K,{value:H,matchMode:ee}])=>{const Ae=Qn(kt,K);switch(ee){case"IN":return Array.isArray(H)?H.includes(Ae):!1;case"CONTAINS":return Ae&&H?Ae.toString().toLowerCase().includes(H):!1;case"EQUALS":return Ae?Ae.toString()===H.toString():!1;case"BETWEEN":return Array.isArray(H)&&H.length===2?!isNaN(Ae)&&(H[0]==null||Ae>=H[0])&&(H[1]==null||Ae<=H[1]):!1;case"DATE_BETWEEN":return Array.isArray(H)?+new Date(Ae)>=H[0]&&+new Date(Ae)<=H[1]:!1;default:return!1}})):g.value}catch(kt){console.error("🚀 ~ applyStaticFilter ~ error:",kt)}bn(ne)},bn=ne=>{var Oe;try{m.value=(Oe=ue.value)!=null&&Oe.length?ne.filter(Xe=>{const kt=JSON.stringify(Xe);return new RegExp(ue.value,"i").test(kt)||ue.value.split(/\s+/).filter(Boolean).every(K=>new RegExp(K,"i").test(kt))}):ne}catch(Xe){console.error("🚀 ~ applyStaticSearch ~ error:",Xe)}},ae=async ne=>{te.value=ne.rows,de.value=ne.page+1,t.lazy&&t.fetchFunction&&await Qe(),Object.keys(v.value).forEach(Oe=>{const Xe=m.value.findIndex(kt=>kt[t.dataKey]==Oe);Xe>=0&&yt(m.value[Xe],Xe,!0)})},Re=(ne,Oe)=>{ne!==Le.value&&(Me.value=void 0),Le.value=ne,Me.value?Me.value==-1?(Me.value=void 0,Le.value=void 0):Me.value=-1:Me.value=1,i("sort",{sortOrder:Me.value,sortField:Le.value,originalEvent:Oe,rows:te.value}),jt(),t.lazy&&t.fetchFunction?Qe():nt()},nt=()=>{const ne=[...m.value??[]],Oe=new Map;if(!Me.value){m.value=g.value??[];return}for(const kt of ne)Oe.set(kt,Ge.resolveFieldData(kt,Le.value));const Xe=new Intl.Collator(void 0,{numeric:!0}).compare;ne.sort((kt,K)=>{const H=Oe.get(kt),ee=Oe.get(K);return Ge.sort(H,ee,Me.value,Xe,-1)}),m.value=ne},Qe=async()=>{var ne;try{j.value=!0;const Oe=await((ne=t.fetchFunction)==null?void 0:ne.call(t,L.value)),{data:Xe=[],totalRecords:kt=0}=(Oe==null?void 0:Oe.data)??{};m.value=Xe,G.value=[...m.value],fe.value=kt}catch(Oe){console.error("🚀 ~ reFetch ~ error:",Oe)}finally{j.value=!1,v.value={}}},rn=async()=>{var Xe;const ne=As(L.value);delete ne.page,delete ne.limit;const Oe=await((Xe=t.fetchFunction)==null?void 0:Xe.call(t,ne));if(Oe instanceof Error)throw Oe;return(Oe==null?void 0:Oe.data)??{data:[],totalRecords:0}},_n=async ne=>{if(t.tableName===ne.tableName)try{j.value=!0;const{data:Oe,totalRecords:Xe=0}=t.lazy?await rn():{totalRecords:(t.data??[]).length,data:t.data},kt=Tn(Oe);k.value=t.includeCheckDisabledRows?Oe??[]:Et(Oe,kt),fe.value=Xe}finally{j.value=!1}},mt=(ne,Oe)=>l==null?void 0:l.headercell({props:t,context:{sortOrder:Me.value,customColumn:Oe,sorted:Le.value&&Le.value===(ne==null?void 0:ne.field),sortable:ne==null?void 0:ne.sortable,isParentHeader:(ne==null?void 0:ne.rowspan)===1}}),bt=ne=>{(!ne.tableName||ne.tableName===t.tableName)&&Xt(()=>{E.value++,Qe()})},Et=(ne,Oe)=>(ne??[]).filter(Xe=>!(Oe??B.value).includes(Xe[t.dataKey])),Tn=(ne=[])=>t.disableAllRows?ne.map(Oe=>Oe[t.dataKey]):ne.filter(Oe=>Oe[t.disableKey]).map(Oe=>Oe[t.dataKey]),xn=async({tableName:ne,multiTableNames:Oe,fileName:Xe,additionalTexts:kt})=>{var qe;if(ne!==t.tableName&&!(Oe!=null&&Oe.includes(t.tableName)))return;const H=b.value.filter($e=>$e.visible!==!1).filter($e=>!$e.excluded),ee=H.map($e=>$e.header??$e.exportHeader??"-"),Ae=()=>Xe.trim().replace(/[^a-zA-Z0-9\s]/g,"-").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/-+$/,"");try{if(pt.off("data-table:download",ie),ne===t.tableName){p(!0,a.downloadingMessage);const{data:$e}=t.fetchFunction?await rn():{data:t.data},be=U1($e,H,a);if(Oe!=null&&Oe.length){pt.emit("button-download:multi-tables",{table:{headers:ee,data:be,tableName:ne,tableTitle:t.tableTitle}});return}await lg({tables:[{headers:ee,data:be,tableName:ne,tableTitle:t.tableTitle}],fileName:Ae(),additionalTexts:kt})}}catch($e){console.error("🚀 ~ downloadExcel error:",$e),d.removeAllGroups(),d.add({message:((qe=r.value.excelToastErrorMessage)==null?void 0:qe.replace("{fileName}",Xe))??"Data gagal diunduh.",error:$e,group:"download"})}finally{p(!1),pt.on("data-table:download",ie)}};Pt(async()=>{var ne;t.fetchFunction&&(await Qe(),vt()),(ne=t.selectedData)!=null&&ne.length&&(k.value=t.selectedData),fo()}),ho(()=>{mo()}),He(()=>t.columns,()=>{t.customColumn||(b.value=t.columns),_.value++}),He(()=>t.data,ne=>{m.value=ne??[],g.value=ne??[],pt.emit("data-table:updated",{tableName:t.tableName,data:ne}),fe.value=ne==null?void 0:ne.length},{immediate:!0}),He(fe,ne=>{ut(ne)}),He(k,ne=>{i("selectData",ne),i("update:selectedData",ne),pt.emit("data-table:update-selected-data",{tableName:t.tableName,data:ne})},{deep:!0});const fo=()=>{pt.on("data-table:apply-filter",Po),pt.on("search-table",ha),pt.on("search-by-scan-table",ws),pt.on("data-table:clear-selected-data",Z),pt.on("data-table:select-all-record",qs),pt.on("data-table:download",ie),pt.on("data-table:import-excel-to-json",Zt)},mo=()=>{pt.off("data-table:update",bt),pt.off("data-table:apply-filter",Po),pt.off("search-table",ha),pt.off("search-by-scan-table",ws),pt.off("data-table:clear-selected-data",Z),pt.off("data-table:select-all-record",qs),pt.off("data-table:download",ie),pt.off("data-table:import-excel-to-json",Zt)},Po=ne=>{ne.tableName===t.tableName&&(F.value=ne.filter,an())},ha=ne=>{ne.tableName===t.tableName&&(ue.value=ne.search,an())},ws=ne=>{ne.tableName===t.tableName&&(je.value=ne.tag,an())},qs=ne=>{ne.tableName===t.tableName&&_n(ne)},Z=ne=>{ne.tableName===t.tableName&&(k.value=[])},ie=ne=>{var Oe;(ne.tableName===t.tableName||(Oe=ne.multiTableNames)!=null&&Oe.includes(t.tableName))&&xn(ne)},ve=ne=>{ne.code.includes("Digit")||ne.code.includes("Numpad")||["ArrowLeft","ArrowRight","Backspace","Delete"].includes(ne.code)||ne.preventDefault()},ut=ne=>{const Oe=t.includeCheckDisabledRows?0:(B.value.length||t.totalDisabledRows)??0,Xe={total:(ne??fe.value??0)-Oe,tableName:t.tableName};pt.emit("data-table:update-total-record",Xe)},vt=()=>{pt.on("data-table:update",bt)},Zt=ne=>{ne.tableName===t.tableName&&(m.value=ne.data,G.value=[...m.value],fe.value=ne.data.length)},Yt=(ne,Oe,Xe)=>typeof(ne==null?void 0:ne.confirmDialogProps)=="function"?ne==null?void 0:ne.confirmDialogProps(Oe,Xe):ne==null?void 0:ne.confirmDialogProps;return(ne,Oe)=>{var Xe,kt,K;return h(),C("div",ht(Ut((Xe=O(l))==null?void 0:Xe.root)),[w("div",ht(Ut((kt=O(l))==null?void 0:kt.tablewrapper)),[A(O(uR),M({"auto-hide":!1},(K=O(l))==null?void 0:K.scrollheightwrapper({props:t}),{class:"custom-scrollbar [&_.simplebar-track]:bg-grayscale-100 dark:[&_.simplebar-track]:bg-grayscale-800"}),{default:Y(()=>{var H,ee,Ae,qe,$e;return[(h(),C("table",M({id:O(f)},(H=O(l))==null?void 0:H.table,{key:I.value,ref:y.value}),[w("thead",ht(Ut(O(l).thead)),[w("tr",ht(Ut(O(l).headerrow)),[ne.reorderable&&!Me.value?(h(),C("th",M({key:0},O(l).headercellreorderable,{class:mt().class,rowspan:We.value}),null,16,XF)):N("",!0),ne.selectionType==="checkbox"?(h(),C("th",M({key:1},O(l).headercellcheckbox,{class:mt().class,rowspan:We.value}),[A(yo,M((ee=O(l))==null?void 0:ee.headercheckbox({context:{isSelectedAll:pe.value}}),{"model-value":pe.value,"onUpdate:modelValue":Oe[0]||(Oe[0]=be=>Tt(!!be)),binary:""}),null,16,["model-value"])],16,eV)):N("",!0),ne.treeTable?(h(),C("th",M({key:2},O(l).headertoggler,{class:mt().class,rowspan:We.value}),[A(Ce,M({onClick:Be},O(l).headertogglerbutton({context:{isExpandedAll:R.value}}),{icon:"arrow-down",text:""}),null,16)],16,tV)):N("",!0),(h(!0),C(re,null,Ye(ke.value.parent,be=>(h(),D(lj,M({key:be.field,ref_for:!0},mt(be),{col:be,"default-header-row-span":We.value,preset:O(l),"sort-by":Le.value,"sort-order":Me.value,onClick:rt=>be.sortable?Re(be.field,rt):null}),null,16,["col","default-header-row-span","preset","sort-by","sort-order","onClick"]))),128)),Te.value?(h(),C("th",M({key:3},mt(void 0,t.customColumn),{id:`column-visibility-toggle-${O(f)}`,rowspan:We.value,onClick:Oe[1]||(Oe[1]=(...be)=>{var rt,en;return((rt=q.value)==null?void 0:rt.toggleMenu)&&((en=q.value)==null?void 0:en.toggleMenu(...be))})}),[t.customColumn?(h(),D(Ke,M({key:0},O(l).columnvisibilityicon,{icon:"ellipsis-h","tooltip-pos":"left"}),null,16)):N("",!0)],16,nV)):N("",!0)],16),ke.value.child.length?(h(),C("tr",ht(M({key:0},O(l).headerrow)),[(h(!0),C(re,null,Ye(ke.value.child,be=>(h(),D(lj,M({key:be.field,ref_for:!0},mt(be),{col:be,"default-header-row-span":We.value,preset:O(l),"sort-by":Le.value,"sort-order":Me.value,onClick:rt=>be.sortable?Re(be.field,rt):null}),null,16,["col","default-header-row-span","preset","sort-by","sort-order","onClick"]))),128))],16)):N("",!0)],16),w("tbody",ht(Ut((Ae=O(l))==null?void 0:Ae.tbody)),[Q.value?(h(),C("tr",iV,[w("td",M({colspan:ye.value},(qe=O(l))==null?void 0:qe.bodycell),[(h(!0),C(re,null,Ye(O(l).invisiblelottiewrapper?2:1,be=>(h(),C("div",M({key:be,ref_for:!0},be===1?O(l).loadingtablewrapper:O(l).invisiblelottiewrapper),[A(ns,M({animation:"loading-table",ref_for:!0},O(l).loadingtablelottie),null,16)],16))),128))],16,sV)])):ze.value?(h(),C("tr",mV,[w("td",M({colspan:ye.value},($e=O(l))==null?void 0:$e.bodycell),[(h(!0),C(re,null,Ye(O(l).invisiblelottiewrapper?2:1,be=>(h(),C("div",M({key:be,ref_for:!0},be===1?O(l).nodatalottiewrapper:O(l).invisiblelottiewrapper),[A(ns,M({animation:"no-data",ref_for:!0},O(l).nodatalottie),null,16),r.value.emptyTableMessage?(h(),C("span",M({key:0,ref_for:!0},O(l).nodatamessage),U(r.value.emptyTableMessage),17)):N("",!0)],16))),128))],16,hV)])):(h(!0),C(re,{key:1},Ye(Ze.value,(be,rt)=>{var en,gn,Zn,Qi,fs,Fi,Ss,rp,lp,up,$h;return h(),C(re,{key:`${rt}-${be[ne.dataKey]}`},[w("tr",M({id:be._id,draggable:ce(be),ref_for:!0},(en=O(l))==null?void 0:en.bodyrow({context:{highlighted:be[ne.highlightKey??""],selected:Ee(be[ne.dataKey]),disabled:le(be[ne.dataKey]),draggable:ce(be),dragging:P.value},props:t}),{onClick:tt=>Nt(tt,be,rt),onDblclick:tt=>{var $o;return ne.treeTable&&(($o=be.children)!=null&&$o.length||be.hasChildren)?yt(be,rt):ne.$emit("doubleClick",be)},onDrag:Oe[11]||(Oe[11]=tt=>P.value=!0),onDragenter:It(tt=>lt(tt,be),["prevent"]),onDragleave:Oe[12]||(Oe[12]=It(()=>{},["prevent"])),onDragover:Oe[13]||(Oe[13]=It(()=>{},["prevent"])),onDragstart:tt=>Je(tt,be,rt),onDrop:he}),[ne.reorderable&&!Me.value?(h(),C("td",M({key:0,ref_for:!0},(gn=O(l))==null?void 0:gn.bodycell),[!be.childRow&&!be.childRowHeader?(h(),D(Ke,{key:0,class:"draggableicon",icon:"dragable-menu"})):N("",!0)],16)):N("",!0),ne.selectionType==="checkbox"?(h(),C("td",M({key:1,ref_for:!0},(Zn=O(l))==null?void 0:Zn.bodycell,{onClick:Oe[3]||(Oe[3]=It(()=>{},["stop"]))}),[!be.childRow&&!be.childRowHeader?(h(),D(yo,M({key:0,ref_for:!0},(Qi=O(l))==null?void 0:Qi.rowcheckbox,{modelValue:k.value,"onUpdate:modelValue":Oe[2]||(Oe[2]=tt=>k.value=tt),binary:!1,disabled:le(be[ne.dataKey]),value:be}),null,16,["modelValue","disabled","value"])):N("",!0)],16)):N("",!0),ne.treeTable?(h(),C("td",M({key:2,ref_for:!0},(fs=O(l))==null?void 0:fs.bodycell,{onClick:tt=>{(be.childRow||be.childRowHeader)&&tt.stopPropagation()}}),[(Fi=be.children)!=null&&Fi.length||be.hasChildren?(h(),D(Ce,M({key:0,onClick:It(tt=>yt(be,rt),["stop"]),ref_for:!0},O(l).rowtogglerbutton({context:{isRowExpanded:Ne(be[ne.dataKey])}}),{icon:"arrow-down",text:""}),null,16,["onClick"])):N("",!0)],16,aV)):N("",!0),(()=>{var tt;return be.childRowHeader&&((tt=t.childTableProps)==null?void 0:tt.useColumnsHeader)})()?(h(),C(re,{key:3},[(h(!0),C(re,null,Ye(se.value,tt=>{var $o,al;return h(),C("td",{key:tt.header,class:Pe([($o=O(l))==null?void 0:$o.bodycell.class,"font-semibold text-xs"]),colspan:tt.colspan??((al=tt.parentColumnsFields)==null?void 0:al.length),onClick:Oe[4]||(Oe[4]=It(()=>{},["stop"]))},U(tt.header),11,rV)}),128)),Te.value?(h(),C("td",{key:0,class:Pe(O(l).bodycell.class),onClick:Oe[5]||(Oe[5]=It(()=>{},["stop"]))},null,2)):N("",!0)],64)):be.childRowHeader?(h(),C("td",M({key:4,ref_for:!0},O(l).childrowheader,{class:(Ss=O(l))==null?void 0:Ss.bodycell.class,colspan:t.columns.length+1,onClick:Oe[6]||(Oe[6]=It(()=>{},["stop"]))}),U(be.header),17,lV)):be.loadingRow?(h(),C("td",{key:5,class:Pe((rp=O(l))==null?void 0:rp.bodycell.class),colspan:t.columns.length+1,onClick:Oe[7]||(Oe[7]=It(()=>{},["stop"]))},[w("div",M({ref_for:!0},O(l).loadingtablewrapper),[A(ns,M({animation:"loading-table",ref_for:!0},O(l).loadingtablelottie),null,16)],16)],10,uV)):be.noDataRow?(h(),C("td",{key:6,class:Pe((lp=O(l))==null?void 0:lp.bodycell.class),colspan:t.columns.length+1,onClick:Oe[8]||(Oe[8]=It(()=>{},["stop"]))},[w("div",M({ref_for:!0},O(l).nodatalottiewrapper),[A(ns,M({animation:"no-data",ref_for:!0},O(l).nodatalottie),null,16),r.value.emptyTableMessage?(h(),C("span",M({key:0,ref_for:!0},O(l).nodatamessage),U(r.value.emptyTableMessage),17)):N("",!0)],16)],10,cV)):(h(),C(re,{key:7},[(h(!0),C(re,null,Ye(be.childRow?se.value:b.value,tt=>{var $o,al,rl,cp,js,Lh,Lu,Ht,dp,di,On,ll,Lo,Nu,Bu,ft,At,Qt;return h(),C("td",M({key:tt.field,class:[{"!py-0":tt.editable,"!px-0":(($o=tt.preset)==null?void 0:$o.type)==="multirow"},typeof tt.bodyClass=="function"?tt.bodyClass(be):tt.bodyClass,J(tt,be,ne.dataKey),tt.class],colspan:tt.colspan??((al=tt.parentColumnsFields)==null?void 0:al.length),ref_for:!0},(rl=O(l))==null?void 0:rl.bodycell),[((cp=tt.preset)==null?void 0:cp.type)==="toggle"||((js=tt.preset)==null?void 0:js.type)==="checkbox"?(h(),C(re,{key:0},[((Lh=tt.preset)==null?void 0:Lh.type)==="toggle"?(h(),D(h2,{key:0,disabled:le(be[ne.dataKey])||(typeof((Lu=tt.preset)==null?void 0:Lu.disabled)=="function"?(Ht=tt.preset)==null?void 0:Ht.disabled(be):(dp=tt.preset)==null?void 0:dp.disabled),"input-id":be[ne.dataKey],"model-value":O(Qn)(be,tt.field),onClick:Oe[9]||(Oe[9]=It(()=>{},["stop"])),"onUpdate:modelValue":Ft=>{O(gl)(be,tt.field,Ft),X(Ft,be,tt)}},null,8,["disabled","input-id","model-value","onUpdate:modelValue"])):N("",!0),((di=tt.preset)==null?void 0:di.type)==="checkbox"?(h(),D(yo,{key:1,disabled:le(be[ne.dataKey])||(typeof((On=tt.preset)==null?void 0:On.disabled)=="function"?(ll=tt.preset)==null?void 0:ll.disabled(be):(Lo=tt.preset)==null?void 0:Lo.disabled),"input-id":be[ne.dataKey],"model-value":O(Qn)(be,tt.field),onClick:Oe[10]||(Oe[10]=It(()=>{},["stop"])),"onUpdate:modelValue":Ft=>{O(gl)(be,tt.field,!!Ft),X(!!Ft,be,tt)},binary:""},null,8,["disabled","input-id","model-value","onUpdate:modelValue"])):N("",!0),(Nu=tt.preset)!=null&&Nu.confirmDialogProps?(h(),D(mi,M({key:2,list:[be],visible:!!Fe.value[be[ne.dataKey]+tt.field],onClose:()=>{var Cn,ni,Nh;const Ft=()=>O(gl)(be,tt.field,!O(Qn)(be,tt.field));((Cn=Yt(tt.preset,be[tt.field],be))==null?void 0:Cn.actionable)==!1&&"onConfirm"in tt.preset?(Nh=(ni=tt.preset).onConfirm)==null||Nh.call(ni,be[tt.field],be,Ft):Ft()},onConfirm:Ft=>{var Cn,ni;return(ni=(Cn=tt.preset)==null?void 0:Cn.onConfirm)==null?void 0:ni.call(Cn,be[tt.field],be,()=>O(gl)(be,tt.field,!O(Qn)(be,tt.field)))},"onUpdate:visible":Ft=>Fe.value[be[ne.dataKey]+tt.field]=Ft,actionable:"",ref_for:!0},Yt(tt.preset,be[tt.field],be)),null,16,["list","visible","onClose","onConfirm","onUpdate:visible"])):N("",!0)],64)):((Bu=tt.preset)==null?void 0:Bu.type)==="multirow"?(h(),D(ZF,{key:1,attributes:((At=(ft=tt.preset)==null?void 0:ft.fieldAttributes)==null?void 0:At.call(ft,be))??[]},null,8,["attributes"])):tt.editable?(h(),C("span",M({key:2,ref_for:!0},O(l).celleditableelement,{contenteditable:tt.editable,onBlur:Ft=>{ne.$emit("cellEdited",{item:be,field:tt.field,index:rt,value:Ft.target.innerText})},onKeypress:Ft=>{tt.numberInputOnly&&ve(Ft)}}),U(O(Qn)(be,tt.field)||"-"),17,pV)):tt.bodyComponent||tt.bodyClass||tt.bodyTemplate||tt.dateFormatOptions?(h(),C(re,{key:3},[tt.bodyComponent?(h(),D(Bt(tt.bodyComponent(be,rt).component),M({key:0,modelValue:tt.bodyComponent(be,rt).model,"onUpdate:modelValue":Ft=>tt.bodyComponent(be,rt).model=Ft,disabled:tt.bodyComponent(be,rt).disabled,ref_for:!0},tt.bodyComponent(be,rt).props,lr(tt.bodyComponent(be,rt).events?tt.bodyComponent(be,rt).events:{}),{onChange:Ft=>{var Cn,ni;return(ni=(Cn=tt.bodyComponent(be,rt)).onChange)==null?void 0:ni.call(Cn,be)},onClick:Ft=>{tt.bodyComponent(be,rt).stop!==!1&&Ft.stopPropagation()},"onUpdate:modelValue":Ft=>{var Cn,ni;return(ni=(Cn=tt.bodyComponent(be,rt)).onChange)==null?void 0:ni.call(Cn,be)}}),null,16,["modelValue","onUpdate:modelValue","disabled","onChange","onClick"])):(h(),C("span",fV,[tt.bodyTemplate?(h(),C(re,{key:0},[st(U(((Qt=tt.bodyTemplate)==null?void 0:Qt.call(tt,be,rt))||"-"),1)],64)):tt.dateFormatOptions?(h(),C(re,{key:1},[st(U(O(rg)(new Date(O(Qn)(be,tt.field)),tt.dateFormatOptions)),1)],64)):(h(),C(re,{key:2},[st(U(O(Qn)(be,tt.field)||"-"),1)],64))]))],64)):(h(),C(re,{key:4},[st(U(O(Qn)(be,tt.field)??"-"),1)],64))],16,dV)}),128)),Te.value?(h(),C("td",M({key:0,ref_for:!0,ref_key:"rowSingleActionCell",ref:T},(up=O(l))==null?void 0:up.rowsingleactioncell({props:t,context:{selected:Ee(be[ne.dataKey]),highlighted:be[ne.highlightKey??""]}}),{class:O(l).bodycell.class}),[!be.childRow&&ne.useOption||be.childRow&&(($h=t.childTableProps)!=null&&$h.useOption)?(h(),C("div",M({key:0,ref_for:!0},O(l).singleactionwrapper),[A(Ce,M({id:"button-action-"+be[t.dataKey],ref_for:!0},O(l).singleactionbutton({props:t}),{disabled:ne.disableAllRows,onClick:It(tt=>ge(tt,be),["stop"]),icon:"ellipsis-h",outlined:"",size:"small","tooltip-pos":"left",type:"button"}),null,16,["id","disabled","onClick"])],16)):N("",!0)],16)):N("",!0)],64))],16,oV),Se(ne.$slots,"row-subcontent",{item:be},void 0,!0)],64)}),128))],16)],16,QF))]}),_:3},16)],16),ne.usePaginator?_t((h(),D(O(w0),M({key:$.value,rows:te.value,"onUpdate:rows":Oe[14]||(Oe[14]=H=>te.value=H)},O(l).paginator({context:{totalRecords:fe.value}}),{"current-page-report-template":fe.value?O(a).paginationReportFound:O(a).paginationReportNotFound,"rows-per-page-options":u,"total-records":fe.value,onPage:ae}),{firstpagelinkicon:Y(()=>[A(Ke,{icon:"round-keyboard-double-arrow-left"})]),lastpagelinkicon:Y(()=>[A(Ke,{icon:"round-keyboard-double-arrow-right"})]),prevpagelinkicon:Y(()=>[A(Ke,{icon:"round-keyboard-arrow-left"})]),nextpagelinkicon:Y(()=>[A(Ke,{icon:"round-keyboard-arrow-right"})]),_:1},16,["rows","current-page-report-template","total-records"])),[[En,!Q.value]]):N("",!0),A(kc,{id:"single-action-menu",ref_key:"optionMenu",ref:me,model:ne.options,onFocus:O(cR),"append-to":"body","auto-z-index":"",popup:""},null,8,["model","onFocus"]),t.customColumn?(h(),D(gF,{key:_.value,ref_key:"customColumn",ref:q,"visible-columns":b.value,"onUpdate:visibleColumns":Oe[15]||(Oe[15]=H=>b.value=H),"default-columns":ne.columns.filter(H=>H.visible!==!1),"table-id":O(f)},null,8,["visible-columns","default-columns","table-id"])):N("",!0),A(rj,{group:"download"})],16)}}}),td=(n,e)=>{const t=n.__vccOpts||n;for(const[i,s]of e)t[i]=s;return t},ss=Ve("DataTable",td(gV,[["__scopeId","data-v-6e13706f"]])),Hl=Ve("Form",Ie({__name:"Form",props:{buttonsTemplate:{},disableSubmit:{type:Boolean},cancelBtnLabel:{default:"Batal"},clearBtnLabel:{default:"Bersihkan Field"},columnPerRow:{},hideFooter:{type:Boolean},hideStayCheckbox:{type:Boolean},invalid:{type:Boolean},resetAfterSubmit:{type:Boolean,default:!0},saveBtnLabel:{default:"Simpan"},submitBtnLabel:{default:"Simpan"},stayCheckboxLabel:{default:"Tetap di halaman ini"},validatorMessage:{default:"Please input all required field!"},validateOnSave:{type:Boolean,default:!1},cancelBtnSeverity:{default:"secondary"},saveBtnSeverity:{default:"success"},submitBtnSeverity:{default:"success"}},emits:["cancel","clear","save","submit"],setup(n,{expose:e,emit:t}){const i=n,s=t;Pt(()=>{if(j.value){const G=i.columnPerRow??1;j.value.style.gridTemplateColumns=`repeat(${G}, minmax(0, 1fr))`,E()}});const o=xe("preset",{}).form,{handleSubmit:a,values:r,resetForm:l,errors:u,resetField:c,setValues:d,setFieldValue:p,setErrors:f}=Ap(),m=z(!1),g=oe(),v=z(!1),b=z(!1),y=z(0),T=oe(),k=z(!1),S=z(!1),_=z(!1),j=oe(null),x=oe(null);Wn("isSubmitting",k);const E=()=>{var G;if(T.value){const F=(G=T.value)==null?void 0:G.offsetHeight;x.value&&(x.value.style.height=`calc(100% + ${F+20}px)`)}},I=()=>{k.value=!0,_.value=!0,b.value||(v.value=!0)},$=()=>{k.value=!0,S.value=!0,i.validateOnSave?(b.value||(v.value=!0),P()):V()},P=a(G=>{if(!i.invalid){const F=me(G),ue={stayAfterSubmit:m.value,formValues:F};S.value?s("save",ue):s("submit",ue),v.value=!1,S.value=!1,i.resetAfterSubmit&&(y.value+=1,l())}k.value=!1},()=>{k.value=!1}),V=()=>{const G=me(r),F={stayAfterSubmit:m.value,formValues:G};s("save",F),k.value=!1},q=()=>{l(),y.value++,s("clear"),v.value=!1,_.value=!1},me=G=>{const F=G,ue=Object.keys(F);for(const je of ue)typeof F[je]=="string"&&(F[je]=F[je].trim());return F};return He(r,()=>{_.value=!1},{deep:!0}),e({stayAfterSubmit:m,submit:P,onSubmitClicked:I,onSaveClicked:$,showValidator:v,formElement:g,clearField:q,resetField:c,errors:u,setOuterFieldsWrapperHeight:E,setValues:d,setFieldValue:p,setErrors:f,values:r,isSubmitClicked:_}),(G,F)=>{var ue,je,Le,Me,de,te,fe,Fe,_e,We,ke,se,ye,L,R;return h(),C("form",M({ref_key:"formElement",ref:g},(ue=O(o))==null?void 0:ue.root({props:i}),{onInput:F[2]||(F[2]=pe=>v.value=!1),onSubmit:F[3]||(F[3]=It((...pe)=>O(P)&&O(P)(...pe),["prevent"]))}),[w("div",{ref_key:"outerFieldsWrapper",ref:x},[w("div",M({ref_key:"fieldsWrapper",ref:j},(je=O(o))==null?void 0:je["fields-wrapper"]),[Se(G.$slots,"fields",{key:y.value,formValues:O(r)})],16)],512),G.hideFooter?N("",!0):(h(),C("div",M({key:0,ref_key:"footer",ref:T},(Le=O(o))==null?void 0:Le.footer),[G.hideStayCheckbox?N("",!0):(h(),C("div",ht(M({key:0},(Me=O(o))==null?void 0:Me.staycheckbox)),[A(yo,{modelValue:m.value,"onUpdate:modelValue":F[0]||(F[0]=pe=>m.value=pe),label:G.stayCheckboxLabel},null,8,["modelValue","label"])],16)),w("div",M({id:"footer-actions-wrapper"},(de=O(o))==null?void 0:de["action-buttons"]),[_t(A(fi,M((te=O(o))==null?void 0:te["validator-message"],{message:G.validatorMessage}),null,16,["message"]),[[En,v.value||i.invalid]]),w("div",ht(Ut((fe=O(o))==null?void 0:fe["button-wrapper"])),[(Fe=i.buttonsTemplate)!=null&&Fe.includes("cancel")?(h(),D(Ce,M({key:0},(_e=O(o))==null?void 0:_e["cancel-button"],{label:G.cancelBtnLabel,severity:G.cancelBtnSeverity,onClick:F[1]||(F[1]=pe=>G.$emit("cancel")),"data-test":"cancel-button",text:"",type:"button"}),null,16,["label","severity"])):N("",!0),(We=i.buttonsTemplate)!=null&&We.includes("clear")?(h(),D(Ce,M({key:1},(ke=O(o))==null?void 0:ke["clear-button"],{label:G.clearBtnLabel,onClick:q,text:"",type:"button"}),null,16,["label"])):N("",!0),(se=i.buttonsTemplate)!=null&&se.includes("save")?(h(),D(Ce,M({key:2},(ye=O(o))==null?void 0:ye["save-button"],{label:G.saveBtnLabel,severity:G.saveBtnSeverity,onClick:$,outlined:"",type:"button"}),null,16,["label","severity"])):N("",!0),(L=i.buttonsTemplate)!=null&&L.includes("submit")?(h(),D(Ce,M({key:3},(R=O(o))==null?void 0:R["submit-button"],{disabled:G.disableSubmit,label:G.submitBtnLabel,severity:G.submitBtnSeverity,onClick:I,type:"submit"}),null,16,["disabled","label","severity"])):N("",!0)],16)],16)],16))],16)}}})),ri=Ve("DialogForm",Ie({__name:"DialogForm",props:{buttonsTemplate:{},header:{},visible:{type:Boolean},asideRightWidth:{default:260},class:{},cancelBtnLabel:{},clearBtnLabel:{},closable:{type:Boolean,default:!0},closeOnSubmit:{type:Boolean,default:!0},contentClass:{},dateHeader:{},headerIcon:{},invalid:{type:Boolean},resetAfterSubmit:{type:Boolean,default:!0},severity:{},showStayCheckbox:{type:Boolean,default:void 0},stayCheckboxLabel:{},submitBtnLabel:{},validatorMessage:{},validationFunction:{},width:{default:"small"},disableSubmit:{type:Boolean},columnPerRow:{default:1},hideFooter:{type:Boolean},hideStayCheckbox:{type:Boolean},saveBtnLabel:{},validateOnSave:{type:Boolean},cancelBtnSeverity:{},saveBtnSeverity:{},submitBtnSeverity:{}},emits:["clear","close","hide","show","submit","update:visible"],setup(n,{expose:e,emit:t}){const i=n,s=t,o=zu(),{locale:a}=kn("DialogForm"),r=xe("preset",{}).dialog,l=xe("preset",{}).dialogform,u=oe(),c=oe(),d=z(0),p=z(!1),f=z(!1),m=oe({stayAfterSubmit:!1,formValues:{}}),g=W(()=>{const S=o["aside-right"]&&f.value?i.asideRightWidth:0;return`calc(${{small:400,medium:500,large:572,"semi-xlarge":600,xlarge:800}[i.width]}px + ${S}px)`}),v=()=>{s("update:visible",!1),s("close")},b=()=>{u.value&&!i.invalid&&!i.validatorMessage&&(u.value.onSubmitClicked(),u.value.submit())},y=()=>{u.value&&u.value.clearField(),s("clear")},T=async S=>{i.validationFunction&&await i.validationFunction(S.formValues),!i.invalid&&!i.validatorMessage&&(m.value=S,o.confirm?p.value=!0:k())},k=async S=>{const{stayAfterSubmit:_}=m.value;if(!_&&i.closeOnSubmit&&s("update:visible",!1),o.confirm)try{await(S==null?void 0:S(m.value))}catch(j){console.error(j)}else s("submit",m.value);i.resetAfterSubmit&&y()};return e({form:u,clearField:y,setValues:S=>{var _;(_=u.value)==null||_.setValues(S)},setFieldValue:(S,_,j)=>{var x;(x=u.value)==null||x.setFieldValue(S,_,j)},setErrors:S=>{var _;(_=u.value)==null||_.setErrors(S)}}),(S,_)=>{var j,x,E,I;return h(),D(O(wl),M({ref_key:"dialogForm",ref:c},(j=O(l))==null?void 0:j.root,{class:i.class,closable:S.closable,draggable:!1,header:S.header,pt:{root:{class:[...(x=O(r))==null?void 0:x.root({state:{}}).class,...(E=O(l))==null?void 0:E.root.class],style:(I=O(l))==null?void 0:I.root.style(g.value)}},visible:S.visible,onHide:_[3]||(_[3]=$=>s("hide")),onShow:_[4]||(_[4]=$=>s("show")),"onUpdate:visible":_[5]||(_[5]=$=>s("update:visible",!!$)),modal:""}),{container:Y(()=>{var $,P,V,q,me,G,F,ue,je,Le;return[w("div",ht(Ut(($=O(l))==null?void 0:$.container(f.value))),[w("section",M((P=O(l))==null?void 0:P.mainsection,{id:"main"}),[w("div",ht(Ut((V=O(l))==null?void 0:V.header)),[Se(S.$slots,"header",{},()=>{var Me,de,te,fe;return[S.headerIcon?(h(),D(Ke,M({key:0},(Me=O(l))==null?void 0:Me.headericon,{icon:S.headerIcon,severity:S.severity,"aria-label":"Header Icon"}),null,16,["icon","severity"])):N("",!0),w("h3",ht(Ut((de=O(l))==null?void 0:de.headertitle)),U(S.header),17),S.$slots["aside-right"]?(h(),D(Ce,M({key:1},(te=O(l))==null?void 0:te.expandasidebutton,{label:f.value?O(a).asideRightExpandedButtonLabel:O(a).asideRightCollapsedButtonLabel,onClick:_[0]||(_[0]=Fe=>f.value=!f.value),text:""}),null,16,["label"])):N("",!0),S.closable?(h(),D(Ce,M({key:2,onClick:v},(fe=O(l))==null?void 0:fe.closedialog,{icon:"close","icon-class":"w-[22px] h-[22px]",rounded:"",severity:"secondary",text:""}),null,16)):N("",!0)]})],16),A(Hl,M((q=O(l))==null?void 0:q.form,{ref_key:"form",ref:u,"buttons-template":S.buttonsTemplate,"column-per-row":S.columnPerRow,"reset-after-submit":S.resetAfterSubmit,onSubmit:T,"hide-footer":""}),{fields:Y(({formValues:Me})=>[Se(S.$slots,"fields",{key:d.value,formValues:Me})]),_:3},16,["buttons-template","column-per-row","reset-after-submit"]),Se(S.$slots,"confirm",{hide:()=>p.value=!1,submit:k,visible:p.value}),w("div",ht(Ut((me=O(l))==null?void 0:me.footer)),[S.showStayCheckbox?(h(),D(yo,M({key:0},(G=O(l))==null?void 0:G.staycheckbox,{label:S.stayCheckboxLabel??O(a).stayCheckboxLabel,"model-value":(F=u.value)==null?void 0:F.stayAfterSubmit,"onUpdate:modelValue":_[1]||(_[1]=Me=>u.value&&(u.value.stayAfterSubmit=Me))}),null,16,["label","model-value"])):N("",!0),_t(A(fi,M((ue=O(l))==null?void 0:ue.validatormessage,{format:!1,message:S.validatorMessage}),null,16,["message"]),[[En,S.invalid&&S.validatorMessage]]),i.buttonsTemplate.length?(h(),C("div",ht(M({key:1},(je=O(l))==null?void 0:je.footerbutton)),[Se(S.$slots,"actionButtons",{submit:b},()=>{var Me,de,te,fe,Fe,_e;return[(Me=i.buttonsTemplate)!=null&&Me.includes("cancel")?(h(),D(Ce,M({key:0},(de=O(l))==null?void 0:de.cancelbtn,{label:S.cancelBtnLabel??O(a).cancelBtnLabel,onClick:_[2]||(_[2]=We=>(s("close"),s("update:visible",!1))),severity:"secondary",text:""}),null,16,["label"])):N("",!0),(te=i.buttonsTemplate)!=null&&te.includes("clear")?(h(),D(Ce,M({key:1},(fe=O(l))==null?void 0:fe.clearfield,{label:S.clearBtnLabel??O(a).clearBtnLabel,onClick:y,class:"whitespace-nowrap",text:""}),null,16,["label"])):N("",!0),(Fe=i.buttonsTemplate)!=null&&Fe.includes("submit")?(h(),D(Ce,M({key:2},(_e=O(l))==null?void 0:_e.savesubmitbutton,{label:S.submitBtnLabel??O(a).submitBtnLabel,severity:i.severity==="primary"?void 0:i.severity??"success",onClick:b}),null,16,["label","severity"])):N("",!0)]})],16)):N("",!0)],16)],16),S.$slots["aside-right"]?(h(),C("aside",ht(M({key:0},(Le=O(l))==null?void 0:Le.asidesection(f.value,S.asideRightWidth))),[Se(S.$slots,"aside-right")],16)):N("",!0)],16)]}),_:3},16,["class","closable","header","pt","visible"])}}})),uj=n=>n!=null&&n.length?typeof(n==null?void 0:n[0])=="string"?n:n==null?void 0:n.filter(e=>e.visible!==!1):[],hi=Ve("Dropdown",Ie({__name:"Dropdown",props:{modelValue:{type:[String,Number,Boolean,Object],default:void 0},initialValue:{type:[String,Number,Boolean,Object],default:void 0},label:{},options:{},allowNullOption:{type:Boolean,default:void 0},unselectOnReselect:{type:Boolean},optionLabel:{},optionValue:{},valueType:{default:"plain"},badgeValueProps:{},inputBorder:{},dataKey:{},useValidator:{type:Boolean},mandatory:{type:Boolean},showOptionalText:{type:Boolean,default:void 0},validatorMessage:{},formatValidatorMessage:{type:Boolean,default:!0},invalid:{type:Boolean},fieldName:{},placeholder:{},loading:{type:Boolean},fieldInfo:{},disabled:{type:Boolean},filter:{type:Boolean,default:!0},filterPlaceholder:{},panelMaxContent:{type:Boolean,default:!1}},emits:["update:modelValue","show","fieldInfoClick"],setup(n,{expose:e,emit:t}){const i=n,s=t;Pt(()=>{y()});const{locale:o,defaultProps:a}=kn("Dropdown"),r=W(()=>Xs(i,a)),l=xe("preset",{}).dropdown,u=xe("preset",{}).inputgroupaddon,c=oe(),d=z(!1),p=z(!1),f=W(()=>i.invalid||!!m.errorMessage),m=Sn({value:i.initialValue!==void 0?i.initialValue:i.modelValue}),g=W(()=>{var j;return o.emptySelectionErrorMessage.replace("{label}",i.label).replace("{formattedLabel}",(j=ov(i.label))==null?void 0:j.toLowerCase())}),v=W(()=>uj(i.options)),b=W(()=>{var j;return i.loading?o.loadingPlaceholder:i.placeholder??((j=o.inputPlaceholder)==null?void 0:j.replace("{label}",i.label??"").replace("{lowercaseLabel}",(i.label??"").toLowerCase()))}),y=()=>{i.useValidator&&(Object.assign(m,ii(i.fieldName??"dropdown",j=>!(j!=null&&j!=="")&&i.mandatory?typeof i.validatorMessage=="object"&&"empty"in i.validatorMessage?i.validatorMessage.empty:i.validatorMessage??g.value:Xt(T))),i.initialValue!==void 0&&(m.value=i.initialValue),i.invalid&&m.validate())},T=()=>i.validatorMessage&&i.invalid?i.validatorMessage:!0,k=j=>{const{value:x}=j;i.unselectOnReselect?p.value=!0:s("update:modelValue",x)},S=()=>{if(i.optionValue){const j=v.value.find(x=>{if(typeof x!="string")return i.dataKey?m.value[i.dataKey]===x[i.optionValue??""][i.dataKey]:Tg(As(x[i.optionValue??""]),As(m.value))});if(j&&typeof j!="string")return j[i.optionLabel??""]}else if(m.value&&typeof m.value=="object"&&i.optionLabel&&i.optionLabel in m.value)return m.value[i.optionLabel];return m.value},_=()=>{c.value&&c.value.show()};return He(()=>i.initialValue,j=>{m.value=j},{once:!0}),He(()=>i.modelValue,j=>{m.value=j}),He(()=>m.value,(j,x)=>{setTimeout(()=>{i.unselectOnReselect&&p.value&&(Tg(j,x)&&j!==void 0&&(m.value=void 0),p.value=!1,s("update:modelValue",m.value))},0)}),e({showOverlay:_}),(j,x)=>(h(),D(Di,{info:j.fieldInfo,label:i.label,mandatory:i.mandatory,"show-optional-text":j.showOptionalText,onInfoClick:x[3]||(x[3]=E=>j.$emit("fieldInfoClick"))},{default:Y(()=>[A(Yo,{class:Pe([{"grid grid-cols-[max-content,1fr,max-content]":j.$slots["addon-left"]&&j.$slots["addon-right"],"grid grid-cols-[1fr,max-content]":!j.$slots["addon-left"]&&j.$slots["addon-right"],"grid grid-cols-[max-content,1fr]":j.$slots["addon-left"]&&!j.$slots["addon-right"]}]),disabled:i.disabled,invalid:f.value,ring:j.inputBorder},{default:Y(()=>{var E,I,$,P,V;return[j.$slots["addon-left"]?(h(),D(O(Tr),{key:0,disabled:i.disabled},{default:Y(()=>[Se(j.$slots,"addon-left")]),_:3},8,["disabled"])):N("",!0),A(O(Ia),M({ref_key:"dropdown",ref:c},i,{modelValue:m.value,"onUpdate:modelValue":x[0]||(x[0]=q=>m.value=q),"aria-describedby":i.label+"error","filter-placeholder":i.filterPlaceholder||O(o).filterPlaceholder,invalid:f.value,options:v.value,placeholder:b.value,pt:{list:(E=O(l))==null?void 0:E.list({props:i}),panel:(I=O(l))==null?void 0:I.panel({props:i}),virtualScroller:($=O(l))==null?void 0:$.virtualScroller({props:i}),wrapper:(P=O(l))==null?void 0:P.wrapper({props:i})},"virtual-scroller-options":((V=v.value)==null?void 0:V.length)>10?{itemSize:32}:void 0,onChange:k,onHide:x[1]||(x[1]=q=>d.value=!1),onShow:x[2]||(x[2]=q=>(j.$emit("show"),d.value=!0))}),pi({dropdownicon:Y(()=>[A(Ke,ht(Ut(O(l).dropdownicon({state:{isShowOverlay:d.value}}))),null,16)]),loadingicon:Y(()=>[A(Ke,ht(Ut(O(l).loadingicon)),null,16)]),filtericon:Y(()=>[A(Ke,ht(Ut(O(l).filtericon)),null,16)]),_:2},[j.loading?{name:"value",fn:Y(({placeholder:q})=>[w("span",ht(Ut(O(l).loadingplaceholder)),U(q),17)]),key:"0"}:{name:"value",fn:Y(q=>[(r.value.allowNullOption?q.value!==void 0:q.value!=null)?Se(j.$slots,"value",{key:0,originalValue:q.value,value:S()},()=>[j.valueType==="badge"?(h(),D(yr,M({key:0},j.badgeValueProps,{label:S()}),null,16,["label"])):(h(),C(re,{key:1},[st(U(S()),1)],64))]):(h(),C(re,{key:1},[st(U(q.placeholder),1)],64))]),key:"1"},j.$slots.option?{name:"option",fn:Y(({option:q})=>[Se(j.$slots,"option",{option:q})]),key:"2"}:void 0,j.$slots.footer?{name:"footer",fn:Y(({value:q,options:me})=>[Se(j.$slots,"footer",{options:me,value:q})]),key:"3"}:void 0]),1040,["modelValue","aria-describedby","filter-placeholder","invalid","options","placeholder","pt","virtual-scroller-options"]),j.$slots["addon-right"]?(h(),D(O(Tr),{key:1,pt:{root:O(u).root({props:{class:[{"!text-general-200":i.disabled}]}})}},{default:Y(()=>[Se(j.$slots,"addon-right")]),_:3},8,["pt"])):N("",!0)]}),_:3},8,["class","disabled","invalid","ring"]),A(fi,{id:i.label+"error",message:m.errorMessage},null,8,["id","message"])]),_:3},8,["info","label","mandatory","show-optional-text"]))}}));function Ci(n){this.content=n}Ci.prototype={constructor:Ci,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var i=t&&t!=n?this.remove(t):this,s=i.find(n),o=i.content.slice();return s==-1?o.push(t||n,e):(o[s+1]=e,t&&(o[s]=t)),new Ci(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ci(t)},addToStart:function(n,e){return new Ci([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Ci(t)},addBefore:function(n,e,t){var i=this.remove(e),s=i.content.slice(),o=i.find(n);return s.splice(o==-1?s.length:o,0,e,t),new Ci(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Ci.from(n),n.size?new Ci(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ci.from(n),n.size?new Ci(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Ci.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},Ci.from=function(n){if(n instanceof Ci)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ci(e)};function cj(n,e,t){for(let i=0;;i++){if(i==n.childCount||i==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(i),o=e.child(i);if(s==o){t+=s.nodeSize;continue}if(!s.sameMarkup(o))return t;if(s.isText&&s.text!=o.text){for(let a=0;s.text[a]==o.text[a];a++)t++;return t}if(s.content.size||o.content.size){let a=cj(s.content,o.content,t+1);if(a!=null)return a}t+=s.nodeSize}}function dj(n,e,t,i){for(let s=n.childCount,o=e.childCount;;){if(s==0||o==0)return s==o?null:{a:t,b:i};let a=n.child(--s),r=e.child(--o),l=a.nodeSize;if(a==r){t-=l,i-=l;continue}if(!a.sameMarkup(r))return{a:t,b:i};if(a.isText&&a.text!=r.text){let u=0,c=Math.min(a.text.length,r.text.length);for(;u<c&&a.text[a.text.length-u-1]==r.text[r.text.length-u-1];)u++,t--,i--;return{a:t,b:i}}if(a.content.size||r.content.size){let u=dj(a.content,r.content,t-1,i-1);if(u)return u}t-=l,i-=l}}class et{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let i=0;i<e.length;i++)this.size+=e[i].nodeSize}nodesBetween(e,t,i,s=0,o){for(let a=0,r=0;r<t;a++){let l=this.content[a],u=r+l.nodeSize;if(u>e&&i(l,s+r,o||null,a)!==!1&&l.content.size){let c=r+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,t-c),i,s+c)}r=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,i,s){let o="",a=!0;return this.nodesBetween(e,t,(r,l)=>{let u=r.isText?r.text.slice(Math.max(e,l)-l,t-l):r.isLeaf?s?typeof s=="function"?s(r):s:r.type.spec.leafText?r.type.spec.leafText(r):"":"";r.isBlock&&(r.isLeaf&&u||r.isTextblock)&&i&&(a?a=!1:o+=i),o+=u},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,i=e.firstChild,s=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(i)&&(s[s.length-1]=t.withText(t.text+i.text),o=1);o<e.content.length;o++)s.push(e.content[o]);return new et(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let i=[],s=0;if(t>e)for(let o=0,a=0;a<t;o++){let r=this.content[o],l=a+r.nodeSize;l>e&&((a<e||l>t)&&(r.isText?r=r.cut(Math.max(0,e-a),Math.min(r.text.length,t-a)):r=r.cut(Math.max(0,e-a-1),Math.min(r.content.size,t-a-1))),i.push(r),s+=r.nodeSize),a=l}return new et(i,s)}cutByIndex(e,t){return e==t?et.empty:e==0&&t==this.content.length?this:new et(this.content.slice(e,t))}replaceChild(e,t){let i=this.content[e];if(i==t)return this;let s=this.content.slice(),o=this.size+t.nodeSize-i.nodeSize;return s[e]=t,new et(s,o)}addToStart(e){return new et([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new et(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,i=0;t<this.content.length;t++){let s=this.content[t];e(s,i,t),i+=s.nodeSize}}findDiffStart(e,t=0){return cj(this,e,t)}findDiffEnd(e,t=this.size,i=e.size){return dj(this,e,t,i)}findIndex(e,t=-1){if(e==0)return kf(0,e);if(e==this.size)return kf(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let i=0,s=0;;i++){let o=this.child(i),a=s+o.nodeSize;if(a>=e)return a==e||t>0?kf(i+1,a):kf(i,s);s=a}}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 et.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new et(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return et.empty;let t,i=0;for(let s=0;s<e.length;s++){let o=e[s];i+=o.nodeSize,s&&o.isText&&e[s-1].sameMarkup(o)?(t||(t=e.slice(0,s)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new et(t||e,i)}static from(e){if(!e)return et.empty;if(e instanceof et)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new et([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}et.empty=new et([],0);const C0={index:0,offset:0};function kf(n,e){return C0.index=n,C0.offset=e,C0}function wf(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!wf(n[i],e[i]))return!1}else{for(let i in n)if(!(i in e)||!wf(n[i],e[i]))return!1;for(let i in e)if(!(i in n))return!1}return!0}let An=class O1{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,i=!1;for(let s=0;s<e.length;s++){let o=e[s];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,s));else{if(o.type.excludes(this.type))return e;!i&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),i=!0),t&&t.push(o)}}return t||(t=e.slice()),i||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&&wf(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 i=e.marks[t.type];if(!i)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=i.create(t.attrs);return i.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++)if(!e[i].eq(t[i]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return O1.none;if(e instanceof O1)return[e];let t=e.slice();return t.sort((i,s)=>i.type.rank-s.type.rank),t}};An.none=[];class Sf extends Error{}class wt{constructor(e,t,i){this.content=e,this.openStart=t,this.openEnd=i}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let i=fj(this.content,e+this.openStart,t);return i&&new wt(i,this.openStart,this.openEnd)}removeBetween(e,t){return new wt(pj(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 wt.empty;let i=t.openStart||0,s=t.openEnd||0;if(typeof i!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new wt(et.fromJSON(e,t.content),i,s)}static maxOpen(e,t=!0){let i=0,s=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)i++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)s++;return new wt(e,i,s)}}wt.empty=new wt(et.empty,0,0);function pj(n,e,t){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i),{index:a,offset:r}=n.findIndex(t);if(s==e||o.isText){if(r!=t&&!n.child(a).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(i!=a)throw new RangeError("Removing non-flat range");return n.replaceChild(i,o.copy(pj(o.content,e-s-1,t-s-1)))}function fj(n,e,t,i){let{index:s,offset:o}=n.findIndex(e),a=n.maybeChild(s);if(o==e||a.isText)return n.cut(0,e).append(t).append(n.cut(e));let r=fj(a.content,e-o-1,t);return r&&n.replaceChild(s,a.copy(r))}function vV(n,e,t){if(t.openStart>n.depth)throw new Sf("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Sf("Inconsistent open depths");return mj(n,e,t,0)}function mj(n,e,t,i){let s=n.index(i),o=n.node(i);if(s==e.index(i)&&i<n.depth-t.openStart){let a=mj(n,e,t,i+1);return o.copy(o.content.replaceChild(s,a))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==i&&e.depth==i){let a=n.parent,r=a.content;return Ar(a,r.cut(0,n.parentOffset).append(t.content).append(r.cut(e.parentOffset)))}else{let{start:a,end:r}=yV(t,n);return Ar(o,gj(n,a,r,e,i))}else return Ar(o,jf(n,e,i))}function hj(n,e){if(!e.type.compatibleContent(n.type))throw new Sf("Cannot join "+e.type.name+" onto "+n.type.name)}function T0(n,e,t){let i=n.node(t);return hj(i,e.node(t)),i}function Ir(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function nd(n,e,t,i){let s=(e||n).node(t),o=0,a=e?e.index(t):s.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(Ir(n.nodeAfter,i),o++));for(let r=o;r<a;r++)Ir(s.child(r),i);e&&e.depth==t&&e.textOffset&&Ir(e.nodeBefore,i)}function Ar(n,e){return n.type.checkContent(e),n.copy(e)}function gj(n,e,t,i,s){let o=n.depth>s&&T0(n,e,s+1),a=i.depth>s&&T0(t,i,s+1),r=[];return nd(null,n,s,r),o&&a&&e.index(s)==t.index(s)?(hj(o,a),Ir(Ar(o,gj(n,e,t,i,s+1)),r)):(o&&Ir(Ar(o,jf(n,e,s+1)),r),nd(e,t,s,r),a&&Ir(Ar(a,jf(t,i,s+1)),r)),nd(i,null,s,r),new et(r)}function jf(n,e,t){let i=[];if(nd(null,n,t,i),n.depth>t){let s=T0(n,e,t+1);Ir(Ar(s,jf(n,e,t+1)),i)}return nd(e,null,t,i),new et(i)}function yV(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)s=e.node(o).copy(et.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class id{constructor(e,t,i){this.pos=e,this.path=t,this.parentOffset=i,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 i=this.pos-this.path[this.path.length-1],s=e.child(t);return i?e.child(t).cut(i):s}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 i=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)s+=i.child(o).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return An.none;if(this.textOffset)return e.child(t).marks;let i=e.maybeChild(t-1),s=e.maybeChild(t);if(!i){let r=i;i=s,s=r}let o=i.marks;for(var a=0;a<o.length;a++)o[a].type.spec.inclusive===!1&&(!s||!o[a].isInSet(s.marks))&&(o=o[a--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let i=t.marks,s=e.parent.maybeChild(e.index());for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}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 i=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);i>=0;i--)if(e.pos<=this.end(i)&&(!t||t(this.node(i))))return new Cf(this,e,i);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 i=[],s=0,o=t;for(let a=e;;){let{index:r,offset:l}=a.content.findIndex(o),u=o-l;if(i.push(a,r,s+l),!u||(a=a.child(r),a.isText))break;o=u-1,s+=l+1}return new id(t,i,o)}static resolveCached(e,t){let i=vj.get(e);if(i)for(let o=0;o<i.elts.length;o++){let a=i.elts[o];if(a.pos==t)return a}else vj.set(e,i=new bV);let s=i.elts[i.i]=id.resolve(e,t);return i.i=(i.i+1)%_V,s}}class bV{constructor(){this.elts=[],this.i=0}}const _V=12,vj=new WeakMap;class Cf{constructor(e,t,i){this.$from=e,this.$to=t,this.depth=i}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 kV=Object.create(null);let Na=class I1{constructor(e,t,i,s=An.none){this.type=e,this.attrs=t,this.marks=s,this.content=i||et.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,i,s=0){this.content.nodesBetween(e,t,i,s,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,i,s){return this.content.textBetween(e,t,i,s)}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,i){return this.type==e&&wf(this.attrs,t||e.defaultAttrs||kV)&&An.sameSet(this.marks,i||An.none)}copy(e=null){return e==this.content?this:new I1(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new I1(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,i=!1){if(e==t)return wt.empty;let s=this.resolve(e),o=this.resolve(t),a=i?0:s.sharedDepth(t),r=s.start(a),u=s.node(a).content.cut(s.pos-r,o.pos-r);return new wt(u,s.depth-a,o.depth-a)}replace(e,t,i){return vV(this.resolve(e),this.resolve(t),i)}nodeAt(e){for(let t=this;;){let{index:i,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(i),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:i}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:i}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:i}=this.content.findIndex(e);if(i<e)return{node:this.content.child(t),index:t,offset:i};let s=this.content.child(t-1);return{node:s,index:t-1,offset:i-s.nodeSize}}resolve(e){return id.resolveCached(this,e)}resolveNoCache(e){return id.resolve(this,e)}rangeHasMark(e,t,i){let s=!1;return t>e&&this.nodesBetween(e,t,o=>(i.isInSet(o.marks)&&(s=!0),!s)),s}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()+")"),yj(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,i=et.empty,s=0,o=i.childCount){let a=this.contentMatchAt(e).matchFragment(i,s,o),r=a&&a.matchFragment(this.content,t);if(!r||!r.validEnd)return!1;for(let l=s;l<o;l++)if(!this.type.allowsMarks(i.child(l).marks))return!1;return!0}canReplaceWith(e,t,i,s){if(s&&!this.type.allowsMarks(s))return!1;let o=this.contentMatchAt(e).matchType(i),a=o&&o.matchFragment(this.content,t);return a?a.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=An.none;for(let t=0;t<this.marks.length;t++){let i=this.marks[t];i.type.checkAttrs(i.attrs),e=i.addToSet(e)}if(!An.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 i;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");i=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,i)}let s=et.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,s,i);return o.type.checkAttrs(o.attrs),o}};Na.prototype.text=void 0;class Tf extends Na{constructor(e,t,i,s){if(super(e,t,null,s),!i)throw new RangeError("Empty text nodes are not allowed");this.text=i}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):yj(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 Tf(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Tf(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 yj(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Mr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let i=new wV(e,t);if(i.next==null)return Mr.empty;let s=bj(i);i.next&&i.err("Unexpected trailing text");let o=AV(IV(s));return MV(o,i),o}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,i=e.childCount){let s=this;for(let o=t;s&&o<i;o++)s=s.matchType(e.child(o).type);return s}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 i=0;i<e.next.length;i++)if(this.next[t].type==e.next[i].type)return!0;return!1}fillBefore(e,t=!1,i=0){let s=[this];function o(a,r){let l=a.matchFragment(e,i);if(l&&(!t||l.validEnd))return et.from(r.map(u=>u.createAndFill()));for(let u=0;u<a.next.length;u++){let{type:c,next:d}=a.next[u];if(!(c.isText||c.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let p=o(d,r.concat(c));if(p)return p}}return null}return o(this,[])}findWrapping(e){for(let i=0;i<this.wrapCache.length;i+=2)if(this.wrapCache[i]==e)return this.wrapCache[i+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),i=[{match:this,type:null,via:null}];for(;i.length;){let s=i.shift(),o=s.match;if(o.matchType(e)){let a=[];for(let r=s;r.type;r=r.via)a.push(r.type);return a.reverse()}for(let a=0;a<o.next.length;a++){let{type:r,next:l}=o.next[a];!r.isLeaf&&!r.hasRequiredAttrs()&&!(r.name in t)&&(!s.type||l.validEnd)&&(i.push({match:r.contentMatch,type:r,via:s}),t[r.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(i){e.push(i);for(let s=0;s<i.next.length;s++)e.indexOf(i.next[s].next)==-1&&t(i.next[s].next)}return t(this),e.map((i,s)=>{let o=s+(i.validEnd?"*":" ")+" ";for(let a=0;a<i.next.length;a++)o+=(a?", ":"")+i.next[a].type.name+"->"+e.indexOf(i.next[a].next);return o}).join(`
200
200
  `)}}Mr.empty=new Mr(!0);class wV{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 bj(n){let e=[];do e.push(SV(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function SV(n){let e=[];do e.push(jV(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function jV(n){let e=OV(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=CV(n,e);else break;return e}function _j(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function CV(n,e){let t=_j(n),i=t;return n.eat(",")&&(n.next!="}"?i=_j(n):i=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:i,expr:e}}function TV(n,e){let t=n.nodeTypes,i=t[e];if(i)return[i];let s=[];for(let o in t){let a=t[o];a.isInGroup(e)&&s.push(a)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function OV(n){if(n.eat("(")){let e=bj(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=TV(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function IV(n){let e=[[]];return s(o(n,0),t()),e;function t(){return e.push([])-1}function i(a,r,l){let u={term:l,to:r};return e[a].push(u),u}function s(a,r){a.forEach(l=>l.to=r)}function o(a,r){if(a.type=="choice")return a.exprs.reduce((l,u)=>l.concat(o(u,r)),[]);if(a.type=="seq")for(let l=0;;l++){let u=o(a.exprs[l],r);if(l==a.exprs.length-1)return u;s(u,r=t())}else if(a.type=="star"){let l=t();return i(r,l),s(o(a.expr,l),l),[i(l)]}else if(a.type=="plus"){let l=t();return s(o(a.expr,r),l),s(o(a.expr,l),l),[i(l)]}else{if(a.type=="opt")return[i(r)].concat(o(a.expr,r));if(a.type=="range"){let l=r;for(let u=0;u<a.min;u++){let c=t();s(o(a.expr,l),c),l=c}if(a.max==-1)s(o(a.expr,l),l);else for(let u=a.min;u<a.max;u++){let c=t();i(l,c),s(o(a.expr,l),c),l=c}return[i(l)]}else{if(a.type=="name")return[i(r,void 0,a.value)];throw new Error("Unknown expr type")}}}}function kj(n,e){return e-n}function wj(n,e){let t=[];return i(e),t.sort(kj);function i(s){let o=n[s];if(o.length==1&&!o[0].term)return i(o[0].to);t.push(s);for(let a=0;a<o.length;a++){let{term:r,to:l}=o[a];!r&&t.indexOf(l)==-1&&i(l)}}}function AV(n){let e=Object.create(null);return t(wj(n,0));function t(i){let s=[];i.forEach(a=>{n[a].forEach(({term:r,to:l})=>{if(!r)return;let u;for(let c=0;c<s.length;c++)s[c][0]==r&&(u=s[c][1]);wj(n,l).forEach(c=>{u||s.push([r,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let o=e[i.join(",")]=new Mr(i.indexOf(n.length-1)>-1);for(let a=0;a<s.length;a++){let r=s[a][1].sort(kj);o.next.push({type:s[a][0],next:e[r.join(",")]||t(r)})}return o}}function MV(n,e){for(let t=0,i=[n];t<i.length;t++){let s=i[t],o=!s.validEnd,a=[];for(let r=0;r<s.next.length;r++){let{type:l,next:u}=s.next[r];a.push(l.name),o&&!(l.isText||l.hasRequiredAttrs())&&(o=!1),i.indexOf(u)==-1&&i.push(u)}o&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Sj(n){let e=Object.create(null);for(let t in n){let i=n[t];if(!i.hasDefault)return null;e[t]=i.default}return e}function jj(n,e){let t=Object.create(null);for(let i in n){let s=e&&e[i];if(s===void 0){let o=n[i];if(o.hasDefault)s=o.default;else throw new RangeError("No value supplied for attribute "+i)}t[i]=s}return t}function Cj(n,e,t,i){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let o=n[s];o.validate&&o.validate(e[s])}}function Tj(n,e){let t=Object.create(null);if(e)for(let i in e)t[i]=new EV(n,i,e[i]);return t}let Oj=class RI{constructor(e,t,i){this.name=e,this.schema=t,this.spec=i,this.markSet=null,this.groups=i.group?i.group.split(" "):[],this.attrs=Tj(e,i.attrs),this.defaultAttrs=Sj(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(i.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Mr.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:jj(this.attrs,e)}create(e=null,t,i){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Na(this,this.computeAttrs(e),et.from(t),An.setFrom(i))}createChecked(e=null,t,i){return t=et.from(t),this.checkContent(t),new Na(this,this.computeAttrs(e),t,An.setFrom(i))}createAndFill(e=null,t,i){if(e=this.computeAttrs(e),t=et.from(t),t.size){let a=this.contentMatch.fillBefore(t);if(!a)return null;t=a.append(t)}let s=this.contentMatch.matchFragment(t),o=s&&s.fillBefore(et.empty,!0);return o?new Na(this,e,t.append(o),An.setFrom(i)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let i=0;i<e.childCount;i++)if(!this.allowsMarks(e.child(i).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){Cj(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 i=0;i<e.length;i++)this.allowsMarkType(e[i].type)?t&&t.push(e[i]):t||(t=e.slice(0,i));return t?t.length?t:An.none:e}static compile(e,t){let i=Object.create(null);e.forEach((o,a)=>i[o]=new RI(o,t,a));let s=t.spec.topNode||"doc";if(!i[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!i.text)throw new RangeError("Every schema needs a 'text' type");for(let o in i.text.attrs)throw new RangeError("The text node type should not have attributes");return i}};function xV(n,e,t){let i=t.split("|");return s=>{let o=s===null?"null":typeof s;if(i.indexOf(o)<0)throw new RangeError(`Expected value of type ${i} for attribute ${e} on type ${n}, got ${o}`)}}class EV{constructor(e,t,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?xV(e,t,i.validate):i.validate}get isRequired(){return!this.hasDefault}}class Of{constructor(e,t,i,s){this.name=e,this.rank=t,this.schema=i,this.spec=s,this.attrs=Tj(e,s.attrs),this.excluded=null;let o=Sj(this.attrs);this.instance=o?new An(this,o):null}create(e=null){return!e&&this.instance?this.instance:new An(this,jj(this.attrs,e))}static compile(e,t){let i=Object.create(null),s=0;return e.forEach((o,a)=>i[o]=new Of(o,s++,t,a)),i}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){Cj(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let Ij=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=Ci.from(e.nodes),t.marks=Ci.from(e.marks||{}),this.nodes=Oj.compile(this.spec.nodes,this),this.marks=Of.compile(this.spec.marks,this);let i=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let o=this.nodes[s],a=o.spec.content||"",r=o.spec.marks;if(o.contentMatch=i[a]||(i[a]=Mr.parse(a,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=r=="_"?null:r?Aj(this,r.split(" ")):r==""||!o.inlineContent?[]:null}for(let s in this.marks){let o=this.marks[s],a=o.spec.excludes;o.excluded=a==null?[o]:a==""?[]:Aj(this,a.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,i,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Oj){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,i,s)}text(e,t){let i=this.nodes.text;return new Tf(i,i.defaultAttrs,e,An.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Na.fromJSON(this,e)}markFromJSON(e){return An.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}};function Aj(n,e){let t=[];for(let i=0;i<e.length;i++){let s=e[i],o=n.marks[s],a=o;if(o)t.push(o);else for(let r in n.marks){let l=n.marks[r];(s=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(s)>-1)&&t.push(a=l)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[i]+"'")}return t}function DV(n){return n.tag!=null}function PV(n){return n.style!=null}class Ba{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let i=this.matchedStyles=[];t.forEach(s=>{if(DV(s))this.tags.push(s);else if(PV(s)){let o=/[^=]*/.exec(s.style)[0];i.indexOf(o)<0&&i.push(o),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let o=e.nodes[s.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let i=new Dj(this,t,!1);return i.addAll(e,An.none,t.from,t.to),i.finish()}parseSlice(e,t={}){let i=new Dj(this,t,!0);return i.addAll(e,An.none,t.from,t.to),wt.maxOpen(i.finish())}matchTag(e,t,i){for(let s=i?this.tags.indexOf(i)+1:0;s<this.tags.length;s++){let o=this.tags[s];if(NV(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let a=o.getAttrs(e);if(a===!1)continue;o.attrs=a||void 0}return o}}}matchStyle(e,t,i,s){for(let o=s?this.styles.indexOf(s)+1:0;o<this.styles.length;o++){let a=this.styles[o],r=a.style;if(!(r.indexOf(e)!=0||a.context&&!i.matchesContext(a.context)||r.length>e.length&&(r.charCodeAt(e.length)!=61||r.slice(e.length+1)!=t))){if(a.getAttrs){let l=a.getAttrs(t);if(l===!1)continue;a.attrs=l||void 0}return a}}}static schemaRules(e){let t=[];function i(s){let o=s.priority==null?50:s.priority,a=0;for(;a<t.length;a++){let r=t[a];if((r.priority==null?50:r.priority)<o)break}t.splice(a,0,s)}for(let s in e.marks){let o=e.marks[s].spec.parseDOM;o&&o.forEach(a=>{i(a=Pj(a)),a.mark||a.ignore||a.clearMark||(a.mark=s)})}for(let s in e.nodes){let o=e.nodes[s].spec.parseDOM;o&&o.forEach(a=>{i(a=Pj(a)),a.node||a.ignore||a.mark||(a.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ba(e,Ba.schemaRules(e)))}}const Mj={address:!0,article:!0,aside:!0,blockquote:!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},$V={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},xj={ol:!0,ul:!0},sd=1,O0=2,If=4;function Ej(n,e,t){return e!=null?(e?sd:0)|(e==="full"?O0:0):n&&n.whitespace=="pre"?sd|O0:t&-5}class Af{constructor(e,t,i,s,o,a){this.type=e,this.attrs=t,this.marks=i,this.solid=s,this.options=a,this.content=[],this.activeMarks=An.none,this.match=o||(a&If?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(et.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let i=this.type.contentMatch,s;return(s=i.findWrapping(e.type))?(this.match=i,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&sd)){let i=this.content[this.content.length-1],s;if(i&&i.isText&&(s=/[ \t\r\n\u000c]+$/.exec(i.text))){let o=i;i.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-s[0].length))}}let t=et.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(et.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&&!Mj.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Dj{constructor(e,t,i){this.parser=e,this.options=t,this.isOpen=i,this.open=0,this.localPreserveWS=!1;let s=t.topNode,o,a=Ej(null,t.preserveWhitespace,0)|(i?If:0);s?o=new Af(s.type,s.attrs,An.none,!0,t.topMatch||s.type.contentMatch,a):i?o=new Af(null,null,An.none,!0,null,a):o=new Af(e.schema.topNodeType,null,An.none,!0,null,a),this.nodes=[o],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 i=e.nodeValue,s=this.top,o=s.options&O0?"full":this.localPreserveWS||(s.options&sd)>0;if(o==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(i)){if(o)o!=="full"?i=i.replace(/\r?\n|\r/g," "):i=i.replace(/\r\n?/g,`
201
201
  `);else if(i=i.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(i)&&this.open==this.nodes.length-1){let a=s.content[s.content.length-1],r=e.previousSibling;(!a||r&&r.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(i=i.slice(1))}i&&this.insertNode(this.parser.schema.text(i),t,!/\S/.test(i)),this.findInText(e)}else this.findInside(e)}addElement(e,t,i){let s=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),r;xj.hasOwnProperty(a)&&this.parser.normalizeLists&&LV(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(r=this.parser.matchTag(e,this,i));e:if(l?l.ignore:$V.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let u,c=this.needsBlock;if(Mj.hasOwnProperty(a))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),u=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=l&&l.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),u&&this.sync(o),this.needsBlock=c}else{let u=this.readStyles(e,t);u&&this.addElementByRule(e,l,u,l.consuming===!1?r:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
202
202
  `),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 i=e.style;if(i&&i.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let o=this.parser.matchedStyles[s],a=i.getPropertyValue(o);if(a)for(let r=void 0;;){let l=this.parser.matchStyle(o,a,this,r);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(u=>!l.clearMark(u)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)r=l;else break}}return t}addElementByRule(e,t,i,s){let o,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),i,e.nodeName=="BR")||this.leafFallback(e,i);else{let l=this.enter(a,t.attrs||null,i,t.preserveWhitespace);l&&(o=!0,i=l)}else{let l=this.parser.schema.marks[t.mark];i=i.concat(l.create(t.attrs))}let r=this.top;if(a&&a.isLeaf)this.findInside(e);else if(s)this.addElement(e,i,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,i,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,i),this.findAround(e,l,!1)}o&&this.sync(r)&&this.open--}addAll(e,t,i,s){let o=i||0;for(let a=i?e.childNodes[i]:e.firstChild,r=s==null?null:e.childNodes[s];a!=r;a=a.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(a,t);this.findAtPoint(e,o)}findPlace(e,t,i){let s,o;for(let a=this.open,r=0;a>=0;a--){let l=this.nodes[a],u=l.findWrapping(e);if(u&&(!s||s.length>u.length+r)&&(s=u,o=l,!u.length))break;if(l.solid){if(i)break;r+=2}}if(!s)return null;this.sync(o);for(let a=0;a<s.length;a++)t=this.enterInner(s[a],null,t,!1);return t}insertNode(e,t,i){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(t=this.enterInner(o,null,t))}let s=this.findPlace(e,t,i);if(s){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let a=An.none;for(let r of s.concat(e.marks))(o.type?o.type.allowsMarkType(r.type):$j(r.type,e.type))&&(a=r.addToSet(a));return o.content.push(e.mark(a)),!0}return!1}enter(e,t,i,s){let o=this.findPlace(e.create(t),i,!1);return o&&(o=this.enterInner(e,t,i,!0,s)),o}enterInner(e,t,i,s=!1,o){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let r=Ej(e,o,a.options);a.options&If&&a.content.length==0&&(r|=If);let l=An.none;return i=i.filter(u=>(a.type?a.type.allowsMarkType(u.type):$j(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new Af(e,t,l,s,null,r)),this.open++,i}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|=sd)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let i=this.nodes[t].content;for(let s=i.length-1;s>=0;s--)e+=i[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].node==e&&this.find[i].offset==t&&(this.find[i].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,i){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(i?2:4)&&(this.find[s].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("/"),i=this.options.context,s=!this.isOpen&&(!i||i.parent.type==this.nodes[0].type),o=-(i?i.depth+1:0)+(s?0:1),a=(r,l)=>{for(;r>=0;r--){let u=t[r];if(u==""){if(r==t.length-1||r==0)continue;for(;l>=o;l--)if(a(r-1,l))return!0;return!1}else{let c=l>0||l==0&&s?this.nodes[l].type:i&&l>=o?i.node(l-o).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;l--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(i&&i.isTextblock&&i.defaultAttrs)return i}for(let t in this.parser.schema.nodes){let i=this.parser.schema.nodes[t];if(i.isTextblock&&i.defaultAttrs)return i}}}function LV(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&xj.hasOwnProperty(i)&&t?(t.appendChild(e),e=t):i=="li"?t=e:i&&(t=null)}}function NV(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Pj(n){let e={};for(let t in n)e[t]=n[t];return e}function $j(n,e){let t=e.schema.nodes;for(let i in t){let s=t[i];if(!s.allowsMarkType(n))continue;let o=[],a=r=>{o.push(r);for(let l=0;l<r.edgeCount;l++){let{type:u,next:c}=r.edge(l);if(u==e||o.indexOf(c)<0&&a(c))return!0}};if(a(s.contentMatch))return!0}}class xr{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},i){i||(i=I0(t).createDocumentFragment());let s=i,o=[];return e.forEach(a=>{if(o.length||a.marks.length){let r=0,l=0;for(;r<o.length&&l<a.marks.length;){let u=a.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(o[r][0])||u.type.spec.spanning===!1)break;r++,l++}for(;r<o.length;)s=o.pop()[1];for(;l<a.marks.length;){let u=a.marks[l++],c=this.serializeMark(u,a.isInline,t);c&&(o.push([u,s]),s.appendChild(c.dom),s=c.contentDOM||c.dom)}}s.appendChild(this.serializeNodeInner(a,t))}),i}serializeNodeInner(e,t){let{dom:i,contentDOM:s}=Mf(I0(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return i}serializeNode(e,t={}){let i=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let o=this.serializeMark(e.marks[s],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(i),i=o.dom)}return i}serializeMark(e,t,i={}){let s=this.marks[e.type.name];return s&&Mf(I0(i),s(e,t),null,e.attrs)}static renderSpec(e,t,i=null,s){return Mf(e,t,i,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new xr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Lj(e.nodes);return t.text||(t.text=i=>i.text),t}static marksFromSchema(e){return Lj(e.marks)}}function Lj(n){let e={};for(let t in n){let i=n[t].spec.toDOM;i&&(e[t]=i)}return e}function I0(n){return n.document||window.document}const Nj=new WeakMap;function BV(n){let e=Nj.get(n);return e===void 0&&Nj.set(n,e=RV(n)),e}function RV(n){let e=null;function t(i){if(i&&typeof i=="object")if(Array.isArray(i))if(typeof i[0]=="string")e||(e=[]),e.push(i);else for(let s=0;s<i.length;s++)t(i[s]);else for(let s in i)t(i[s])}return t(n),e}function Mf(n,e,t,i){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],o;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(i&&(o=BV(i))&&o.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 a=s.indexOf(" ");a>0&&(t=s.slice(0,a),s=s.slice(a+1));let r,l=t?n.createElementNS(t,s):n.createElement(s),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 p=d.indexOf(" ");p>0?l.setAttributeNS(d.slice(0,p),d.slice(p+1),u[d]):l.setAttribute(d,u[d])}}for(let d=c;d<e.length;d++){let p=e[d];if(p===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:m}=Mf(n,p,t,i);if(l.appendChild(f),m){if(r)throw new RangeError("Multiple content holes");r=m}}}return{dom:l,contentDOM:r}}const Bj=65535,Rj=Math.pow(2,16);function FV(n,e){return n+e*Rj}function Fj(n){return n&Bj}function VV(n){return(n-(n&Bj))/Rj}const Vj=1,zj=2,xf=4,Uj=8;class A0{constructor(e,t,i){this.pos=e,this.delInfo=t,this.recover=i}get deleted(){return(this.delInfo&Uj)>0}get deletedBefore(){return(this.delInfo&(Vj|xf))>0}get deletedAfter(){return(this.delInfo&(zj|xf))>0}get deletedAcross(){return(this.delInfo&xf)>0}}class gs{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&gs.empty)return gs.empty}recover(e){let t=0,i=Fj(e);if(!this.inverted)for(let s=0;s<i;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[i*3]+t+VV(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,i){let s=0,o=this.inverted?2:1,a=this.inverted?1:2;for(let r=0;r<this.ranges.length;r+=3){let l=this.ranges[r]-(this.inverted?s:0);if(l>e)break;let u=this.ranges[r+o],c=this.ranges[r+a],d=l+u;if(e<=d){let p=u?e==l?-1:e==d?1:t:t,f=l+s+(p<0?0:c);if(i)return f;let m=e==(t<0?l:d)?null:FV(r/3,e-l),g=e==l?zj:e==d?Vj:xf;return(t<0?e!=l:e!=d)&&(g|=Uj),new A0(f,g,m)}s+=c-u}return i?e+s:new A0(e+s,0,null)}touches(e,t){let i=0,s=Fj(t),o=this.inverted?2:1,a=this.inverted?1:2;for(let r=0;r<this.ranges.length;r+=3){let l=this.ranges[r]-(this.inverted?i:0);if(l>e)break;let u=this.ranges[r+o],c=l+u;if(e<=c&&r==s*3)return!0;i+=this.ranges[r+a]-u}return!1}forEach(e){let t=this.inverted?2:1,i=this.inverted?1:2;for(let s=0,o=0;s<this.ranges.length;s+=3){let a=this.ranges[s],r=a-(this.inverted?o:0),l=a+(this.inverted?0:o),u=this.ranges[s+t],c=this.ranges[s+i];e(r,r+u,l,l+c),o+=c-u}}invert(){return new gs(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?gs.empty:new gs(e<0?[0,-e,0]:[0,0,e])}}gs.empty=new gs([]);class od{constructor(e,t,i=0,s=e?e.length:0){this.mirror=t,this.from=i,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new od(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,i=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?i+s: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,i=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?i-s-1:void 0)}}invert(){let e=new od;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let i=this.from;i<this.to;i++)e=this._maps[i].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,i){let s=0;for(let o=this.from;o<this.to;o++){let a=this._maps[o],r=a.mapResult(e,t);if(r.recover!=null){let l=this.getMirror(o);if(l!=null&&l>o&&l<this.to){o=l,e=this._maps[l].recover(r.recover);continue}}s|=r.delInfo,e=r.pos}return i?e:new A0(e,s,null)}}const M0=Object.create(null);class Li{getMap(){return gs.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=M0[t.stepType];if(!i)throw new RangeError(`No step type ${t.stepType} defined`);return i.fromJSON(e,t)}static jsonID(e,t){if(e in M0)throw new RangeError("Duplicate use of step JSON ID "+e);return M0[e]=t,t.prototype.jsonID=e,t}}class li{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new li(e,null)}static fail(e){return new li(null,e)}static fromReplace(e,t,i,s){try{return li.ok(e.replace(t,i,s))}catch(o){if(o instanceof Sf)return li.fail(o.message);throw o}}}function x0(n,e,t){let i=[];for(let s=0;s<n.childCount;s++){let o=n.child(s);o.content.size&&(o=o.copy(x0(o.content,e,o))),o.isInline&&(o=e(o,t,s)),i.push(o)}return et.fromArray(i)}class Ra extends Li{constructor(e,t,i){super(),this.from=e,this.to=t,this.mark=i}apply(e){let t=e.slice(this.from,this.to),i=e.resolve(this.from),s=i.node(i.sharedDepth(this.to)),o=new wt(x0(t.content,(a,r)=>!a.isAtom||!r.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),s),t.openStart,t.openEnd);return li.fromReplace(e,this.from,this.to,o)}invert(){return new _o(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deleted&&i.deleted||t.pos>=i.pos?null:new Ra(t.pos,i.pos,this.mark)}merge(e){return e instanceof Ra&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ra(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 Ra(t.from,t.to,e.markFromJSON(t.mark))}}Li.jsonID("addMark",Ra);class _o extends Li{constructor(e,t,i){super(),this.from=e,this.to=t,this.mark=i}apply(e){let t=e.slice(this.from,this.to),i=new wt(x0(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return li.fromReplace(e,this.from,this.to,i)}invert(){return new Ra(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deleted&&i.deleted||t.pos>=i.pos?null:new _o(t.pos,i.pos,this.mark)}merge(e){return e instanceof _o&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new _o(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 _o(t.from,t.to,e.markFromJSON(t.mark))}}Li.jsonID("removeMark",_o);class Fa extends Li{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return li.fail("No node at mark step's position");let i=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return li.fromReplace(e,this.pos,this.pos+1,new wt(et.from(i),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let i=this.mark.addToSet(t.marks);if(i.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(i))return new Fa(this.pos,t.marks[s]);return new Fa(this.pos,this.mark)}}return new Er(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Fa(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 Fa(t.pos,e.markFromJSON(t.mark))}}Li.jsonID("addNodeMark",Fa);class Er extends Li{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return li.fail("No node at mark step's position");let i=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return li.fromReplace(e,this.pos,this.pos+1,new wt(et.from(i),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Fa(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Er(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 Er(t.pos,e.markFromJSON(t.mark))}}Li.jsonID("removeNodeMark",Er);class yi extends Li{constructor(e,t,i,s=!1){super(),this.from=e,this.to=t,this.slice=i,this.structure=s}apply(e){return this.structure&&E0(e,this.from,this.to)?li.fail("Structure replace would overwrite content"):li.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new gs([this.from,this.to-this.from,this.slice.size])}invert(e){return new yi(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deletedAcross&&i.deletedAcross?null:new yi(t.pos,Math.max(t.pos,i.pos),this.slice,this.structure)}merge(e){if(!(e instanceof yi)||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?wt.empty:new wt(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new yi(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?wt.empty:new wt(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new yi(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 yi(t.from,t.to,wt.fromJSON(e,t.slice),!!t.structure)}}Li.jsonID("replace",yi);class bi extends Li{constructor(e,t,i,s,o,a,r=!1){super(),this.from=e,this.to=t,this.gapFrom=i,this.gapTo=s,this.slice=o,this.insert=a,this.structure=r}apply(e){if(this.structure&&(E0(e,this.from,this.gapFrom)||E0(e,this.gapTo,this.to)))return li.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return li.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,t.content);return i?li.fromReplace(e,this.from,this.to,i):li.fail("Content does not fit in gap")}getMap(){return new gs([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 bi(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),i=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return t.deletedAcross&&i.deletedAcross||s<t.pos||o>i.pos?null:new bi(t.pos,i.pos,s,o,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 bi(t.from,t.to,t.gapFrom,t.gapTo,wt.fromJSON(e,t.slice),t.insert,!!t.structure)}}Li.jsonID("replaceAround",bi);function E0(n,e,t){let i=n.resolve(e),s=t-e,o=i.depth;for(;s>0&&o>0&&i.indexAfter(o)==i.node(o).childCount;)o--,s--;if(s>0){let a=i.node(o).maybeChild(i.indexAfter(o));for(;s>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,s--}}return!1}function zV(n,e,t,i){let s=[],o=[],a,r;n.doc.nodesBetween(e,t,(l,u,c)=>{if(!l.isInline)return;let d=l.marks;if(!i.isInSet(d)&&c.type.allowsMarkType(i.type)){let p=Math.max(u,e),f=Math.min(u+l.nodeSize,t),m=i.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(m)||(a&&a.to==p&&a.mark.eq(d[g])?a.to=f:s.push(a=new _o(p,f,d[g])));r&&r.to==p?r.to=f:o.push(r=new Ra(p,f,i))}}),s.forEach(l=>n.step(l)),o.forEach(l=>n.step(l))}function UV(n,e,t,i){let s=[],o=0;n.doc.nodesBetween(e,t,(a,r)=>{if(!a.isInline)return;o++;let l=null;if(i instanceof Of){let u=a.marks,c;for(;c=i.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else i?i.isInSet(a.marks)&&(l=[i]):l=a.marks;if(l&&l.length){let u=Math.min(r+a.nodeSize,t);for(let c=0;c<l.length;c++){let d=l[c],p;for(let f=0;f<s.length;f++){let m=s[f];m.step==o-1&&d.eq(s[f].style)&&(p=m)}p?(p.to=u,p.step=o):s.push({style:d,from:Math.max(r,e),to:u,step:o})}}}),s.forEach(a=>n.step(new _o(a.from,a.to,a.style)))}function D0(n,e,t,i=t.contentMatch,s=!0){let o=n.doc.nodeAt(e),a=[],r=e+1;for(let l=0;l<o.childCount;l++){let u=o.child(l),c=r+u.nodeSize,d=i.matchType(u.type);if(!d)a.push(new yi(r,c,wt.empty));else{i=d;for(let p=0;p<u.marks.length;p++)t.allowsMarkType(u.marks[p].type)||n.step(new _o(r,c,u.marks[p]));if(s&&u.isText&&t.whitespace!="pre"){let p,f=/\r?\n|\r/g,m;for(;p=f.exec(u.text);)m||(m=new wt(et.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),a.push(new yi(r+p.index,r+p.index+p[0].length,m))}}r=c}if(!i.validEnd){let l=i.fillBefore(et.empty,!0);n.replace(r,r,new wt(l,0,0))}for(let l=a.length-1;l>=0;l--)n.step(a[l])}function HV(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Kl(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let i=n.depth;;--i){let s=n.$from.node(i),o=n.$from.index(i),a=n.$to.indexAfter(i);if(i<n.depth&&s.canReplace(o,a,t))return i;if(i==0||s.type.spec.isolating||!HV(s,o,a))break}return null}function KV(n,e,t){let{$from:i,$to:s,depth:o}=e,a=i.before(o+1),r=s.after(o+1),l=a,u=r,c=et.empty,d=0;for(let m=o,g=!1;m>t;m--)g||i.index(m)>0?(g=!0,c=et.from(i.node(m).copy(c)),d++):l--;let p=et.empty,f=0;for(let m=o,g=!1;m>t;m--)g||s.after(m+1)<s.end(m)?(g=!0,p=et.from(s.node(m).copy(p)),f++):u++;n.step(new bi(l,u,a,r,new wt(c.append(p),d,f),c.size-d,!0))}function P0(n,e,t=null,i=n){let s=WV(n,e),o=s&&qV(i,e);return o?s.map(Hj).concat({type:e,attrs:t}).concat(o.map(Hj)):null}function Hj(n){return{type:n,attrs:null}}function WV(n,e){let{parent:t,startIndex:i,endIndex:s}=n,o=t.contentMatchAt(i).findWrapping(e);if(!o)return null;let a=o.length?o[0]:e;return t.canReplaceWith(i,s,a)?o:null}function qV(n,e){let{parent:t,startIndex:i,endIndex:s}=n,o=t.child(i),a=e.contentMatch.findWrapping(o.type);if(!a)return null;let l=(a.length?a[a.length-1]:e).contentMatch;for(let u=i;l&&u<s;u++)l=l.matchType(t.child(u).type);return!l||!l.validEnd?null:a}function GV(n,e,t){let i=et.empty;for(let a=t.length-1;a>=0;a--){if(i.size){let r=t[a].type.contentMatch.matchFragment(i);if(!r||!r.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=et.from(t[a].type.create(t[a].attrs,i))}let s=e.start,o=e.end;n.step(new bi(s,o,s,o,new wt(i,0,0),t.length,!0))}function JV(n,e,t,i,s){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(a,r)=>{let l=typeof s=="function"?s(a):s;if(a.isTextblock&&!a.hasMarkup(i,l)&&YV(n.doc,n.mapping.slice(o).map(r),i)){let u=null;if(i.schema.linebreakReplacement){let f=i.whitespace=="pre",m=!!i.contentMatch.matchType(i.schema.linebreakReplacement);f&&!m?u=!1:!f&&m&&(u=!0)}u===!1&&Wj(n,a,r,o),D0(n,n.mapping.slice(o).map(r,1),i,void 0,u===null);let c=n.mapping.slice(o),d=c.map(r,1),p=c.map(r+a.nodeSize,1);return n.step(new bi(d,p,d+1,p-1,new wt(et.from(i.create(l,null,a.marks)),0,0),1,!0)),u===!0&&Kj(n,a,r,o),!1}})}function Kj(n,e,t,i){e.forEach((s,o)=>{if(s.isText){let a,r=/\r?\n|\r/g;for(;a=r.exec(s.text);){let l=n.mapping.slice(i).map(t+1+o+a.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Wj(n,e,t,i){e.forEach((s,o)=>{if(s.type==s.type.schema.linebreakReplacement){let a=n.mapping.slice(i).map(t+1+o);n.replaceWith(a,a+1,e.type.schema.text(`