headroom-cms 0.1.3 → 0.1.4
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/admin/assets/{AdminsPage-DYJhlQnA.js → AdminsPage-Cvqw6UOu.js} +1 -1
- package/admin/assets/{AllContentPage-DShBvFru.js → AllContentPage-Cnkt8Fgm.js} +1 -1
- package/admin/assets/{ApiKeysPage-DONrd-TJ.js → ApiKeysPage-FLex3Chc.js} +1 -1
- package/admin/assets/{AuditPage-BwhYu96L.js → AuditPage-ClgwR_8y.js} +1 -1
- package/admin/assets/{BlockEditor-C0KaZUHQ.js → BlockEditor-uSyk_TPt.js} +1 -1
- package/admin/assets/{BlockTypeEditPage-BYJfEA6l.js → BlockTypeEditPage-Dr_yNLDI.js} +1 -1
- package/admin/assets/{BlockTypesPage-Pf9u78-O.js → BlockTypesPage-CwsGPuAZ.js} +1 -1
- package/admin/assets/{BulkActionBar-BX-t8fyM.js → BulkActionBar-C-88Wnqw.js} +1 -1
- package/admin/assets/{CollectionEditPage-CQGo9Cbu.js → CollectionEditPage-Cimkb84B.js} +1 -1
- package/admin/assets/{CollectionsPage-D-QTkoW_.js → CollectionsPage-CxnSFPCH.js} +1 -1
- package/admin/assets/{ContentCreatePage-DujNZXXj.js → ContentCreatePage-DZCyOcte.js} +1 -1
- package/admin/assets/ContentEditPage-RtHbU_l4.js +3 -0
- package/admin/assets/{ContentListPage-llAlhZTH.js → ContentListPage-qFcZVzg9.js} +1 -1
- package/admin/assets/{CustomBlockPreview-CCiZrZhi.js → CustomBlockPreview-ers8OdZ0.js} +1 -1
- package/admin/assets/{FieldBuilder-B3-3MTqp.js → FieldBuilder-Ds-agLm7.js} +1 -1
- package/admin/assets/{LoginPage-BlJXP0GH.js → LoginPage-uxiw8K1J.js} +1 -1
- package/admin/assets/{MediaPage-Cad4n33B.js → MediaPage-CeepVDHQ.js} +1 -1
- package/admin/assets/{SiteSettingsPage-xfAm3ZKQ.js → SiteSettingsPage-xkngL15i.js} +1 -1
- package/admin/assets/SitesPage-BD9tou9-.js +1 -0
- package/admin/assets/{TagsPage-DNlaoFCE.js → TagsPage-BxSwTLpQ.js} +1 -1
- package/admin/assets/{UsersPage-D_nOx6W9.js → UsersPage-BayuQyLh.js} +1 -1
- package/admin/assets/{WebhookEditPage-BUvLl4rY.js → WebhookEditPage-BrXm8Dht.js} +1 -1
- package/admin/assets/{WebhooksPage-CG7WC9Bq.js → WebhooksPage-BUE6XuIP.js} +1 -1
- package/admin/assets/{badge-ChZ2DZue.js → badge-B8OxObuF.js} +1 -1
- package/admin/assets/{card-DpNr7WTb.js → card-C7fgQS_U.js} +1 -1
- package/admin/assets/check-CxKAR64t.js +1 -0
- package/admin/assets/{checkbox-VtCfoGic.js → checkbox-BV2kjQBe.js} +1 -1
- package/admin/assets/{command-98iA8Va4.js → command-qGFnWxcS.js} +1 -1
- package/admin/assets/{copy-fXL6Ngxi.js → copy-CgYzmj06.js} +1 -1
- package/admin/assets/{core.esm-BtFZvlg0.js → core.esm-DRuhixPo.js} +1 -1
- package/admin/assets/index-DX9xeoQx.js +18 -0
- package/admin/assets/index-PpbsYFRh.css +1 -0
- package/admin/assets/{plus-2Ds_MoqB.js → plus-HdRn2U0S.js} +1 -1
- package/admin/assets/{popover-DFInMOpa.js → popover-Cou924mw.js} +1 -1
- package/admin/assets/{radix-n1vDIPi6.js → radix-lA_IxTIV.js} +1 -1
- package/admin/assets/{react-vendor-DNVhVxD7.js → react-vendor-B0Dih9Pj.js} +1 -1
- package/admin/assets/{search-DRNC6QB5.js → search-C-3Q9nn7.js} +1 -1
- package/admin/assets/{select-Cj54Wt-H.js → select-CHW5R8qv.js} +1 -1
- package/admin/assets/{sortable.esm-BUhmZW2_.js → sortable.esm-CBJBhe4k.js} +1 -1
- package/admin/assets/{table-D4rLgOKa.js → table-BjSue8Ev.js} +1 -1
- package/admin/assets/{tanstack-BO6c-AOu.js → tanstack-oFmRhGwV.js} +1 -1
- package/admin/assets/{trash-2-CbbWF_O4.js → trash-2-CWWRVuRB.js} +1 -1
- package/admin/assets/{use-mobile-Cvl5tIVY.js → use-mobile-C1r2eP64.js} +1 -1
- package/admin/assets/useAdminResolver-D6B6RXnk.js +1 -0
- package/admin/assets/useContent-f19XHVlJ.js +1 -0
- package/admin/assets/{useDebouncedValue-Bf8UizjU.js → useDebouncedValue-DHUCnm9B.js} +1 -1
- package/admin/assets/{useMedia-DjiNKMOU.js → useMedia-DkvP1QLG.js} +1 -1
- package/admin/assets/{useTags-BB47vbXO.js → useTags-BuXf7_7H.js} +1 -1
- package/admin/assets/{useWebhooks-DS4Ee8Wk.js → useWebhooks-Cx9tbBME.js} +1 -1
- package/admin/index.html +5 -5
- package/admin/sw.js +1 -1
- package/lambda/api/bootstrap +0 -0
- package/lambda/webhook-worker/bootstrap +0 -0
- package/package.json +1 -1
- package/admin/assets/ContentEditPage-DyqgEoAe.js +0 -3
- package/admin/assets/SitesPage-DnCiSu23.js +0 -1
- package/admin/assets/check-BMpruHpO.js +0 -1
- package/admin/assets/index-CwkwXbO-.js +0 -18
- package/admin/assets/index-FYfbavkE.css +0 -1
- package/admin/assets/useAdminResolver-B-_1f6SR.js +0 -1
- package/admin/assets/useContent-Cp41wBYR.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-
|
|
1
|
+
import{j as e}from"./tanstack-oFmRhGwV.js";import{u as H,r as x}from"./react-vendor-B0Dih9Pj.js";import{o as L,u as q,a7 as B,a8 as _,p as z,a9 as M,aa as V,S as y,D as G,i as $,B as l,j as J,k as K,l as Q,m as W,I as X,n as Y,t as i}from"./index-DX9xeoQx.js";import{u as Z}from"./useAdminResolver-D6B6RXnk.js";import{T as ee,a as se,b,c as p,d as ae,e as j}from"./table-BjSue8Ev.js";import{P as ie,a as te,b as ne}from"./popover-Cou924mw.js";import{C as re,a as oe,b as le,c as de,d as ce,e as me}from"./command-qGFnWxcS.js";import{S as ue,a as he,b as xe,c as pe,d as C}from"./select-CHW5R8qv.js";import{P as je}from"./plus-HdRn2U0S.js";import{T as ve}from"./trash-2-CWWRVuRB.js";import"./radix-lA_IxTIV.js";import"./search-C-3Q9nn7.js";import"./check-CxKAR64t.js";const fe=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],ge=L("user-plus",fe);function ke(){const{host:d}=H(),{user:N}=q(),S=B(),{data:A,isLoading:I}=_(d),{data:T}=z(),c=M(d),m=V(d),n=A?.admins??[],E=T?.items??[],r=S==="admin",v=n.map(s=>s.id),{resolve:w}=Z(v),[D,f]=x.useState(!1),[P,g]=x.useState(!1),[u,h]=x.useState("");if(I)return e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{className:"h-8 w-64"}),Array.from({length:3}).map((s,a)=>e.jsx(y,{className:"h-12 w-full"},a))]});const R=E.filter(s=>!v.includes(s.sub));async function k(s){try{await c.mutateAsync({admins:[...n,{id:s,role:"editor"}]}),i.success("Admin added"),f(!1)}catch(a){i.error("Failed to add admin",{description:a instanceof Error?a.message:void 0})}}async function U(s){if(s.preventDefault(),!!u.trim())try{const a=await m.mutateAsync({email:u.trim()});a.existed?i.success("Existing user added to site"):i.success("Invite email sent",{description:`An invite has been sent to ${a.email}`}),h(""),g(!1)}catch(a){i.error("Failed to invite user",{description:a instanceof Error?a.message:void 0})}}async function O(s){try{await c.mutateAsync({admins:n.filter(a=>a.id!==s)}),i.success("Admin removed")}catch(a){i.error("Failed to remove admin",{description:a instanceof Error?a.message:void 0})}}async function F(s,a){const o=n.map(t=>t.id===s?{...t,role:a}:t);if(!o.some(t=>t.role==="admin")){i.error("At least one admin role is required");return}try{await c.mutateAsync({admins:o}),i.success("Role updated")}catch(t){i.error("Failed to update role",{description:t instanceof Error?t.message:void 0})}}return e.jsxs("div",{children:[e.jsx("h1",{className:"mb-6 text-2xl font-semibold",children:"Admins"}),r&&e.jsxs("div",{className:"mb-6 flex gap-2",children:[e.jsxs(G,{open:P,onOpenChange:s=>{g(s),s||h("")},children:[e.jsx($,{asChild:!0,children:e.jsxs(l,{children:[e.jsx(ge,{className:"mr-2 h-4 w-4"}),"Invite by email"]})}),e.jsxs(J,{children:[e.jsxs(K,{children:[e.jsx(Q,{children:"Invite User to Site"}),e.jsx(W,{className:"sr-only",children:"Send an invite email to add a user to this site"})]}),e.jsxs("form",{onSubmit:U,className:"space-y-4",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Enter an email address. If the user doesn't have an account yet, they'll receive an invite email."}),e.jsx(X,{type:"email",value:u,onChange:s=>h(s.target.value),placeholder:"email@example.com",required:!0}),e.jsx(Y,{children:e.jsx(l,{type:"submit",disabled:m.isPending,children:m.isPending?"Inviting...":"Send Invite"})})]})]})]}),e.jsxs(ie,{open:D,onOpenChange:f,children:[e.jsx(te,{asChild:!0,children:e.jsxs(l,{variant:"outline",children:[e.jsx(je,{className:"mr-2 h-4 w-4"}),"Add existing user"]})}),e.jsx(ne,{className:"w-72 p-0",align:"start",children:e.jsxs(re,{children:[e.jsx(oe,{placeholder:"Search users..."}),e.jsxs(le,{children:[e.jsx(de,{children:"No users found."}),e.jsx(ce,{children:R.map(s=>e.jsx(me,{value:s.email,onSelect:()=>k(s.sub),children:s.email},s.sub))})]})]})})]})]}),n.length===0?e.jsx("p",{className:"text-muted-foreground",children:"No admins configured."}):e.jsxs(ee,{children:[e.jsx(se,{children:e.jsxs(b,{children:[e.jsx(p,{children:"Email"}),e.jsx(p,{children:"Role"}),r&&e.jsx(p,{})]})}),e.jsx(ae,{children:n.map(s=>{const a=s.id===N?.sub;return e.jsxs(b,{children:[e.jsxs(j,{className:"text-sm",children:[w(s.id),a&&e.jsx("span",{className:"ml-2 text-muted-foreground",children:"(you)"})]}),e.jsx(j,{children:r&&!a?e.jsxs(ue,{value:s.role,onValueChange:o=>F(s.id,o),children:[e.jsx(he,{className:"w-28",children:e.jsx(xe,{})}),e.jsxs(pe,{children:[e.jsx(C,{value:"admin",children:"Admin"}),e.jsx(C,{value:"editor",children:"Editor"})]})]}):e.jsx("span",{className:"text-sm capitalize",children:s.role})}),r&&e.jsx(j,{className:"text-right",children:!a&&e.jsx(l,{variant:"ghost",size:"sm",onClick:()=>O(s.id),title:"Remove from site",children:e.jsx(ve,{className:"h-4 w-4"})})})]},s.id)})})]})]})}export{ke as AdminsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./tanstack-
|
|
1
|
+
import{j as s}from"./tanstack-oFmRhGwV.js";import{u as T,e as D,r as C}from"./react-vendor-B0Dih9Pj.js";import{u as M,a as L,b as R,c as z}from"./useContent-f19XHVlJ.js";import{u as E,m as w}from"./use-mobile-C1r2eP64.js";import{v as H,t as r,S as F,w as V,B as _}from"./index-DX9xeoQx.js";import{B as h}from"./badge-B8OxObuF.js";import{C as q,c as G}from"./card-C7fgQS_U.js";import{C as m}from"./checkbox-BV2kjQBe.js";import{T as J,a as K,b as k,c as i,d as O,e as d}from"./table-BjSue8Ev.js";import{f as S}from"./format-C88SDH8g.js";import{B as Q}from"./BulkActionBar-C-88Wnqw.js";import"./radix-lA_IxTIV.js";import"./check-CxKAR64t.js";function ie(){const{host:c}=T(),p=D(),{collections:y}=H(),A=E(),[$,I]=C.useState(),[n,a]=C.useState(new Set),{data:o,isLoading:P}=M(c,$),f=L(c),j=R(c),g=z(c),b=new Map(y.map(e=>[e.name,e.label])),x=o?.items.map(e=>e.contentId)??[],N=x.length>0&&x.every(e=>n.has(e));function v(e){a(l=>{const t=new Set(l);return t.has(e)?t.delete(e):t.add(e),t})}function B(){a(N?new Set:new Set(x))}const U=f.isPending||j.isPending||g.isPending;return s.jsxs("div",{children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("h1",{className:"text-2xl font-semibold",children:"All Content"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Recently updated content across all collections."})]}),n.size>0&&s.jsx(Q,{selectedCount:n.size,onPublish:async()=>{const e=[...n],t=(await f.mutateAsync(e)).filter(u=>u.status==="rejected").length;t?r.error(`${t} of ${e.length} failed to publish`):r.success(`${e.length} item(s) published`),a(new Set)},onUnpublish:async()=>{const e=[...n],t=(await j.mutateAsync(e)).filter(u=>u.status==="rejected").length;t?r.error(`${t} of ${e.length} failed to unpublish`):r.success(`${e.length} item(s) unpublished`),a(new Set)},onDelete:async()=>{const e=[...n],t=(await g.mutateAsync(e)).filter(u=>u.status==="rejected").length;t?r.error(`${t} of ${e.length} failed to delete`):r.success(`${e.length} item(s) deleted`),a(new Set)},onClear:()=>a(new Set),isPending:U}),P?s.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((e,l)=>s.jsx(F,{className:"h-12 w-full"},l))}):o?.items.length?s.jsxs(s.Fragment,{children:[A?s.jsx("div",{className:"grid gap-3","data-testid":"all-content-card-view",children:o.items.map(e=>{const l=e.coverUrl;return s.jsx(q,{className:V("cursor-pointer gap-0 overflow-hidden py-0 transition-shadow hover:shadow-md",n.has(e.contentId)&&"ring-2 ring-primary"),onClick:()=>p(`/sites/${c}/content/${e.collection}/${e.contentId}`),children:s.jsx(G,{className:"p-3",children:s.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[l&&s.jsx("img",{src:w(l),alt:"",className:"h-12 w-12 rounded object-cover flex-shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("span",{className:"font-medium truncate",children:e.title||"Untitled"}),s.jsx(h,{variant:e.publishedAt?"default":"secondary",className:"shrink-0",children:e.publishedAt?"Published":"Draft"})]}),e.slug&&s.jsxs("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:["/",e.slug]}),s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[s.jsx(h,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:b.get(e.collection)??e.collection}),s.jsx("span",{className:"text-xs text-muted-foreground",children:e.publishedAt?S(e.publishedAt):"—"})]})]}),s.jsx(m,{checked:n.has(e.contentId),onCheckedChange:()=>v(e.contentId),onClick:t=>t.stopPropagation(),className:"mt-1"})]})})},e.contentId)})}):s.jsxs(J,{children:[s.jsx(K,{children:s.jsxs(k,{children:[s.jsx(i,{className:"w-10",children:s.jsx(m,{checked:N,onCheckedChange:B,"aria-label":"Select all"})}),s.jsx(i,{children:"Title"}),s.jsx(i,{children:"Slug"}),s.jsx(i,{children:"Collection"}),s.jsx(i,{children:"Status"}),s.jsx(i,{children:"Updated"})]})}),s.jsx(O,{children:o.items.map(e=>s.jsxs(k,{className:"cursor-pointer",onClick:()=>p(`/sites/${c}/content/${e.collection}/${e.contentId}`),children:[s.jsx(d,{onClick:l=>l.stopPropagation(),children:s.jsx(m,{checked:n.has(e.contentId),onCheckedChange:()=>v(e.contentId),"aria-label":`Select ${e.title||"Untitled"}`})}),s.jsx(d,{className:"font-medium",children:s.jsxs("div",{className:"flex items-center gap-3",children:[!!e.coverUrl&&s.jsx("img",{src:w(e.coverUrl),alt:"",className:"h-8 w-8 rounded object-cover flex-shrink-0"}),s.jsx("span",{children:e.title||"Untitled"})]})}),s.jsx(d,{className:"text-muted-foreground text-sm",children:e.slug||"—"}),s.jsx(d,{children:s.jsx(h,{variant:"outline",children:b.get(e.collection)??e.collection})}),s.jsx(d,{children:s.jsx(h,{variant:e.publishedAt?"default":"secondary",children:e.publishedAt?"Published":"Draft"})}),s.jsx(d,{className:"text-muted-foreground",children:e.publishedAt?S(e.publishedAt):"—"})]},e.contentId))})]}),o.hasMore&&s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(_,{variant:"outline",onClick:()=>I(o.cursor??void 0),children:"Load More"})})]}):s.jsx("p",{className:"text-muted-foreground",children:"No content yet."})]})}export{ie as AllContentPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as L,a as N,b as A,j as e}from"./tanstack-
|
|
1
|
+
import{u as L,a as N,b as A,j as e}from"./tanstack-oFmRhGwV.js";import{u as q,r as m}from"./react-vendor-B0Dih9Pj.js";import{e as f,B as r,S as E,D as K,j as D,k as w,l as I,m as T,I as g,n as p,L as O,t as x}from"./index-DX9xeoQx.js";import{T as G,a as Q,b as k,c as d,d as R,e as u}from"./table-BjSue8Ev.js";import{f as C}from"./format-C88SDH8g.js";import{P as $}from"./plus-HdRn2U0S.js";import{T as B}from"./trash-2-CWWRVuRB.js";import{C as H}from"./copy-CgYzmj06.js";import"./radix-lA_IxTIV.js";function U(s){const t=f();return L({queryKey:["sites",s,"api-keys"],queryFn:async()=>({items:(await t.apiFetch(`/v1/admin/sites/${s}/api-keys`)).keys}),enabled:!!s})}function z(s){const t=f(),n=N();return A({mutationFn:i=>t.apiFetch(`/v1/admin/sites/${s}/api-keys`,{method:"POST",body:JSON.stringify(i)}),onSuccess:()=>n.invalidateQueries({queryKey:["sites",s,"api-keys"]})})}function J(s,t){const n=f(),i=N();return A({mutationFn:()=>n.apiFetch(`/v1/admin/sites/${s}/api-keys/${t}`,{method:"DELETE"}),onSuccess:()=>i.invalidateQueries({queryKey:["sites",s,"api-keys"]})})}function te(){const{host:s}=q(),{data:t,isLoading:n}=U(s),i=z(s),[h,l]=m.useState(!1),[b,y]=m.useState(""),[o,j]=m.useState(null),[P,v]=m.useState(null);async function F(a){a.preventDefault();try{const c=await i.mutateAsync({label:b});j(c.key),y("")}catch(c){x.error("Failed to create API key",{description:c instanceof Error?c.message:void 0})}}function S(){o&&(navigator.clipboard.writeText(o),x.success("Copied to clipboard"))}return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"API Keys"}),e.jsxs(r,{onClick:()=>l(!0),children:[e.jsx($,{className:"mr-2 h-4 w-4"}),"Generate Key"]})]}),n?e.jsx("div",{className:"space-y-2",children:Array.from({length:3}).map((a,c)=>e.jsx(E,{className:"h-12 w-full"},c))}):t?.items.length?e.jsxs(G,{children:[e.jsx(Q,{children:e.jsxs(k,{children:[e.jsx(d,{children:"Label"}),e.jsx(d,{children:"Key ID"}),e.jsx(d,{children:"Created"}),e.jsx(d,{children:"Last Used"}),e.jsx(d,{})]})}),e.jsx(R,{children:t.items.map(a=>e.jsxs(k,{children:[e.jsx(u,{className:"font-medium",children:a.label}),e.jsx(u,{className:"font-mono text-xs",children:a.keyId}),e.jsx(u,{className:"text-muted-foreground",children:C(a.createdAt)}),e.jsx(u,{className:"text-muted-foreground",children:a.lastUsedAt?C(a.lastUsedAt):"Never"}),e.jsx(u,{children:e.jsx(r,{variant:"ghost",size:"sm",onClick:()=>v(a.keyId),children:e.jsx(B,{className:"h-4 w-4"})})})]},a.keyId))})]}):e.jsx("p",{className:"text-muted-foreground",children:"No API keys."}),e.jsx(K,{open:h,onOpenChange:a=>{l(a),a||(j(null),y(""))},children:e.jsxs(D,{children:[e.jsxs(w,{children:[e.jsx(I,{children:o?"API Key Generated":"Generate API Key"}),e.jsx(T,{className:"sr-only",children:"Create a new API key for site access"})]}),o?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Copy this key now. You won't be able to see it again."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{value:o,readOnly:!0,className:"font-mono text-xs"}),e.jsx(r,{variant:"outline",size:"icon",onClick:S,children:e.jsx(H,{className:"h-4 w-4"})})]}),e.jsx(p,{children:e.jsx(r,{onClick:()=>{l(!1),j(null)},children:"Done"})})]}):e.jsxs("form",{onSubmit:F,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"key-label",children:"Label"}),e.jsx(g,{id:"key-label",value:b,onChange:a=>y(a.target.value),required:!0,autoFocus:!0})]}),e.jsxs(p,{children:[e.jsx(r,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(r,{type:"submit",disabled:i.isPending,children:"Generate"})]})]})]})}),e.jsx(M,{host:s,keyId:P,onClose:()=>v(null)})]})}function M({host:s,keyId:t,onClose:n}){const i=J(s,t??"");async function h(){try{await i.mutateAsync(),x.success("API key revoked"),n()}catch(l){x.error("Failed to revoke",{description:l instanceof Error?l.message:void 0})}}return e.jsx(K,{open:!!t,onOpenChange:()=>n(),children:e.jsxs(D,{children:[e.jsxs(w,{children:[e.jsx(I,{children:"Revoke API key?"}),e.jsx(T,{children:"This action cannot be undone. Any applications using this key will lose access."})]}),e.jsxs(p,{children:[e.jsx(r,{variant:"outline",onClick:n,children:"Cancel"}),e.jsx(r,{variant:"destructive",onClick:h,children:"Revoke"})]})]})})}export{te as ApiKeysPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as x,j as e}from"./tanstack-
|
|
1
|
+
import{u as x,j as e}from"./tanstack-oFmRhGwV.js";import{u as h,r as f}from"./react-vendor-B0Dih9Pj.js";import{e as j,S as b,B as g}from"./index-DX9xeoQx.js";import{u as p}from"./useAdminResolver-D6B6RXnk.js";import{T as A,a as N,b as c,c as n,d as T,e as o}from"./table-BjSue8Ev.js";import{f as y}from"./format-C88SDH8g.js";import"./radix-lA_IxTIV.js";function S(a,t){const d=j(),s=new URLSearchParams;t?.action&&s.set("action",t.action),t?.before&&s.set("before",String(t.before));const r=s.toString();return x({queryKey:["sites",a,"audit",t?.action??"",t?.before??""],queryFn:()=>d.apiFetch(`/v1/admin/sites/${a}/audit${r?`?${r}`:""}`),enabled:!!a})}function C(){const{host:a}=h(),[t,d]=f.useState(),{data:s,isLoading:r}=S(a,{before:t}),l=s?.items.map(i=>i.adminId)??[],{resolve:m}=p(l);return e.jsxs("div",{children:[e.jsx("h1",{className:"mb-6 text-2xl font-semibold",children:"Audit Log"}),r?e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((i,u)=>e.jsx(b,{className:"h-12 w-full"},u))}):s?.items.length?e.jsxs(e.Fragment,{children:[e.jsxs(A,{children:[e.jsx(N,{children:e.jsxs(c,{children:[e.jsx(n,{children:"Action"}),e.jsx(n,{children:"Admin"}),e.jsx(n,{children:"Status"}),e.jsx(n,{children:"Time"})]})}),e.jsx(T,{children:s.items.map(i=>e.jsxs(c,{children:[e.jsx(o,{className:"font-medium",children:i.action}),e.jsx(o,{className:"text-sm",children:m(i.adminId)}),e.jsx(o,{children:e.jsx("span",{className:"text-muted-foreground",children:i.status})}),e.jsx(o,{className:"text-muted-foreground",children:y(i.createdAt)})]},i.eventId))})]}),s.hasMore&&s.items.length>0&&e.jsx("div",{className:"mt-4 flex justify-center",children:e.jsx(g,{variant:"outline",onClick:()=>d(s.items[s.items.length-1].createdAt),children:"Load More"})})]}):e.jsx("p",{className:"text-muted-foreground",children:"No audit events."})]})}export{C as AuditPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as y}from"./tanstack-BO6c-AOu.js";import{g as gC,r as C,b as bC,a as r3,R as Ie,u as yC,e as o3}from"./react-vendor-DNVhVxD7.js";import{o as i3,_ as eu,ah as s3,ai as a3,ag as Vm,D as EC,j as xC,k as CC,l as kC,m as TC,K as wC,L as Sf,X as l3,I as vf,B as Sa,n as SC,M as c3}from"./index-CwkwXbO-.js";import{ag as vC,ah as u3,ai as On,Q as ki,aj as Af,ak as d3,al as _f,am as f3,an as h3,ao as p3,ap as m3,R as g3,aq as b3,ar as Dr,as as Hi,at as Al,au as tu,av as y3,aw as E3,ax as ip,ay as x3,u as C3,s as k3,w as T3,A as w3,t as S3,az as v3,j as A3,L as _3,k as N3,i as I3,a4 as M3,a2 as O3,a3 as D3,a8 as L3,a9 as R3,aa as P3,a6 as B3,a7 as F3,a1 as H3,_ as U3,a0 as V3,Z as $3,T as j3,aA as z3,aB as q3,aC as W3,b as G3,aD as Y3,I as K3,C as Q3,aE as X3,aF as Z3,a as J3,ab as eN,ac as tN}from"./radix-n1vDIPi6.js";import{P as kd,S as AC}from"./command-98iA8Va4.js";import{B as nN}from"./badge-ChZ2DZue.js";import{M as rN,P as _C,F as oN,C as iN}from"./ContentEditPage-DyqgEoAe.js";import{m as sp}from"./use-mobile-Cvl5tIVY.js";import{C as sN}from"./CustomBlockPreview-CCiZrZhi.js";import"./search-DRNC6QB5.js";import"./useContent-Cp41wBYR.js";import"./useAdminResolver-B-_1f6SR.js";import"./select-Cj54Wt-H.js";import"./check-BMpruHpO.js";import"./format-C88SDH8g.js";import"./sortable.esm-BUhmZW2_.js";import"./core.esm-BtFZvlg0.js";import"./card-DpNr7WTb.js";import"./useMedia-DjiNKMOU.js";import"./useTags-BB47vbXO.js";import"./popover-DFInMOpa.js";import"./useDebouncedValue-Bf8UizjU.js";import"./plus-2Ds_MoqB.js";import"./checkbox-VtCfoGic.js";import"./trash-2-CbbWF_O4.js";import"./contentStatus-BmaiYVOm.js";const aN=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],lN=i3("paperclip",aN);function zt(t){this.content=t}zt.prototype={constructor:zt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new zt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new zt(n)},addToStart:function(t,e){return new zt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new zt(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new zt(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=zt.from(t),t.size?new zt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=zt.from(t),t.size?new zt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=zt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};zt.from=function(t){if(t instanceof zt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new zt(e)};function NC(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=NC(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function IC(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),a=e.child(--i),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let c=0,u=Math.min(s.text.length,a.text.length);for(;c<u&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let c=IC(s.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class V{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,o=0,i){for(let s=0,a=0;a<n;s++){let l=this.content[s],c=a+l.nodeSize;if(c>e&&r(l,o+a,i||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,o+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new V(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let a=this.content[i],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),o+=a.nodeSize),s=l}return new V(r,o)}cutByIndex(e,n){return e==n?V.empty:e==0&&n==this.content.length?this:new V(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new V(o,i)}addToStart(e){return new V([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new V(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return NC(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return IC(this,e,n,r)}findIndex(e){if(e==0)return Ql(0,e);if(e==this.size)return Ql(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=e)return i==e?Ql(n+1,i):Ql(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return V.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new V(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return V.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new V(n||e,r)}static from(e){if(!e)return V.empty;if(e instanceof V)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new V([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}V.empty=new V([],0);const Nf={index:0,offset:0};function Ql(t,e){return Nf.index=t,Nf.offset=e,Nf}function nu(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!nu(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!nu(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Ze=class ap{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))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 n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ap.none;if(e instanceof ap)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};Ze.none=[];class ru extends Error{}class Q{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=OC(this.content,e+this.openStart,n);return r&&new Q(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Q(MC(this.content,e+this.openStart,n+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,n){if(!n)return Q.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Q(V.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new Q(e,r,o)}}Q.empty=new Q(V.empty,0,0);function MC(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(o==e||i.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(MC(i.content,e-o-1,n-o-1)))}function OC(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=OC(s.content,e-i-1,n,s);return a&&t.replaceChild(o,s.copy(a))}function cN(t,e,n){if(n.openStart>t.depth)throw new ru("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ru("Inconsistent open depths");return DC(t,e,n,0)}function DC(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=DC(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,a=s.content;return mi(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=uN(n,t);return mi(i,RC(t,s,a,e,r))}else return mi(i,ou(t,e,r))}function LC(t,e){if(!e.type.compatibleContent(t.type))throw new ru("Cannot join "+e.type.name+" onto "+t.type.name)}function lp(t,e,n){let r=t.node(n);return LC(r,e.node(n)),r}function pi(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function va(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(pi(t.nodeAfter,r),i++));for(let a=i;a<s;a++)pi(o.child(a),r);e&&e.depth==n&&e.textOffset&&pi(e.nodeBefore,r)}function mi(t,e){return t.type.checkContent(e),t.copy(e)}function RC(t,e,n,r,o){let i=t.depth>o&&lp(t,e,o+1),s=r.depth>o&&lp(n,r,o+1),a=[];return va(null,t,o,a),i&&s&&e.index(o)==n.index(o)?(LC(i,s),pi(mi(i,RC(t,e,n,r,o+1)),a)):(i&&pi(mi(i,ou(t,e,o+1)),a),va(e,n,o,a),s&&pi(mi(s,ou(n,r,o+1)),a)),va(r,null,o,a),new V(a)}function ou(t,e,n){let r=[];if(va(null,t,n,r),t.depth>n){let o=lp(t,e,n+1);pi(mi(o,ou(t,e,n+1)),r)}return va(e,null,n,r),new V(r)}function uN(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(V.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class Ka{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(n);return r?e.child(n).cut(r):o}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ze.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let a=r;r=o,o=a}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new iu(this,e,r);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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(i),c=i-l;if(r.push(s,a,o+l),!c||(s=s.child(a),s.isText))break;i=c-1,o+=l+1}return new Ka(n,r,i)}static resolveCached(e,n){let r=h1.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else h1.set(e,r=new dN);let o=r.elts[r.i]=Ka.resolve(e,n);return r.i=(r.i+1)%fN,o}}class dN{constructor(){this.elts=[],this.i=0}}const fN=12,h1=new WeakMap;class iu{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}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 hN=Object.create(null);let ao=class cp{constructor(e,n,r,o=Ze.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||V.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,n,r,o=0){this.content.nodesBetween(e,n,r,o,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,n,r,o){return this.content.textBetween(e,n,r,o)}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,n,r){return this.type==e&&nu(this.attrs,n||e.defaultAttrs||hN)&&Ze.sameSet(this.marks,r||Ze.none)}copy(e=null){return e==this.content?this:new cp(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new cp(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return Q.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),a=o.start(s),c=o.node(s).content.cut(o.pos-a,i.pos-a);return new Q(c,o.depth-s,i.depth-s)}replace(e,n,r){return cN(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return Ka.resolveCached(this,e)}resolveNoCache(e){return Ka.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}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()+")"),PC(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=V.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=o;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.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=Ze.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Ze.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=V.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};ao.prototype.text=void 0;class su extends ao{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):PC(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}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,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function PC(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ti{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new pN(e,n);if(r.next==null)return Ti.empty;let o=BC(r);r.next&&r.err("Unexpected trailing text");let i=CN(xN(o));return kN(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}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:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let o=[this];function i(s,a){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return V.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,a.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let a=o;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:a,next:l}=i.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!o.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),n[a.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 n(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
|
|
1
|
+
import{j as y}from"./tanstack-oFmRhGwV.js";import{g as gC,r as C,b as bC,a as r3,R as Ie,u as yC,e as o3}from"./react-vendor-B0Dih9Pj.js";import{o as i3,_ as eu,ah as s3,ai as a3,ag as Vm,D as EC,j as xC,k as CC,l as kC,m as TC,K as wC,L as Sf,X as l3,I as vf,B as Sa,n as SC,M as c3}from"./index-DX9xeoQx.js";import{ag as vC,ah as u3,ai as On,Q as ki,aj as Af,ak as d3,al as _f,am as f3,an as h3,ao as p3,ap as m3,R as g3,aq as b3,ar as Dr,as as Hi,at as Al,au as tu,av as y3,aw as E3,ax as ip,ay as x3,u as C3,s as k3,w as T3,A as w3,t as S3,az as v3,j as A3,L as _3,k as N3,i as I3,a4 as M3,a2 as O3,a3 as D3,a8 as L3,a9 as R3,aa as P3,a6 as B3,a7 as F3,a1 as H3,_ as U3,a0 as V3,Z as $3,T as j3,aA as z3,aB as q3,aC as W3,b as G3,aD as Y3,I as K3,C as Q3,aE as X3,aF as Z3,a as J3,ab as eN,ac as tN}from"./radix-lA_IxTIV.js";import{P as kd,S as AC}from"./command-qGFnWxcS.js";import{B as nN}from"./badge-B8OxObuF.js";import{M as rN,P as _C,F as oN,C as iN}from"./ContentEditPage-RtHbU_l4.js";import{m as sp}from"./use-mobile-C1r2eP64.js";import{C as sN}from"./CustomBlockPreview-ers8OdZ0.js";import"./search-C-3Q9nn7.js";import"./useContent-f19XHVlJ.js";import"./useAdminResolver-D6B6RXnk.js";import"./select-CHW5R8qv.js";import"./check-CxKAR64t.js";import"./format-C88SDH8g.js";import"./sortable.esm-CBJBhe4k.js";import"./core.esm-DRuhixPo.js";import"./card-C7fgQS_U.js";import"./useMedia-DkvP1QLG.js";import"./useTags-BuXf7_7H.js";import"./popover-Cou924mw.js";import"./useDebouncedValue-DHUCnm9B.js";import"./plus-HdRn2U0S.js";import"./checkbox-BV2kjQBe.js";import"./trash-2-CWWRVuRB.js";import"./contentStatus-BmaiYVOm.js";const aN=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],lN=i3("paperclip",aN);function zt(t){this.content=t}zt.prototype={constructor:zt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new zt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new zt(n)},addToStart:function(t,e){return new zt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new zt(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new zt(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=zt.from(t),t.size?new zt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=zt.from(t),t.size?new zt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=zt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};zt.from=function(t){if(t instanceof zt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new zt(e)};function NC(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=NC(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function IC(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),a=e.child(--i),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let c=0,u=Math.min(s.text.length,a.text.length);for(;c<u&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let c=IC(s.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class V{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,o=0,i){for(let s=0,a=0;a<n;s++){let l=this.content[s],c=a+l.nodeSize;if(c>e&&r(l,o+a,i||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,o+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new V(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let a=this.content[i],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),o+=a.nodeSize),s=l}return new V(r,o)}cutByIndex(e,n){return e==n?V.empty:e==0&&n==this.content.length?this:new V(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new V(o,i)}addToStart(e){return new V([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new V(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return NC(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return IC(this,e,n,r)}findIndex(e){if(e==0)return Ql(0,e);if(e==this.size)return Ql(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=e)return i==e?Ql(n+1,i):Ql(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return V.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new V(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return V.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new V(n||e,r)}static from(e){if(!e)return V.empty;if(e instanceof V)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new V([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}V.empty=new V([],0);const Nf={index:0,offset:0};function Ql(t,e){return Nf.index=t,Nf.offset=e,Nf}function nu(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!nu(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!nu(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Ze=class ap{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))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 n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ap.none;if(e instanceof ap)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};Ze.none=[];class ru extends Error{}class Q{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=OC(this.content,e+this.openStart,n);return r&&new Q(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Q(MC(this.content,e+this.openStart,n+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,n){if(!n)return Q.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Q(V.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new Q(e,r,o)}}Q.empty=new Q(V.empty,0,0);function MC(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(o==e||i.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(MC(i.content,e-o-1,n-o-1)))}function OC(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=OC(s.content,e-i-1,n,s);return a&&t.replaceChild(o,s.copy(a))}function cN(t,e,n){if(n.openStart>t.depth)throw new ru("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ru("Inconsistent open depths");return DC(t,e,n,0)}function DC(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=DC(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,a=s.content;return mi(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=uN(n,t);return mi(i,RC(t,s,a,e,r))}else return mi(i,ou(t,e,r))}function LC(t,e){if(!e.type.compatibleContent(t.type))throw new ru("Cannot join "+e.type.name+" onto "+t.type.name)}function lp(t,e,n){let r=t.node(n);return LC(r,e.node(n)),r}function pi(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function va(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(pi(t.nodeAfter,r),i++));for(let a=i;a<s;a++)pi(o.child(a),r);e&&e.depth==n&&e.textOffset&&pi(e.nodeBefore,r)}function mi(t,e){return t.type.checkContent(e),t.copy(e)}function RC(t,e,n,r,o){let i=t.depth>o&&lp(t,e,o+1),s=r.depth>o&&lp(n,r,o+1),a=[];return va(null,t,o,a),i&&s&&e.index(o)==n.index(o)?(LC(i,s),pi(mi(i,RC(t,e,n,r,o+1)),a)):(i&&pi(mi(i,ou(t,e,o+1)),a),va(e,n,o,a),s&&pi(mi(s,ou(n,r,o+1)),a)),va(r,null,o,a),new V(a)}function ou(t,e,n){let r=[];if(va(null,t,n,r),t.depth>n){let o=lp(t,e,n+1);pi(mi(o,ou(t,e,n+1)),r)}return va(e,null,n,r),new V(r)}function uN(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(V.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class Ka{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(n);return r?e.child(n).cut(r):o}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ze.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let a=r;r=o,o=a}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new iu(this,e,r);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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(i),c=i-l;if(r.push(s,a,o+l),!c||(s=s.child(a),s.isText))break;i=c-1,o+=l+1}return new Ka(n,r,i)}static resolveCached(e,n){let r=h1.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else h1.set(e,r=new dN);let o=r.elts[r.i]=Ka.resolve(e,n);return r.i=(r.i+1)%fN,o}}class dN{constructor(){this.elts=[],this.i=0}}const fN=12,h1=new WeakMap;class iu{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}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 hN=Object.create(null);let ao=class cp{constructor(e,n,r,o=Ze.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||V.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,n,r,o=0){this.content.nodesBetween(e,n,r,o,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,n,r,o){return this.content.textBetween(e,n,r,o)}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,n,r){return this.type==e&&nu(this.attrs,n||e.defaultAttrs||hN)&&Ze.sameSet(this.marks,r||Ze.none)}copy(e=null){return e==this.content?this:new cp(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new cp(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return Q.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),a=o.start(s),c=o.node(s).content.cut(o.pos-a,i.pos-a);return new Q(c,o.depth-s,i.depth-s)}replace(e,n,r){return cN(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return Ka.resolveCached(this,e)}resolveNoCache(e){return Ka.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}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()+")"),PC(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=V.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=o;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.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=Ze.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Ze.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=V.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};ao.prototype.text=void 0;class su extends ao{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):PC(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}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,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function PC(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ti{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new pN(e,n);if(r.next==null)return Ti.empty;let o=BC(r);r.next&&r.err("Unexpected trailing text");let i=CN(xN(o));return kN(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}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:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let o=[this];function i(s,a){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return V.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,a.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let a=o;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:a,next:l}=i.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!o.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),n[a.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 n(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
|
|
2
2
|
`)}}Ti.empty=new Ti(!0);class pN{constructor(e,n){this.string=e,this.nodeTypes=n,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 BC(t){let e=[];do e.push(mN(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function mN(t){let e=[];do e.push(gN(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function gN(t){let e=EN(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=bN(t,e);else break;return e}function p1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function bN(t,e){let n=p1(t),r=n;return t.eat(",")&&(t.next!="}"?r=p1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function yN(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function EN(t){if(t.eat("(")){let e=BC(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=yN(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function xN(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,l){let c={term:l,to:a};return e[s].push(c),c}function o(s,a){s.forEach(l=>l.to=a)}function i(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=i(s.exprs[l],a);if(l==s.exprs.length-1)return c;o(c,a=n())}else if(s.type=="star"){let l=n();return r(a,l),o(i(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return o(i(s.expr,a),l),o(i(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let u=n();o(i(s.expr,l),u),l=u}if(s.max==-1)o(i(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let u=n();r(l,u),o(i(s.expr,l),u),l=u}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function FC(t,e){return e-t}function m1(t,e){let n=[];return r(e),n.sort(FC);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:a,to:l}=i[s];!a&&n.indexOf(l)==-1&&r(l)}}}function CN(t){let e=Object.create(null);return n(m1(t,0));function n(r){let o=[];r.forEach(s=>{t[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<o.length;u++)o[u][0]==a&&(c=o[u][1]);m1(t,l).forEach(u=>{c||o.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new Ti(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let a=o[s][1].sort(FC);i.next.push({type:o[s][0],next:e[a.join(",")]||n(a)})}return i}}function kN(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let a=0;a<o.next.length;a++){let{type:l,next:c}=o.next[a];s.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function HC(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function UC(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let i=t[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function VC(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in t){let i=t[o];i.validate&&i.validate(e[o])}}function $C(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new wN(t,r,e[r]);return n}let g1=class jC{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=$C(e,r.attrs),this.defaultAttrs=HC(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ti.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:UC(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ao(this,this.computeAttrs(e),V.from(n),Ze.setFrom(r))}createChecked(e=null,n,r){return n=V.from(n),this.checkContent(n),new ao(this,this.computeAttrs(e),n,Ze.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=V.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(V.empty,!0);return i?new ao(this,e,n.append(i),Ze.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).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){VC(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 n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Ze.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new jC(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function TN(t,e,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class wN{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?TN(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Td{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=$C(e,o.attrs),this.excluded=null;let i=HC(this.attrs);this.instance=i?new Ze(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Ze(this,UC(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new Td(i,o++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){VC(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let zC=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=zt.from(e.nodes),n.marks=zt.from(e.marks||{}),this.nodes=g1.compile(this.spec.nodes,this),this.marks=Td.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=Ti.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?b1(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:b1(this,s.split(" "))}this.nodeFromJSON=o=>ao.fromJSON(this,o),this.markFromJSON=o=>Ze.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof g1){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(n,r,o)}text(e,n){let r=this.nodes.text;return new su(r,r.defaultAttrs,e,Ze.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function b1(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let a in t.marks){let l=t.marks[a];(o=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function SN(t){return t.tag!=null}function vN(t){return t.style!=null}let hr=class up{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(SN(o))this.tags.push(o);else if(vN(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new E1(this,n,!1);return r.addAll(e,Ze.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new E1(this,n,!0);return r.addAll(e,Ze.none,n.from,n.to),Q.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(NN(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<i)break}n.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=x1(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=x1(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new up(e,up.schemaRules(e)))}};const qC={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},AN={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},WC={ol:!0,ul:!0},Qa=1,dp=2,Aa=4;function y1(t,e,n){return e!=null?(e?Qa:0)|(e==="full"?dp:0):t&&t.whitespace=="pre"?Qa|dp:n&~Aa}class Xl{constructor(e,n,r,o,i,s){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=Ze.none,this.match=i||(s&Aa?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(V.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Qa)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=V.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(V.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!qC.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class E1{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,s=y1(null,n.preserveWhitespace,0)|(r?Aa:0);o?i=new Xl(o.type,o.attrs,Ze.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new Xl(null,null,Ze.none,!0,null,s):i=new Xl(e.schema.topNodeType,null,Ze.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,o=this.top,i=o.options&dp?"full":this.localPreserveWS||(o.options&Qa)>0,{schema:s}=this.parser;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
|
3
3
|
`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(s.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=o.content[o.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;WC.hasOwnProperty(s)&&this.parser.normalizeLists&&_N(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:AN.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);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 c,u=this.needsBlock;if(qC.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
4
|
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(i,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}i&&this.sync(a)&&this.open--}addAll(e,n,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=o==null?null:e.childNodes[o];s!=a;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,r){let o,i;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!o||o.length>c.length+a)&&(o=c,i=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)n=this.enterInner(o[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=Ze.none;for(let a of o.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):C1(a.type,e.type))&&(s=a.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,r,o){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,o)),i}enterInner(e,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=y1(e,i,s.options);s.options&Aa&&s.content.length==0&&(a|=Aa);let l=Ze.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):C1(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Xl(e,n,l,o,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].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 n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Qa)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(s(a-1,l))return!0;return!1}else{let u=l>0||l==0&&o?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function _N(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&WC.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function NN(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function x1(t){let e={};for(let n in t)e[n]=t[n];return e}function C1(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}class Fn{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=If(n).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let a=0,l=0;for(;a<i.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)o=i.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],u=this.serializeMark(c,s.isInline,n);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=Oc(If(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&Oc(If(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return Oc(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Fn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=k1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return k1(e.marks)}}function k1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function If(t){return t.document||window.document}const T1=new WeakMap;function IN(t){let e=T1.get(t);return e===void 0&&T1.set(t,e=MN(t)),e}function MN(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function Oc(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=IN(r))&&i.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 s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let a,l=n?t.createElementNS(n,o):t.createElement(o),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:p}=Oc(t,f,n,r);if(l.appendChild(h),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const GC=65535,YC=Math.pow(2,16);function ON(t,e){return t+e*YC}function w1(t){return t&GC}function DN(t){return(t-(t&GC))/YC}const KC=1,QC=2,Dc=4,XC=8;class fp{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&XC)>0}get deletedBefore(){return(this.delInfo&(KC|Dc))>0}get deletedAfter(){return(this.delInfo&(QC|Dc))>0}get deletedAcross(){return(this.delInfo&Dc)>0}}class Dn{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Dn.empty)return Dn.empty}recover(e){let n=0,r=w1(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+DN(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?o:0);if(l>e)break;let c=this.ranges[a+i],u=this.ranges[a+s],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:n:n,h=l+o+(f<0?0:u);if(r)return h;let p=e==(n<0?l:d)?null:ON(a/3,e-l),g=e==l?QC:e==d?KC:Dc;return(n<0?e!=l:e!=d)&&(g|=XC),new fp(h,g,p)}o+=u-c}return r?e+o:new fp(e+o,0,null)}touches(e,n){let r=0,o=w1(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+i],u=l+c;if(e<=u&&a==o*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],a=s-(this.inverted?i:0),l=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];e(a,a+c,l,l+u),i+=u-c}}invert(){return new Dn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Dn.empty:new Dn(e<0?[0,-e,0]:[0,0,e])}}Dn.empty=new Dn([]);class Ss{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Ss(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new Ss;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],a=s.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this._maps[l].recover(a.recover);continue}}o|=a.delInfo,e=a.pos}return r?e:new fp(e,o,null)}}const Mf=Object.create(null);class tn{getMap(){return Dn.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Mf[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Mf)throw new RangeError("Duplicate use of step JSON ID "+e);return Mf[e]=n,n.prototype.jsonID=e,n}}class vt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new vt(e,null)}static fail(e){return new vt(null,e)}static fromReplace(e,n,r,o){try{return vt.ok(e.replace(n,r,o))}catch(i){if(i instanceof ru)return vt.fail(i.message);throw i}}}function $m(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy($m(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return V.fromArray(r)}class Mo extends tn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new Q($m(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return vt.fromReplace(e,this.from,this.to,i)}invert(){return new ur(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Mo(n.pos,r.pos,this.mark)}merge(e){return e instanceof Mo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Mo(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Mo(n.from,n.to,e.markFromJSON(n.mark))}}tn.jsonID("addMark",Mo);class ur extends tn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Q($m(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return vt.fromReplace(e,this.from,this.to,r)}invert(){return new Mo(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ur(n.pos,r.pos,this.mark)}merge(e){return e instanceof ur&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ur(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ur(n.from,n.to,e.markFromJSON(n.mark))}}tn.jsonID("removeMark",ur);class Oo extends tn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return vt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return vt.fromReplace(e,this.pos,this.pos+1,new Q(V.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new Oo(this.pos,n.marks[o]);return new Oo(this.pos,this.mark)}}return new wi(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Oo(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Oo(n.pos,e.markFromJSON(n.mark))}}tn.jsonID("addNodeMark",Oo);class wi extends tn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return vt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return vt.fromReplace(e,this.pos,this.pos+1,new Q(V.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Oo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new wi(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new wi(n.pos,e.markFromJSON(n.mark))}}tn.jsonID("removeNodeMark",wi);class St extends tn{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&hp(e,this.from,this.to)?vt.fail("Structure replace would overwrite content"):vt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Dn([this.from,this.to-this.from,this.slice.size])}invert(e){return new St(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new St(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof St)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?Q.empty:new Q(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new St(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?Q.empty:new Q(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new St(e.from,this.to,n,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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new St(n.from,n.to,Q.fromJSON(e,n.slice),!!n.structure)}}tn.jsonID("replace",St);class yt extends tn{constructor(e,n,r,o,i,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=a}apply(e){if(this.structure&&(hp(e,this.from,this.gapFrom)||hp(e,this.gapTo,this.to)))return vt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return vt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?vt.fromReplace(e,this.from,this.to,r):vt.fail("Content does not fit in gap")}getMap(){return new Dn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new yt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new yt(n.pos,r.pos,o,i,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,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new yt(n.from,n.to,n.gapFrom,n.gapTo,Q.fromJSON(e,n.slice),n.insert,!!n.structure)}}tn.jsonID("replaceAround",yt);function hp(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function LN(t,e,n,r){let o=[],i=[],s,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+l.nodeSize,n),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(s&&s.to==f&&s.mark.eq(d[g])?s.to=h:o.push(s=new ur(f,h,d[g])));a&&a.to==f?a.to=h:i.push(a=new Mo(f,h,r))}}),o.forEach(l=>t.step(l)),i.forEach(l=>t.step(l))}function RN(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;i++;let l=null;if(r instanceof Td){let c=s.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],f;for(let h=0;h<o.length;h++){let p=o[h];p.step==i-1&&d.eq(o[h].style)&&(f=p)}f?(f.to=c,f.step=i):o.push({style:d,from:Math.max(a,e),to:c,step:i})}}}),o.forEach(s=>t.step(new ur(s.from,s.to,s.style)))}function jm(t,e,n,r=n.contentMatch,o=!0){let i=t.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new St(a,u,Q.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new ur(a,u,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new Q(V.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new St(a+f.index,a+f.index+f[0].length,p))}}a=u}if(!r.validEnd){let l=r.fillBefore(V.empty,!0);t.replace(a,a,new Q(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function PN(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function $s(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,o=0,i=0;;--r){let s=t.$from.node(r),a=t.$from.index(r)+o,l=t.$to.indexAfter(r)-i;if(r<t.depth&&s.canReplace(a,l,n))return r;if(r==0||s.type.spec.isolating||!PN(s,a,l))break;a&&(o=1),l<s.childCount&&(i=1)}return null}function BN(t,e,n){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),a=o.after(i+1),l=s,c=a,u=V.empty,d=0;for(let p=i,g=!1;p>n;p--)g||r.index(p)>0?(g=!0,u=V.from(r.node(p).copy(u)),d++):l--;let f=V.empty,h=0;for(let p=i,g=!1;p>n;p--)g||o.after(p+1)<o.end(p)?(g=!0,f=V.from(o.node(p).copy(f)),h++):c++;t.step(new yt(l,c,s,a,new Q(u.append(f),d,h),u.size-d,!0))}function ZC(t,e,n=null,r=t){let o=FN(t,e),i=o&&HN(r,e);return i?o.map(S1).concat({type:e,attrs:n}).concat(i.map(S1)):null}function S1(t){return{type:t,attrs:null}}function FN(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}function HN(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;l&&c<o;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:s}function UN(t,e,n){let r=V.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=V.from(n[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new yt(o,i,o,i,new Q(r,0,0),n.length,!0))}function VN(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let l=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,l)&&$N(t.doc,t.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&ek(t,s,a,i),jm(t,t.mapping.slice(i).map(a,1),r,void 0,c===null);let u=t.mapping.slice(i),d=u.map(a,1),f=u.map(a+s.nodeSize,1);return t.step(new yt(d,f,d+1,f-1,new Q(V.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&JC(t,s,a,i),!1}})}function JC(t,e,n,r){e.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let l=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function ek(t,e,n,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-
|
|
1
|
+
import{j as e}from"./tanstack-oFmRhGwV.js";import{u as A,e as H,r as o}from"./react-vendor-B0Dih9Pj.js";import{L as d,I as b,W as C,a3 as R,S as k,a4 as U,a5 as V,a6 as W,B as h,a as _,D as z,i as G,j as J,k as K,l as M,m as Q,n as X,t as j}from"./index-DX9xeoQx.js";import{I as Y,F as Z}from"./FieldBuilder-Ds-agLm7.js";import{i as ee}from"./format-C88SDH8g.js";import{T as ae,C as se,b as te,c as le}from"./sortable.esm-CBJBhe4k.js";import{C as ie,a as ne,b as re,c as oe}from"./card-C7fgQS_U.js";import{C as ce}from"./CustomBlockPreview-ers8OdZ0.js";import{u as T}from"./useDebouncedValue-DHUCnm9B.js";import{b as de}from"./core.esm-DRuhixPo.js";import{T as me}from"./trash-2-CWWRVuRB.js";import"./radix-lA_IxTIV.js";import"./select-CHW5R8qv.js";import"./check-CxKAR64t.js";import"./checkbox-BV2kjQBe.js";import"./plus-HdRn2U0S.js";function pe({fields:s,previewTemplate:t,previewData:a,onPreviewDataChange:n,blockTypeName:c,blockTypeLabel:m,blockTypeIcon:f}){const r=T(t,300),y=T(a,300);return e.jsxs("div",{className:"space-y-4",children:[s.map(i=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(d,{className:"text-xs",children:i.label}),e.jsx(b,{value:String(a[i.name]??""),onChange:v=>n({...a,[i.name]:v.target.value}),placeholder:`Sample ${i.label}...`})]},i.name)),e.jsx(C,{}),e.jsx("div",{className:"rounded-md border p-4",children:e.jsx(ce,{blockType:{name:c,label:m,icon:f,fields:s,previewTemplate:r},props:y})})]})}function Se(){const{host:s,name:t}=A(),a=t==="new",{data:n,isLoading:c}=R(s,a?"":t);return!a&&c?e.jsxs("div",{className:"space-y-4",children:[e.jsx(k,{className:"h-8 w-64"}),e.jsx(k,{className:"h-64 w-full"})]}):a?e.jsx(B,{host:s,isNew:!0}):n?e.jsx(B,{host:s,isNew:!1,blockType:n},n.name):e.jsx("p",{className:"text-muted-foreground",children:"Block type not found."})}function B({host:s,isNew:t,blockType:a}){const n=H(),c=U(s),m=V(s,a?.name??""),f=W(s,a?.name??""),[r,y]=o.useState(a?.name??""),[i,v]=o.useState(a?.label??""),[g,D]=o.useState(a?.icon??""),[S,F]=o.useState(!t),P=new Set((a?.fields??[]).map(l=>l.name).filter(Boolean)),[p,L]=o.useState(a?.fields??[]),[u,E]=o.useState(a?.previewTemplate??""),[x,I]=o.useState(a?.previewData??{}),[O,w]=o.useState(!1);async function $(l){l.preventDefault();try{t?(await c.mutateAsync({name:r,label:i,icon:g,fields:p,previewTemplate:u||void 0,previewData:Object.keys(x).length>0?x:void 0}),j.success("Block type created"),n(`/sites/${s}/settings/block-types/${r}`)):(await m.mutateAsync({label:i,icon:g,fields:p,previewTemplate:u||void 0,previewData:Object.keys(x).length>0?x:void 0}),j.success("Block type updated"))}catch(N){j.error(t?"Failed to create":"Failed to update",{description:N instanceof Error?N.message:void 0})}}async function q(){try{await f.mutateAsync(),j.success("Block type deleted"),n(`/sites/${s}/settings/block-types`)}catch(l){j.error("Failed to delete",{description:l instanceof Error?l.message:void 0})}}return e.jsxs("div",{className:"mx-auto max-w-2xl",children:[e.jsx("h1",{className:"mb-6 text-2xl font-semibold",children:t?"New Block Type":`Edit: ${a?.label??r}`}),e.jsxs(ie,{children:[e.jsx(ne,{children:e.jsx(re,{children:"Block Type Settings"})}),e.jsx(oe,{children:e.jsxs("form",{onSubmit:$,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"name",children:"Name"}),e.jsx(Y,{id:"name",value:r,onChange:y,onBlur:()=>{r&&!S&&v(ee(r))},readOnly:!t,placeholder:"e.g. hero_banner",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"label",children:"Label"}),e.jsx(b,{id:"label",value:i,onChange:l=>{v(l.target.value),F(!0)},required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"icon",children:"Icon"}),e.jsx(b,{id:"icon",value:g,onChange:l=>D(l.target.value)})]}),e.jsx(C,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{children:"Block Fields"}),e.jsx(Z,{fields:p,onChange:L,existingFieldNames:P})]}),e.jsx(C,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"preview-template",children:"Preview Template (Liquid + Tailwind)"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional. Use Liquid syntax to render a preview. Block field values are available as template variables."}),e.jsx(ae,{id:"preview-template",value:u,onChange:l=>E(l.target.value),rows:6,placeholder:'<div class="p-4">{{ title }}</div>',className:"font-mono text-sm"})]}),(u||p.length>0)&&e.jsxs(se,{children:[e.jsxs(te,{className:"flex w-full items-center gap-2 text-sm font-medium",children:[e.jsx(de,{className:"h-4 w-4 transition-transform [[data-state=open]>&]:rotate-90"}),"Preview"]}),e.jsx(le,{className:"mt-2",children:e.jsx(pe,{fields:p,previewTemplate:u,previewData:x,onPreviewDataChange:I,blockTypeName:r,blockTypeLabel:i,blockTypeIcon:g})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(h,{type:"submit",disabled:c.isPending||m.isPending,children:[(c.isPending||m.isPending)&&e.jsx(_,{className:"mr-2 h-4 w-4 animate-spin"}),t?"Create":"Save"]}),e.jsx(h,{type:"button",variant:"outline",onClick:()=>n(`/sites/${s}/settings/block-types`),children:"Cancel"})]})]})})]}),!t&&e.jsx("div",{className:"mt-6",children:e.jsxs(z,{open:O,onOpenChange:w,children:[e.jsx(G,{asChild:!0,children:e.jsxs(h,{variant:"destructive",children:[e.jsx(me,{className:"mr-2 h-4 w-4"}),"Delete Block Type"]})}),e.jsxs(J,{children:[e.jsxs(K,{children:[e.jsx(M,{children:"Delete block type?"}),e.jsx(Q,{children:"This will permanently delete this block type."})]}),e.jsxs(X,{children:[e.jsx(h,{variant:"outline",onClick:()=>w(!1),children:"Cancel"}),e.jsx(h,{variant:"destructive",onClick:q,children:"Delete"})]})]})]})})]})}export{Se as BlockTypeEditPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-
|
|
1
|
+
import{j as e}from"./tanstack-oFmRhGwV.js";import{u as m,e as d}from"./react-vendor-B0Dih9Pj.js";import{a2 as x,B as h,S as j}from"./index-DX9xeoQx.js";import{T as p,a as f,b as c,c as a,d as u,e as l}from"./table-BjSue8Ev.js";import{P as N}from"./plus-HdRn2U0S.js";import"./radix-lA_IxTIV.js";function w(){const{host:n}=m(),i=d(),{data:r,isLoading:o}=x(n);return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Block Types"}),e.jsxs(h,{onClick:()=>i(`/sites/${n}/settings/block-types/new`),children:[e.jsx(N,{className:"mr-2 h-4 w-4"}),"New Block Type"]})]}),o?e.jsx("div",{className:"space-y-2",children:Array.from({length:3}).map((s,t)=>e.jsx(j,{className:"h-12 w-full"},t))}):r?.items.length?e.jsxs(p,{children:[e.jsx(f,{children:e.jsxs(c,{children:[e.jsx(a,{children:"Name"}),e.jsx(a,{children:"Label"}),e.jsx(a,{children:"Icon"}),e.jsx(a,{children:"Fields"})]})}),e.jsx(u,{children:r.items.map(s=>e.jsxs(c,{className:"cursor-pointer",onClick:()=>i(`/sites/${n}/settings/block-types/${s.name}`),children:[e.jsx(l,{className:"font-mono text-sm",children:s.name}),e.jsx(l,{children:s.label}),e.jsx(l,{children:s.icon}),e.jsx(l,{className:"text-muted-foreground",children:s.fields?.length??0})]},s.name))})]}):e.jsx("p",{className:"text-muted-foreground",children:"No block types defined."})]})}export{w as BlockTypesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-
|
|
1
|
+
import{j as e}from"./tanstack-oFmRhGwV.js";import{r as m}from"./react-vendor-B0Dih9Pj.js";import{B as a,a as t,X as x,D as h,j,k as p,l as u,m as D,n as b}from"./index-DX9xeoQx.js";function k({selectedCount:i,onPublish:n,onUnpublish:r,onDelete:c,onClear:o,isPending:s}){const[d,l]=m.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-md border bg-muted/50 px-4 py-2",children:[e.jsxs("span",{className:"text-sm font-medium",children:[i," selected"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{size:"sm",variant:"outline",onClick:n,disabled:s,children:[s&&e.jsx(t,{className:"mr-1 h-3 w-3 animate-spin"}),"Publish"]}),e.jsx(a,{size:"sm",variant:"outline",onClick:r,disabled:s,children:"Unpublish"}),e.jsx(a,{size:"sm",variant:"destructive",onClick:()=>l(!0),disabled:s,children:"Delete"})]}),e.jsx(a,{size:"sm",variant:"ghost",onClick:o,className:"ml-auto",disabled:s,children:e.jsx(x,{className:"h-4 w-4"})})]}),e.jsx(h,{open:d,onOpenChange:l,children:e.jsxs(j,{children:[e.jsxs(p,{children:[e.jsxs(u,{children:["Delete ",i," item",i!==1?"s":"","?"]}),e.jsx(D,{children:"This action cannot be undone. The selected content items will be permanently deleted."})]}),e.jsxs(b,{children:[e.jsx(a,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsxs(a,{variant:"destructive",onClick:async()=>{l(!1),await c()},disabled:s,children:[s&&e.jsx(t,{className:"mr-1 h-3 w-3 animate-spin"}),"Delete"]})]})]})})]})}export{k as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-
|
|
1
|
+
import{j as e}from"./tanstack-oFmRhGwV.js";import{r as c,u as Q,e as X}from"./react-vendor-B0Dih9Pj.js";import{o as Y,w as ee,B as C,I as E,Z as se,S as B,v as te,$ as ae,a0 as le,a1 as ne,L as f,W as T,a as ie,D as re,i as oe,j as ce,k as de,l as me,m as ue,n as xe,t as D}from"./index-DX9xeoQx.js";import{I as P,F as he}from"./FieldBuilder-Ds-agLm7.js";import{i as O,c as ge}from"./format-C88SDH8g.js";import{C as A}from"./checkbox-BV2kjQBe.js";import{C as je,a as pe,b as fe,c as Ce}from"./card-C7fgQS_U.js";import{C as be,G as ve,b as Se,u as Ne,a as ye,P as De,D as Ee,c as ke}from"./core.esm-DRuhixPo.js";import{u as we,C as Fe,b as Le,c as Re,S as Ie,v as Be,a as Te}from"./sortable.esm-CBJBhe4k.js";import{S as $e,a as Pe,b as Oe,c as Ae,d as _e}from"./select-CHW5R8qv.js";import{T as _}from"./trash-2-CWWRVuRB.js";import{P as qe}from"./plus-HdRn2U0S.js";import"./radix-lA_IxTIV.js";import"./check-CxKAR64t.js";const ze=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ve=Y("arrow-right",ze);function Ge({id:t,relationship:s,onChange:a,onRemove:d,collections:x,readOnlyName:u,defaultExpanded:g}){const[b,m]=c.useState(g??!1),[N,j]=c.useState(!!s.label),{attributes:v,listeners:r,setNodeRef:n,transform:o,transition:S}=we({id:t}),h={transform:be.Transform.toString(o),transition:S};function p(i){a({...s,...i})}const k=x.find(i=>i.name===s.targetCollection)?.label??s.targetCollection;return e.jsx("div",{ref:n,style:h,className:"rounded-md border bg-card",children:e.jsxs(Fe,{open:b,onOpenChange:m,children:[e.jsxs("div",{className:"flex items-center gap-2 p-2",children:[e.jsx("button",{type:"button",className:"cursor-grab touch-none text-muted-foreground hover:text-foreground",...v,...r,children:e.jsx(ve,{className:"h-4 w-4"})}),e.jsx(Le,{asChild:!0,children:e.jsx("button",{type:"button",className:"flex items-center",children:e.jsx(Se,{className:ee("h-4 w-4 transition-transform",b&&"rotate-90")})})}),e.jsx("span",{className:"min-w-[80px] text-sm font-mono",children:s.name||"unnamed"}),e.jsx(Ve,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:k}),e.jsx("span",{className:"flex-1 truncate text-sm text-muted-foreground",children:s.label}),e.jsx(C,{type:"button",variant:"ghost",size:"sm",onClick:d,className:"text-destructive",children:e.jsx(_,{className:"h-3 w-3"})})]}),e.jsx(Re,{children:e.jsxs("div",{className:"space-y-3 border-t p-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Name"}),e.jsx(P,{value:s.name,onChange:i=>p({name:i}),onBlur:()=>{s.name&&!N&&p({label:O(s.name)})},readOnly:u,className:"h-8 text-sm"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Label"}),e.jsx(E,{value:s.label,onChange:i=>{p({label:i.target.value}),j(!0)},className:"h-8 text-sm"})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Target Collection"}),e.jsxs($e,{value:s.targetCollection,onValueChange:i=>p({targetCollection:i}),children:[e.jsx(Pe,{className:"h-8 text-sm",children:e.jsx(Oe,{placeholder:"Select collection..."})}),e.jsx(Ae,{children:x.map(i=>e.jsx(_e,{value:i.name,children:i.label},i.name))})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{id:`${t}-multiple`,checked:s.multiple,onCheckedChange:i=>p({multiple:!!i})}),e.jsx("label",{htmlFor:`${t}-multiple`,className:"text-sm",children:"Allow multiple"})]})]})})]})})}function He({relationships:t,onChange:s,collections:a,existingRelNames:d}){const x=Ne(ye(De)),u=t.map((r,n)=>`rel-${n}`),[g,b]=c.useState(null);function m(){b(t.length),s([...t,{name:"",label:"",targetCollection:"",multiple:!1}])}function N(r,n){const o=[...t];o[r]=n,s(o)}function j(r){s(t.filter((n,o)=>o!==r))}function v(r){const{active:n,over:o}=r;if(o&&n.id!==o.id){const S=u.indexOf(String(n.id)),h=u.indexOf(String(o.id));s(Te(t,S,h))}}return e.jsx(Ee,{sensors:x,collisionDetection:ke,onDragEnd:v,children:e.jsx(Ie,{items:u,strategy:Be,children:e.jsxs("div",{className:"space-y-2",children:[t.map((r,n)=>e.jsx(Ge,{id:`rel-${n}`,relationship:r,onChange:o=>N(n,o),onRemove:()=>j(n),collections:a,readOnlyName:!!(d?.has(r.name)&&r.name),defaultExpanded:n===g},`rel-${n}`)),e.jsxs(C,{type:"button",variant:"outline",size:"sm",onClick:m,children:[e.jsx(qe,{className:"mr-2 h-3 w-3"})," Add Relationship"]})]})})})}function ns(){const{host:t,name:s}=Q(),a=s==="new",{data:d,isLoading:x}=se(t,a?"":s);return!a&&x?e.jsxs("div",{className:"space-y-4",children:[e.jsx(B,{className:"h-8 w-64"}),e.jsx(B,{className:"h-64 w-full"})]}):a?e.jsx($,{host:t,isNew:!0}):d?e.jsx($,{host:t,isNew:!1,collection:d},d.name):e.jsx("p",{className:"text-muted-foreground",children:"Collection not found."})}function $({host:t,isNew:s,collection:a}){const d=X(),{collections:x}=te(),u=ae(t),g=le(t,a?.name??""),b=ne(t,a?.name??""),[m,N]=c.useState(a?.name??""),[j,v]=c.useState(a?.label??""),[r,n]=c.useState(a?.labelSingular??""),[o,S]=c.useState(a?.slug??""),[h,p]=c.useState(a?.singleton??!1),[k,i]=c.useState(!s),[q,z]=c.useState(!s),[V,G]=c.useState(!s),H=new Set((a?.fields??[]).map(l=>l.name).filter(Boolean)),L=[{name:"blocks",label:"Blocks",type:"blocks",options:{}}],[w,R]=c.useState(a?.fields??(s&&!h?L:[])),[F,M]=c.useState(a?.relationships??[]),U=new Set((a?.relationships??[]).map(l=>l.name).filter(Boolean)),[W,I]=c.useState(!1);function Z(){if(!m)return;const l=O(m);k||v(l),q||n(ge(l)),V||S(m.replace(/_/g,"-"))}async function J(l){l.preventDefault();try{s?(await u.mutateAsync({name:m,label:j,labelSingular:r,slug:o,singleton:h,fields:w,relationships:F}),D.success("Collection created"),d(`/sites/${t}/settings/collections/${m}`)):(await g.mutateAsync({label:j,labelSingular:r,slug:o,singleton:h,fields:w,relationships:F}),D.success("Collection updated"))}catch(y){D.error(s?"Failed to create":"Failed to update",{description:y instanceof Error?y.message:void 0})}}async function K(){try{await b.mutateAsync(),D.success("Collection deleted"),d(`/sites/${t}/settings/collections`)}catch(l){D.error("Failed to delete",{description:l instanceof Error?l.message:void 0})}}return e.jsxs("div",{className:"mx-auto max-w-2xl",children:[e.jsx("h1",{className:"mb-6 text-2xl font-semibold",children:s?"New Collection":`Edit: ${a?.label??m}`}),e.jsxs(je,{children:[e.jsx(pe,{children:e.jsx(fe,{children:"Collection Settings"})}),e.jsx(Ce,{children:e.jsxs("form",{onSubmit:J,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"name",children:"Name"}),e.jsx(P,{id:"name",value:m,onChange:N,onBlur:Z,readOnly:!s,placeholder:"e.g. blog_posts",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"label",children:"Label"}),e.jsx(E,{id:"label",value:j,onChange:l=>{v(l.target.value),i(!0)},required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"label-singular",children:"Label Singular"}),e.jsx(E,{id:"label-singular",value:r,onChange:l=>{n(l.target.value),z(!0)},required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"slug",children:"Slug"}),e.jsx(E,{id:"slug",value:o,onChange:l=>{S(l.target.value),G(!0)},required:!0})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{id:"singleton",checked:h,onCheckedChange:l=>{const y=!!l;p(y),s&&R(y?[]:L)},disabled:!s}),e.jsx(f,{htmlFor:"singleton",children:"Singleton (single entry, no list)"})]}),e.jsx(T,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{children:"Fields"}),e.jsx(he,{fields:w,onChange:R,existingFieldNames:H})]}),e.jsx(T,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{children:"Relationships"}),e.jsx(He,{relationships:F,onChange:M,collections:x,existingRelNames:U})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(C,{type:"submit",disabled:u.isPending||g.isPending,children:[(u.isPending||g.isPending)&&e.jsx(ie,{className:"mr-2 h-4 w-4 animate-spin"}),s?"Create":"Save"]}),e.jsx(C,{type:"button",variant:"outline",onClick:()=>d(`/sites/${t}/settings/collections`),children:"Cancel"})]})]})})]}),!s&&e.jsx("div",{className:"mt-6",children:e.jsxs(re,{open:W,onOpenChange:I,children:[e.jsx(oe,{asChild:!0,children:e.jsxs(C,{variant:"destructive",children:[e.jsx(_,{className:"mr-2 h-4 w-4"}),"Delete Collection"]})}),e.jsxs(ce,{children:[e.jsxs(de,{children:[e.jsx(me,{children:"Delete collection?"}),e.jsx(ue,{children:"This will permanently delete the collection and all its content."})]}),e.jsxs(xe,{children:[e.jsx(C,{variant:"outline",onClick:()=>I(!1),children:"Cancel"}),e.jsx(C,{variant:"destructive",onClick:K,children:"Delete"})]})]})]})})]})}export{ns as CollectionEditPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-
|
|
1
|
+
import{j as e}from"./tanstack-oFmRhGwV.js";import{u as m,e as x}from"./react-vendor-B0Dih9Pj.js";import{Y as h,B as j,S as f}from"./index-DX9xeoQx.js";import{B as o}from"./badge-B8OxObuF.js";import{T as u,a as p,b as r,c as l,d as g,e as n}from"./table-BjSue8Ev.js";import{P as N}from"./plus-HdRn2U0S.js";import"./radix-lA_IxTIV.js";function P(){const{host:a}=m(),i=x(),{data:t,isLoading:c}=h(a);return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Collections"}),e.jsxs(j,{onClick:()=>i(`/sites/${a}/settings/collections/new`),children:[e.jsx(N,{className:"mr-2 h-4 w-4"}),"New Collection"]})]}),c?e.jsx("div",{className:"space-y-2",children:Array.from({length:3}).map((s,d)=>e.jsx(f,{className:"h-12 w-full"},d))}):t?.items.length?e.jsxs(u,{children:[e.jsx(p,{children:e.jsxs(r,{children:[e.jsx(l,{children:"Name"}),e.jsx(l,{children:"Label"}),e.jsx(l,{children:"Type"}),e.jsx(l,{children:"Fields"})]})}),e.jsx(g,{children:t.items.map(s=>e.jsxs(r,{className:"cursor-pointer",onClick:()=>i(`/sites/${a}/settings/collections/${s.name}`),children:[e.jsx(n,{className:"font-mono text-sm",children:s.name}),e.jsx(n,{children:s.label}),e.jsx(n,{children:s.singleton?e.jsx(o,{variant:"secondary",children:"Singleton"}):e.jsx(o,{variant:"outline",children:"Collection"})}),e.jsx(n,{className:"text-muted-foreground",children:s.fields?.length??0})]},s.name))})]}):e.jsx("p",{className:"text-muted-foreground",children:"No collections defined."})]})}export{P as CollectionsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-
|
|
1
|
+
import{j as e}from"./tanstack-oFmRhGwV.js";import{u as y,e as $,r as i,N as E}from"./react-vendor-B0Dih9Pj.js";import{v as w,L as g,I as h,B as f,a as I,t as p,x as F}from"./index-DX9xeoQx.js";import{e as P}from"./useContent-f19XHVlJ.js";import{C as T,a as A,b as L,c as B}from"./card-C7fgQS_U.js";import{s as D}from"./format-C88SDH8g.js";import"./radix-lA_IxTIV.js";function K(){const{host:n,collection:s}=y(),c=$(),{collections:C}=w(),o=P(n),[l,j]=i.useState(""),[u,d]=i.useState(""),[v,N]=i.useState(!1),[m,x]=i.useState(null),r=C.find(t=>t.name===s);if(r?.singleton){const t=r.singletonContentId?`/sites/${n}/content/${s}/${r.singletonContentId}`:`/sites/${n}/content/${s}`;return e.jsx(E,{to:t,replace:!0})}function S(t){j(t),v||d(D(t))}async function b(t){t.preventDefault(),x(null);try{const a=await o.mutateAsync({collection:s,title:l,slug:u||void 0});p.success("Content created"),c(`/sites/${n}/content/${s}/${a.contentId}`)}catch(a){a instanceof F&&a.status===409?x("A content item with this slug already exists. Choose a different slug."):p.error("Failed to create content",{description:a instanceof Error?a.message:void 0})}}return e.jsxs("div",{className:"mx-auto max-w-2xl",children:[e.jsxs("h1",{className:"mb-6 text-2xl font-semibold",children:["New ",r?.labelSingular??s]}),e.jsxs(T,{children:[e.jsx(A,{children:e.jsx(L,{children:"Details"})}),e.jsx(B,{children:e.jsxs("form",{onSubmit:b,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"title",children:"Title"}),e.jsx(h,{id:"title",value:l,onChange:t=>S(t.target.value),required:!0,autoFocus:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"slug",children:"Slug"}),e.jsx(h,{id:"slug",value:u,onChange:t=>{d(t.target.value),N(!0)}})]}),m&&e.jsx("p",{className:"text-sm text-destructive",children:m}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(f,{type:"submit",disabled:!l||o.isPending,children:[o.isPending&&e.jsx(I,{className:"mr-2 h-4 w-4 animate-spin"}),"Create"]}),e.jsx(f,{type:"button",variant:"outline",onClick:()=>c(-1),children:"Cancel"})]})]})})]})]})}export{K as ContentCreatePage};
|