adminizer 4.4.0-build.175 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/add-DFzzaDhZ.js +1 -0
- package/assets/{add-form-BfIXZ_9g.js → add-form-Taz9dTw_.js} +1 -1
- package/assets/add-group-BVYkGCd9.js +1 -0
- package/assets/{add-group-form-BkXmTsXF.js → add-group-form-DMz0_Oo9.js} +1 -1
- package/assets/add-user-Dq_U0RCT.js +1 -0
- package/assets/{add-user-form-CeLtuCJN.js → add-user-form-izlXhv2-.js} +1 -1
- package/assets/{app-CUnGKHb5.css → app-ByR7F4XX.css} +1 -1
- package/assets/app-layout-C7q3_eFS.js +1 -0
- package/assets/{app-shell-CggZrBz6.js → app-shell-C8Cnr5Hy.js} +1 -1
- package/assets/{app-sidebar-Do2eoo3w.js → app-sidebar-BCtD_nHo.js} +1 -1
- package/assets/app-sidebar-header-Bcpas2Np.js +1 -0
- package/assets/app.js +2 -2
- package/assets/breadcrumbs-DSMzNYiS.js +1 -0
- package/assets/{catalog-BbgPgewa.js → catalog-DYJ6dK_P.js} +1 -1
- package/assets/{dashboard-Chht3NJZ.js → dashboard-DEVNMK2g.js} +1 -1
- package/assets/{date-picker-BjXNej9c.js → date-picker-kW3wZQr_.js} +1 -1
- package/assets/del-modal-DyIWFflP.js +1 -0
- package/assets/{field-renderer-CUYWPzfi.js → field-renderer-CVUxftOw.js} +3 -3
- package/assets/{form-DMLPoAW8.js → form-1GnTJlbE.js} +1 -1
- package/assets/form-B4ymMuwj.js +1 -0
- package/assets/{geo-json-CM4o8sUY.js → geo-json-YeWQOYnT.js} +1 -1
- package/assets/{home-OvDENcVX.js → home-ipCg51mN.js} +2 -2
- package/assets/list-C_KPYQc4.js +1 -0
- package/assets/{list-table-CmYyTdS5.js → list-table-Do8_doRe.js} +3 -3
- package/assets/manifest.json +75 -75
- package/assets/{media-manager-CGPeuOR2.js → media-manager-IknQnWel.js} +1 -1
- package/assets/{module-DxNCvjiw.js → module-Bf9rzSBs.js} +1 -1
- package/assets/{nav-footer-2ZwcY1Pj.js → nav-footer-B85HLj-j.js} +1 -1
- package/assets/{nav-main-CZa4xkP1.js → nav-main-UuH4U_0H.js} +1 -1
- package/assets/{nav-user-e1Cj0abB.js → nav-user-DuCZNsZX.js} +1 -1
- package/assets/{notification-DWxL0Sxm.js → notification-C6X6f-xS.js} +1 -1
- package/assets/{pagination-render-C1OX0c6q.js → pagination-render-io0M2m2O.js} +1 -1
- package/assets/{tabs-7Dl6--VG.js → tabs-BhkFoerH.js} +1 -1
- package/assets/theme-switcher-cgyA7_cO.js +1 -0
- package/assets/{toast-editor-Bso8riqX.js → toast-editor-DwRk6WqT.js} +1 -1
- package/assets/{user-info-DrdQBvFb.js → user-info-BGQvqBmO.js} +1 -1
- package/assets/{user-menu-content-ePAt_cwK.js → user-menu-content-BDm88xaM.js} +1 -1
- package/assets/{welcome-Buo3uXmE.js → welcome-Cu8G7BE9.js} +1 -1
- package/interfaces/adminpanelConfig.d.ts +0 -5
- package/interfaces/types.d.ts +0 -13
- package/lib/Adminizer.d.ts +0 -2
- package/lib/Adminizer.js +0 -4
- package/package.json +3 -6
- package/system/Router.js +0 -7
- package/system/bindInertia.js +0 -4
- package/system/defaults.js +0 -5
- package/assets/add-DlVWR7Qx.js +0 -1
- package/assets/add-group-CLSUO35F.js +0 -1
- package/assets/add-user-Bw5AuxqF.js +0 -1
- package/assets/app-layout-mpp8ni0G.js +0 -1
- package/assets/app-sidebar-header-pfquDpHT.js +0 -1
- package/assets/breadcrumbs-BS5uXMaM.js +0 -1
- package/assets/del-modal-P8KiMFNx.js +0 -1
- package/assets/form-wcpZWHjp.js +0 -1
- package/assets/list-DfqnQZpI.js +0 -1
- package/assets/theme-switcher-xFldiRZz.js +0 -1
- package/controllers/ai/AiAssistantController.d.ts +0 -7
- package/controllers/ai/AiAssistantController.js +0 -92
- package/lib/ai-assistant/AbstractAiModelService.d.ts +0 -17
- package/lib/ai-assistant/AbstractAiModelService.js +0 -32
- package/lib/ai-assistant/AiAssistantHandler.d.ts +0 -19
- package/lib/ai-assistant/AiAssistantHandler.js +0 -58
- package/lib/ai-assistant/DummyAiModelService.d.ts +0 -8
- package/lib/ai-assistant/DummyAiModelService.js +0 -14
- package/lib/ai-assistant/OpenAiModelService.d.ts +0 -24
- package/lib/ai-assistant/OpenAiModelService.js +0 -185
- package/system/bindAiAssistant.d.ts +0 -2
- package/system/bindAiAssistant.js +0 -30
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as v,_ as pr,E as Rs,$ as ws,P as pp,a0 as _p,a1 as vp,a2 as xp,a3 as mp,a4 as Hi,a5 as vt,a6 as wp,a7 as Xe,M as Ap,N as yp,B as Gi,O as Rp,a8 as Tp,a9 as Sp,aa as Cp,ab as Ep,ac as Ip,u as Lp,I as bp,L as As,r as Op}from"./app.js";import{A as Np}from"./app-layout-
|
|
1
|
+
import{j as v,_ as pr,E as Rs,$ as ws,P as pp,a0 as _p,a1 as vp,a2 as xp,a3 as mp,a4 as Hi,a5 as vt,a6 as wp,a7 as Xe,M as Ap,N as yp,B as Gi,O as Rp,a8 as Tp,a9 as Sp,aa as Cp,ab as Ep,ac as Ip,u as Lp,I as bp,L as As,r as Op}from"./app.js";import{A as Np}from"./app-layout-C7q3_eFS.js";import{e as Wp,r as V}from"./monaco-ICtx6xoc.js";import{T as Pp,a as Mp,b as Bp,c as Dp}from"./tabs-BhkFoerH.js";import{c as _r}from"./vendor-wzZzN_Jv.js";import{u as Fp}from"./app-sidebar-header-Bcpas2Np.js";import{d as Up}from"./jsoneditor-D95dIAP2.js";import"./handsontable-PVakPtJV.js";import"./app-shell-C8Cnr5Hy.js";import"./app-sidebar-BCtD_nHo.js";import"./nav-main-UuH4U_0H.js";import"./material-icon-DwkE6wKL.js";import"./breadcrumbs-DSMzNYiS.js";import"./nav-user-DuCZNsZX.js";import"./user-info-BGQvqBmO.js";import"./user-menu-content-BDm88xaM.js";import"./theme-switcher-cgyA7_cO.js";import"./icon-DpkedrXG.js";const Hp=({changes:J,title:pn="Changes",className:s=""})=>{if(!J||J.length===0)return v.jsx("div",{className:pr("bg-muted border border-border rounded-lg p-4",s),children:v.jsxs("div",{className:"flex items-center text-muted-foreground",children:[v.jsx(Rs,{className:"w-5 h-5 mr-2"}),v.jsx("span",{children:"Changes not found"})]})});const bn=B=>B===null?"null":B===void 0?"—":typeof B=="boolean"?B?"Да":"Нет":typeof B=="object"?JSON.stringify(B):String(B),F=B=>B.oldValue===void 0?"added":B.newValue===void 0?"removed":"modified";return v.jsxs("div",{className:pr("bg-card border border-border rounded-lg shadow-sm",s),children:[v.jsx("div",{className:"px-4 py-3 border-b border-border bg-muted",children:v.jsxs("h3",{className:"text-lg font-semibold text-card-foreground flex items-center",children:[v.jsx(ws,{className:"w-5 h-5 mr-2"}),pn," (",J.length,")"]})}),v.jsx("div",{className:"divide-y divide-border",children:J.map((B,U)=>{const Q=F(B),wn=Q==="added"?pp:Q==="removed"?_p:ws,ce=pr("text-xs px-2 py-1 rounded-full bg-opacity-10",Q==="added"&&"text-green-600 bg-green-100",Q==="removed"&&"text-destructive bg-destructive/20",Q==="modified"&&"text-primary bg-primary/20"),An=Q==="added"?"text-green-600":Q==="removed"?"text-destructive":"text-primary";return v.jsxs("div",{className:"p-4 hover:bg-muted/50 transition-colors",children:[v.jsxs("div",{className:"flex items-center justify-between mb-2",children:[v.jsxs("div",{className:"flex items-center",children:[Wp.createElement(wn,{className:pr("w-4 h-4 mr-2",An)}),v.jsx("span",{className:"font-medium text-card-foreground",children:B.field})]}),v.jsx("span",{className:ce,children:Q==="added"?"Added":Q==="removed"?"Removed":"Updated"})]}),v.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 text-sm",children:[Q!=="added"&&v.jsxs("div",{className:"p-2 bg-destructive/10 border border-destructive/20 rounded",children:[v.jsx("div",{className:"text-xs text-destructive font-medium mb-1",children:"Old:"}),v.jsx("div",{className:"text-destructive-foreground font-mono break-words",children:bn(B.oldValue)})]}),Q!=="removed"&&v.jsxs("div",{className:"p-2 bg-green-50 border border-green-100 rounded",children:[v.jsx("div",{className:"text-xs text-green-600 font-medium mb-1",children:"New:"}),v.jsx("div",{className:"text-green-800 font-mono break-words",children:bn(B.newValue)})]})]}),Q==="modified"&&v.jsxs("div",{className:"mt-2 flex items-center text-xs text-muted-foreground",children:[v.jsx(vp,{className:"w-3 h-3 mr-1"}),"changed type: ",B.type]})]},U)})})]})};var xt={exports:{}};/**
|
|
2
2
|
* @license
|
|
3
3
|
* Lodash <https://lodash.com/>
|
|
4
4
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r,
|
|
1
|
+
import{j as r,bI as p,bJ as m,bK as o,bL as a,bM as x,bN as b}from"./app.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./monaco-ICtx6xoc.js";import"./handsontable-PVakPtJV.js";const N=({pagination:s,pageChange:t,currentPage:n})=>{const l=n!==1&&s.last_page>1,i=n!==s.last_page&&s.last_page>1;return r.jsx(p,{children:r.jsxs(m,{className:"flex-wrap",children:[r.jsx(o,{className:`${l?"":"opacity-40 pointer-events-none"}`,children:r.jsx(a,{className:"px-6 cursor-pointer bg-secondary hover:bg-muted-foreground/15",onClick:e=>{e.preventDefault(),t(1)},children:"First"})}),r.jsx(o,{children:r.jsx(x,{className:`cursor-pointer bg-secondary hover:bg-muted-foreground/15 ${s.prev_page_url?"":"opacity-50 pointer-events-none"}`,onClick:e=>{e.preventDefault(),s.prev_page_url&&t(n-1)}})}),s.links.map((e,c)=>e.label==="Previous"||e.label==="Next"?null:r.jsx(o,{children:r.jsx(a,{className:`cursor-pointer bg-secondary hover:bg-muted-foreground/15 ${e.active?"!bg-primary dark:!bg-muted-foreground !text-primary-foreground dark:!text-ring":""}`,onClick:u=>{u.preventDefault();const d=parseInt(e.label);t(d)},isActive:e.active,children:e.label})},c)),r.jsx(o,{children:r.jsx(b,{className:`cursor-pointer bg-secondary hover:bg-muted-foreground/15 ${s.next_page_url?"":"opacity-50 pointer-events-none"}`,onClick:e=>{e.preventDefault(),s.next_page_url&&t(n+1)}})}),r.jsx(o,{className:`${i?"":"opacity-40 pointer-events-none"}`,children:r.jsx(a,{className:"px-6 cursor-pointer bg-secondary hover:bg-muted-foreground/15",onClick:e=>{e.preventDefault(),t(s.last_page)},children:"Last"})})]})})};export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{au as M,av as P,j as s,aw as S,ax as k,ay as g,az as h,aA as F,aB as D,aC as m,aD as $,_ as p}from"./app.js";import{r as b}from"./monaco-ICtx6xoc.js";var x="Tabs",[V]=S(x,[h]),C=h(),[G,T]=V(x),y=b.forwardRef((e,t)=>{const{__scopeTabs:c,value:a,onValueChange:r,defaultValue:d,orientation:o="horizontal",dir:u,activationMode:v="automatic",...f}=e,i=M(u),[n,l]=P({prop:a,onChange:r,defaultProp:d??"",caller:x});return s.jsx(G,{scope:c,baseId:k(),value:n,onValueChange:l,orientation:o,dir:i,activationMode:v,children:s.jsx(g.div,{dir:i,"data-orientation":o,...f,ref:t})})});y.displayName=x;var _="TabsList",j=b.forwardRef((e,t)=>{const{__scopeTabs:c,loop:a=!0,...r}=e,d=T(_,c),o=C(c);return s.jsx(F,{asChild:!0,...o,orientation:d.orientation,dir:d.dir,loop:a,children:s.jsx(g.div,{role:"tablist","aria-orientation":d.orientation,...r,ref:t})})});j.displayName=_;var I="TabsTrigger",w=b.forwardRef((e,t)=>{const{__scopeTabs:c,value:a,disabled:r=!1,...d}=e,o=T(I,c),u=C(c),v=R(o.baseId,a),f=E(o.baseId,a),i=a===o.value;return s.jsx(D,{asChild:!0,...u,focusable:!r,active:i,children:s.jsx(g.button,{type:"button",role:"tab","aria-selected":i,"aria-controls":f,"data-state":i?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:v,...d,ref:t,onMouseDown:m(e.onMouseDown,n=>{!r&&n.button===0&&n.ctrlKey===!1?o.onValueChange(a):n.preventDefault()}),onKeyDown:m(e.onKeyDown,n=>{[" ","Enter"].includes(n.key)&&o.onValueChange(a)}),onFocus:m(e.onFocus,()=>{const n=o.activationMode!=="manual";!i&&!r&&n&&o.onValueChange(a)})})})});w.displayName=I;var N="TabsContent",A=b.forwardRef((e,t)=>{const{__scopeTabs:c,value:a,forceMount:r,children:d,...o}=e,u=T(N,c),v=R(u.baseId,a),f=E(u.baseId,a),i=a===u.value,n=b.useRef(i);return b.useEffect(()=>{const l=requestAnimationFrame(()=>n.current=!1);return()=>cancelAnimationFrame(l)},[]),s.jsx($,{present:r||i,children:({present:l})=>s.jsx(g.div,{"data-state":i?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":v,hidden:!l,id:f,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:n.current?"0s":void 0},children:l&&d})})});A.displayName=N;function R(e,t){return`${e}-trigger-${t}`}function E(e,t){return`${e}-content-${t}`}var L=y,z=j,B=w,K=A;function O({className:e,...t}){return s.jsx(L,{"data-slot":"tabs",className:p("flex flex-col gap-2",e),...t})}function J({className:e,...t}){return s.jsx(z,{"data-slot":"tabs-list",className:p("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function Q({className:e,...t}){return s.jsx(B,{"data-slot":"tabs-trigger",className:p("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 cursor-pointer",e),...t})}function U({className:e,...t}){return s.jsx(K,{"data-slot":"tabs-content",className:p("flex-1 outline-none",e),...t})}export{O as T,J as a,Q as b,U as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{af as i,j as n,B as c,bp as p,bq as m,br as u}from"./app.js";import{Icon as h}from"./icon-DpkedrXG.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./monaco-ICtx6xoc.js";import"./handsontable-PVakPtJV.js";function j(){const{appearance:t,updateAppearance:o}=i(),s={light:"dark",dark:"system",system:"light"},a={light:u,dark:m,system:p},e=()=>o(s[t]),r=a[t];return n.jsx(c,{variant:"ghost",size:"icon",onClick:e,className:"shrink-0",children:n.jsx(h,{iconNode:r})})}export{j as ThemeSwitcher,j as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ai as KZ,aj as JZ,j as kv}from"./app.js";import{e as Ro,r as Dl}from"./monaco-ICtx6xoc.js";import{k as YZ,b as XZ}from"./jsoneditor-D95dIAP2.js";import{g as ZZ}from"./vendor-wzZzN_Jv.js";import"./handsontable-PVakPtJV.js";function Ar(r){this.content=r}Ar.prototype={constructor:Ar,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),a=n.content.slice();return i==-1?a.push(t||r,e):(a[i+1]=e,t&&(a[i]=t)),new Ar(a)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ar(t)},addToStart:function(r,e){return new Ar([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new Ar(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),a=n.find(r);return i.splice(a==-1?i.length:a,0,e,t),new Ar(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=Ar.from(r),r.size?new Ar(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=Ar.from(r),r.size?new Ar(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=Ar.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}};Ar.from=function(r){if(r instanceof Ar)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new Ar(e)};function Ky(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),a=e.child(n);if(i==a){t+=i.nodeSize;continue}if(!i.sameMarkup(a))return t;if(i.isText&&i.text!=a.text){for(let o=0;i.text[o]==a.text[o];o++)t++;return t}if(i.content.size||a.content.size){let o=Ky(i.content,a.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Jy(r,e,t,n){for(let i=r.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:t,b:n};let o=r.child(--i),s=e.child(--a),l=o.nodeSize;if(o==s){t-=l,n-=l;continue}if(!o.sameMarkup(s))return{a:t,b:n};if(o.isText&&o.text!=s.text){let f=0,v=Math.min(o.text.length,s.text.length);for(;f<v&&o.text[o.text.length-f-1]==s.text[s.text.length-f-1];)f++,t--,n--;return{a:t,b:n}}if(o.content.size||s.content.size){let f=Jy(o.content,s.content,t-1,n-1);if(f)return f}t-=l,n-=l}}class Ne{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,a){for(let o=0,s=0;s<t;o++){let l=this.content[o],f=s+l.nodeSize;if(f>e&&n(l,i+s,a||null,o)!==!1&&l.content.size){let v=s+1;l.nodesBetween(Math.max(0,e-v),Math.min(l.content.size,t-v),n,i+v)}s=f}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let a="",o=!0;return this.nodesBetween(e,t,(s,l)=>{let f=s.isText?s.text.slice(Math.max(e,l)-l,t-l):s.isLeaf?i?typeof i=="function"?i(s):i:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&f||s.isTextblock)&&n&&(o?o=!1:a+=n),a+=f},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),a=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),a=1);a<e.content.length;a++)i.push(e.content[a]);return new Ne(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let a=0,o=0;o<t;a++){let s=this.content[a],l=o+s.nodeSize;l>e&&((o<e||l>t)&&(s.isText?s=s.cut(Math.max(0,e-o),Math.min(s.text.length,t-o)):s=s.cut(Math.max(0,e-o-1),Math.min(s.content.size,t-o-1))),n.push(s),i+=s.nodeSize),o=l}return new Ne(n,i)}cutByIndex(e,t){return e==t?Ne.empty:e==0&&t==this.content.length?this:new Ne(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),a=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new Ne(i,a)}addToStart(e){return new Ne([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ne(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return Ky(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Jy(this,e,t,n)}findIndex(e){if(e==0)return Ll(0,e);if(e==this.size)return Ll(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let i=this.child(t),a=n+i.nodeSize;if(a>=e)return a==e?Ll(t+1,a):Ll(t,n);n=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 Ne.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ne(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ne.empty;let t,n=0;for(let i=0;i<e.length;i++){let a=e[i];n+=a.nodeSize,i&&a.isText&&e[i-1].sameMarkup(a)?(t||(t=e.slice(0,i)),t[t.length-1]=a.withText(t[t.length-1].text+a.text)):t&&t.push(a)}return new Ne(t||e,n)}static from(e){if(!e)return Ne.empty;if(e instanceof Ne)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Ne([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Ne.empty=new Ne([],0);const xf={index:0,offset:0};function Ll(r,e){return xf.index=r,xf.offset=e,xf}function nu(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!nu(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!nu(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let Pt=class hd{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let a=e[i];if(this.eq(a))return e;if(this.type.excludes(a.type))t||(t=e.slice(0,i));else{if(a.type.excludes(this.type))return e;!n&&a.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(a)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&nu(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=n.create(t.attrs);return n.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return hd.none;if(e instanceof hd)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};Pt.none=[];class iu extends Error{}class $e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Xy(this.content,e+this.openStart,t);return n&&new $e(n,this.openStart,this.openEnd)}removeBetween(e,t){return new $e(Yy(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 $e.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new $e(Ne.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(t||!a.type.spec.isolating);a=a.firstChild)n++;for(let a=e.lastChild;a&&!a.isLeaf&&(t||!a.type.spec.isolating);a=a.lastChild)i++;return new $e(e,n,i)}}$e.empty=new $e(Ne.empty,0,0);function Yy(r,e,t){let{index:n,offset:i}=r.findIndex(e),a=r.maybeChild(n),{index:o,offset:s}=r.findIndex(t);if(i==e||a.isText){if(s!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,a.copy(Yy(a.content,e-i-1,t-i-1)))}function Xy(r,e,t,n){let{index:i,offset:a}=r.findIndex(e),o=r.maybeChild(i);if(a==e||o.isText)return n&&!n.canReplace(i,i,t)?null:r.cut(0,e).append(t).append(r.cut(e));let s=Xy(o.content,e-a-1,t,o);return s&&r.replaceChild(i,o.copy(s))}function QZ(r,e,t){if(t.openStart>r.depth)throw new iu("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new iu("Inconsistent open depths");return Zy(r,e,t,0)}function Zy(r,e,t,n){let i=r.index(n),a=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=Zy(r,e,t,n+1);return a.copy(a.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,s=o.content;return Va(o,s.cut(0,r.parentOffset).append(t.content).append(s.cut(e.parentOffset)))}else{let{start:o,end:s}=eQ(t,r);return Va(a,eb(r,o,s,e,n))}else return Va(a,au(r,e,n))}function Qy(r,e){if(!e.type.compatibleContent(r.type))throw new iu("Cannot join "+e.type.name+" onto "+r.type.name)}function pd(r,e,t){let n=r.node(t);return Qy(n,e.node(t)),n}function za(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function Ts(r,e,t,n){let i=(e||r).node(t),a=0,o=e?e.index(t):i.childCount;r&&(a=r.index(t),r.depth>t?a++:r.textOffset&&(za(r.nodeAfter,n),a++));for(let s=a;s<o;s++)za(i.child(s),n);e&&e.depth==t&&e.textOffset&&za(e.nodeBefore,n)}function Va(r,e){return r.type.checkContent(e),r.copy(e)}function eb(r,e,t,n,i){let a=r.depth>i&&pd(r,e,i+1),o=n.depth>i&&pd(t,n,i+1),s=[];return Ts(null,r,i,s),a&&o&&e.index(i)==t.index(i)?(Qy(a,o),za(Va(a,eb(r,e,t,n,i+1)),s)):(a&&za(Va(a,au(r,e,i+1)),s),Ts(e,t,i,s),o&&za(Va(o,au(t,n,i+1)),s)),Ts(n,null,i,s),new Ne(s)}function au(r,e,t){let n=[];if(Ts(null,r,t,n),r.depth>t){let i=pd(r,e,t+1);za(Va(i,au(r,e,t+1)),n)}return Ts(e,null,t,n),new Ne(n)}function eQ(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let a=t-1;a>=0;a--)i=e.node(a).copy(Ne.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class Os{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=e.child(t);return n?e.child(t).cut(n):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let a=0;a<e;a++)i+=n.child(a).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Pt.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let s=n;n=i,i=s}let a=n.marks;for(var o=0;o<a.length;o++)a[o].type.spec.inclusive===!1&&(!i||!a[o].isInSet(i.marks))&&(a=a[o--].removeFromSet(a));return a}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var a=0;a<n.length;a++)n[a].type.spec.inclusive===!1&&(!i||!n[a].isInSet(i.marks))&&(n=n[a--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new ou(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,a=t;for(let o=e;;){let{index:s,offset:l}=o.content.findIndex(a),f=a-l;if(n.push(o,s,i+l),!f||(o=o.child(s),o.isText))break;a=f-1,i+=l+1}return new Os(t,n,a)}static resolveCached(e,t){let n=wv.get(e);if(n)for(let a=0;a<n.elts.length;a++){let o=n.elts[a];if(o.pos==t)return o}else wv.set(e,n=new tQ);let i=n.elts[n.i]=Os.resolve(e,t);return n.i=(n.i+1)%rQ,i}}class tQ{constructor(){this.elts=[],this.i=0}}const rQ=12,wv=new WeakMap;class ou{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const nQ=Object.create(null);let aa=class vd{constructor(e,t,n,i=Pt.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||Ne.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,i=0){this.content.nodesBetween(e,t,n,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,i){return this.content.textBetween(e,t,n,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&nu(this.attrs,t||e.defaultAttrs||nQ)&&Pt.sameSet(this.marks,n||Pt.none)}copy(e=null){return e==this.content?this:new vd(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new vd(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return $e.empty;let i=this.resolve(e),a=this.resolve(t),o=n?0:i.sharedDepth(t),s=i.start(o),f=i.node(o).content.cut(i.pos-s,a.pos-s);return new $e(f,i.depth-o,a.depth-o)}replace(e,t,n){return QZ(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return Os.resolveCached(this,e)}resolveNoCache(e){return Os.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,a=>(n.isInSet(a.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),tb(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=Ne.empty,i=0,a=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,a),s=o&&o.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let l=i;l<a;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(e).matchType(n),o=a&&a.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Pt.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Pt.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let i=Ne.fromJSON(e,t.content),a=e.nodeType(t.type).create(t.attrs,i,n);return a.type.checkAttrs(a.attrs),a}};aa.prototype.text=void 0;class su extends aa{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):tb(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 su(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new su(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 tb(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class ja{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new iQ(e,t);if(n.next==null)return ja.empty;let i=rb(n);n.next&&n.err("Unexpected trailing text");let a=fQ(cQ(i));return dQ(a,n),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let i=this;for(let a=t;i&&a<n;a++)i=i.matchType(e.child(a).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let i=[this];function a(o,s){let l=o.matchFragment(e,n);if(l&&(!t||l.validEnd))return Ne.from(s.map(f=>f.createAndFill()));for(let f=0;f<o.next.length;f++){let{type:v,next:b}=o.next[f];if(!(v.isText||v.hasRequiredAttrs())&&i.indexOf(b)==-1){i.push(b);let T=a(b,s.concat(v));if(T)return T}}return null}return a(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let i=n.shift(),a=i.match;if(a.matchType(e)){let o=[];for(let s=i;s.type;s=s.via)o.push(s.type);return o.reverse()}for(let o=0;o<a.next.length;o++){let{type:s,next:l}=a.next[o];!s.isLeaf&&!s.hasRequiredAttrs()&&!(s.name in t)&&(!i.type||l.validEnd)&&(n.push({match:s.contentMatch,type:s,via:i}),t[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let a=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)a+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return a}).join(`
|
|
1
|
+
import{ae as KZ,af as JZ,j as kv}from"./app.js";import{e as Ro,r as Dl}from"./monaco-ICtx6xoc.js";import{k as YZ,b as XZ}from"./jsoneditor-D95dIAP2.js";import{g as ZZ}from"./vendor-wzZzN_Jv.js";import"./handsontable-PVakPtJV.js";function Ar(r){this.content=r}Ar.prototype={constructor:Ar,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),a=n.content.slice();return i==-1?a.push(t||r,e):(a[i+1]=e,t&&(a[i]=t)),new Ar(a)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ar(t)},addToStart:function(r,e){return new Ar([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new Ar(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),a=n.find(r);return i.splice(a==-1?i.length:a,0,e,t),new Ar(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=Ar.from(r),r.size?new Ar(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=Ar.from(r),r.size?new Ar(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=Ar.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}};Ar.from=function(r){if(r instanceof Ar)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new Ar(e)};function Ky(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),a=e.child(n);if(i==a){t+=i.nodeSize;continue}if(!i.sameMarkup(a))return t;if(i.isText&&i.text!=a.text){for(let o=0;i.text[o]==a.text[o];o++)t++;return t}if(i.content.size||a.content.size){let o=Ky(i.content,a.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Jy(r,e,t,n){for(let i=r.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:t,b:n};let o=r.child(--i),s=e.child(--a),l=o.nodeSize;if(o==s){t-=l,n-=l;continue}if(!o.sameMarkup(s))return{a:t,b:n};if(o.isText&&o.text!=s.text){let f=0,v=Math.min(o.text.length,s.text.length);for(;f<v&&o.text[o.text.length-f-1]==s.text[s.text.length-f-1];)f++,t--,n--;return{a:t,b:n}}if(o.content.size||s.content.size){let f=Jy(o.content,s.content,t-1,n-1);if(f)return f}t-=l,n-=l}}class Ne{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,a){for(let o=0,s=0;s<t;o++){let l=this.content[o],f=s+l.nodeSize;if(f>e&&n(l,i+s,a||null,o)!==!1&&l.content.size){let v=s+1;l.nodesBetween(Math.max(0,e-v),Math.min(l.content.size,t-v),n,i+v)}s=f}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let a="",o=!0;return this.nodesBetween(e,t,(s,l)=>{let f=s.isText?s.text.slice(Math.max(e,l)-l,t-l):s.isLeaf?i?typeof i=="function"?i(s):i:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&f||s.isTextblock)&&n&&(o?o=!1:a+=n),a+=f},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),a=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),a=1);a<e.content.length;a++)i.push(e.content[a]);return new Ne(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let a=0,o=0;o<t;a++){let s=this.content[a],l=o+s.nodeSize;l>e&&((o<e||l>t)&&(s.isText?s=s.cut(Math.max(0,e-o),Math.min(s.text.length,t-o)):s=s.cut(Math.max(0,e-o-1),Math.min(s.content.size,t-o-1))),n.push(s),i+=s.nodeSize),o=l}return new Ne(n,i)}cutByIndex(e,t){return e==t?Ne.empty:e==0&&t==this.content.length?this:new Ne(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),a=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new Ne(i,a)}addToStart(e){return new Ne([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ne(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return Ky(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Jy(this,e,t,n)}findIndex(e){if(e==0)return Ll(0,e);if(e==this.size)return Ll(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let i=this.child(t),a=n+i.nodeSize;if(a>=e)return a==e?Ll(t+1,a):Ll(t,n);n=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 Ne.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ne(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ne.empty;let t,n=0;for(let i=0;i<e.length;i++){let a=e[i];n+=a.nodeSize,i&&a.isText&&e[i-1].sameMarkup(a)?(t||(t=e.slice(0,i)),t[t.length-1]=a.withText(t[t.length-1].text+a.text)):t&&t.push(a)}return new Ne(t||e,n)}static from(e){if(!e)return Ne.empty;if(e instanceof Ne)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Ne([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Ne.empty=new Ne([],0);const xf={index:0,offset:0};function Ll(r,e){return xf.index=r,xf.offset=e,xf}function nu(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!nu(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!nu(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let Pt=class hd{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let a=e[i];if(this.eq(a))return e;if(this.type.excludes(a.type))t||(t=e.slice(0,i));else{if(a.type.excludes(this.type))return e;!n&&a.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(a)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&nu(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=n.create(t.attrs);return n.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return hd.none;if(e instanceof hd)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};Pt.none=[];class iu extends Error{}class $e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Xy(this.content,e+this.openStart,t);return n&&new $e(n,this.openStart,this.openEnd)}removeBetween(e,t){return new $e(Yy(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 $e.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new $e(Ne.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(t||!a.type.spec.isolating);a=a.firstChild)n++;for(let a=e.lastChild;a&&!a.isLeaf&&(t||!a.type.spec.isolating);a=a.lastChild)i++;return new $e(e,n,i)}}$e.empty=new $e(Ne.empty,0,0);function Yy(r,e,t){let{index:n,offset:i}=r.findIndex(e),a=r.maybeChild(n),{index:o,offset:s}=r.findIndex(t);if(i==e||a.isText){if(s!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,a.copy(Yy(a.content,e-i-1,t-i-1)))}function Xy(r,e,t,n){let{index:i,offset:a}=r.findIndex(e),o=r.maybeChild(i);if(a==e||o.isText)return n&&!n.canReplace(i,i,t)?null:r.cut(0,e).append(t).append(r.cut(e));let s=Xy(o.content,e-a-1,t,o);return s&&r.replaceChild(i,o.copy(s))}function QZ(r,e,t){if(t.openStart>r.depth)throw new iu("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new iu("Inconsistent open depths");return Zy(r,e,t,0)}function Zy(r,e,t,n){let i=r.index(n),a=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=Zy(r,e,t,n+1);return a.copy(a.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,s=o.content;return Va(o,s.cut(0,r.parentOffset).append(t.content).append(s.cut(e.parentOffset)))}else{let{start:o,end:s}=eQ(t,r);return Va(a,eb(r,o,s,e,n))}else return Va(a,au(r,e,n))}function Qy(r,e){if(!e.type.compatibleContent(r.type))throw new iu("Cannot join "+e.type.name+" onto "+r.type.name)}function pd(r,e,t){let n=r.node(t);return Qy(n,e.node(t)),n}function za(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function Ts(r,e,t,n){let i=(e||r).node(t),a=0,o=e?e.index(t):i.childCount;r&&(a=r.index(t),r.depth>t?a++:r.textOffset&&(za(r.nodeAfter,n),a++));for(let s=a;s<o;s++)za(i.child(s),n);e&&e.depth==t&&e.textOffset&&za(e.nodeBefore,n)}function Va(r,e){return r.type.checkContent(e),r.copy(e)}function eb(r,e,t,n,i){let a=r.depth>i&&pd(r,e,i+1),o=n.depth>i&&pd(t,n,i+1),s=[];return Ts(null,r,i,s),a&&o&&e.index(i)==t.index(i)?(Qy(a,o),za(Va(a,eb(r,e,t,n,i+1)),s)):(a&&za(Va(a,au(r,e,i+1)),s),Ts(e,t,i,s),o&&za(Va(o,au(t,n,i+1)),s)),Ts(n,null,i,s),new Ne(s)}function au(r,e,t){let n=[];if(Ts(null,r,t,n),r.depth>t){let i=pd(r,e,t+1);za(Va(i,au(r,e,t+1)),n)}return Ts(e,null,t,n),new Ne(n)}function eQ(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let a=t-1;a>=0;a--)i=e.node(a).copy(Ne.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class Os{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=e.child(t);return n?e.child(t).cut(n):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let a=0;a<e;a++)i+=n.child(a).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Pt.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let s=n;n=i,i=s}let a=n.marks;for(var o=0;o<a.length;o++)a[o].type.spec.inclusive===!1&&(!i||!a[o].isInSet(i.marks))&&(a=a[o--].removeFromSet(a));return a}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var a=0;a<n.length;a++)n[a].type.spec.inclusive===!1&&(!i||!n[a].isInSet(i.marks))&&(n=n[a--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new ou(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,a=t;for(let o=e;;){let{index:s,offset:l}=o.content.findIndex(a),f=a-l;if(n.push(o,s,i+l),!f||(o=o.child(s),o.isText))break;a=f-1,i+=l+1}return new Os(t,n,a)}static resolveCached(e,t){let n=wv.get(e);if(n)for(let a=0;a<n.elts.length;a++){let o=n.elts[a];if(o.pos==t)return o}else wv.set(e,n=new tQ);let i=n.elts[n.i]=Os.resolve(e,t);return n.i=(n.i+1)%rQ,i}}class tQ{constructor(){this.elts=[],this.i=0}}const rQ=12,wv=new WeakMap;class ou{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const nQ=Object.create(null);let aa=class vd{constructor(e,t,n,i=Pt.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||Ne.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,i=0){this.content.nodesBetween(e,t,n,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,i){return this.content.textBetween(e,t,n,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&nu(this.attrs,t||e.defaultAttrs||nQ)&&Pt.sameSet(this.marks,n||Pt.none)}copy(e=null){return e==this.content?this:new vd(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new vd(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return $e.empty;let i=this.resolve(e),a=this.resolve(t),o=n?0:i.sharedDepth(t),s=i.start(o),f=i.node(o).content.cut(i.pos-s,a.pos-s);return new $e(f,i.depth-o,a.depth-o)}replace(e,t,n){return QZ(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return Os.resolveCached(this,e)}resolveNoCache(e){return Os.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,a=>(n.isInSet(a.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),tb(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=Ne.empty,i=0,a=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,a),s=o&&o.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let l=i;l<a;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(e).matchType(n),o=a&&a.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Pt.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Pt.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let i=Ne.fromJSON(e,t.content),a=e.nodeType(t.type).create(t.attrs,i,n);return a.type.checkAttrs(a.attrs),a}};aa.prototype.text=void 0;class su extends aa{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):tb(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 su(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new su(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 tb(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class ja{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new iQ(e,t);if(n.next==null)return ja.empty;let i=rb(n);n.next&&n.err("Unexpected trailing text");let a=fQ(cQ(i));return dQ(a,n),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let i=this;for(let a=t;i&&a<n;a++)i=i.matchType(e.child(a).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let i=[this];function a(o,s){let l=o.matchFragment(e,n);if(l&&(!t||l.validEnd))return Ne.from(s.map(f=>f.createAndFill()));for(let f=0;f<o.next.length;f++){let{type:v,next:b}=o.next[f];if(!(v.isText||v.hasRequiredAttrs())&&i.indexOf(b)==-1){i.push(b);let T=a(b,s.concat(v));if(T)return T}}return null}return a(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let i=n.shift(),a=i.match;if(a.matchType(e)){let o=[];for(let s=i;s.type;s=s.via)o.push(s.type);return o.reverse()}for(let o=0;o<a.next.length;o++){let{type:s,next:l}=a.next[o];!s.isLeaf&&!s.hasRequiredAttrs()&&!(s.name in t)&&(!i.type||l.validEnd)&&(n.push({match:s.contentMatch,type:s,via:i}),t[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let a=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)a+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return a}).join(`
|
|
2
2
|
`)}}ja.empty=new ja(!0);class iQ{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 rb(r){let e=[];do e.push(aQ(r));while(r.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function aQ(r){let e=[];do e.push(oQ(r));while(r.next&&r.next!=")"&&r.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function oQ(r){let e=uQ(r);for(;;)if(r.eat("+"))e={type:"plus",expr:e};else if(r.eat("*"))e={type:"star",expr:e};else if(r.eat("?"))e={type:"opt",expr:e};else if(r.eat("{"))e=sQ(r,e);else break;return e}function Cv(r){/\D/.test(r.next)&&r.err("Expected number, got '"+r.next+"'");let e=Number(r.next);return r.pos++,e}function sQ(r,e){let t=Cv(r),n=t;return r.eat(",")&&(r.next!="}"?n=Cv(r):n=-1),r.eat("}")||r.err("Unclosed braced range"),{type:"range",min:t,max:n,expr:e}}function lQ(r,e){let t=r.nodeTypes,n=t[e];if(n)return[n];let i=[];for(let a in t){let o=t[a];o.isInGroup(e)&&i.push(o)}return i.length==0&&r.err("No node type or group '"+e+"' found"),i}function uQ(r){if(r.eat("(")){let e=rb(r);return r.eat(")")||r.err("Missing closing paren"),e}else if(/\W/.test(r.next))r.err("Unexpected token '"+r.next+"'");else{let e=lQ(r,r.next).map(t=>(r.inline==null?r.inline=t.isInline:r.inline!=t.isInline&&r.err("Mixing inline and block content"),{type:"name",value:t}));return r.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function cQ(r){let e=[[]];return i(a(r,0),t()),e;function t(){return e.push([])-1}function n(o,s,l){let f={term:l,to:s};return e[o].push(f),f}function i(o,s){o.forEach(l=>l.to=s)}function a(o,s){if(o.type=="choice")return o.exprs.reduce((l,f)=>l.concat(a(f,s)),[]);if(o.type=="seq")for(let l=0;;l++){let f=a(o.exprs[l],s);if(l==o.exprs.length-1)return f;i(f,s=t())}else if(o.type=="star"){let l=t();return n(s,l),i(a(o.expr,l),l),[n(l)]}else if(o.type=="plus"){let l=t();return i(a(o.expr,s),l),i(a(o.expr,l),l),[n(l)]}else{if(o.type=="opt")return[n(s)].concat(a(o.expr,s));if(o.type=="range"){let l=s;for(let f=0;f<o.min;f++){let v=t();i(a(o.expr,l),v),l=v}if(o.max==-1)i(a(o.expr,l),l);else for(let f=o.min;f<o.max;f++){let v=t();n(l,v),i(a(o.expr,l),v),l=v}return[n(l)]}else{if(o.type=="name")return[n(s,void 0,o.value)];throw new Error("Unknown expr type")}}}}function nb(r,e){return e-r}function Tv(r,e){let t=[];return n(e),t.sort(nb);function n(i){let a=r[i];if(a.length==1&&!a[0].term)return n(a[0].to);t.push(i);for(let o=0;o<a.length;o++){let{term:s,to:l}=a[o];!s&&t.indexOf(l)==-1&&n(l)}}}function fQ(r){let e=Object.create(null);return t(Tv(r,0));function t(n){let i=[];n.forEach(o=>{r[o].forEach(({term:s,to:l})=>{if(!s)return;let f;for(let v=0;v<i.length;v++)i[v][0]==s&&(f=i[v][1]);Tv(r,l).forEach(v=>{f||i.push([s,f=[]]),f.indexOf(v)==-1&&f.push(v)})})});let a=e[n.join(",")]=new ja(n.indexOf(r.length-1)>-1);for(let o=0;o<i.length;o++){let s=i[o][1].sort(nb);a.next.push({type:i[o][0],next:e[s.join(",")]||t(s)})}return a}}function dQ(r,e){for(let t=0,n=[r];t<n.length;t++){let i=n[t],a=!i.validEnd,o=[];for(let s=0;s<i.next.length;s++){let{type:l,next:f}=i.next[s];o.push(l.name),a&&!(l.isText||l.hasRequiredAttrs())&&(a=!1),n.indexOf(f)==-1&&n.push(f)}a&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ib(r){let e=Object.create(null);for(let t in r){let n=r[t];if(!n.hasDefault)return null;e[t]=n.default}return e}function ab(r,e){let t=Object.create(null);for(let n in r){let i=e&&e[n];if(i===void 0){let a=r[n];if(a.hasDefault)i=a.default;else throw new RangeError("No value supplied for attribute "+n)}t[n]=i}return t}function ob(r,e,t,n){for(let i in e)if(!(i in r))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in r){let a=r[i];a.validate&&a.validate(e[i])}}function sb(r,e){let t=Object.create(null);if(e)for(let n in e)t[n]=new pQ(r,n,e[n]);return t}let Sv=class lb{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=sb(e,n.attrs),this.defaultAttrs=ib(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ja.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:ab(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new aa(this,this.computeAttrs(e),Ne.from(t),Pt.setFrom(n))}createChecked(e=null,t,n){return t=Ne.from(t),this.checkContent(t),new aa(this,this.computeAttrs(e),t,Pt.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=Ne.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),a=i&&i.fillBefore(Ne.empty,!0);return a?new aa(this,e,t.append(a),Pt.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){ob(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Pt.none:e}static compile(e,t){let n=Object.create(null);e.forEach((a,o)=>n[a]=new lb(a,t,o));let i=t.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let a in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function hQ(r,e,t){let n=t.split("|");return i=>{let a=i===null?"null":typeof i;if(n.indexOf(a)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${r}, got ${a}`)}}class pQ{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?hQ(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class Lu{constructor(e,t,n,i){this.name=e,this.rank=t,this.schema=n,this.spec=i,this.attrs=sb(e,i.attrs),this.excluded=null;let a=ib(this.attrs);this.instance=a?new Pt(this,a):null}create(e=null){return!e&&this.instance?this.instance:new Pt(this,ab(this.attrs,e))}static compile(e,t){let n=Object.create(null),i=0;return e.forEach((a,o)=>n[a]=new Lu(a,i++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){ob(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class ub{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Ar.from(e.nodes),t.marks=Ar.from(e.marks||{}),this.nodes=Sv.compile(this.spec.nodes,this),this.marks=Lu.compile(this.spec.marks,this);let n=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let a=this.nodes[i],o=a.spec.content||"",s=a.spec.marks;if(a.contentMatch=n[o]||(n[o]=ja.parse(o,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=s=="_"?null:s?xv(this,s.split(" ")):s==""||!a.inlineContent?[]:null}for(let i in this.marks){let a=this.marks[i],o=a.spec.excludes;a.excluded=o==null?[a]:o==""?[]:xv(this,o.split(" "))}this.nodeFromJSON=i=>aa.fromJSON(this,i),this.markFromJSON=i=>Pt.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Sv){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,n,i)}text(e,t){let n=this.nodes.text;return new su(n,n.defaultAttrs,e,Pt.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function xv(r,e){let t=[];for(let n=0;n<e.length;n++){let i=e[n],a=r.marks[i],o=a;if(a)t.push(a);else for(let s in r.marks){let l=r.marks[s];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return t}function vQ(r){return r.tag!=null}function mQ(r){return r.style!=null}class Ga{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(i=>{if(vQ(i))this.tags.push(i);else if(mQ(i)){let a=/[^=]*/.exec(i.style)[0];n.indexOf(a)<0&&n.push(a),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let a=e.nodes[i.node];return a.contentMatch.matchType(a)})}parse(e,t={}){let n=new Mv(this,t,!1);return n.addAll(e,Pt.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Mv(this,t,!0);return n.addAll(e,Pt.none,t.from,t.to),$e.maxOpen(n.finish())}matchTag(e,t,n){for(let i=n?this.tags.indexOf(n)+1:0;i<this.tags.length;i++){let a=this.tags[i];if(bQ(e,a.tag)&&(a.namespace===void 0||e.namespaceURI==a.namespace)&&(!a.context||t.matchesContext(a.context))){if(a.getAttrs){let o=a.getAttrs(e);if(o===!1)continue;a.attrs=o||void 0}return a}}}matchStyle(e,t,n,i){for(let a=i?this.styles.indexOf(i)+1:0;a<this.styles.length;a++){let o=this.styles[a],s=o.style;if(!(s.indexOf(e)!=0||o.context&&!n.matchesContext(o.context)||s.length>e.length&&(s.charCodeAt(e.length)!=61||s.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function n(i){let a=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let s=t[o];if((s.priority==null?50:s.priority)<a)break}t.splice(o,0,i)}for(let i in e.marks){let a=e.marks[i].spec.parseDOM;a&&a.forEach(o=>{n(o=Av(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let a=e.nodes[i].spec.parseDOM;a&&a.forEach(o=>{n(o=Av(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ga(e,Ga.schemaRules(e)))}}const cb={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},gQ={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},fb={ol:!0,ul:!0},Ns=1,md=2,Ss=4;function Ev(r,e,t){return e!=null?(e?Ns:0)|(e==="full"?md:0):r&&r.whitespace=="pre"?Ns|md:t&~Ss}class Rl{constructor(e,t,n,i,a,o){this.type=e,this.attrs=t,this.marks=n,this.solid=i,this.options=o,this.content=[],this.activeMarks=Pt.none,this.match=a||(o&Ss?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Ne.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let n=this.type.contentMatch,i;return(i=n.findWrapping(e.type))?(this.match=n,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ns)){let n=this.content[this.content.length-1],i;if(n&&n.isText&&(i=/[ \t\r\n\u000c]+$/.exec(n.text))){let a=n;n.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let t=Ne.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Ne.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&&!cb.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Mv{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let i=t.topNode,a,o=Ev(null,t.preserveWhitespace,0)|(n?Ss:0);i?a=new Rl(i.type,i.attrs,Pt.none,!0,t.topMatch||i.type.contentMatch,o):n?a=new Rl(null,null,Pt.none,!0,null,o):a=new Rl(e.schema.topNodeType,null,Pt.none,!0,null,o),this.nodes=[a],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,i=this.top,a=i.options&md?"full":this.localPreserveWS||(i.options&Ns)>0;if(a==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(a)a!=="full"?n=n.replace(/\r?\n|\r/g," "):n=n.replace(/\r\n?/g,`
|
|
3
3
|
`);else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],s=e.previousSibling;(!o||s&&s.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let i=this.localPreserveWS,a=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),s;fb.hasOwnProperty(o)&&this.parser.normalizeLists&&yQ(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,n));e:if(l?l.ignore:gQ.hasOwnProperty(o))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 f,v=this.needsBlock;if(cb.hasOwnProperty(o))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),f=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let b=l&&l.skip?t:this.readStyles(e,t);b&&this.addAll(e,b),f&&this.sync(a),this.needsBlock=v}else{let f=this.readStyles(e,t);f&&this.addElementByRule(e,l,f,l.consuming===!1?s:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
4
|
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let a=this.parser.matchedStyles[i],o=n.getPropertyValue(a);if(o)for(let s=void 0;;){let l=this.parser.matchStyle(a,o,this,s);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(f=>!l.clearMark(f)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)s=l;else break}}return t}addElementByRule(e,t,n,i){let a,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let l=this.enter(o,t.attrs||null,n,t.preserveWhitespace);l&&(a=!0,n=l)}else{let l=this.parser.schema.marks[t.mark];n=n.concat(l.create(t.attrs))}let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,n,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,n,!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,n),this.findAround(e,l,!1)}a&&this.sync(s)&&this.open--}addAll(e,t,n,i){let a=n||0;for(let o=n?e.childNodes[n]:e.firstChild,s=i==null?null:e.childNodes[i];o!=s;o=o.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(o,t);this.findAtPoint(e,a)}findPlace(e,t,n){let i,a;for(let o=this.open,s=0;o>=0;o--){let l=this.nodes[o],f=l.findWrapping(e);if(f&&(!i||i.length>f.length+s)&&(i=f,a=l,!f.length))break;if(l.solid){if(n)break;s+=2}}if(!i)return null;this.sync(a);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let a=this.textblockFromContext();a&&(t=this.enterInner(a,null,t))}let i=this.findPlace(e,t,n);if(i){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(e.type));let o=Pt.none;for(let s of i.concat(e.marks))(a.type?a.type.allowsMarkType(s.type):Ov(s.type,e.type))&&(o=s.addToSet(o));return a.content.push(e.mark(o)),!0}return!1}enter(e,t,n,i){let a=this.findPlace(e.create(t),n,!1);return a&&(a=this.enterInner(e,t,n,!0,i)),a}enterInner(e,t,n,i=!1,a){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let s=Ev(e,a,o.options);o.options&Ss&&o.content.length==0&&(s|=Ss);let l=Pt.none;return n=n.filter(f=>(o.type?o.type.allowsMarkType(f.type):Ov(f.type,e))?(l=f.addToSet(l),!1):!0),this.nodes.push(new Rl(e,t,l,i,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Ns)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let i=n.length-1;i>=0;i--)e+=n[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(n?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,i=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),a=-(n?n.depth+1:0)+(i?0:1),o=(s,l)=>{for(;s>=0;s--){let f=t[s];if(f==""){if(s==t.length-1||s==0)continue;for(;l>=a;l--)if(o(s-1,l))return!0;return!1}else{let v=l>0||l==0&&i?this.nodes[l].type:n&&l>=a?n.node(l-a).type:null;if(!v||v.name!=f&&!v.isInGroup(f))return!1;l--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let n=this.parser.schema.nodes[t];if(n.isTextblock&&n.defaultAttrs)return n}}}function yQ(r){for(let e=r.firstChild,t=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&fb.hasOwnProperty(n)&&t?(t.appendChild(e),e=t):n=="li"?t=e:n&&(t=null)}}function bQ(r,e){return(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,e)}function Av(r){let e={};for(let t in r)e[t]=r[t];return e}function Ov(r,e){let t=e.schema.nodes;for(let n in t){let i=t[n];if(!i.allowsMarkType(r))continue;let a=[],o=s=>{a.push(s);for(let l=0;l<s.edgeCount;l++){let{type:f,next:v}=s.edge(l);if(f==e||a.indexOf(v)<0&&o(v))return!0}};if(o(i.contentMatch))return!0}}class Zo{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Ef(t).createDocumentFragment());let i=n,a=[];return e.forEach(o=>{if(a.length||o.marks.length){let s=0,l=0;for(;s<a.length&&l<o.marks.length;){let f=o.marks[l];if(!this.marks[f.type.name]){l++;continue}if(!f.eq(a[s][0])||f.type.spec.spanning===!1)break;s++,l++}for(;s<a.length;)i=a.pop()[1];for(;l<o.marks.length;){let f=o.marks[l++],v=this.serializeMark(f,o.isInline,t);v&&(a.push([f,i]),i.appendChild(v.dom),i=v.contentDOM||v.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:i}=Gl(Ef(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let a=this.serializeMark(e.marks[i],e.isInline,t);a&&((a.contentDOM||a.dom).appendChild(n),n=a.dom)}return n}serializeMark(e,t,n={}){let i=this.marks[e.type.name];return i&&Gl(Ef(n),i(e,t),null,e.attrs)}static renderSpec(e,t,n=null,i){return Gl(e,t,n,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Zo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Nv(e.nodes);return t.text||(t.text=n=>n.text),t}static marksFromSchema(e){return Nv(e.marks)}}function Nv(r){let e={};for(let t in r){let n=r[t].spec.toDOM;n&&(e[t]=n)}return e}function Ef(r){return r.document||window.document}const Dv=new WeakMap;function kQ(r){let e=Dv.get(r);return e===void 0&&Dv.set(r,e=wQ(r)),e}function wQ(r){let e=null;function t(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let i=0;i<n.length;i++)t(n[i]);else for(let i in n)t(n[i])}return t(r),e}function Gl(r,e,t,n){if(typeof e=="string")return{dom:r.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],a;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(a=kQ(n))&&a.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let s,l=t?r.createElementNS(t,i):r.createElement(i),f=e[1],v=1;if(f&&typeof f=="object"&&f.nodeType==null&&!Array.isArray(f)){v=2;for(let b in f)if(f[b]!=null){let T=b.indexOf(" ");T>0?l.setAttributeNS(b.slice(0,T),b.slice(T+1),f[b]):b=="style"&&l.style?l.style.cssText=f[b]:l.setAttribute(b,f[b])}}for(let b=v;b<e.length;b++){let T=e[b];if(T===0){if(b<e.length-1||b>v)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:x,contentDOM:E}=Gl(r,T,t,n);if(l.appendChild(x),E){if(s)throw new RangeError("Multiple content holes");s=E}}}return{dom:l,contentDOM:s}}const db=65535,hb=Math.pow(2,16);function CQ(r,e){return r+e*hb}function Lv(r){return r&db}function TQ(r){return(r-(r&db))/hb}const pb=1,vb=2,Kl=4,mb=8;class gd{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&mb)>0}get deletedBefore(){return(this.delInfo&(pb|Kl))>0}get deletedAfter(){return(this.delInfo&(vb|Kl))>0}get deletedAcross(){return(this.delInfo&Kl)>0}}class ln{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&ln.empty)return ln.empty}recover(e){let t=0,n=Lv(e);if(!this.inverted)for(let i=0;i<n;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[n*3]+t+TQ(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let i=0,a=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let l=this.ranges[s]-(this.inverted?i:0);if(l>e)break;let f=this.ranges[s+a],v=this.ranges[s+o],b=l+f;if(e<=b){let T=f?e==l?-1:e==b?1:t:t,x=l+i+(T<0?0:v);if(n)return x;let E=e==(t<0?l:b)?null:CQ(s/3,e-l),B=e==l?vb:e==b?pb:Kl;return(t<0?e!=l:e!=b)&&(B|=mb),new gd(x,B,E)}i+=v-f}return n?e+i:new gd(e+i,0,null)}touches(e,t){let n=0,i=Lv(t),a=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let l=this.ranges[s]-(this.inverted?n:0);if(l>e)break;let f=this.ranges[s+a],v=l+f;if(e<=v&&s==i*3)return!0;n+=this.ranges[s+o]-f}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,a=0;i<this.ranges.length;i+=3){let o=this.ranges[i],s=o-(this.inverted?a:0),l=o+(this.inverted?0:a),f=this.ranges[i+t],v=this.ranges[i+n];e(s,s+f,l,l+v),a+=v-f}}invert(){return new ln(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?ln.empty:new ln(e<0?[0,-e,0]:[0,0,e])}}ln.empty=new ln([]);class Ds{constructor(e,t,n=0,i=e?e.length:0){this.mirror=t,this.from=n,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Ds(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?n+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?n-i-1:void 0)}}invert(){let e=new Ds;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let i=0;for(let a=this.from;a<this.to;a++){let o=this._maps[a],s=o.mapResult(e,t);if(s.recover!=null){let l=this.getMirror(a);if(l!=null&&l>a&&l<this.to){a=l,e=this._maps[l].recover(s.recover);continue}}i|=s.delInfo,e=s.pos}return n?e:new gd(e,i,null)}}const Mf=Object.create(null);class Vr{getMap(){return ln.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=Mf[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Mf)throw new RangeError("Duplicate use of step JSON ID "+e);return Mf[e]=t,t.prototype.jsonID=e,t}}class dr{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new dr(e,null)}static fail(e){return new dr(null,e)}static fromReplace(e,t,n,i){try{return dr.ok(e.replace(t,n,i))}catch(a){if(a instanceof iu)return dr.fail(a.message);throw a}}}function rh(r,e,t){let n=[];for(let i=0;i<r.childCount;i++){let a=r.child(i);a.content.size&&(a=a.copy(rh(a.content,e,a))),a.isInline&&(a=e(a,t,i)),n.push(a)}return Ne.fromArray(n)}class ra extends Vr{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),i=n.node(n.sharedDepth(this.to)),a=new $e(rh(t.content,(o,s)=>!o.isAtom||!s.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return dr.fromReplace(e,this.from,this.to,a)}invert(){return new li(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new ra(t.pos,n.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))}}Vr.jsonID("addMark",ra);class li extends Vr{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new $e(rh(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return dr.fromReplace(e,this.from,this.to,n)}invert(){return new ra(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new li(t.pos,n.pos,this.mark)}merge(e){return e instanceof li&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new li(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 li(t.from,t.to,e.markFromJSON(t.mark))}}Vr.jsonID("removeMark",li);class na extends Vr{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return dr.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return dr.fromReplace(e,this.pos,this.pos+1,new $e(Ne.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(n))return new na(this.pos,t.marks[i]);return new na(this.pos,this.mark)}}return new Ka(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new na(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 na(t.pos,e.markFromJSON(t.mark))}}Vr.jsonID("addNodeMark",na);class Ka extends Vr{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return dr.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return dr.fromReplace(e,this.pos,this.pos+1,new $e(Ne.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new na(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ka(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 Ka(t.pos,e.markFromJSON(t.mark))}}Vr.jsonID("removeNodeMark",Ka);class Hr extends Vr{constructor(e,t,n,i=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=i}apply(e){return this.structure&&yd(e,this.from,this.to)?dr.fail("Structure replace would overwrite content"):dr.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ln([this.from,this.to-this.from,this.slice.size])}invert(e){return new Hr(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new Hr(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Hr)||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?$e.empty:new $e(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Hr(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?$e.empty:new $e(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Hr(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 Hr(t.from,t.to,$e.fromJSON(e,t.slice),!!t.structure)}}Vr.jsonID("replace",Hr);class Tr extends Vr{constructor(e,t,n,i,a,o,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=i,this.slice=a,this.insert=o,this.structure=s}apply(e){if(this.structure&&(yd(e,this.from,this.gapFrom)||yd(e,this.gapTo,this.to)))return dr.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return dr.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?dr.fromReplace(e,this.from,this.to,n):dr.fail("Content does not fit in gap")}getMap(){return new ln([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 Tr(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||i<t.pos||a>n.pos?null:new Tr(t.pos,n.pos,i,a,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 Tr(t.from,t.to,t.gapFrom,t.gapTo,$e.fromJSON(e,t.slice),t.insert,!!t.structure)}}Vr.jsonID("replaceAround",Tr);function yd(r,e,t){let n=r.resolve(e),i=t-e,a=n.depth;for(;i>0&&a>0&&n.indexAfter(a)==n.node(a).childCount;)a--,i--;if(i>0){let o=n.node(a).maybeChild(n.indexAfter(a));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function SQ(r,e,t,n){let i=[],a=[],o,s;r.doc.nodesBetween(e,t,(l,f,v)=>{if(!l.isInline)return;let b=l.marks;if(!n.isInSet(b)&&v.type.allowsMarkType(n.type)){let T=Math.max(f,e),x=Math.min(f+l.nodeSize,t),E=n.addToSet(b);for(let B=0;B<b.length;B++)b[B].isInSet(E)||(o&&o.to==T&&o.mark.eq(b[B])?o.to=x:i.push(o=new li(T,x,b[B])));s&&s.to==T?s.to=x:a.push(s=new ra(T,x,n))}}),i.forEach(l=>r.step(l)),a.forEach(l=>r.step(l))}function xQ(r,e,t,n){let i=[],a=0;r.doc.nodesBetween(e,t,(o,s)=>{if(!o.isInline)return;a++;let l=null;if(n instanceof Lu){let f=o.marks,v;for(;v=n.isInSet(f);)(l||(l=[])).push(v),f=v.removeFromSet(f)}else n?n.isInSet(o.marks)&&(l=[n]):l=o.marks;if(l&&l.length){let f=Math.min(s+o.nodeSize,t);for(let v=0;v<l.length;v++){let b=l[v],T;for(let x=0;x<i.length;x++){let E=i[x];E.step==a-1&&b.eq(i[x].style)&&(T=E)}T?(T.to=f,T.step=a):i.push({style:b,from:Math.max(s,e),to:f,step:a})}}}),i.forEach(o=>r.step(new li(o.from,o.to,o.style)))}function nh(r,e,t,n=t.contentMatch,i=!0){let a=r.doc.nodeAt(e),o=[],s=e+1;for(let l=0;l<a.childCount;l++){let f=a.child(l),v=s+f.nodeSize,b=n.matchType(f.type);if(!b)o.push(new Hr(s,v,$e.empty));else{n=b;for(let T=0;T<f.marks.length;T++)t.allowsMarkType(f.marks[T].type)||r.step(new li(s,v,f.marks[T]));if(i&&f.isText&&t.whitespace!="pre"){let T,x=/\r?\n|\r/g,E;for(;T=x.exec(f.text);)E||(E=new $e(Ne.from(t.schema.text(" ",t.allowedMarks(f.marks))),0,0)),o.push(new Hr(s+T.index,s+T.index+T[0].length,E))}}s=v}if(!n.validEnd){let l=n.fillBefore(Ne.empty,!0);r.replace(s,s,new $e(l,0,0))}for(let l=o.length-1;l>=0;l--)r.step(o[l])}function EQ(r,e,t){return(e==0||r.canReplace(e,r.childCount))&&(t==r.childCount||r.canReplace(0,t))}function Ru(r){let t=r.parent.content.cutByIndex(r.startIndex,r.endIndex);for(let n=r.depth;;--n){let i=r.$from.node(n),a=r.$from.index(n),o=r.$to.indexAfter(n);if(n<r.depth&&i.canReplace(a,o,t))return n;if(n==0||i.type.spec.isolating||!EQ(i,a,o))break}return null}function MQ(r,e,t){let{$from:n,$to:i,depth:a}=e,o=n.before(a+1),s=i.after(a+1),l=o,f=s,v=Ne.empty,b=0;for(let E=a,B=!1;E>t;E--)B||n.index(E)>0?(B=!0,v=Ne.from(n.node(E).copy(v)),b++):l--;let T=Ne.empty,x=0;for(let E=a,B=!1;E>t;E--)B||i.after(E+1)<i.end(E)?(B=!0,T=Ne.from(i.node(E).copy(T)),x++):f++;r.step(new Tr(l,f,o,s,new $e(v.append(T),b,x),v.size-b,!0))}function AQ(r,e,t=null,n=r){let i=OQ(r,e),a=i&&NQ(n,e);return a?i.map(Rv).concat({type:e,attrs:t}).concat(a.map(Rv)):null}function Rv(r){return{type:r,attrs:null}}function OQ(r,e){let{parent:t,startIndex:n,endIndex:i}=r,a=t.contentMatchAt(n).findWrapping(e);if(!a)return null;let o=a.length?a[0]:e;return t.canReplaceWith(n,i,o)?a:null}function NQ(r,e){let{parent:t,startIndex:n,endIndex:i}=r,a=t.child(n),o=e.contentMatch.findWrapping(a.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let f=n;l&&f<i;f++)l=l.matchType(t.child(f).type);return!l||!l.validEnd?null:o}function DQ(r,e,t){let n=Ne.empty;for(let o=t.length-1;o>=0;o--){if(n.size){let s=t[o].type.contentMatch.matchFragment(n);if(!s||!s.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=Ne.from(t[o].type.create(t[o].attrs,n))}let i=e.start,a=e.end;r.step(new Tr(i,a,i,a,new $e(n,0,0),t.length,!0))}function LQ(r,e,t,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=r.steps.length;r.doc.nodesBetween(e,t,(o,s)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(n,l)&&RQ(r.doc,r.mapping.slice(a).map(s),n)){let f=null;if(n.schema.linebreakReplacement){let x=n.whitespace=="pre",E=!!n.contentMatch.matchType(n.schema.linebreakReplacement);x&&!E?f=!1:!x&&E&&(f=!0)}f===!1&&yb(r,o,s,a),nh(r,r.mapping.slice(a).map(s,1),n,void 0,f===null);let v=r.mapping.slice(a),b=v.map(s,1),T=v.map(s+o.nodeSize,1);return r.step(new Tr(b,T,b+1,T-1,new $e(Ne.from(n.create(l,null,o.marks)),0,0),1,!0)),f===!0&&gb(r,o,s,a),!1}})}function gb(r,e,t,n){e.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let l=r.mapping.slice(n).map(t+1+a+o.index);r.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function yb(r,e,t,n){e.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let o=r.mapping.slice(n).map(t+1+a);r.replaceWith(o,o+1,e.type.schema.text(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a,
|
|
1
|
+
import{j as a,bs as i,bt as l,bu as o}from"./app.js";import{r as c}from"./monaco-ICtx6xoc.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./handsontable-PVakPtJV.js";function m(){return c.useCallback(r=>{const t=r.trim().split(" ");if(t.length===0)return"";if(t.length===1)return t[0].charAt(0).toUpperCase();const s=t[0].charAt(0),n=t[t.length-1].charAt(0);return`${s}${n}`.toUpperCase()},[])}function f({user:e,showEmail:r=!1}){const t=m();return a.jsxs(a.Fragment,{children:[a.jsxs(i,{className:"h-8 w-8 overflow-hidden rounded-full",children:[a.jsx(l,{src:e.avatar,alt:e.login}),a.jsx(o,{className:"rounded-lg bg-neutral-200 text-black dark:bg-neutral-700 dark:text-white",children:t(e.login)})]}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-medium",children:e.login}),r&&a.jsx("span",{className:"text-muted-foreground truncate text-xs",children:e.email})]})]})}export{f as UserInfo};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,
|
|
1
|
+
import{j as e,bv as n,aK as a,aJ as l,W as i,bw as m}from"./app.js";import{UserInfo as c}from"./user-info-BGQvqBmO.js";import{r as p}from"./monaco-ICtx6xoc.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./handsontable-PVakPtJV.js";function u(){return p.useCallback(()=>{document.body.style.removeProperty("pointer-events")},[])}function w({user:t,logout:r,logoutBtn:o}){const s=u();return e.jsxs(e.Fragment,{children:[e.jsx(n,{className:"p-0 font-normal",children:e.jsx("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm",children:e.jsx(c,{user:t,showEmail:!0})})}),e.jsx(a,{}),e.jsx(l,{asChild:!0,children:e.jsxs(i,{className:"block w-full cursor-pointer",method:"get",href:r,as:"button",onClick:s,children:[e.jsx(m,{className:"mr-2"}),o]})})]})}export{w as UserMenuContent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as o,j as t}from"./app.js";import{A as p}from"./app-layout-
|
|
1
|
+
import{u as o,j as t}from"./app.js";import{A as p}from"./app-layout-C7q3_eFS.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./monaco-ICtx6xoc.js";import"./handsontable-PVakPtJV.js";import"./app-shell-C8Cnr5Hy.js";import"./app-sidebar-BCtD_nHo.js";import"./nav-main-UuH4U_0H.js";import"./material-icon-DwkE6wKL.js";import"./app-sidebar-header-Bcpas2Np.js";import"./breadcrumbs-DSMzNYiS.js";import"./nav-user-DuCZNsZX.js";import"./user-info-BGQvqBmO.js";import"./user-menu-content-BDm88xaM.js";import"./theme-switcher-cgyA7_cO.js";import"./icon-DpkedrXG.js";const i=[];function N(){const r=o();return t.jsx(p,{breadcrumbs:i,children:t.jsxs("div",{className:"flex h-full flex-1 flex-col gap-4 rounded-xl p-4",children:[r.props.title&&t.jsx("div",{className:"text-3xl mb-8",children:r.props.title}),t.jsx("div",{className:"text-3xl mb-8",children:"Adminizer"}),r.props.text&&t.jsx("div",{dangerouslySetInnerHTML:{__html:r.props.text}})]})})}export{N as default};
|
|
@@ -197,11 +197,6 @@ export interface AdminpanelConfig {
|
|
|
197
197
|
enableGeneral?: boolean;
|
|
198
198
|
initTab?: string;
|
|
199
199
|
};
|
|
200
|
-
aiAssistant?: {
|
|
201
|
-
enabled: boolean;
|
|
202
|
-
defaultModel?: string;
|
|
203
|
-
models?: string[];
|
|
204
|
-
};
|
|
205
200
|
cors?: {
|
|
206
201
|
enabled: boolean;
|
|
207
202
|
origin: string[] | string;
|
package/interfaces/types.d.ts
CHANGED
|
@@ -57,19 +57,6 @@ export interface INotificationEvent {
|
|
|
57
57
|
channel?: string;
|
|
58
58
|
userId?: number;
|
|
59
59
|
}
|
|
60
|
-
export type AiAssistantRole = 'user' | 'assistant';
|
|
61
|
-
export interface AiAssistantMessage {
|
|
62
|
-
id: string;
|
|
63
|
-
role: AiAssistantRole;
|
|
64
|
-
content: string;
|
|
65
|
-
timestamp: Date;
|
|
66
|
-
modelId: string;
|
|
67
|
-
}
|
|
68
|
-
export interface AiAssistantModelInfo {
|
|
69
|
-
id: string;
|
|
70
|
-
name: string;
|
|
71
|
-
description?: string;
|
|
72
|
-
}
|
|
73
60
|
export type Migration = {
|
|
74
61
|
name: string;
|
|
75
62
|
timestamp: number;
|
package/lib/Adminizer.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ import type { ViteDevServer } from 'vite';
|
|
|
12
12
|
import { MenuHelper } from "../helpers/menuHelper";
|
|
13
13
|
import { ControlsHandler } from "./controls/ControlsHandler";
|
|
14
14
|
import { CatalogHandler } from "./catalog/CatalogHandler";
|
|
15
|
-
import { AiAssistantHandler } from './ai-assistant/AiAssistantHandler';
|
|
16
15
|
import { NotificationHandler } from './notifications/NotificationHandler';
|
|
17
16
|
import { INotification } from "../interfaces/types";
|
|
18
17
|
import { MediaManagerHandler } from "./media-manager/MediaManagerHandler";
|
|
@@ -32,7 +31,6 @@ export declare class Adminizer {
|
|
|
32
31
|
configHelper: ConfigHelper;
|
|
33
32
|
menuHelper: MenuHelper;
|
|
34
33
|
notificationHandler: NotificationHandler;
|
|
35
|
-
aiAssistantHandler?: AiAssistantHandler;
|
|
36
34
|
modelHandler: ModelHandler;
|
|
37
35
|
widgetHandler: WidgetHandler;
|
|
38
36
|
vite: ViteDevServer;
|
package/lib/Adminizer.js
CHANGED
|
@@ -30,7 +30,6 @@ import { ControlsHandler } from "./controls/ControlsHandler.js";
|
|
|
30
30
|
import { CatalogHandler } from "./catalog/CatalogHandler.js";
|
|
31
31
|
import { v4 as uuid } from "uuid";
|
|
32
32
|
import { bindNotifications } from "../system/bindNotifications.js";
|
|
33
|
-
import { bindAiAssistant } from "../system/bindAiAssistant.js";
|
|
34
33
|
import { MediaManagerHandler } from "./media-manager/MediaManagerHandler.js";
|
|
35
34
|
import { bindCors } from "../system/bindCors.js";
|
|
36
35
|
export class Adminizer {
|
|
@@ -50,7 +49,6 @@ export class Adminizer {
|
|
|
50
49
|
configHelper;
|
|
51
50
|
menuHelper;
|
|
52
51
|
notificationHandler;
|
|
53
|
-
aiAssistantHandler;
|
|
54
52
|
modelHandler;
|
|
55
53
|
widgetHandler;
|
|
56
54
|
vite;
|
|
@@ -213,8 +211,6 @@ export class Adminizer {
|
|
|
213
211
|
// Bind notifications
|
|
214
212
|
if (this.config.notifications.enabled)
|
|
215
213
|
await bindNotifications(this);
|
|
216
|
-
if (this.config.aiAssistant?.enabled)
|
|
217
|
-
await bindAiAssistant(this);
|
|
218
214
|
await Router.bind(this); // must be after binding policies and req/res functions
|
|
219
215
|
/**
|
|
220
216
|
* Adminizer loaded
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adminizer",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.4.0
|
|
4
|
+
"version": "4.4.0",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./index.js",
|
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
"crypto-puzzle": "^5.0.2",
|
|
59
59
|
"date-fns": "^3.6.0",
|
|
60
60
|
"deep-object-diff": "^1.1.9",
|
|
61
|
-
"dotenv": "^17.2.2",
|
|
62
61
|
"express": "^4.21.2",
|
|
63
62
|
"express-session": "^1.18.1",
|
|
64
63
|
"image-size": "^2.0.2",
|
|
@@ -70,14 +69,13 @@
|
|
|
70
69
|
"react-cropper": "^2.3.3",
|
|
71
70
|
"react-dnd": "^16.0.1",
|
|
72
71
|
"reflect-metadata": "^0.2.2",
|
|
73
|
-
"sequelize": "^6.37.7",
|
|
74
72
|
"sharp": "^0.33.5",
|
|
75
73
|
"sprintf-js": "^1.1.3",
|
|
76
74
|
"typeorm": "^0.3.20",
|
|
77
75
|
"uuid": "^11.0.5",
|
|
78
76
|
"waterline": "^0.15.2",
|
|
79
|
-
"
|
|
80
|
-
"
|
|
77
|
+
"sequelize": "^6.37.7",
|
|
78
|
+
"winston": "^3.17.0"
|
|
81
79
|
},
|
|
82
80
|
"devDependencies": {
|
|
83
81
|
"@babel/plugin-proposal-decorators": "^7.27.1",
|
|
@@ -89,7 +87,6 @@
|
|
|
89
87
|
"@handsontable/react": "^15.2.0",
|
|
90
88
|
"@inertiajs/react": "^2.2.0",
|
|
91
89
|
"@monaco-editor/react": "^4.7.0",
|
|
92
|
-
"@openai/agents": "^0.3.2",
|
|
93
90
|
"@radix-ui/react-avatar": "^1.1.3",
|
|
94
91
|
"@radix-ui/react-checkbox": "^1.1.4",
|
|
95
92
|
"@radix-ui/react-collapsible": "^1.1.3",
|
package/system/Router.js
CHANGED
|
@@ -19,7 +19,6 @@ import { thumbController } from "../controllers/media-manager/ThumbController.js
|
|
|
19
19
|
import { Adminizer } from "../lib/Adminizer.js";
|
|
20
20
|
import timezones from "../controllers/timezones.js";
|
|
21
21
|
import { NotificationController } from "../controllers/notifications/NotificationController.js";
|
|
22
|
-
import { AiAssistantController } from "../controllers/ai/AiAssistantController.js";
|
|
23
22
|
export default class Router {
|
|
24
23
|
static onlyOnce = false;
|
|
25
24
|
/**
|
|
@@ -102,12 +101,6 @@ export default class Router {
|
|
|
102
101
|
adminizer.app.put(`${adminizer.config.routePrefix}/notifications/api/read-all`, adminizer.policyManager.bindPolicies(policies, NotificationController.markAllAsRead));
|
|
103
102
|
adminizer.app.post(`${adminizer.config.routePrefix}/notifications/api/search`, adminizer.policyManager.bindPolicies(policies, NotificationController.search));
|
|
104
103
|
}
|
|
105
|
-
if (adminizer.config.aiAssistant?.enabled) {
|
|
106
|
-
adminizer.app.get(`${adminizer.config.routePrefix}/api/ai-assistant/models`, adminizer.policyManager.bindPolicies(policies, AiAssistantController.getModels));
|
|
107
|
-
adminizer.app.get(`${adminizer.config.routePrefix}/api/ai-assistant/history/:modelId`, adminizer.policyManager.bindPolicies(policies, AiAssistantController.getHistory));
|
|
108
|
-
adminizer.app.post(`${adminizer.config.routePrefix}/api/ai-assistant/query`, adminizer.policyManager.bindPolicies(policies, AiAssistantController.sendMessage));
|
|
109
|
-
adminizer.app.delete(`${adminizer.config.routePrefix}/api/ai-assistant/history/:modelId`, adminizer.policyManager.bindPolicies(policies, AiAssistantController.resetHistory));
|
|
110
|
-
}
|
|
111
104
|
/**
|
|
112
105
|
* List of records
|
|
113
106
|
*/
|
package/system/bindInertia.js
CHANGED
|
@@ -134,10 +134,6 @@ export function bindInertia(adminizer) {
|
|
|
134
134
|
] : null,
|
|
135
135
|
showVersion: req.adminizer.config.showVersion ?? false,
|
|
136
136
|
notifications: req.adminizer.config.notifications.enabled ?? false,
|
|
137
|
-
aiAssistant: {
|
|
138
|
-
enabled: req.adminizer.config.aiAssistant?.enabled ?? false,
|
|
139
|
-
defaultModel: req.adminizer.config.aiAssistant?.defaultModel ?? null,
|
|
140
|
-
},
|
|
141
137
|
});
|
|
142
138
|
next();
|
|
143
139
|
});
|
package/system/defaults.js
CHANGED
package/assets/add-DlVWR7Qx.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as t,j as o}from"./app.js";import{A as m}from"./app-layout-mpp8ni0G.js";import p from"./add-form-BfIXZ_9g.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./monaco-ICtx6xoc.js";import"./handsontable-PVakPtJV.js";import"./app-shell-CggZrBz6.js";import"./app-sidebar-Do2eoo3w.js";import"./nav-main-CZa4xkP1.js";import"./material-icon-DwkE6wKL.js";import"./app-sidebar-header-pfquDpHT.js";import"./breadcrumbs-BS5uXMaM.js";import"./nav-user-e1Cj0abB.js";import"./user-info-DrdQBvFb.js";import"./user-menu-content-ePAt_cwK.js";import"./theme-switcher-xFldiRZz.js";import"./icon-DpkedrXG.js";import"./field-renderer-CUYWPzfi.js";import"./dynamic-controls-BOYmRX_z.js";import"./input-error-CmXZF6xy.js";const i=[];function k(){const r=t();return o.jsx(m,{breadcrumbs:i,children:o.jsx(p,{page:r,catalog:!1})})}export{k as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./app.js";import{A as o}from"./app-layout-mpp8ni0G.js";import t from"./add-group-form-BkXmTsXF.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./monaco-ICtx6xoc.js";import"./handsontable-PVakPtJV.js";import"./app-shell-CggZrBz6.js";import"./app-sidebar-Do2eoo3w.js";import"./nav-main-CZa4xkP1.js";import"./material-icon-DwkE6wKL.js";import"./app-sidebar-header-pfquDpHT.js";import"./breadcrumbs-BS5uXMaM.js";import"./nav-user-e1Cj0abB.js";import"./user-info-DrdQBvFb.js";import"./user-menu-content-ePAt_cwK.js";import"./theme-switcher-xFldiRZz.js";import"./icon-DpkedrXG.js";const m=[];function E(){return r.jsx(o,{breadcrumbs:m,children:r.jsx(t,{})})}export{E as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./app.js";import{A as o}from"./app-layout-mpp8ni0G.js";import t from"./add-user-form-CeLtuCJN.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./monaco-ICtx6xoc.js";import"./handsontable-PVakPtJV.js";import"./app-shell-CggZrBz6.js";import"./app-sidebar-Do2eoo3w.js";import"./nav-main-CZa4xkP1.js";import"./material-icon-DwkE6wKL.js";import"./app-sidebar-header-pfquDpHT.js";import"./breadcrumbs-BS5uXMaM.js";import"./nav-user-e1Cj0abB.js";import"./user-info-DrdQBvFb.js";import"./user-menu-content-ePAt_cwK.js";import"./theme-switcher-xFldiRZz.js";import"./icon-DpkedrXG.js";import"./input-error-CmXZF6xy.js";const m=[];function F(){return r.jsx(o,{breadcrumbs:m,children:r.jsx(t,{})})}export{F as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as E,j as e,V as I,ad as L,ae as v,af as P,B as w,ag as z,S as C,c as M,d as R,e as T,f as D,ah as O,L as k}from"./app.js";import V from"./app-shell-CggZrBz6.js";import{AppSidebar as B}from"./app-sidebar-Do2eoo3w.js";import{A as K,a as N,N as _,b as F}from"./app-sidebar-header-pfquDpHT.js";import{r as l}from"./monaco-ICtx6xoc.js";const H=l.memo(({children:o,breadcrumbs:a=[],className:i})=>{const n=E();return e.jsxs(V,{variant:"sidebar",children:[e.jsx(I,{title:n.props.title}),e.jsx(B,{}),e.jsxs(L,{className:i,children:[e.jsx(K,{breadcrumbs:a}),e.jsx("div",{className:"relative flex-1 overflow-hidden",children:e.jsx("div",{className:"h-full",children:o})})]})]})});function $({width:o="min(25vw, 420px)"}){const{isEnabled:a,isOpen:i,closeChat:n,models:s,activeModel:r,setActiveModel:d,messages:c,loading:m,sending:x,error:j,sendMessage:y}=N(),[f,h]=l.useState(""),g=l.useRef(null);l.useEffect(()=>{i||h("")},[i]),l.useEffect(()=>{g.current&&g.current.scrollIntoView({behavior:"smooth"})},[c]);const u=s.length>0,A=async t=>{t.preventDefault();const p=f.trim();p&&(await y(p),h(""))},S=t=>{if((t.ctrlKey||t.metaKey)&&t.key==="Enter"){t.preventDefault();const p=f.trim();p&&!x&&(y(p),h(""))}};return a?e.jsxs("aside",{id:"ai-assistant-panel","aria-label":"AI assistant chat","aria-hidden":!i,className:v("bg-card text-card-foreground fixed bottom-0 right-0 top-0 z-[60] flex h-full flex-col border-l shadow-xl transition-all duration-300 ease-in-out","md:w-auto w-full",i?"translate-x-0 opacity-100":"translate-x-full opacity-0 pointer-events-none"),style:{width:"var(--ai-assistant-panel-actual-width, "+o+")"},children:[e.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(P,{className:"size-5 text-primary"}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-semibold leading-tight",children:"AI assistant"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Chat with your selected model."})]})]}),e.jsx(w,{variant:"ghost",size:"icon",onClick:n,"aria-label":"Close AI assistant",children:e.jsx(z,{className:"size-4"})})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-hidden px-4 py-4",children:[!u&&!m&&e.jsx("div",{className:"flex flex-1 items-center justify-center rounded-md border border-dashed p-6 text-sm text-muted-foreground",children:"No AI models are available for your account."}),u&&e.jsxs(e.Fragment,{children:[e.jsxs(C,{value:r,onValueChange:d,children:[e.jsx(M,{className:"w-full",children:e.jsx(R,{placeholder:"Select a model"})}),e.jsx(T,{className:"z-[70]",children:s.map(t=>e.jsx(D,{value:t.id,children:e.jsxs("div",{className:"flex flex-col text-left",children:[e.jsx("span",{className:"font-medium",children:t.name}),t.description&&e.jsx("span",{className:"text-xs text-muted-foreground",children:t.description})]})},t.id))})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-3 overflow-hidden rounded-md border bg-background p-4",children:[e.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto pr-2","data-ai-assistant-messages":!0,children:[m&&e.jsx("div",{className:"flex justify-center py-6 text-sm text-muted-foreground",children:"Loading conversation..."}),!m&&c.length===0&&e.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"Start a conversation to see responses here."}),c.map(t=>e.jsxs("div",{className:v("flex flex-col gap-1 rounded-md border p-3 text-sm shadow-xs",t.role==="assistant"?"border-primary/30 bg-primary/5":"border-border bg-background"),children:[e.jsx("span",{className:"font-semibold",children:t.role==="assistant"?"Assistant":"You"}),e.jsx("p",{className:"whitespace-pre-wrap leading-relaxed",children:t.content}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(t.timestamp).toLocaleTimeString()})]},t.id)),e.jsx("div",{ref:g})]}),e.jsxs("form",{className:"space-y-2",onSubmit:A,children:[e.jsx(O,{placeholder:u?"Type your question... (Ctrl+Enter to send)":"No models available",value:f,onChange:t=>h(t.target.value),onKeyDown:S,disabled:!u||x,rows:3}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[j&&e.jsx("span",{className:"text-xs text-destructive",children:j}),e.jsx(w,{type:"submit",disabled:!u||x||!f.trim(),children:x?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(k,{className:"size-4 animate-spin"}),"Sending…"]}):"Send"})]})]})]})]})]})]}):null}const q="min(25vw, 420px)",b="margin-right 300ms ease-in-out";function G({children:o,panelWidth:a=q}){const{isEnabled:i,isOpen:n}=N();return l.useEffect(()=>{const s=document.getElementById("app");if(!s)return;const r=s.style.transition,d=r==null?void 0:r.includes("margin-right");return d||(s.style.transition=r?`${r}, ${b}`:b),s.classList.add("ai-assistant-host"),s.style.setProperty("--ai-assistant-panel-width",a),()=>{s.classList.remove("ai-assistant-host"),s.style.removeProperty("--ai-assistant-panel-width"),s.style.removeProperty("--ai-assistant-panel-actual-width"),s.style.removeProperty("margin-right"),delete s.dataset.aiAssistantOpen,d||(s.style.transition=r)}},[a]),l.useEffect(()=>{const s=document.getElementById("app");if(!s)return;const r=window.innerWidth<768,d=r?"100vw":a;s.style.setProperty("--ai-assistant-panel-actual-width",d),i&&n?(s.style.marginRight=r?"0":a,s.dataset.aiAssistantOpen="true"):(s.style.removeProperty("margin-right"),s.dataset.aiAssistantOpen="false");const c=()=>{const m=window.innerWidth<768,x=m?"100vw":a;s.style.setProperty("--ai-assistant-panel-actual-width",x),i&&n&&(s.style.marginRight=m?"0":a)};return window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)},[i,n,a]),e.jsxs(e.Fragment,{children:[o,e.jsx($,{width:a})]})}const Z=l.memo(({children:o,className:a,breadcrumbs:i,...n})=>e.jsx(_,{children:e.jsxs(F,{children:[e.jsx(H,{breadcrumbs:i,className:a,...n,children:o}),e.jsx(G,{})]})}));export{Z as A};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as D,j as e,h as y,aK as J,q as G,B as _,aL as K,v as V,w as W,aM as Y,M as L,N as R,E as Q,O as B,r as X,aN as Z,W as ee,L as z,ae as te,af as se,aO as ae}from"./app.js";import{Breadcrumbs as re}from"./breadcrumbs-BS5uXMaM.js";import{NavUser as oe}from"./nav-user-e1Cj0abB.js";import{ThemeSwitcher as ne}from"./theme-switcher-xFldiRZz.js";import{r as a}from"./monaco-ICtx6xoc.js";import ie from"./material-icon-DwkE6wKL.js";const F=a.createContext(void 0),je=({children:l})=>{const[w,o]=a.useState([]),[m,u]=a.useState([]),[p,f]=a.useState([]),[E,c]=a.useState(!1),[n,h]=a.useState(null),[j,C]=a.useState(""),v=D(),[g,S]=a.useState({}),M=[...m,...p],x=async()=>{try{const t=await y.get(`${window.routePrefix}/notifications/api`,{params:{unreadOnly:!0,limit:4}});o(t.data)}catch(t){console.error("Error fetching bell notifications:",t)}},i=async()=>{try{const t=await y.post(`${window.routePrefix}/notifications`);S(t.data)}catch(t){console.log(t)}},A=async()=>{await x()},b=async()=>{try{const t=await y.get(`${window.routePrefix}/notifications/api/get-classes`);t.data&&(h(t.data.activeServices),C(t.data.initTab))}catch(t){console.error("Error fetching tabs:",t)}},$=async(t,s)=>{try{if(!t){await P(s);return}const r=await y.post(`${window.routePrefix}/notifications/api/search`,{s:t,notificationClass:s});f(r.data)}catch(r){console.error("Error searching notifications:",r)}},P=async t=>{c(!0);try{const s=`${window.routePrefix}/notifications/api/${t}`,r=await y.get(s,{params:{limit:20,skip:0,unreadOnly:!1}});return u([]),f(r.data),r.data}catch(s){return console.error("Error fetching all notifications:",s),[]}finally{c(!1)}},k=async(t,s)=>{try{const r=`${window.routePrefix}/notifications/api/${t}`,d=await y.get(r,{params:{limit:20,skip:s,unreadOnly:!1}});return f(N=>[...N,...d.data]),d.data}catch(r){return console.error("Error paginating notifications:",r),[]}};a.useEffect(()=>{if(!v.props.notifications)return;i(),x();const t=new EventSource(`${window.routePrefix}/notifications/api/stream`);return t.addEventListener("connected",s=>{const r=JSON.parse(s.data);console.log("Connected event:",r),b()}),t.addEventListener("notification",s=>{const r=JSON.parse(s.data);u(d=>[r,...d]),o(d=>[r,...d].slice(0,4))}),t.onerror=()=>{console.error("SSE connection error")},()=>t.close()},[]);const I=async(t,s)=>{try{await y.put(`${window.routePrefix}/notifications/api/${t}/${s}/read`,{}),u(r=>r.map(d=>d.id===s?{...d,read:!0}:d)),f(r=>r.map(d=>d.id===s?{...d,read:!0}:d)),o([])}catch(r){console.error("Error marking as read:",r)}},T=async()=>{try{await y.put(`${window.routePrefix}/notifications/api/read-all`),u(t=>t.map(s=>({...s,read:!0}))),f(t=>t.map(s=>({...s,read:!0}))),await x()}catch(t){console.error("Error marking all as read:",t)}},O=w.filter(t=>!t.read).length;return e.jsx(F.Provider,{value:{bellNotifications:w,allNotifications:M,unreadCount:O,getTabs:b,tabs:n,initTab:j,search:$,markAsRead:I,markAllAsRead:T,getLocale:i,messages:g,fetchAllNotifications:P,paginateNotifications:k,loading:E,refreshBellNotifications:A},children:l})},H=()=>{const l=a.useContext(F);if(l===void 0)throw new Error("useNotifications must be used within a NotificationProvider");return l};function ce(){const{bellNotifications:l,markAsRead:w,unreadCount:o,refreshBellNotifications:m,messages:u}=H(),[p,f]=a.useState(!1),E=async(n,h)=>{f(!0);try{await w(n,h),await m()}catch(j){console.error("Error marking as read:",j)}finally{f(!1)}},c=n=>{const h=new Date,j=new Date(n),C=h.getTime()-j.getTime(),v=Math.floor(C/1e3),g=new Intl.RelativeTimeFormat("en",{numeric:"auto"});if(v<60)return g.format(-v,"second");const S=Math.floor(v/60);if(S<60)return g.format(-S,"minute");const M=Math.floor(S/60);if(M<24)return g.format(-M,"hour");const x=Math.floor(M/24);if(x<30)return g.format(-x,"day");const i=Math.floor(x/30);if(i<12)return g.format(-i,"month");const A=Math.floor(i/12);return g.format(-A,"year")};return e.jsxs(J,{children:[e.jsx(G,{asChild:!0,className:"cursor-pointer data-[state=open]:bg-sidebar-accent",children:e.jsxs(_,{variant:"ghost",className:"relative",children:[e.jsx(K,{}),o>0&&e.jsx("div",{className:"absolute top-1.5 right-1.5 size-1.5 rounded-full bg-destructive"})]})}),e.jsxs(V,{className:"z-[1002] p-2",align:"end",onCloseAutoFocus:n=>n.preventDefault(),children:[e.jsx(W,{className:`${p?"opacity-50 pointer-events-none":""}`,children:l.length===0?e.jsx("div",{className:"p-4 text-center text-muted-foreground",children:"No notifications"}):l.map(n=>e.jsxs("div",{children:[e.jsx(Y,{asChild:!0,className:"cursor-pointer",onSelect:h=>{h.preventDefault(),X.visit(`${window.routePrefix}/notifications?type=${n.notificationClass}`)},children:e.jsxs("div",{className:"grid grid-cols-[32px_250px] grid-rows-[auto_1fr] items-start gap-x-4 gap-y-2",children:[n.icon?e.jsx(ie,{name:n.icon.icon,style:{color:n.icon.iconColor},className:"!text-[32px]"}):e.jsx("div",{}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium",children:n.title}),e.jsx("span",{className:"truncate",children:n.message})]}),e.jsxs("div",{className:"col-start-2 flex justify-between flex-nowrap items-center",children:[e.jsx("div",{className:"flex flex-nowrap gap-2 items-center",children:e.jsx("div",{children:c(n.createdAt)})}),e.jsxs(L,{children:[e.jsx(R,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"icon",className:"size-4",onClick:h=>{h.stopPropagation(),E(n.notificationClass,n.id)},children:e.jsx(Q,{className:"text-primary"})})}),e.jsx(B,{side:"left",className:"z-[1003]",children:e.jsx("p",{children:u["Make read"]})})]})]})]})}),e.jsx(Z,{})]},n.id))}),e.jsx(_,{variant:"secondary",asChild:!0,children:e.jsxs(ee,{href:`${window.routePrefix}/notifications`,className:`w-full ${p?"opacity-50 pointer-events-none":""}`,children:[u["View All"],p&&e.jsx(z,{className:"h-4 w-4 animate-spin"})]})})]})]})}const le=()=>{if(!(typeof window>"u"))return window.__adminizerAiAssistantState__??void 0},de=l=>{typeof window>"u"||(window.__adminizerAiAssistantState__=l)},U=a.createContext(void 0),ve=({children:l})=>{const o=D().props.aiAssistant,m=a.useMemo(()=>le(),[]),[u,p]=a.useState(()=>(m==null?void 0:m.isOpen)??!1),[f,E]=a.useState([]),[c,n]=a.useState(()=>(m==null?void 0:m.activeModel)??(o==null?void 0:o.defaultModel)??void 0),[h,j]=a.useState([]),[C,v]=a.useState(!1),[g,S]=a.useState(!1),[M,x]=a.useState(null),i=(o==null?void 0:o.enabled)??!1,A=a.useCallback(async()=>{if(i)try{v(!0);const{data:s}=await y.get(`${window.routePrefix}/api/ai-assistant/models`);E(s),n(r=>{var N;return r||(o!=null&&o.defaultModel&&s.some(q=>q.id===o.defaultModel)?o.defaultModel:(N=s[0])==null?void 0:N.id)})}catch(s){console.error("Failed to load AI assistant models",s),x("Unable to load AI assistant models")}finally{v(!1)}},[o==null?void 0:o.defaultModel,i]),b=a.useCallback(async s=>{if(!(!i||!s))try{v(!0);const{data:r}=await y.get(`${window.routePrefix}/api/ai-assistant/history/${s}`);j(r.history??[])}catch(r){console.error("Failed to load AI assistant history",r),x("Unable to load AI assistant history")}finally{v(!1)}},[i]);a.useEffect(()=>{if(!i){j([]);return}A()},[A,i]),a.useEffect(()=>{!i||!c||b(c)},[c,b,i]);const $=a.useCallback(s=>{n(s)},[]),P=a.useCallback(()=>p(!0),[]),k=a.useCallback(()=>p(!1),[]),I=a.useCallback(()=>p(s=>!s),[]),T=a.useCallback(async s=>{if(!i||!c)return;const r=s.trim();if(!r)return;const d={id:`tmp-${Date.now()}`,role:"user",content:r,timestamp:new Date().toISOString(),modelId:c};j(N=>[...N,d]),S(!0),x(null);try{const{data:N}=await y.post(`${window.routePrefix}/api/ai-assistant/query`,{modelId:c,message:r});j(N.history??[])}catch(N){console.error("Failed to send AI assistant message",N),x("Unable to reach AI assistant"),await b(c)}finally{S(!1)}},[c,b,i]),O=a.useCallback(async()=>{c&&await b(c)},[c,b]);a.useEffect(()=>{i||p(!1)},[i]),a.useEffect(()=>{de({isOpen:u,activeModel:c})},[c,u]);const t=a.useMemo(()=>({isEnabled:i,isOpen:u,openChat:P,closeChat:k,toggleChat:I,models:f,activeModel:c,setActiveModel:$,messages:h,loading:C,sending:g,error:M,sendMessage:T,refreshHistory:O}),[c,k,M,i,u,C,h,f,P,O,T,g,$,I]);return e.jsx(U.Provider,{value:t,children:l})},ue=()=>{const l=a.useContext(U);if(!l)throw new Error("useAiAssistant must be used within an AiAssistantProvider");return l};function fe(){const{isEnabled:l,isOpen:w,toggleChat:o,models:m,sending:u,loading:p}=ue();if(!l)return null;const f=m.length>0;return e.jsx(e.Fragment,{children:e.jsxs(L,{children:[e.jsx(R,{asChild:!0,children:e.jsx(_,{variant:"ghost",className:te("relative",{"text-primary":w}),onClick:o,"aria-expanded":w,"aria-haspopup":"true","aria-controls":"ai-assistant-panel",disabled:!f&&p,children:u?e.jsx(z,{className:"size-4 animate-spin"}):e.jsx(se,{className:"size-4"})})}),e.jsx(B,{side:"bottom",className:"z-[1002]",children:e.jsx("span",{children:"AI assistant"})})]})})}function me({breadcrumbs:l=[]}){const{tabs:w}=H(),o=D();return e.jsx("header",{className:"border-sidebar-border/50 flex h-16 shrink-0 items-center gap-2 border-b px-6 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12 md:px-4",children:e.jsxs("div",{className:"flex justify-between w-full",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"-ml-1"}),e.jsx(re,{breadcrumbs:l})]}),e.jsxs("div",{className:"flex gap-4 items-center",children:[e.jsx(fe,{}),e.jsx(ne,{}),o.props.notifications&&(w===null?e.jsx("div",{className:"w-[40px] flex-none flex justify-center",children:e.jsx(z,{className:"size-4 animate-spin"})}):w.length?e.jsx(ce,{}):null),e.jsx(oe,{})]})]})})}const Ne=Object.freeze(Object.defineProperty({__proto__:null,AppSidebarHeader:me},Symbol.toStringTag,{value:"Module"}));export{me as A,je as N,ue as a,ve as b,Ne as c,H as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r,ba as i,bb as n,bc as c,bd as d,be as m,W as l,bf as h}from"./app.js";import{r as o}from"./monaco-ICtx6xoc.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./handsontable-PVakPtJV.js";function f({breadcrumbs:e}){return r.jsx(r.Fragment,{children:e.length>0&&r.jsx(i,{children:r.jsx(n,{children:e.map((s,t)=>{const a=t===e.length-1;return r.jsxs(o.Fragment,{children:[r.jsx(c,{children:a?r.jsx(d,{children:s.title}):r.jsx(m,{asChild:!0,children:r.jsx(l,{href:s.href,children:s.title})})}),!a&&r.jsx(h,{})]},t)})})})})}export{f as Breadcrumbs};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s,a9 as x,av as h,B as e,_ as j,ao as m,aa as u,ab as p,ac as D,aq as g,ar as r,W as v}from"./app.js";import{r as C}from"./monaco-ICtx6xoc.js";import{Icon as f}from"./icon-DpkedrXG.js";const y=C.forwardRef(({btnTitle:i,link:t,delModal:a,handleDelete:l,variant:n,btnCLass:o,isLink:c=!0},d)=>s.jsxs(x,{children:[s.jsx(h,{asChild:!0,children:s.jsxs(e,{ref:d,size:"list",variant:n??"ghost",className:j("cursor-pointer",o),children:[s.jsx(f,{iconNode:m}),i]})}),s.jsxs(u,{className:"sm:max-w-[425px] z-[1011]",children:[s.jsxs(p,{children:[s.jsx(D,{children:"Delete"}),s.jsx("div",{className:"mt-2 text-base",children:a.text})]}),s.jsxs(g,{children:[s.jsx(r,{asChild:!0,children:c?s.jsx(e,{variant:"destructive",asChild:!0,children:s.jsx(v,{href:t??"#",children:a.yes})}):s.jsx(e,{variant:"destructive",asChild:!0,onClick:l,children:s.jsx("span",{children:a.yes})})}),s.jsx(r,{asChild:!0,children:s.jsx(e,{type:"button",variant:"secondary",children:a.no})})]})]})]}));y.displayName="DeleteModal";export{y as D};
|
package/assets/form-wcpZWHjp.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./app.js";import{A as o}from"./app-layout-mpp8ni0G.js";import t from"./form-DMLPoAW8.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./monaco-ICtx6xoc.js";import"./handsontable-PVakPtJV.js";import"./app-shell-CggZrBz6.js";import"./app-sidebar-Do2eoo3w.js";import"./nav-main-CZa4xkP1.js";import"./material-icon-DwkE6wKL.js";import"./app-sidebar-header-pfquDpHT.js";import"./breadcrumbs-BS5uXMaM.js";import"./nav-user-e1Cj0abB.js";import"./user-info-DrdQBvFb.js";import"./user-menu-content-ePAt_cwK.js";import"./theme-switcher-xFldiRZz.js";import"./icon-DpkedrXG.js";import"./add-form-BfIXZ_9g.js";import"./field-renderer-CUYWPzfi.js";import"./dynamic-controls-BOYmRX_z.js";import"./input-error-CmXZF6xy.js";const m=[];function g(){return r.jsx(o,{breadcrumbs:m,children:r.jsx(t,{})})}export{g as default};
|
package/assets/list-DfqnQZpI.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./app.js";import{A as r}from"./app-layout-mpp8ni0G.js";import t from"./list-table-CmYyTdS5.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./monaco-ICtx6xoc.js";import"./handsontable-PVakPtJV.js";import"./app-shell-CggZrBz6.js";import"./app-sidebar-Do2eoo3w.js";import"./nav-main-CZa4xkP1.js";import"./material-icon-DwkE6wKL.js";import"./app-sidebar-header-pfquDpHT.js";import"./breadcrumbs-BS5uXMaM.js";import"./nav-user-e1Cj0abB.js";import"./user-info-DrdQBvFb.js";import"./user-menu-content-ePAt_cwK.js";import"./theme-switcher-xFldiRZz.js";import"./icon-DpkedrXG.js";import"./del-modal-P8KiMFNx.js";import"./pagination-render-C1OX0c6q.js";const m=[],E=()=>o.jsx(r,{breadcrumbs:m,className:"overflow-auto h-[calc(100svh-16px)]",children:o.jsx(t,{})});export{E as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aj as i,j as n,B as c,bs as p,bt as m,bu as u}from"./app.js";import{Icon as h}from"./icon-DpkedrXG.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./monaco-ICtx6xoc.js";import"./handsontable-PVakPtJV.js";function g(){const{appearance:t,updateAppearance:s}=i(),o={light:"dark",dark:"system",system:"light"},a={light:u,dark:m,system:p},e=()=>s(o[t]),r=a[t];return n.jsx(c,{variant:"ghost",size:"icon",onClick:e,className:"shrink-0",children:n.jsx(h,{iconNode:r})})}export{g as ThemeSwitcher,g as default};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare class AiAssistantController {
|
|
2
|
-
static getModels(req: ReqType, res: ResType): Promise<ResType>;
|
|
3
|
-
static getHistory(req: ReqType, res: ResType): Promise<ResType>;
|
|
4
|
-
static sendMessage(req: ReqType, res: ResType): Promise<ResType>;
|
|
5
|
-
static resetHistory(req: ReqType, res: ResType): Promise<ResType>;
|
|
6
|
-
private static serializeMessage;
|
|
7
|
-
}
|