@pramen/cms-editor 0.0.64 → 0.0.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editor.js +1 -1
- package/package.json +1 -1
- package/src/components.tsx +21 -4
package/dist/editor.js
CHANGED
|
@@ -396,7 +396,7 @@ ${n}
|
|
|
396
396
|
`);if(!Xt.startsWith("/"))return x(null);let In=Xt.slice(1);if(/\s/.test(In)||cM(In).length===0)return x(null);x({...ft,query:In,index:0})},onSelectionUpdate({editor:ye}){let Ee=g.current;if(!Ee)return;let ft=ye.state.selection.from;if(ft<Ee.from||ft>Ee.from+Ee.query.length+1)x(null)},onBlur(){x(null)}});Wt.useEffect(()=>{if(!te)return;if(e!==p.current&&e!==te.getHTML())te.commands.setContent(e||"",{emitUpdate:!1}),p.current=e},[e,te]),Wt.useEffect(()=>{if(te)te.setEditable(s)},[s,te]);let Ce=Wt.useCallback((ye)=>{let Ee=g.current;if(!te||!Ee||!ye)return;let ft=te.state.doc.content.size,Se=Math.min(Math.max(Ee.from,0),ft),Xt=Math.min(Math.max(te.state.selection.from,Se),ft);te.chain().focus().deleteRange({from:Se,to:Xt}).run(),ye.run(te),x(null)},[te,x]);U.current=Ce;let $e=Wt.useCallback(()=>{let ye=g.current,Ee=z.current;if(!te||!ye||!Ee)return;let ft=te.state.doc.content.size;if(ye.from>ft)return x(null);let Se=te.view.coordsAtPos(ye.from),Xt=Ee.getBoundingClientRect(),In=6,xn=8,sn=Se.bottom+In;if(sn+Xt.height>window.innerHeight-xn)sn=Math.max(xn,Se.top-In-Xt.height);let je=Math.max(xn,Math.min(Se.left,window.innerWidth-Xt.width-xn));ne((qr)=>qr&&qr.left===je&&qr.top===sn?qr:{left:je,top:sn})},[te,x]);Wt.useLayoutEffect(()=>{if(y)$e();else ne(null)},[y,$e]),Wt.useEffect(()=>{if(!y)return;let ye=()=>$e();return window.addEventListener("scroll",ye,!0),window.addEventListener("resize",ye),()=>{window.removeEventListener("scroll",ye,!0),window.removeEventListener("resize",ye)}},[y,$e]);let se=eR({editor:te,selector:({editor:ye})=>ye?{bold:ye.isActive("bold"),italic:ye.isActive("italic"),strike:ye.isActive("strike"),highlight:ye.isActive("highlight"),code:ye.isActive("code"),link:ye.isActive("link"),hasSelection:!ye.state.selection.empty}:null}),de=Wt.useCallback(()=>{C(!1),_(null),I.current=!1},[]);Wt.useEffect(()=>{if(w&&se&&!se.hasSelection&&!se.link)de()},[w,se,de]),Wt.useEffect(()=>{if(w)W.current?.focus()},[w]);let ge=()=>{if(!te)return;H(te.getAttributes("link").href??""),_(null),I.current=!0,C(!0)},Re=()=>{if(!te)return;if(R.trim()===""){te.chain().focus().extendMarkRange("link").unsetLink().run(),de();return}let ye=sA(R);if(!ye)return _(iA);te.chain().focus().extendMarkRange("link").setLink({href:ye}).run(),de()};return hn.jsxDEV("div",{className:Ra("flex w-full flex-col gap-2",c),children:[r?hn.jsxDEV("span",{id:re,className:"text-small font-medium text-fg",children:r},void 0,!1,void 0,this):null,hn.jsxDEV("div",{className:"relative rounded-lg border border-border bg-surface focus-within:border-brand-green",children:[te?hn.jsxDEV(hX,{editor:te,shouldShow:({editor:ye,view:Ee,state:ft,element:Se})=>{let Xt=Se.contains(document.activeElement);if(!ye.isEditable||!(Ee.hasFocus()||Xt))return!1;return I.current||!ft.selection.empty},className:"flex flex-col gap-1 rounded-lg border border-border bg-surface-card p-1 shadow-md",children:w?hn.jsxDEV(hn.Fragment,{children:[hn.jsxDEV("div",{className:"flex items-center gap-1",children:[hn.jsxDEV("input",{ref:W,type:"text",value:R,"aria-label":"Link URL","aria-invalid":L?!0:void 0,placeholder:"https://, mailto:, /path",className:"h-8 w-56 rounded-md border border-border bg-surface px-2 text-small text-fg outline-none placeholder:text-fg-subtle focus:border-brand-green",onChange:(ye)=>{H(ye.target.value),_(null)},onKeyDown:(ye)=>{if(ye.key==="Enter")ye.preventDefault(),Re();if(ye.key==="Escape")ye.preventDefault(),de(),te.chain().focus().run()}},void 0,!1,void 0,this),hn.jsxDEV("button",{type:"button",className:b4,onMouseDown:(ye)=>ye.preventDefault(),onClick:Re,title:"Apply link",children:"Apply"},void 0,!1,void 0,this),hn.jsxDEV("button",{type:"button",className:b4,onMouseDown:(ye)=>ye.preventDefault(),onClick:()=>{de(),te.chain().focus().run()},title:"Cancel",children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L?hn.jsxDEV("span",{className:"px-1 pb-0.5 text-caption text-danger",children:L},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):hn.jsxDEV("div",{className:"flex items-center gap-0.5",children:[rbe.map((ye)=>hn.jsxDEV("button",{type:"button",className:b4,"data-active":se?.[ye.key]??!1,"aria-pressed":se?.[ye.key]??!1,onMouseDown:(Ee)=>Ee.preventDefault(),onClick:()=>ye.run(te),title:ye.title,children:ye.label},ye.key,!1,void 0,this)),hn.jsxDEV("button",{type:"button",className:b4,"data-active":se?.link??!1,"aria-pressed":se?.link??!1,onMouseDown:(ye)=>ye.preventDefault(),onClick:ge,title:"Link",children:hn.jsxDEV(abe,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null,hn.jsxDEV(Qk,{editor:te},void 0,!1,void 0,this),V&&k&&y?JJ.createPortal(hn.jsxDEV("div",{ref:z,id:D,role:"listbox","aria-label":"Insert block",className:"fixed z-50 max-h-72 w-64 overflow-auto rounded-lg border border-border bg-surface-card p-1 shadow-md",style:{left:F?.left??0,top:F?.top??0,visibility:F?"visible":"hidden"},children:xe.map((ye,Ee)=>hn.jsxDEV("div",{id:B(Ee),role:"option","aria-selected":Ee===le,className:Ra("flex w-full cursor-pointer flex-col items-start rounded-md px-3 py-1.5 text-left",Ee===le?"bg-surface-muted":"hover:bg-surface-muted"),onMouseDown:(ft)=>ft.preventDefault(),onClick:()=>Ce(ye),children:[hn.jsxDEV("span",{className:"text-small text-fg",children:ye.title},void 0,!1,void 0,this),hn.jsxDEV("span",{className:"text-caption text-fg-subtle",children:ye.hint},void 0,!1,void 0,this)]},ye.title,!0,void 0,this))},void 0,!1,void 0,this),document.body):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Wt,JJ,hn,XJ,b4="inline-flex h-8 min-w-8 items-center justify-center rounded-md px-2 text-small text-fg-muted transition-colors hover:bg-surface-muted hover:text-fg data-[active=true]:bg-surface-muted data-[active=true]:text-fg",rbe,abe=()=>hn.jsxDEV("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[hn.jsxDEV("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"},void 0,!1,void 0,this),hn.jsxDEV("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);var QJ=E(()=>{ZC();bX();aM();YJ();sM();iM();lM();Bl();Wt=O(ee(),1),JJ=O(vr(),1),hn=O(Me(),1),XJ=[{title:"Text",hint:"Plain paragraph",keywords:["text","paragraph","body","p"],run:(e)=>e.chain().focus().setParagraph().run()},{title:"Heading 1",hint:"Big section heading",keywords:["h1","heading","title"],run:(e)=>e.chain().focus().toggleHeading({level:1}).run()},{title:"Heading 2",hint:"Medium heading",keywords:["h2","subheading"],run:(e)=>e.chain().focus().toggleHeading({level:2}).run()},{title:"Heading 3",hint:"Small heading",keywords:["h3"],run:(e)=>e.chain().focus().toggleHeading({level:3}).run()},{title:"Bulleted list",hint:"Unordered list",keywords:["bullet","unordered","ul","list"],run:(e)=>e.chain().focus().toggleBulletList().run()},{title:"Numbered list",hint:"Ordered list",keywords:["numbered","ordered","ol","list"],run:(e)=>e.chain().focus().toggleOrderedList().run()},{title:"To-do list",hint:"Checklist",keywords:["todo","task","checkbox","check"],run:(e)=>e.chain().focus().toggleTaskList().run()},{title:"Quote",hint:"Block quote",keywords:["quote","blockquote","citation"],run:(e)=>e.chain().focus().toggleBlockquote().run()},{title:"Code",hint:"Code block",keywords:["code","snippet","pre"],run:(e)=>e.chain().focus().toggleCodeBlock().run()},{title:"Divider",hint:"Horizontal rule",keywords:["divider","rule","hr","separator"],run:(e)=>e.chain().focus().setHorizontalRule().run()}];rbe=[{key:"bold",title:"Bold",label:hn.jsxDEV("b",{children:"B"},void 0,!1,void 0,this),run:(e)=>e.chain().focus().toggleBold().run()},{key:"italic",title:"Italic",label:hn.jsxDEV("i",{children:"i"},void 0,!1,void 0,this),run:(e)=>e.chain().focus().toggleItalic().run()},{key:"strike",title:"Strikethrough",label:hn.jsxDEV("s",{children:"S"},void 0,!1,void 0,this),run:(e)=>e.chain().focus().toggleStrike().run()},{key:"highlight",title:"Highlight",label:"H",run:(e)=>e.chain().focus().toggleHighlight().run()},{key:"code",title:"Inline code",label:"</>",run:(e)=>e.chain().focus().toggleCode().run()}]});var eQ=E(()=>{QJ()});function Uh(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)&&e.type==="doc"}function T1(e){let t=[],n=(r)=>{for(let s of r){if(s.type==="text")t.push(s.text??"");else if(s.type==="hardBreak")t.push(`
|
|
397
397
|
`);if(s.content)n(s.content);if(sbe.has(s.type))t.push(`
|
|
398
398
|
`)}};return n(e?.content??[]),t.join("").replace(/\n{2,}/g,`
|
|
399
|
-
`).trim()}var sbe;var dM=E(()=>{sbe=new Set(["paragraph","heading","listItem","taskItem","blockquote","codeBlock","horizontalRule"])});function tp({label:e,children:t}){return be.jsxDEV("label",{className:"flex w-full flex-col gap-2",children:[e===void 0?null:be.jsxDEV("span",{className:"text-sm font-medium text-fg",children:e},void 0,!1,void 0,this),t]},void 0,!0,void 0,this)}function y4(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let n=(r)=>String(r).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function v4(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toISOString()}function np(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function ibe(e){let[t,n]=Lt.useState(0);Lt.useEffect(()=>{if(e===null)return;let r=e-Date.now();if(r<=0)return;let s=setTimeout(()=>n((i)=>i+1),Math.min(r+1000,2147483647));return()=>clearTimeout(s)},[e,t])}function lbe({value:e,onChange:t}){let[n,r]=Lt.useState(!1),[s,i]=Lt.useState(""),c=Boolean(e),u=c?new Date(e).getTime():Number.NaN,f=Number.isFinite(u)&&u>Date.now();ibe(f?u:null);let p=!c?{text:"Not published",tone:"text-fg-muted"}:f?{text:`Scheduled for ${np(e)}`,tone:"text-accent-strong"}:{text:`Published ${np(e)}`,tone:"text-fg"},m=()=>{i(y4(e)),r((g)=>!g)};return be.jsxDEV("div",{className:"flex flex-col gap-2",children:[be.jsxDEV("span",{className:`text-sm ${p.tone}`,children:p.text},void 0,!1,void 0,this),be.jsxDEV("div",{className:"flex flex-wrap items-center gap-2",children:[!c||f?be.jsxDEV(me,{size:"sm",onPress:()=>{r(!1),t(new Date().toISOString())},children:"Publish now"},void 0,!1,void 0,this):null,be.jsxDEV(me,{variant:"secondary",size:"sm",onPress:m,children:f?"Change schedule":c?"Change time":"Schedule…"},void 0,!1,void 0,this),c?be.jsxDEV(me,{variant:"ghost",size:"sm",className:"text-danger",onPress:()=>{r(!1),t(null)},children:"Unpublish"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),n?be.jsxDEV("input",{className:at,type:"datetime-local",value:s,autoFocus:!0,onChange:(g)=>{i(g.target.value);let y=g.target.value?v4(g.target.value):null;if(y)t(y)}},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function jh({schema:e,value:t,onChange:n,api:r}){let s=(i,c)=>n({...t,[i]:c});return be.jsxDEV("div",{className:"flex flex-col gap-4",children:e.map((i)=>be.jsxDEV(rQ,{def:i,value:t[i.name],onChange:(c)=>s(i.name,c),api:r,siblings:t},i.name,!1,void 0,this))},void 0,!1,void 0,this)}function rQ({def:e,value:t,onChange:n,api:r,hideLabelAs:s,siblings:i}){let c=s!==void 0?void 0:be.jsxDEV(be.Fragment,{children:[e.label??e.name," ",e.required?be.jsxDEV("span",{className:"text-danger",children:"*"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),u=(f)=>typeof f==="string"?f:f==null?"":JSON.stringify(f);switch(e.type){case"text":case"url":{let f=e.type==="url"?"https://…":"";return s!==void 0?be.jsxDEV("input",{className:at,type:"text","aria-label":s,placeholder:f,value:t??"",onChange:(p)=>n(p.target.value)},void 0,!1,void 0,this):be.jsxDEV(pn,{label:c,value:t??"",onChange:n,placeholder:f},void 0,!1,void 0,this)}case"textarea":return s!==void 0?be.jsxDEV("textarea",{className:`${at} h-auto min-h-20 py-2.5`,"aria-label":s,value:u(t),onChange:(f)=>n(f.target.value)},void 0,!1,void 0,this):be.jsxDEV(fh,{label:c,value:u(t),onChange:n},void 0,!1,void 0,this);case"richtext":return be.jsxDEV(tp,{label:c,children:be.jsxDEV(fM,{value:t,onChange:n},void 0,!1,void 0,this)},void 0,!1,void 0,this);case"number":return be.jsxDEV(tp,{label:c,children:be.jsxDEV("input",{className:at,type:"number","aria-label":s,value:t==null?"":String(t),onChange:(f)=>n(f.target.value===""?null:Number(f.target.value))},void 0,!1,void 0,this)},void 0,!1,void 0,this);case"date":case"datetime":return be.jsxDEV(tp,{label:c,children:be.jsxDEV("input",{className:at,type:e.type==="date"?"date":"datetime-local","aria-label":s,value:t??"",onChange:(f)=>n(f.target.value||null)},void 0,!1,void 0,this)},void 0,!1,void 0,this);case"slug":return be.jsxDEV(ube,{def:e,label:c,value:typeof t==="string"?t:"",source:typeof i?.[e.from??""]==="string"?i[e.from??""]:"",onChange:n},void 0,!1,void 0,this);case"publish":return be.jsxDEV("div",{className:"flex w-full flex-col gap-2",children:[be.jsxDEV("span",{className:"text-sm font-medium text-fg",children:c},void 0,!1,void 0,this),be.jsxDEV(lbe,{value:typeof t==="string"?t:"",onChange:n},void 0,!1,void 0,this)]},void 0,!0,void 0,this);case"boolean":return be.jsxDEV("label",{className:"flex items-center gap-2",children:[be.jsxDEV("input",{type:"checkbox",checked:Boolean(t),onChange:(f)=>n(f.target.checked)},void 0,!1,void 0,this),be.jsxDEV("span",{className:"text-sm text-fg",children:e.label??e.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this);case"select":return be.jsxDEV(tp,{label:c,children:be.jsxDEV(dbe,{def:e,value:t,onChange:n,api:r,ariaLabel:s},void 0,!1,void 0,this)},void 0,!1,void 0,this);case"media":return be.jsxDEV(tp,{label:c,children:be.jsxDEV(fbe,{value:t,onChange:n,api:r},void 0,!1,void 0,this)},void 0,!1,void 0,this);case"reference":return be.jsxDEV("div",{className:"flex w-full flex-col gap-2",children:[c===void 0?null:be.jsxDEV("span",{className:"text-sm font-medium text-fg",children:c},void 0,!1,void 0,this),be.jsxDEV(gbe,{def:e,value:t,onChange:n,api:r,ariaLabel:s},void 0,!1,void 0,this)]},void 0,!0,void 0,this);case"group":return be.jsxDEV(tp,{label:c,children:be.jsxDEV("div",{className:"rounded-lg border border-border bg-surface-muted p-3.5",children:be.jsxDEV(jh,{schema:e.fields??[],value:t??{},onChange:n,api:r},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);case"repeater":return be.jsxDEV(cbe,{def:e,value:t??[],onChange:n,api:r,label:c},void 0,!1,void 0,this);default:return null}}function tQ(e){try{return EZ(e,aQ)}catch(t){return console.error("pramen/cms-editor: could not parse editor HTML",t),{type:"doc",content:[]}}}function nQ(e){if(typeof e==="string")return e;if(!Uh(e))return"";try{return IZ(e,aQ)}catch(t){return console.error("pramen/cms-editor: rich-text document uses nodes this editor cannot render",t),""}}function fM({value:e,onChange:t}){let[n,r]=Lt.useState(()=>nQ(e)),s=Lt.useRef(null),i=Lt.useRef(!1);return Lt.useEffect(()=>{if(i.current||typeof e!=="string"||e==="")return;i.current=!0;let u=tQ(e);s.current=u,t(u)},[e,t]),Lt.useEffect(()=>{if(e!==null&&e===s.current)return;r(nQ(e))},[e]),be.jsxDEV(uM,{value:n,onChange:(u)=>{r(u);let f=tQ(u);s.current=f,t(f)},minHeight:180,placeholder:"Write, or press '/' for blocks…"},void 0,!1,void 0,this)}function cbe({def:e,value:t,onChange:n,api:r,label:s}){let i=Array.isArray(t)?t:[],c=e.fields??[],u=c.length===1&&!["repeater","group","richtext","media"].includes(c[0].type),[f,p]=Lt.useState(null),m=(z,F)=>n(i.map((ne,V)=>V===z?F:ne)),g=()=>n([...i,{}]),y=(z)=>n(i.filter((F,ne)=>ne!==z)),v=(z,F)=>{if(z===F||F<0||F>=i.length)return;let ne=i.slice(),[V]=ne.splice(z,1);ne.splice(F,0,V),n(ne)},x=(z,F)=>v(z,z+F),w=e.max!=null&&i.length>=e.max,C=e.min!=null&&i.length<=e.min,I=(z)=>{let F=["text","textarea","richtext","select","url"];for(let ne of c){if(!F.includes(ne.type))continue;let V=z[ne.name],ae=(Uh(V)?T1(V):typeof V==="string"?V.replace(/<[^>]+>/g," "):"").replace(/\s+/g," ").trim();if(ae)return ae.slice(0,80)}return""},R=(z)=>({onDragOver:(F)=>{if(!f)return;F.preventDefault(),p((ne)=>ne&&ne.over!==z?{...ne,over:z}:ne)},onDrop:(F)=>{if(!f)return;F.preventDefault(),v(f.from,z),p(null)}}),H=(z)=>be.jsxDEV("span",{draggable:!0,onDragStart:(F)=>{F.dataTransfer.effectAllowed="move",F.dataTransfer.setData("text/plain",""),p({from:z,over:z})},onDragEnd:()=>p(null),className:"cursor-grab select-none px-1 text-fg-subtle transition-colors hover:text-fg active:cursor-grabbing",title:"Drag to reorder","aria-hidden":!0,children:"⠿"},void 0,!1,void 0,this),L=(z)=>`${f&&f.over===z&&f.from!==z?"ring-2 ring-brand-green":""} ${f&&f.from===z?"opacity-40":""}`,_="opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 [@media(hover:none)]:opacity-100",W=(z)=>be.jsxDEV("div",{className:"flex shrink-0 items-center",children:[be.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg disabled:opacity-30",title:"Move up",disabled:z===0,onClick:()=>x(z,-1),children:"↑"},void 0,!1,void 0,this),be.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg disabled:opacity-30",title:"Move down",disabled:z===i.length-1,onClick:()=>x(z,1),children:"↓"},void 0,!1,void 0,this),be.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-danger disabled:opacity-30",title:"Remove",disabled:C,onClick:()=>y(z),children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return be.jsxDEV("div",{className:"flex flex-col gap-2",children:[be.jsxDEV("span",{className:"text-sm font-medium text-fg",children:s},void 0,!1,void 0,this),i.length===0?be.jsxDEV("span",{className:"text-sm text-fg-muted",children:"None yet."},void 0,!1,void 0,this):null,be.jsxDEV("div",{className:`flex flex-col ${u?"gap-1":"gap-2"}`,children:i.map((z,F)=>u?be.jsxDEV("div",{className:`group/row flex items-center gap-1 rounded-lg px-1 py-0.5 transition-colors ${L(F)}`,...R(F),children:[H(F),be.jsxDEV("div",{className:"min-w-0 flex-1",children:be.jsxDEV(rQ,{def:c[0],hideLabelAs:`${e.label??e.name} ${F+1}`,value:z[c[0].name],onChange:(ne)=>m(F,{...z,[c[0].name]:ne}),api:r},void 0,!1,void 0,this)},void 0,!1,void 0,this),be.jsxDEV("div",{className:"opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 [@media(hover:none)]:opacity-100",children:W(F)},void 0,!1,void 0,this)]},F,!0,void 0,this):be.jsxDEV("div",{className:`rounded-lg border border-border bg-surface-muted transition-colors ${L(F)}`,...R(F),children:[be.jsxDEV("div",{className:"flex items-center gap-1 border-b border-border px-2 py-1.5",children:[H(F),be.jsxDEV("span",{className:"text-caption text-fg-subtle",children:F+1},void 0,!1,void 0,this),be.jsxDEV("span",{className:"min-w-0 flex-1 truncate text-sm text-fg-muted",children:I(z)},void 0,!1,void 0,this),W(F)]},void 0,!0,void 0,this),be.jsxDEV("div",{className:"p-3.5",children:be.jsxDEV(jh,{schema:c,value:z,onChange:(ne)=>m(F,ne),api:r},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},F,!0,void 0,this))},void 0,!1,void 0,this),be.jsxDEV(me,{variant:"secondary",size:"sm",className:"self-start",onPress:g,isDisabled:w,children:["+ Add ",e.label??e.name]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function da(e){return sQ(e).replace(/-+$/,"")}function sQ(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/-{2,}/g,"-").replace(/^-+/,"").slice(0,80)}function ube({def:e,label:t,value:n,source:r,onChange:s}){let i=Lt.useRef(null),c=Lt.useRef(!1),u=Lt.useRef(null);Lt.useEffect(()=>{if(!e.from)return;let m=u.current;if(u.current=r,m===null||m===r||!r)return;if(c.current)return;if(n!==""&&n!==i.current)return;let g=da(r);if(g===n)return;i.current=g,s(g)},[r,n,e.from,s]);let f=r?da(r):"",p=Boolean(f)&&f!==n;return be.jsxDEV(tp,{label:t,children:[be.jsxDEV("input",{className:at,value:n,onChange:(m)=>{c.current=!0,i.current=null,s(sQ(m.target.value))},onBlur:()=>{let m=da(n);if(m!==n)s(m)},placeholder:f},void 0,!1,void 0,this),p?be.jsxDEV("button",{type:"button",className:"self-start text-caption text-fg-subtle underline hover:text-fg",onClick:()=>{i.current=f,c.current=!1,s(f)},children:["Generate from ",e.from,": ",f]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function dbe({def:e,value:t,onChange:n,api:r,ariaLabel:s}){let[i,c]=Lt.useState(null),u=e.optionsFrom;Lt.useEffect(()=>{if(!u)return;let m=!0;return r.call(u).then((g)=>{if(m)c(Array.isArray(g)?g:[])}).catch(()=>{if(m)c([])}),()=>{m=!1}},[u,r]);let f=Boolean(u)&&i===null,p=u?i??[]:(e.options??[]).map((m)=>({value:m,label:m}));return be.jsxDEV("select",{className:at,"aria-label":s,value:t??"",onChange:(m)=>n(m.target.value||null),children:[be.jsxDEV("option",{value:"",children:f?"Načítám…":"—"},void 0,!1,void 0,this),p.map((m)=>be.jsxDEV("option",{value:m.value,children:m.label},m.value,!1,void 0,this))]},void 0,!0,void 0,this)}function fbe({value:e,onChange:t,api:n}){let[r,s]=Lt.useState(!1),[i,c]=Lt.useState(null);return Lt.useEffect(()=>{if(e)n.call("getMedia",{id:e}).then(c).catch(()=>c(null));else c(null)},[e,n]),be.jsxDEV("div",{children:[be.jsxDEV("div",{className:"flex items-center gap-3 rounded-[14px] border border-transparent bg-surface-card px-[18px] py-3.5",children:[i?be.jsxDEV("img",{className:"h-10 w-10 rounded object-cover",src:n.resolve(`/media/${i.file.key}`),alt:""},void 0,!1,void 0,this):be.jsxDEV("span",{className:"text-fg-subtle",children:"no media"},void 0,!1,void 0,this),be.jsxDEV("span",{className:"flex-1 truncate text-fg-subtle",children:i?.file.filename??e??""},void 0,!1,void 0,this),be.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>s(!0),children:"pick"},void 0,!1,void 0,this),e?be.jsxDEV(me,{variant:"ghost",size:"sm",className:"text-danger",onPress:()=>t(null),children:"clear"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),r?be.jsxDEV(pbe,{api:n,onClose:()=>s(!1),onPick:(u)=>{t(u),s(!1)}},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function pbe({api:e,onClose:t,onPick:n}){let[r,s]=Lt.useState([]),[i,c]=Lt.useState(!1),[u,f]=Lt.useState(""),p=()=>e.listMedia().then(s).catch((g)=>f(String(g.message??g)));Lt.useEffect(()=>{p()},[]);let m=async(g)=>{c(!0),f("");try{let y=await e.uploadMedia(g);n(y.id)}catch(y){f(String(y.message??y))}finally{c(!1)}};return be.jsxDEV(oS,{isOpen:!0,isDismissable:!0,onOpenChange:(g)=>!g&&t(),children:be.jsxDEV(rS,{className:"w-full max-w-[680px] px-9 py-8",children:be.jsxDEV(aS,{className:"max-h-[86vh] overflow-auto outline-none",children:[be.jsxDEV(Qo,{level:"1",className:"mb-5 font-normal",children:["Choose ",be.jsxDEV("span",{className:"text-fg-subtle",children:"a file"},void 0,!1,void 0,this)," from the library"]},void 0,!0,void 0,this),u?be.jsxDEV("div",{className:"my-2 rounded-lg border border-danger bg-surface-card px-3.5 py-2.5 text-small text-danger",children:u},void 0,!1,void 0,this):null,be.jsxDEV("label",{className:"mb-4 flex w-full flex-col gap-2",children:[be.jsxDEV(cS,{size:"small",weight:"medium",children:"Upload a new file"},void 0,!1,void 0,this),be.jsxDEV("input",{type:"file",className:"text-small text-fg-muted",disabled:i,onChange:(g)=>g.target.files?.[0]&&m(g.target.files[0])},void 0,!1,void 0,this)]},void 0,!0,void 0,this),be.jsxDEV("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2.5",children:r.map((g)=>be.jsxDEV("div",{className:"cursor-pointer overflow-hidden rounded-lg border border-border bg-surface-card",onClick:()=>n(g.id),children:[(g.file.contentType??"").startsWith("image/")?be.jsxDEV("img",{className:"block h-[130px] w-full object-cover",src:e.resolve(`/media/${g.file.key}`),alt:""},void 0,!1,void 0,this):be.jsxDEV("div",{className:"h-[130px] bg-surface-muted"},void 0,!1,void 0,this),be.jsxDEV("div",{className:"truncate px-2 py-1.5 text-caption text-fg-muted",children:g.file.filename??g.id},void 0,!1,void 0,this)]},g.id,!0,void 0,this))},void 0,!1,void 0,this),be.jsxDEV("div",{className:"mt-3 text-right",children:be.jsxDEV(me,{variant:"ghost",onPress:t,children:"close"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function iQ(e){if(Array.isArray(e))return{items:e};let t=e;return{items:Array.isArray(t?.items)?t.items:[],hasMore:t?.hasMore}}function mbe(e,t,n){let[r,s]=Lt.useState(()=>new Map),i=JSON.stringify(n);return Lt.useEffect(()=>{if(!t)return;let u=JSON.parse(i).filter((p)=>!r.has(p));if(u.length===0)return;let f=!0;return e.call(t,{ids:u}).then((p)=>{if(!f)return;let m=iQ(p).items;s((g)=>{let y=new Map(g);for(let v of m)y.set(v.value,v);for(let v of u)if(!y.has(v))y.set(v,{value:v,label:""});return y})}).catch(()=>{if(!f)return;s((p)=>{let m=new Map(p);for(let g of u)if(!m.has(g))m.set(g,{value:g,label:""});return m})}),()=>{f=!1}},[e,t,i,r]),r}function hbe(e,t){let n=t.get(e);if(!n)return{label:"Loading...",muted:!0};return n.label?{label:n.label,muted:!1}:{label:e,muted:!0}}function gbe({def:e,value:t,onChange:n,api:r,ariaLabel:s}){let i=e.multiple===!0,c=i?Array.isArray(t)?t.filter((y)=>typeof y==="string"):[]:typeof t==="string"&&t!==""?[t]:[],u=mbe(r,e.referenceFrom,c),[f,p]=Lt.useState(!1),m=(y)=>{if(i){if(!c.includes(y.value))n([...c,y.value])}else n(y.value),p(!1)},g=(y)=>n(i?c.filter((v)=>v!==y):null);if(!e.referenceFrom)return be.jsxDEV("span",{className:"text-sm text-danger",children:"This reference field declares no `referenceFrom` handler."},void 0,!1,void 0,this);return be.jsxDEV("div",{className:"flex flex-col gap-2",children:[c.length===0?be.jsxDEV("span",{className:"text-sm text-fg-muted",children:"Nothing selected."},void 0,!1,void 0,this):be.jsxDEV("div",{className:"flex flex-col gap-1",children:c.map((y)=>{let{label:v,muted:x}=hbe(y,u),w=u.get(y)?.hint;return be.jsxDEV("div",{className:"flex items-center gap-2 rounded-[14px] bg-surface-card px-4 py-2.5",children:[be.jsxDEV("span",{className:`min-w-0 flex-1 truncate text-sm ${x?"text-fg-subtle":"text-fg"}`,children:v},void 0,!1,void 0,this),w?be.jsxDEV("span",{className:"shrink-0 text-caption text-fg-subtle",children:w},void 0,!1,void 0,this):null,be.jsxDEV(me,{variant:"ghost",size:"sm",className:"text-danger",onPress:()=>g(y),children:"remove"},void 0,!1,void 0,this)]},y,!0,void 0,this)})},void 0,!1,void 0,this),be.jsxDEV(me,{variant:"secondary",size:"sm",className:"self-start","aria-label":s,onPress:()=>p(!0),children:i?"+ Add":c.length>0?"Change":"Choose"},void 0,!1,void 0,this),f?be.jsxDEV(bbe,{api:r,from:e.referenceFrom,title:e.label??e.name,selected:c,multiple:i,onPick:m,onClose:()=>p(!1)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function bbe({api:e,from:t,title:n,selected:r,multiple:s,onPick:i,onClose:c}){let[u,f]=Lt.useState(""),[p,m]=Lt.useState([]),[g,y]=Lt.useState(!1),[v,x]=Lt.useState(!0),[w,C]=Lt.useState(""),[I,R]=Lt.useState("");Lt.useEffect(()=>{let L=setTimeout(()=>R(u.trim()),250);return()=>clearTimeout(L)},[u]);let H=Lt.useCallback((L)=>(x(!0),C(""),e.call(t,{search:I||void 0,limit:oQ,offset:L}).then((_)=>{let W=iQ(_);m((z)=>L===0?W.items:[...z,...W.items]),y(W.hasMore??W.items.length===oQ)}).catch((_)=>C(String(_?.message??_))).finally(()=>x(!1))),[e,t,I]);return Lt.useEffect(()=>{H(0)},[H]),be.jsxDEV(oS,{isOpen:!0,isDismissable:!0,onOpenChange:(L)=>!L&&c(),children:be.jsxDEV(rS,{className:"w-full max-w-[560px] px-9 py-8",children:be.jsxDEV(aS,{className:"max-h-[86vh] overflow-auto outline-none",children:[be.jsxDEV(Qo,{level:"1",className:"mb-5 font-normal",children:["Choose ",be.jsxDEV("span",{className:"text-fg-subtle",children:n.toLowerCase()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),be.jsxDEV("input",{className:`${at} mb-3`,type:"search",autoFocus:!0,placeholder:"Search","aria-label":"Search",value:u,onChange:(L)=>f(L.target.value)},void 0,!1,void 0,this),w?be.jsxDEV("div",{className:"mb-2 rounded-lg border border-danger bg-surface-card px-3.5 py-2.5 text-small text-danger",children:w},void 0,!1,void 0,this):null,be.jsxDEV("div",{className:"flex flex-col gap-1",children:[p.map((L)=>{let _=r.includes(L.value);return be.jsxDEV("button",{type:"button",disabled:_,onClick:()=>i(L),className:"flex items-center gap-3 rounded-lg px-3 py-2 text-left transition-colors hover:bg-surface-muted disabled:opacity-40",children:[be.jsxDEV("span",{className:"min-w-0 flex-1",children:[be.jsxDEV("span",{className:"block truncate text-sm text-fg",children:L.label},void 0,!1,void 0,this),L.hint?be.jsxDEV("span",{className:"block truncate text-caption text-fg-subtle",children:L.hint},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),_?be.jsxDEV("span",{className:"shrink-0 text-caption text-fg-subtle",children:"selected"},void 0,!1,void 0,this):null]},L.value,!0,void 0,this)}),!v&&p.length===0?be.jsxDEV("p",{className:"px-3 py-2 text-sm text-fg-subtle",children:"Nothing matches."},void 0,!1,void 0,this):null,v?be.jsxDEV("p",{className:"px-3 py-2 text-sm text-fg-subtle",children:"Loading..."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),g&&!v?be.jsxDEV("div",{className:"mt-3 text-center",children:be.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>void H(p.length),children:"Load more"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,be.jsxDEV("div",{className:"mt-3 text-right",children:be.jsxDEV(me,{variant:"ghost",onPress:c,children:s?"done":"close"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var Lt,be,at="h-10 w-full rounded-lg border border-border bg-surface-card px-4 text-sm text-fg outline-none transition-colors placeholder:text-fg-muted focus:border-brand-green",aQ,oQ=20;var I1=E(()=>{Ur();eQ();rt();sM();lM();iM();aM();dM();Lt=O(ee(),1),be=O(Me(),1);aQ=[p4.configure({heading:{levels:[1,2,3]},link:{openOnClick:!1,autolink:!0}}),m4,h4,g4.configure({nested:!0})]});var nn="mx-auto max-w-[1200px] px-7 pb-8 pt-2",Za="flex items-center gap-3 rounded-[14px] border border-transparent bg-surface-card px-[18px] py-3.5",lQ="h-11",x4="top-11",cQ="h-14",pM="top-[6.25rem]";function S4(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t>>>0}function ybe(e){let t=e>>>0;return()=>{t=t+1831565813>>>0;let n=t;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function vbe(e){return uQ[S4(`${e}:accent`)%uQ.length]}function xbe(e,t,n){let r=e,s=t;return n?`M${r+0.5} ${s} A0.5 0.5 0 0 0 ${r+1} ${s+0.5} M${r} ${s+0.5} A0.5 0.5 0 0 0 ${r+0.5} ${s+1}`:`M${r} ${s+0.5} A0.5 0.5 0 0 0 ${r+0.5} ${s} M${r+1} ${s+0.5} A0.5 0.5 0 0 0 ${r+0.5} ${s+1}`}function dQ({seed:e}){let t=ybe(S4(e)),n=vbe(e),r=55+t()*40,s=20+t()*60,i=[];for(let u=0;u<5;u++)for(let f=0;f<20;f++)i.push(xbe(f,u,t()>0.5));let c=Array.from({length:5},()=>({cx:1+t()*18,cy:0.5+t()*4,r:0.09+t()*0.11}));return li.jsxDEV("svg",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 h-full w-full text-fg",viewBox:"0 0 20 5",preserveAspectRatio:"xMidYMid slice",children:[li.jsxDEV("defs",{children:li.jsxDEV("radialGradient",{id:`wash-${S4(e)}`,cx:`${r}%`,cy:`${s}%`,r:"70%",children:[li.jsxDEV("stop",{offset:"0%",stopColor:n,stopOpacity:"0.34"},void 0,!1,void 0,this),li.jsxDEV("stop",{offset:"100%",stopColor:n,stopOpacity:"0"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),li.jsxDEV("rect",{width:20,height:5,fill:`url(#wash-${S4(e)})`},void 0,!1,void 0,this),li.jsxDEV("g",{fill:"none",stroke:"currentColor",strokeWidth:"0.035",strokeLinecap:"round",opacity:"0.28",children:i.map((u)=>li.jsxDEV("path",{d:u},u,!1,void 0,this))},void 0,!1,void 0,this),li.jsxDEV("g",{fill:n,opacity:"0.5",children:c.map((u)=>li.jsxDEV("circle",{cx:u.cx,cy:u.cy,r:u.r},`${u.cx}-${u.cy}`,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var li,uQ;var fQ=E(()=>{li=O(Me(),1);uQ=["var(--color-accent-strong)","var(--color-brand-green)","var(--color-accent-green-lighter)","var(--color-accent-yellow)","var(--color-accent-pink)"]});function $be(){let[e,t]=C4.useState(!1);return C4.useEffect(()=>{let n=()=>t((r)=>r?window.scrollY>Cbe:window.scrollY>Sbe);return n(),window.addEventListener("scroll",n,{passive:!0}),()=>window.removeEventListener("scroll",n)},[]),e}function $4({lead:e,em:t,children:n}){let r=$be();return $c.jsxDEV("div",{className:`sticky ${x4} z-20 mx-auto max-w-[1200px] bg-surface px-7 pb-4`,children:$c.jsxDEV("div",{className:"relative isolate overflow-hidden rounded-panel border border-border bg-surface-card",children:[$c.jsxDEV(dQ,{seed:e},void 0,!1,void 0,this),$c.jsxDEV("div",{className:"absolute inset-0 bg-gradient-to-r from-surface-card via-surface-card/70 to-transparent"},void 0,!1,void 0,this),$c.jsxDEV("div",{className:`relative grid grid-cols-[1fr_auto] items-center gap-6 px-8 transition-[padding] duration-150 ease-out max-[820px]:grid-cols-1 ${r?"py-3.5":"py-9"}`,children:[$c.jsxDEV("h1",{className:`m-0 font-normal tracking-[-0.01em] ${r?"flex items-baseline gap-2 text-[22px] leading-tight":"text-[56px] leading-[1.05] max-[820px]:text-[40px]"}`,children:[$c.jsxDEV("span",{className:r?"text-fg-subtle":"block text-fg-subtle",children:e},void 0,!1,void 0,this),$c.jsxDEV("span",{className:r?"text-fg":"block text-fg",children:t},void 0,!1,void 0,this)]},void 0,!0,void 0,this),n]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var C4,$c,Sbe=120,Cbe=16;var mM=E(()=>{fQ();C4=O(ee(),1),$c=O(Me(),1)});function pQ(e=globalThis){let t=e.PRAMEN_CMS_EDITOR?.previewUrl;if(typeof t!=="string")return;let n=t.trim();return n===""?void 0:n}function mQ(e,t){let n=t.siteUrl;if(!n)return t.resolve(e.url);let r=n.includes("?")?"&":"?",s=`${n}${r}token=${encodeURIComponent(e.token)}`;try{return new URL(s,t.origin).href}catch{return s}}function Vn(e){return String(e?.message??e)}function hQ(){return G.jsxDEV("div",{className:"rounded-lg border border-brand-green bg-brand-green/20 px-3.5 py-2.5 text-small text-fg",children:"saved"},void 0,!1,void 0,this)}function I4({label:e,keyValue:t,onLabel:n,onKey:r,keyHint:s}){return G.jsxDEV("div",{className:"grid grid-cols-2 gap-3 max-[720px]:grid-cols-1",children:[G.jsxDEV(pn,{label:"Label",value:e,onChange:n},void 0,!1,void 0,this),G.jsxDEV("label",{className:"flex flex-col gap-2",children:[G.jsxDEV("span",{className:"text-sm font-medium text-fg",children:"Key"},void 0,!1,void 0,this),G.jsxDEV("input",{className:at,value:t,onChange:(i)=>r(i.target.value.trim())},void 0,!1,void 0,this),G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:s},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function gQ({api:e,onOpen:t,onError:n,canEdit:r}){let[s,i]=_e.useState(null),[c,u]=_e.useState(""),[f,p]=_e.useState(""),[m,g]=_e.useState(!1),[y,v]=_e.useState(!1),x=_e.useCallback(()=>{e.listMenus().then(i).catch((C)=>{i([]),n(Vn(C))})},[e,n]);_e.useEffect(x,[x]);let w=async()=>{v(!0);try{let C=await e.createMenu(f,c);u(""),p(""),g(!1),t(C.name)}catch(C){n(Vn(C))}finally{v(!1)}};return G.jsxDEV(G.Fragment,{children:[G.jsxDEV(T4,{lead:"Navigation",em:s===null?"Menus":s.length===1?"1 menu":`${s.length} menus`},void 0,!1,void 0,this),G.jsxDEV("div",{className:nn,children:[G.jsxDEV("div",{className:"flex flex-col gap-2",children:[s===null?G.jsxDEV("p",{className:"text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this):null,s?.length===0?G.jsxDEV("p",{className:"text-fg-subtle",children:["No menus yet. A menu is read by name — ",G.jsxDEV("code",{children:'getMenu("primary")'},void 0,!1,void 0,this)," — from your layout."]},void 0,!0,void 0,this):null,(s??[]).map((C)=>G.jsxDEV("div",{className:`${Za} cursor-pointer hover:bg-surface-muted`,onClick:()=>t(C.name),children:[G.jsxDEV("span",{className:"min-w-0 flex-1 truncate font-medium",children:C.label},void 0,!1,void 0,this),G.jsxDEV("span",{className:"shrink-0 truncate text-fg-subtle",children:C.name},void 0,!1,void 0,this),G.jsxDEV("span",{className:"shrink-0 text-caption text-fg-subtle",children:[bQ(C.items??[])," item(s)"]},void 0,!0,void 0,this)]},C.id,!0,void 0,this))]},void 0,!0,void 0,this),r?G.jsxDEV("div",{className:"mt-6 max-w-[720px] rounded-lg border border-border bg-surface-muted p-4",children:[G.jsxDEV(Qo,{level:"2",className:"mb-3 font-normal",children:"New menu"},void 0,!1,void 0,this),G.jsxDEV(I4,{label:c,keyValue:f,onLabel:(C)=>{if(u(C),!m)p(da(C))},onKey:(C)=>{g(!0),p(C)},keyHint:"What your layout asks for. Not renameable afterwards."},void 0,!1,void 0,this),G.jsxDEV(me,{className:"mt-3",onPress:w,isDisabled:y||!c.trim()||!f.trim(),children:"Create menu"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function bQ(e){return e.reduce((t,n)=>t+1+bQ(n.children??[]),0)}function yQ(e,t=[]){let n=[];return e.forEach((r,s)=>{let i=[...t,s];n.push({item:r,path:i,depth:t.length}),n.push(...yQ(r.children??[],i))}),n}function Kh(e,t){let n=e;for(let r=0;r<t.length-1;r++)n=n[t[r]].children??[];return{list:n,index:t[t.length-1]}}function w4(e){return e.map((t)=>({...t,children:t.children?w4(t.children):void 0}))}function hM(e,t){let n=w4(e),{list:r,index:s}=Kh(n,t),[i]=r.splice(s,1);return{tree:n,removed:i}}function vQ({api:e,name:t,collections:n,onBack:r,onDeleted:s,onError:i,canEdit:c}){let[u,f]=_e.useState(null),[p,m]=_e.useState([]);vS(u?.label);let[g,y]=_e.useState(""),[v,x]=_e.useState("");gh(u!==null&&JSON.stringify({label:g,items:p})!==v);let[w,C]=_e.useState(void 0),[I,R]=_e.useState(!1),[H,L]=_e.useState(!1),[_,W]=_e.useState(!1),[z,F]=_e.useState([]),[ne,V]=_e.useState([]);_e.useEffect(()=>{let k=!0;return e.listMenus().then((te)=>{if(!k)return;let Ce=te.find(($e)=>$e.name===t);if(!Ce){R(!0);return}f(Ce),y(Ce.label),m(Ce.items??[]),C(Ce.version),x(JSON.stringify({label:Ce.label,items:Ce.items??[]}))}).catch((te)=>i(Vn(te))),e.listPages({limit:200}).then((te)=>k&&F(te)).catch(()=>F([])),e.listTaxonomies().then(async(te)=>{let Ce=await Promise.all(te.map(async(se)=>[se,await e.getTermTree(se.slug).catch(()=>[])])),$e=[];for(let[se,de]of Ce){let ge=(Re,ye)=>{for(let Ee of Re)if($e.push({id:Ee.id,label:`${ye}${Ee.label}`,taxonomy:se.label}),Ee.children)ge(Ee.children,`${ye}${Ee.label} / `)};ge(de,"")}if(k)V($e)}).catch(()=>V([])),()=>{k=!1}},[e,t,i]);let ie=async()=>{if(!u)return;L(!0);try{let k=await e.updateMenu(u.id,{label:g,items:p,expectedVersion:w});C(k.version),x(JSON.stringify({label:g,items:p})),W(!0),setTimeout(()=>W(!1),1200)}catch(k){i(Vn(k))}finally{L(!1)}},ae=async()=>{if(!u||!confirm(`Delete the menu “${u.label}”? Any layout reading it will render nothing.`))return;L(!0);try{await e.deleteMenu(u.id),s()}catch(k){i(Vn(k))}finally{L(!1)}},re=yQ(p),D=(k,te)=>{let Ce=w4(p),{list:$e,index:se}=Kh(Ce,k);$e[se]={...$e[se],...te},m(Ce)},B=(k)=>m(hM(p,k).tree),U=(k,te)=>{let Ce=w4(p),{list:$e,index:se}=Kh(Ce,k),de=se+te;if(de<0||de>=$e.length)return;let[ge]=$e.splice(se,1);$e.splice(de,0,ge),m(Ce)},Q=(k,te)=>{let{index:Ce}=Kh(p,k);if(Ce===0||te+1>=wA)return;let{tree:$e,removed:se}=hM(p,k),{list:de}=Kh($e,k),ge=de[Ce-1];ge.children=[...ge.children??[],se],m($e)},xe=(k)=>{if(k.length<2)return;let{tree:te,removed:Ce}=hM(p,k),$e=k.slice(0,-1),{list:se,index:de}=Kh(te,$e);se.splice(de+1,0,Ce),m(te)},le=()=>m([...p,{id:crypto.randomUUID(),label:"New item",kind:"custom",url:"/"}]);if(I)return G.jsxDEV("div",{className:nn,children:G.jsxDEV("p",{className:"pt-8 text-fg-subtle",children:["Unknown menu: ",t]},void 0,!0,void 0,this)},void 0,!1,void 0,this);if(!u)return G.jsxDEV("div",{className:nn,children:G.jsxDEV("p",{className:"pt-8 text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this)},void 0,!1,void 0,this);return G.jsxDEV("div",{className:nn,children:[G.jsxDEV("div",{className:"mb-4 mt-2 flex items-center gap-3",children:[G.jsxDEV(me,{variant:"ghost",size:"sm",onPress:r,children:"← Menus"},void 0,!1,void 0,this),G.jsxDEV("h1",{className:"text-[22px] font-normal text-fg",children:u.label},void 0,!1,void 0,this),G.jsxDEV("span",{className:"text-fg-subtle",children:u.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("div",{className:"flex max-w-[860px] flex-col gap-4",children:[_?G.jsxDEV(hQ,{},void 0,!1,void 0,this):null,G.jsxDEV(pn,{label:"Label",value:g,onChange:y},void 0,!1,void 0,this),G.jsxDEV("div",{className:"flex flex-col gap-2",children:[re.length===0?G.jsxDEV("p",{className:"text-sm text-fg-subtle",children:"No items yet."},void 0,!1,void 0,this):null,re.map(({item:k,path:te,depth:Ce})=>G.jsxDEV("div",{style:{marginLeft:Ce*24},children:G.jsxDEV(Tbe,{item:k,depth:Ce,pages:z,terms:ne,collections:n,onPatch:($e)=>D(te,$e),onMove:($e)=>U(te,$e),onIndent:()=>Q(te,Ce),onOutdent:()=>xe(te),onRemove:()=>B(te)},void 0,!1,void 0,this)},k.id,!1,void 0,this))]},void 0,!0,void 0,this),c?G.jsxDEV("div",{className:"flex items-center gap-2",children:[G.jsxDEV(me,{variant:"secondary",size:"sm",onPress:le,children:"+ Add item"},void 0,!1,void 0,this),G.jsxDEV(me,{onPress:ie,isDisabled:H,children:H?"Saving…":"Save menu"},void 0,!1,void 0,this),G.jsxDEV(me,{variant:"ghost",className:"text-danger",onPress:ae,isDisabled:H,children:"Delete menu"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Tbe({item:e,depth:t,pages:n,terms:r,collections:s,onPatch:i,onMove:c,onIndent:u,onOutdent:f,onRemove:p}){let m=e.kind??"custom";return G.jsxDEV("div",{className:"rounded-lg border border-border bg-surface-muted p-3.5",children:[G.jsxDEV("div",{className:"grid grid-cols-[1fr_auto] gap-3",children:[G.jsxDEV("div",{className:"grid grid-cols-2 gap-3 max-[720px]:grid-cols-1",children:[G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Label"},void 0,!1,void 0,this),G.jsxDEV("input",{className:at,value:e.label,onChange:(g)=>i({label:g.target.value})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Points at"},void 0,!1,void 0,this),G.jsxDEV("select",{className:at,value:m,onChange:(g)=>i({kind:g.target.value,ref:null,url:g.target.value==="custom"?"/":void 0}),children:wbe.map((g)=>G.jsxDEV("option",{value:g.value,children:g.label},g.value,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("div",{className:"flex shrink-0 items-start gap-0.5 pt-5",children:[G.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg",title:"Move up",onClick:()=>c(-1),children:"↑"},void 0,!1,void 0,this),G.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg",title:"Move down",onClick:()=>c(1),children:"↓"},void 0,!1,void 0,this),G.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg disabled:opacity-30",title:"Nest under the item above",disabled:t+1>=wA,onClick:u,children:"→"},void 0,!1,void 0,this),G.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg disabled:opacity-30",title:"Move out a level",disabled:t===0,onClick:f,children:"←"},void 0,!1,void 0,this),G.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-danger",title:"Remove",onClick:p,children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("div",{className:"mt-3 grid grid-cols-2 gap-3 max-[720px]:grid-cols-1",children:[m==="custom"?G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"URL"},void 0,!1,void 0,this),G.jsxDEV("input",{className:at,value:e.url??"",placeholder:"/about or https://…",onChange:(g)=>i({url:g.target.value})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Target"},void 0,!1,void 0,this),G.jsxDEV("select",{className:at,value:e.ref??"",onChange:(g)=>i({ref:g.target.value||null}),children:[G.jsxDEV("option",{value:"",children:"— pick one —"},void 0,!1,void 0,this),m==="page"?n.map((g)=>G.jsxDEV("option",{value:g.id,children:[g.title," (",g.slug,")"]},g.id,!0,void 0,this)):null,m==="term"?r.map((g)=>G.jsxDEV("option",{value:g.id,children:[g.taxonomy,": ",g.label]},g.id,!0,void 0,this)):null,m==="collection"?s.map((g)=>G.jsxDEV("option",{value:g.slug,children:g.pluralLabel},g.slug,!1,void 0,this)):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Opens in"},void 0,!1,void 0,this),G.jsxDEV("select",{className:at,value:e.target??"",onChange:(g)=>i({target:g.target.value||void 0}),children:[G.jsxDEV("option",{value:"",children:"this tab"},void 0,!1,void 0,this),G.jsxDEV("option",{value:"_blank",children:"a new tab"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m!=="custom"&&!e.ref?G.jsxDEV("p",{className:"mt-2 text-caption text-danger",children:"Pick a target, or this item cannot be saved."},void 0,!1,void 0,this):null,m!=="custom"?G.jsxDEV("p",{className:"mt-2 text-caption text-fg-subtle",children:"The URL is worked out when the menu is read, so it follows the target. An item whose target is unpublished or gone is left out of the public menu rather than rendered as a dead link."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function xQ({api:e,onError:t,canEdit:n}){let[r,s]=_e.useState(null),[i,c]=_e.useState(""),[u,f]=_e.useState(""),[p,m]=_e.useState(301),[g,y]=_e.useState(!1),v=_e.useCallback(()=>{e.listRedirects().then(s).catch((I)=>{s([]),t(Vn(I))})},[e,t]);_e.useEffect(v,[v]);let x=async()=>{y(!0);try{await e.createRedirect({fromPath:i,toPath:u,status:p}),c(""),f(""),v()}catch(I){t(Vn(I))}finally{y(!1)}},w=async(I,R)=>{try{await e.updateRedirect(I.id,R),v()}catch(H){t(Vn(H))}},C=async(I)=>{if(!confirm(`Delete the redirect from ${I.fromPath}?`))return;try{await e.deleteRedirect(I.id),v()}catch(R){t(Vn(R))}};return G.jsxDEV(G.Fragment,{children:[G.jsxDEV(T4,{lead:"Old URLs, kept alive",em:r===null?"Redirects":r.length===1?"1 redirect":`${r.length} redirects`},void 0,!1,void 0,this),G.jsxDEV("div",{className:nn,children:[G.jsxDEV("p",{className:"mb-4 max-w-[62ch] text-sm text-fg-muted",children:"Changing a page's slug changes a live URL and breaks every link to it. A redirect is how the old one keeps working. Disabling one keeps the record of what the old URL was, which deleting it does not."},void 0,!1,void 0,this),G.jsxDEV("div",{className:"flex flex-col gap-2",children:[r===null?G.jsxDEV("p",{className:"text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this):null,r?.length===0?G.jsxDEV("p",{className:"text-fg-subtle",children:"No redirects yet."},void 0,!1,void 0,this):null,(r??[]).map((I)=>G.jsxDEV("div",{className:`${Za} ${I.enabled?"":"opacity-60"}`,children:[G.jsxDEV("span",{className:"min-w-0 flex-1 truncate font-medium",children:I.fromPath},void 0,!1,void 0,this),G.jsxDEV("span",{className:"shrink-0 text-fg-subtle",children:"→"},void 0,!1,void 0,this),G.jsxDEV("span",{className:"min-w-0 flex-1 truncate text-fg-muted",children:I.toPath},void 0,!1,void 0,this),G.jsxDEV("span",{className:"shrink-0 text-caption text-fg-subtle",children:I.status},void 0,!1,void 0,this),n?G.jsxDEV(G.Fragment,{children:[G.jsxDEV(me,{variant:"ghost",size:"sm",onPress:()=>w(I,{enabled:!I.enabled}),children:I.enabled?"disable":"enable"},void 0,!1,void 0,this),G.jsxDEV(me,{variant:"ghost",size:"sm",className:"text-danger",onPress:()=>C(I),children:"delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},I.id,!0,void 0,this))]},void 0,!0,void 0,this),n?G.jsxDEV("div",{className:"mt-6 max-w-[860px] rounded-lg border border-border bg-surface-muted p-4",children:[G.jsxDEV(Qo,{level:"2",className:"mb-3 font-normal",children:"New redirect"},void 0,!1,void 0,this),G.jsxDEV("div",{className:"grid grid-cols-[1fr_1fr_auto] gap-3 max-[720px]:grid-cols-1",children:[G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"From (a path on this site)"},void 0,!1,void 0,this),G.jsxDEV("input",{className:at,value:i,placeholder:"/old-page",onChange:(I)=>c(I.target.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"To (a path, or a full URL)"},void 0,!1,void 0,this),G.jsxDEV("input",{className:at,value:u,placeholder:"/new-page",onChange:(I)=>f(I.target.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Status"},void 0,!1,void 0,this),G.jsxDEV("select",{className:at,value:p,onChange:(I)=>m(Number(I.target.value)),children:NK.map((I)=>G.jsxDEV("option",{value:I,children:[I,I===301||I===308?" permanent":" temporary"]},I,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV(me,{className:"mt-3",onPress:x,isDisabled:g||!i.trim()||!u.trim(),children:"Add redirect"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function SQ({value:e,onChange:t,disabled:n}){let r=(s)=>{let i=(e??[]).includes(s)?(e??[]).filter((c)=>c!==s):[...e??[],s];t(i.length===0?null:i)};return G.jsxDEV("div",{className:"mt-3",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Applies to"},void 0,!1,void 0,this),G.jsxDEV("div",{className:"mt-1 flex flex-col gap-1",children:[G.jsxDEV("label",{className:"flex items-center gap-2",children:[G.jsxDEV("input",{type:"radio",checked:e===null,disabled:n,onChange:()=>t(null)},void 0,!1,void 0,this),G.jsxDEV("span",{className:"text-sm text-fg",children:"Everything"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 pl-5",children:PK.map((s)=>G.jsxDEV("label",{className:"flex items-center gap-2",children:[G.jsxDEV("input",{type:"checkbox",checked:(e??[]).includes(s),disabled:n,onChange:()=>r(s)},void 0,!1,void 0,this),G.jsxDEV("span",{className:"text-sm text-fg",children:TA[s]},void 0,!1,void 0,this)]},s,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Ibe(e){let t=e.appliesTo;if(!Array.isArray(t)||t.length===0)return"everything";return t.map((n)=>TA[n]??n).join(" + ").toLowerCase()}function CQ({api:e,onOpen:t,onError:n,canEdit:r}){let[s,i]=_e.useState(null),[c,u]=_e.useState(""),[f,p]=_e.useState(""),[m,g]=_e.useState(!1),[y,v]=_e.useState(!1),[x,w]=_e.useState(null),[C,I]=_e.useState(!1),{cms:{mediaTerms:R}}=nt(),H=_e.useCallback(()=>{e.listTaxonomies().then(i).catch((_)=>{i([]),n(Vn(_))})},[e,n]);_e.useEffect(H,[H]);let L=async()=>{I(!0);try{let _=await e.createTaxonomy({slug:f,label:c,hierarchical:y,appliesTo:R?x:null});u(""),p(""),g(!1),v(!1),w(null),t(_.slug)}catch(_){n(Vn(_))}finally{I(!1)}};return G.jsxDEV(G.Fragment,{children:[G.jsxDEV(T4,{lead:"How this site",em:"is classified"},void 0,!1,void 0,this),G.jsxDEV("div",{className:nn,children:[G.jsxDEV("p",{className:"mb-4 max-w-[62ch] text-sm text-fg-muted",children:"A vocabulary is a way of grouping pages — categories, tags, regions. There are no built-in ones: a deployment declares what it sorts by, the same way it declares its content types."},void 0,!1,void 0,this),G.jsxDEV("div",{className:"flex flex-col gap-2",children:[s===null?G.jsxDEV("p",{className:"text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this):null,s?.length===0?G.jsxDEV("p",{className:"text-fg-subtle",children:"No vocabularies yet."},void 0,!1,void 0,this):null,(s??[]).map((_)=>G.jsxDEV("div",{className:`${Za} cursor-pointer hover:bg-surface-muted`,onClick:()=>t(_.slug),children:[G.jsxDEV("span",{className:"min-w-0 flex-1 truncate font-medium",children:_.label},void 0,!1,void 0,this),G.jsxDEV("span",{className:"shrink-0 truncate text-fg-subtle",children:_.slug},void 0,!1,void 0,this),G.jsxDEV("span",{className:"shrink-0 text-caption text-fg-subtle",children:_.hierarchical?"nested":"flat"},void 0,!1,void 0,this),R?G.jsxDEV("span",{className:"shrink-0 text-caption text-fg-subtle",children:Ibe(_)},void 0,!1,void 0,this):null]},_.id,!0,void 0,this))]},void 0,!0,void 0,this),r?G.jsxDEV("div",{className:"mt-6 max-w-[720px] rounded-lg border border-border bg-surface-muted p-4",children:[G.jsxDEV(Qo,{level:"2",className:"mb-3 font-normal",children:"New vocabulary"},void 0,!1,void 0,this),G.jsxDEV(I4,{label:c,keyValue:f,onLabel:(_)=>{if(u(_),!m)p(da(_))},onKey:(_)=>{g(!0),p(_)},keyHint:"A URL segment — terms live under it. Not renameable afterwards."},void 0,!1,void 0,this),G.jsxDEV("label",{className:"mt-3 flex items-center gap-2",children:[G.jsxDEV("input",{type:"checkbox",checked:y,onChange:(_)=>v(_.target.checked)},void 0,!1,void 0,this),G.jsxDEV("span",{className:"text-sm text-fg",children:"Terms can nest (categories rather than tags)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),R?G.jsxDEV(SQ,{value:x,onChange:w},void 0,!1,void 0,this):null,G.jsxDEV(me,{className:"mt-3",onPress:L,isDisabled:C||!c.trim()||!f.trim(),children:"Create vocabulary"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function $Q({api:e,slug:t,onBack:n,onDeleted:r,onError:s,canEdit:i}){let[c,u]=_e.useState(null),[f,p]=_e.useState(null),[m,g]=_e.useState(!1),[y,v]=_e.useState(""),[x,w]=_e.useState(""),[C,I]=_e.useState(!1),[R,H]=_e.useState(""),[L,_]=_e.useState(!1),{cms:{mediaTerms:W}}=nt(),z=_e.useCallback(()=>{e.getTermTree(t).then(p).catch((D)=>{p([]),s(Vn(D))})},[e,t,s]);_e.useEffect(()=>{let D=!0;return e.listTaxonomies().then((B)=>{if(!D)return;let U=B.find((Q)=>Q.slug===t);if(!U){g(!0);return}u(U)}).catch((B)=>s(Vn(B))),()=>{D=!1}},[e,t,s]),_e.useEffect(z,[z]);let F=f?E1(f):[],ne=async()=>{_(!0);try{await e.createTerm({taxonomy:t,slug:x,label:y,parentId:R||null}),v(""),w(""),I(!1),H(""),z()}catch(D){s(Vn(D))}finally{_(!1)}},V=async(D)=>{if(!confirm(`Delete “${D.label}”? Pages tagged with it lose the tag; any terms under it move to the top level.`))return;try{await e.deleteTerm(D.id),z()}catch(B){s(Vn(B))}},ie=async(D,B)=>{if(B===D.label)return;try{await e.updateTerm(D.id,{label:B}),z()}catch(U){s(Vn(U))}},ae=async(D)=>{if(!c)return;let B=c.appliesTo??null;u({...c,appliesTo:D});try{s(""),await e.updateTaxonomy(c.id,{appliesTo:D})}catch(U){u({...c,appliesTo:B}),s(Vn(U))}},re=async()=>{if(!c||!confirm(`Delete the vocabulary “${c.label}”? Every term in it goes too, along with every page's assignments.`))return;try{await e.deleteTaxonomy(c.id),r()}catch(D){s(Vn(D))}};if(m)return G.jsxDEV("div",{className:nn,children:G.jsxDEV("p",{className:"pt-8 text-fg-subtle",children:["Unknown vocabulary: ",t]},void 0,!0,void 0,this)},void 0,!1,void 0,this);if(!c)return G.jsxDEV("div",{className:nn,children:G.jsxDEV("p",{className:"pt-8 text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this)},void 0,!1,void 0,this);return G.jsxDEV("div",{className:nn,children:[G.jsxDEV("div",{className:"mb-4 mt-2 flex items-center gap-3",children:[G.jsxDEV(me,{variant:"ghost",size:"sm",onPress:n,children:"← Taxonomies"},void 0,!1,void 0,this),G.jsxDEV("h1",{className:"text-[22px] font-normal text-fg",children:c.label},void 0,!1,void 0,this),G.jsxDEV("span",{className:"text-fg-subtle",children:c.slug},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("div",{className:"flex max-w-[860px] flex-col gap-4",children:[G.jsxDEV("div",{className:"flex flex-col gap-2",children:[f===null?G.jsxDEV("p",{className:"text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this):null,f?.length===0?G.jsxDEV("p",{className:"text-fg-subtle",children:"No terms yet."},void 0,!1,void 0,this):null,F.map(({term:D,depth:B})=>G.jsxDEV("div",{className:Za,style:{marginLeft:B*24},children:[G.jsxDEV("input",{className:`${at} flex-1`,defaultValue:D.label,"aria-label":`Label for ${D.label}`,disabled:!i,onBlur:(U)=>ie(D,U.target.value.trim())},void 0,!1,void 0,this),G.jsxDEV("span",{className:"shrink-0 truncate text-fg-subtle",children:D.slug},void 0,!1,void 0,this),i?G.jsxDEV(me,{variant:"ghost",size:"sm",className:"text-danger",onPress:()=>V(D),children:"delete"},void 0,!1,void 0,this):null]},D.id,!0,void 0,this))]},void 0,!0,void 0,this),i?G.jsxDEV("div",{className:"rounded-lg border border-border bg-surface-muted p-4",children:[G.jsxDEV(Qo,{level:"2",className:"mb-3 font-normal",children:"New term"},void 0,!1,void 0,this),G.jsxDEV(I4,{label:y,keyValue:x,onLabel:(D)=>{if(v(D),!C)w(da(D))},onKey:(D)=>{I(!0),w(D)},keyHint:"The URL segment for this term."},void 0,!1,void 0,this),c.hierarchical?G.jsxDEV("label",{className:"mt-3 flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Nested under"},void 0,!1,void 0,this),G.jsxDEV("select",{className:at,value:R,onChange:(D)=>H(D.target.value),children:[G.jsxDEV("option",{value:"",children:"— top level —"},void 0,!1,void 0,this),F.map(({term:D,depth:B})=>G.jsxDEV("option",{value:D.id,children:["— ".repeat(B),D.label]},D.id,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,G.jsxDEV(me,{className:"mt-3",onPress:ne,isDisabled:L||!y.trim()||!x.trim(),children:"Add term"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,i&&W?G.jsxDEV("div",{className:"rounded-lg border border-border bg-surface-muted p-4",children:[G.jsxDEV(Qo,{level:"2",className:"mb-1 font-normal",children:"Where this vocabulary is offered"},void 0,!1,void 0,this),G.jsxDEV("p",{className:"max-w-[62ch] text-caption text-fg-subtle",children:"Narrowing is refused while the vocabulary is still assigned to something it would stop applying to — remove those assignments first, so nothing is left tagged with a vocabulary you can no longer see."},void 0,!1,void 0,this),G.jsxDEV(SQ,{value:c.appliesTo??null,onChange:ae},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,i?G.jsxDEV(me,{variant:"ghost",className:"self-start text-danger",onPress:re,children:"Delete this vocabulary"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function E1(e,t=0){let n=[];for(let r of e)if(n.push({term:r,depth:t}),r.children)n.push(...E1(r.children,t+1));return n}function wQ({api:e,onOpen:t,onError:n,canEdit:r}){let[s,i]=_e.useState(null),[c,u]=_e.useState(""),[f,p]=_e.useState(""),[m,g]=_e.useState(!1),[y,v]=_e.useState(!1),x=_e.useCallback(()=>{e.listWidgetAreas().then(i).catch((C)=>{i([]),n(Vn(C))})},[e,n]);_e.useEffect(x,[x]);let w=async()=>{v(!0);try{let C=await e.createWidgetArea(f,c);u(""),p(""),g(!1),t(C.name)}catch(C){n(Vn(C))}finally{v(!1)}};return G.jsxDEV(G.Fragment,{children:[G.jsxDEV(T4,{lead:"Parts of the layout",em:"you can fill in"},void 0,!1,void 0,this),G.jsxDEV("div",{className:nn,children:[G.jsxDEV("p",{className:"mb-4 max-w-[62ch] text-sm text-fg-muted",children:["A widget area is a named slot in your layout — a sidebar, a footer column — that an editor fills without touching code. Your layout reads one by name: ",G.jsxDEV("code",{children:'getWidgetArea("sidebar")'},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this),G.jsxDEV("div",{className:"flex flex-col gap-2",children:[s===null?G.jsxDEV("p",{className:"text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this):null,s?.length===0?G.jsxDEV("p",{className:"text-fg-subtle",children:"No widget areas yet."},void 0,!1,void 0,this):null,(s??[]).map((C)=>G.jsxDEV("div",{className:`${Za} cursor-pointer hover:bg-surface-muted`,onClick:()=>t(C.name),children:[G.jsxDEV("span",{className:"min-w-0 flex-1 truncate font-medium",children:C.label},void 0,!1,void 0,this),G.jsxDEV("span",{className:"shrink-0 truncate text-fg-subtle",children:C.name},void 0,!1,void 0,this),G.jsxDEV("span",{className:"shrink-0 text-caption text-fg-subtle",children:[(C.widgets??[]).length," widget(s)"]},void 0,!0,void 0,this)]},C.id,!0,void 0,this))]},void 0,!0,void 0,this),r?G.jsxDEV("div",{className:"mt-6 max-w-[720px] rounded-lg border border-border bg-surface-muted p-4",children:[G.jsxDEV(Qo,{level:"2",className:"mb-3 font-normal",children:"New widget area"},void 0,!1,void 0,this),G.jsxDEV(I4,{label:c,keyValue:f,onLabel:(C)=>{if(u(C),!m)p(da(C))},onKey:(C)=>{g(!0),p(C)},keyHint:"What your layout asks for. Not renameable afterwards."},void 0,!1,void 0,this),G.jsxDEV(me,{className:"mt-3",onPress:w,isDisabled:y||!c.trim()||!f.trim(),children:"Create widget area"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function TQ({api:e,name:t,onBack:n,onDeleted:r,onError:s,canEdit:i}){let[c,u]=_e.useState(null),[f,p]=_e.useState(""),[m,g]=_e.useState([]),[y,v]=_e.useState([]),[x,w]=_e.useState("");gh(c!==null&&JSON.stringify({label:f,widgets:m})!==x);let[C,I]=_e.useState(void 0),[R,H]=_e.useState(!1),[L,_]=_e.useState(!1),[W,z]=_e.useState(!1);_e.useEffect(()=>{let ae=!0;return e.listWidgetAreas().then((re)=>{if(!ae)return;let D=re.find((B)=>B.name===t);if(!D){H(!0);return}u(D),p(D.label),g(D.widgets??[]),I(D.version),w(JSON.stringify({label:D.label,widgets:D.widgets??[]}))}).catch((re)=>s(Vn(re))),e.listMenus().then((re)=>ae&&v(re)).catch(()=>v([])),()=>{ae=!1}},[e,t,s]);let F=async()=>{if(!c)return;_(!0);try{let ae=await e.updateWidgetArea(c.id,{label:f,widgets:m,expectedVersion:C});I(ae.version),w(JSON.stringify({label:f,widgets:m})),z(!0),setTimeout(()=>z(!1),1200)}catch(ae){s(Vn(ae))}finally{_(!1)}},ne=async()=>{if(!c||!confirm(`Delete the widget area “${c.label}”?`))return;try{await e.deleteWidgetArea(c.id),r()}catch(ae){s(Vn(ae))}},V=(ae,re)=>g(m.map((D,B)=>B===ae?re:D)),ie=(ae,re)=>{let D=ae+re;if(D<0||D>=m.length)return;let B=m.slice(),[U]=B.splice(ae,1);B.splice(D,0,U),g(B)};if(R)return G.jsxDEV("div",{className:nn,children:G.jsxDEV("p",{className:"pt-8 text-fg-subtle",children:["Unknown widget area: ",t]},void 0,!0,void 0,this)},void 0,!1,void 0,this);if(!c)return G.jsxDEV("div",{className:nn,children:G.jsxDEV("p",{className:"pt-8 text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this)},void 0,!1,void 0,this);return G.jsxDEV("div",{className:nn,children:[G.jsxDEV("div",{className:"mb-4 mt-2 flex items-center gap-3",children:[G.jsxDEV(me,{variant:"ghost",size:"sm",onPress:n,children:"← Widgets"},void 0,!1,void 0,this),G.jsxDEV("h1",{className:"text-[22px] font-normal text-fg",children:c.label},void 0,!1,void 0,this),G.jsxDEV("span",{className:"text-fg-subtle",children:c.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("div",{className:"flex max-w-[860px] flex-col gap-4",children:[W?G.jsxDEV(hQ,{},void 0,!1,void 0,this):null,G.jsxDEV(pn,{label:"Label",value:f,onChange:p},void 0,!1,void 0,this),G.jsxDEV("div",{className:"flex flex-col gap-2",children:[m.length===0?G.jsxDEV("p",{className:"text-sm text-fg-subtle",children:"No widgets yet."},void 0,!1,void 0,this):null,m.map((ae,re)=>G.jsxDEV(Ebe,{widget:ae,menus:y,onChange:(D)=>V(re,D),onMove:(D)=>ie(re,D),onRemove:()=>g(m.filter((D,B)=>B!==re))},ae.id,!1,void 0,this))]},void 0,!0,void 0,this),i?G.jsxDEV("div",{className:"flex flex-wrap items-center gap-2",children:[G.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>g([...m,{id:crypto.randomUUID(),type:"content",content:{type:"doc",content:[]}}]),children:"+ Text"},void 0,!1,void 0,this),G.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>g([...m,{id:crypto.randomUUID(),type:"menu",menuName:y[0]?.name??""}]),children:"+ Menu"},void 0,!1,void 0,this),G.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>g([...m,{id:crypto.randomUUID(),type:"component",componentId:""}]),children:"+ Component"},void 0,!1,void 0,this),G.jsxDEV(me,{onPress:F,isDisabled:L,children:L?"Saving…":"Save"},void 0,!1,void 0,this),G.jsxDEV(me,{variant:"ghost",className:"text-danger",onPress:ne,isDisabled:L,children:"Delete area"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Ebe({widget:e,menus:t,onChange:n,onMove:r,onRemove:s}){let i=(c)=>n({...e,...c});return G.jsxDEV("div",{className:"rounded-lg border border-border bg-surface-muted",children:[G.jsxDEV("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:e.type},void 0,!1,void 0,this),G.jsxDEV("input",{className:"min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-subtle",value:e.title??"",placeholder:"Title (optional)","aria-label":"Widget title",onChange:(c)=>i({title:c.target.value||null})},void 0,!1,void 0,this),G.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg",title:"Move up",onClick:()=>r(-1),children:"↑"},void 0,!1,void 0,this),G.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg",title:"Move down",onClick:()=>r(1),children:"↓"},void 0,!1,void 0,this),G.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-danger",title:"Remove",onClick:s,children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("div",{className:"p-3.5",children:e.type==="content"?G.jsxDEV(fM,{value:e.content??null,onChange:(c)=>i({content:c})},void 0,!1,void 0,this):e.type==="menu"?G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Menu"},void 0,!1,void 0,this),G.jsxDEV("select",{className:at,value:e.menuName??"",onChange:(c)=>i({menuName:c.target.value}),children:[G.jsxDEV("option",{value:"",children:"— pick one —"},void 0,!1,void 0,this),t.map((c)=>G.jsxDEV("option",{value:c.name,children:c.label},c.name,!1,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):G.jsxDEV("div",{className:"flex flex-col gap-3",children:[G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Component id — your front end maps this to one of its own components"},void 0,!1,void 0,this),G.jsxDEV("input",{className:at,value:e.componentId??"",onChange:(c)=>i({componentId:c.target.value.trim()})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV(Abe,{value:e.componentProps,onChange:(c)=>i({componentProps:c})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Abe({value:e,onChange:t}){let[n,r]=_e.useState(()=>e?JSON.stringify(e,null,2):""),[s,i]=_e.useState(!1);return G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Props (JSON object, optional)"},void 0,!1,void 0,this),G.jsxDEV("textarea",{className:`${at} h-auto min-h-24 py-2.5 font-mono text-[12px]`,value:n,onChange:(c)=>{let u=c.target.value;if(r(u),u.trim()===""){i(!1),t(void 0);return}try{let f=JSON.parse(u);if(f===null||typeof f!=="object"||Array.isArray(f)){i(!0);return}i(!1),t(f)}catch{i(!0)}}},void 0,!1,void 0,this),s?G.jsxDEV("span",{className:"text-caption text-danger",children:"Not a JSON object — the last valid value is what will be saved."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var _e,G,T4,wbe;var wc=E(()=>{Ur();Rn();I1();xS();mM();Pf();_e=O(ee(),1),G=O(Me(),1);T4=$4;wbe=[{value:"custom",label:"A URL"},{value:"page",label:"A page"},{value:"term",label:"A term"},{value:"collection",label:"A collection"}]});function Mbe(e){switch(e){case"review":return[{label:"Approve & publish",action:"approve"},{label:"Reject",action:"reject"},{label:"Publish directly",action:"publishPage"}];case"published":return[{label:"Unpublish",action:"unpublishPage"}];default:return[{label:"Publish",action:"publishPage"},{label:"Submit for review",action:"submitForReview"}]}}function bM(e,t=!1){return kbe.filter((n)=>n==="i18n"?e:n==="terms"?t:!0)}function rp(){return typeof window<"u"&&window.PRAMEN_CMS_EDITOR?.hidePages===!0}function ap(e,t,n=rp()){return!n&&t.pagesByType&&e!==null&&e.length>1}function sp({children:e}){return N.jsxDEV("div",{className:"mb-2 mt-[18px] text-sm text-fg-subtle first:mt-0",children:e},void 0,!1,void 0,this)}function op({status:e,children:t}){return N.jsxDEV("span",{className:`inline-block whitespace-nowrap rounded-full border px-2.5 py-0.5 text-caption font-medium ${e==="published"||e==="active"?"bg-brand-green text-fg-on-brand border-transparent":e==="in_review"||e==="review"?"bg-accent-yellow text-fg-on-brand border-transparent":e==="rejected"||e==="archived"||e==="inactive"?"border-danger text-danger bg-surface-card":"border-border text-fg-muted bg-surface-card"}`,children:t},void 0,!1,void 0,this)}function yM({onClose:e,size:t,title:n,description:r,children:s}){return N.jsxDEV(Mf,{isOpen:!0,isDismissable:!0,size:t,title:n,description:r,onOpenChange:(i)=>!i&&e(),children:s},void 0,!1,void 0,this)}function vM({children:e,className:t}){return N.jsxDEV("div",{className:`grid grid-cols-[auto_1fr] gap-x-3.5 gap-y-2 text-[13px] text-fg-muted [&>span:nth-child(odd)]:text-fg-subtle ${t??""}`,children:e},void 0,!1,void 0,this)}function NQ({children:e}){return N.jsxDEV("div",{className:"overflow-auto rounded-lg border border-border bg-surface-card p-6",children:e},void 0,!1,void 0,this)}function ip({ok:e,children:t}){return N.jsxDEV("div",{className:`my-2 rounded-lg border px-3.5 py-2.5 text-small ${e?"border-brand-green bg-brand-green/20 text-fg":"border-danger bg-surface-card text-danger"}`,children:t},void 0,!1,void 0,this)}function Ut({children:e,action:t}){return N.jsxDEV("div",{className:"mx-auto flex max-w-[1200px] items-center gap-2 px-7 pt-8",children:[N.jsxDEV("p",{className:"text-fg-subtle",children:e},void 0,!1,void 0,this),t]},void 0,!0,void 0,this)}function E4({api:e,type:t,onOpen:n,onError:r}){let{cms:{multilingual:s}}=nt(),[i,c]=fe.useState([]),[u,f]=fe.useState(0),[p,m]=fe.useState(!1),[g,y]=fe.useState(!0),[v,x]=fe.useState([]),[w,C]=fe.useState(!1),I=t?.slug,R=fe.useCallback((L)=>(y(!0),e.listPages({contentType:I,limit:IQ,offset:L}).then((_)=>{c((W)=>L===0?_:[...W,..._]),m(_.length===IQ),f(L+_.length)}).catch((_)=>r(ht(_))).finally(()=>y(!1))),[e,I,r]);fe.useEffect(()=>{c([]),f(0),m(!1),R(0)},[R]),fe.useEffect(()=>{e.listBlockTypes().then(x).catch((L)=>r(ht(L)))},[e,r]);let H=i.length===0?"None yet":i.length===1?"1 page total":`${i.length}${p?"+":""} pages total`;return N.jsxDEV(N.Fragment,{children:[N.jsxDEV(A1,{lead:t?.name??"Pages",em:g&&i.length===0?"Loading…":H,children:N.jsxDEV(me,{className:"shrink-0",onPress:()=>C(!0),children:"+ New page"},void 0,!1,void 0,this)},void 0,!1,void 0,this),N.jsxDEV("div",{className:nn,children:[N.jsxDEV("div",{className:"flex flex-col gap-2",children:[i.map((L)=>N.jsxDEV("div",{className:`${Za} cursor-pointer hover:bg-surface-muted`,onClick:()=>n(L),children:[N.jsxDEV("span",{className:"flex-1 truncate font-medium",children:L.title},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-fg-subtle",children:["/",L.slug]},void 0,!0,void 0,this),s?N.jsxDEV("span",{className:"text-fg-subtle",children:L.locale},void 0,!1,void 0,this):null,N.jsxDEV(op,{status:L.status,children:L.status},void 0,!1,void 0,this)]},L.id,!0,void 0,this)),!g&&i.length===0?N.jsxDEV("p",{className:"text-fg-subtle",children:["No pages yet. ",v.length===0?"Define block types + a content type first (via the API/admin).":"Create one."]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),p?N.jsxDEV("div",{className:"mt-4 flex justify-center",children:N.jsxDEV(me,{variant:"ghost",onPress:()=>void R(u),isDisabled:g,children:g?"Loading…":"Load more"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),w?N.jsxDEV(Nbe,{api:e,type:t,onClose:()=>C(!1),onCreated:()=>{C(!1),R(0)},onError:r},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function Nbe({api:e,type:t,onClose:n,onCreated:r,onError:s}){let{contentTypes:i}=nt(),c=i??[],[u,f]=fe.useState(t?.id??""),[p,m]=fe.useState(""),[g,y]=fe.useState("");fe.useEffect(()=>{if(t){f(t.id);return}let x=i??[];f((w)=>w&&x.some((C)=>C.id===w)?w:x[0]?.id??"")},[t,i]);let v=async()=>{try{await e.call("createPage",{typeId:u,title:p,slug:g||da(p)}),r()}catch(x){s(ht(x))}};return N.jsxDEV(yM,{onClose:n,size:"full",title:N.jsxDEV(N.Fragment,{children:["Create a ",N.jsxDEV(Gh,{children:"new page"},void 0,!1,void 0,this),t?N.jsxDEV(N.Fragment,{children:[" in ",N.jsxDEV(Gh,{children:t.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null," and define the essentials",N.jsxDEV(Gh,{children:"."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:N.jsxDEV("div",{className:"m-auto flex w-full max-w-[560px] flex-col gap-4",children:[N.jsxDEV("div",{className:`w-full flex-col gap-2 ${t?"hidden":"flex"}`,children:[N.jsxDEV("span",{className:"text-sm font-medium text-fg",children:"Content type"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex flex-wrap gap-2",children:c.map((x)=>N.jsxDEV("button",{type:"button",onClick:()=>f(x.id),className:`rounded-lg border px-4 py-2.5 text-sm font-medium transition-colors ${u===x.id?"border-brand-green bg-surface-muted text-fg":"border-border bg-surface-card text-fg-muted hover:border-fg-subtle hover:text-fg"}`,children:x.name},x.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV(pn,{label:"Title",value:p,onChange:m},void 0,!1,void 0,this),N.jsxDEV(pn,{label:"Slug",value:g,onChange:y,placeholder:da(p)},void 0,!1,void 0,this),N.jsxDEV("div",{className:"mt-2 flex justify-end gap-2",children:[N.jsxDEV(me,{variant:"ghost",onPress:n,children:"cancel"},void 0,!1,void 0,this),N.jsxDEV(me,{onPress:v,isDisabled:!u||!p,children:"Create"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function gM(e){if(e==null)return"";if(typeof e==="boolean")return e?"yes":"no";if(Array.isArray(e))return e.length===1?"1 item":`${e.length} items`;if(Uh(e)){let t=T1(e).replace(/\s+/g," ").trim();return t.length>80?t.slice(0,80)+"…":t}if(typeof e==="object")return"—";return String(e)}function PQ({api:e,def:t,onOpen:n,onNew:r,onError:s}){let[i,c]=fe.useState([]),[u,f]=fe.useState(0),[p,m]=fe.useState(!1),[g,y]=fe.useState(!0),v=fe.useCallback((w)=>(y(!0),e.call("collectionList",{collection:t.slug,limit:EQ,offset:w}).then((C)=>{c((I)=>w===0?C:[...I,...C]),m(C.length===EQ),f(w+C.length)}).catch((C)=>s(ht(C))).finally(()=>y(!1))),[e,t.slug,s]);fe.useEffect(()=>{c([]),f(0),m(!1),v(0)},[v]);let x=(w)=>t.fields.find((C)=>C.name===w)?.label??w;return N.jsxDEV(N.Fragment,{children:[N.jsxDEV(A1,{lead:t.pluralLabel,em:i.length===0?"None yet":i.length===1?`1 ${t.label.toLowerCase()}`:`${i.length}${p?"+":""} ${t.pluralLabel.toLowerCase()}`,children:N.jsxDEV(me,{className:"shrink-0",onPress:r,children:["+ New ",t.label.toLowerCase()]},void 0,!0,void 0,this)},void 0,!1,void 0,this),N.jsxDEV("div",{className:nn,children:[N.jsxDEV("div",{className:"flex flex-col gap-2",children:[i.map((w)=>{let C=String(w[t.idField]??""),[I,...R]=t.list;return N.jsxDEV("div",{className:`${Za} cursor-pointer hover:bg-surface-muted`,onClick:()=>n(C),children:[N.jsxDEV("span",{className:"flex-1 truncate font-medium",children:gM(w[I??t.titleField])||N.jsxDEV(Gh,{children:"untitled"},void 0,!1,void 0,this)},void 0,!1,void 0,this),R.map((H)=>N.jsxDEV("span",{className:"truncate text-fg-subtle",title:x(H),children:gM(w[H])},H,!1,void 0,this))]},C,!0,void 0,this)}),!g&&i.length===0?N.jsxDEV("p",{className:"text-fg-subtle",children:["No ",t.pluralLabel.toLowerCase()," yet. Create one."]},void 0,!0,void 0,this):null,g?N.jsxDEV("p",{className:"text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),p&&!g?N.jsxDEV("div",{className:"mt-3.5 text-center",children:N.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>void v(u),children:"Load more"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Pbe({api:e,def:t,id:n,values:r,onChanged:s,onError:i}){let c=t.supports??[],[u,f]=fe.useState(!1),[p,m]=fe.useState(!1),[g,y]=fe.useState(""),[v,x]=fe.useState(""),[w,C]=fe.useState(null),[I,R]=fe.useState(null),H=typeof r.status==="string"?r.status:"draft",L=H==="published",_=(B)=>typeof r[B]==="string"&&r[B]!==""?r[B]:null,W=_("scheduledAt"),z=_("unpublishAt"),F=_("publishedAt");if(c.length===0)return null;let ne=async(B,U={})=>{f(!0);try{let Q=await e.call(B,{collection:t.slug,id:n,...U});if(Q&&typeof Q==="object"&&t.idField in Q)s(Q);else{let xe=await e.call("collectionGet",{collection:t.slug,id:n});if(xe)s(xe)}return!0}catch(Q){return i(ht(Q)),!1}finally{f(!1)}},V=async()=>{let B=g?v4(g):null;if(!B)return i("Pick a publication date and time first.");let U=v?v4(v):null;if(v&&!U)return i("That takedown date is not a valid date and time.");if(await ne("collectionSchedule",{publishAt:Date.parse(B),unpublishAt:U?Date.parse(U):null}))m(!1)},ie=()=>{y(y4(W??F??new Date().toISOString())),x(z?y4(z):""),m((B)=>!B)},ae=async()=>{f(!0);try{let B=await e.call("signCollectionPreview",{collection:t.slug,id:n}),U=e.resolve(B.url);C(U),await navigator.clipboard?.writeText(U).catch(()=>{})}catch(B){i(ht(B))}finally{f(!1)}},re=async()=>{if(I)return R(null);try{R(await e.call("collectionListRevisions",{collection:t.slug,id:n}))}catch(B){i(ht(B))}},D=async(B)=>{if(!confirm("Restore this version? The current content is snapshotted first, so this is itself undoable."))return;if(await ne("collectionRestoreRevision",{revisionId:B}))R(null)};return N.jsxDEV("div",{className:"flex flex-col gap-3 rounded-[14px] border border-border bg-surface-card px-[18px] py-4",children:[N.jsxDEV("div",{className:"flex flex-wrap items-center gap-2",children:[N.jsxDEV("span",{className:"text-fg-subtle",children:"Status"},void 0,!1,void 0,this),N.jsxDEV(op,{status:H,children:H},void 0,!1,void 0,this),F&&L?N.jsxDEV("span",{className:"text-fg-subtle",children:["since ",np(F)]},void 0,!0,void 0,this):null,W?N.jsxDEV("span",{className:"text-accent-strong",children:["publishes ",np(W)]},void 0,!0,void 0,this):null,z?N.jsxDEV("span",{className:"text-danger",children:["comes down ",np(z)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"flex flex-wrap items-center gap-2",children:[c.includes("drafts")&&!L?N.jsxDEV(me,{size:"sm",isDisabled:u,onPress:()=>void ne("collectionPublish"),children:"Publish now"},void 0,!1,void 0,this):null,c.includes("drafts")&&L?N.jsxDEV(me,{variant:"secondary",size:"sm",isDisabled:u,onPress:()=>void ne("collectionUnpublish"),children:"Unpublish"},void 0,!1,void 0,this):null,c.includes("scheduling")?N.jsxDEV(me,{variant:"secondary",size:"sm",isDisabled:u,onPress:ie,children:W?"Change schedule":"Schedule…"},void 0,!1,void 0,this):null,c.includes("preview")?N.jsxDEV(me,{variant:"ghost",size:"sm",isDisabled:u,onPress:()=>void ae(),children:"Preview link"},void 0,!1,void 0,this):null,c.includes("revisions")?N.jsxDEV(me,{variant:"ghost",size:"sm",isDisabled:u,onPress:()=>void re(),children:I?"Hide history":"History"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),p?N.jsxDEV("div",{className:"flex flex-col gap-2 border-t border-border pt-3",children:[N.jsxDEV("label",{className:"flex flex-col gap-1 text-sm",children:[N.jsxDEV("span",{className:"font-medium text-fg",children:"Publish at"},void 0,!1,void 0,this),N.jsxDEV("input",{className:at,type:"datetime-local",value:g,onChange:(B)=>y(B.target.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("label",{className:"flex flex-col gap-1 text-sm",children:[N.jsxDEV("span",{className:"font-medium text-fg",children:"Take down at (optional)"},void 0,!1,void 0,this),N.jsxDEV("input",{className:at,type:"datetime-local",value:v,onChange:(B)=>x(B.target.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("p",{className:"text-fg-subtle",children:"Scheduling does not take a live row down — it publishes at the first instant. A takedown must be after the publication time. Leave it empty to cancel one."},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex gap-2",children:[N.jsxDEV(me,{size:"sm",isDisabled:u,onPress:()=>void V(),children:"Save schedule"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",size:"sm",onPress:()=>m(!1),children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,w?N.jsxDEV("div",{className:"border-t border-border pt-3 text-sm",children:[N.jsxDEV("span",{className:"text-fg-subtle",children:"Preview link (copied): "},void 0,!1,void 0,this),N.jsxDEV("a",{className:"break-all underline",href:w,target:"_blank",rel:"noreferrer",children:w},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,I?N.jsxDEV("div",{className:"flex flex-col gap-2 border-t border-border pt-3",children:[I.map((B)=>N.jsxDEV("div",{className:`${Za} text-xs`,children:[N.jsxDEV("span",{className:"rounded-full bg-surface-muted px-2 py-0.5 font-mono text-xs text-fg-muted",children:["#",B.revision]},void 0,!0,void 0,this),N.jsxDEV("span",{className:"flex-1 truncate text-fg-subtle",children:[B.note??"edit"," · ",B.actor??"system"," · ",np(B.createdAt)]},void 0,!0,void 0,this),N.jsxDEV(me,{variant:"ghost",size:"sm",isDisabled:u,onPress:()=>void D(B.id),children:"Restore"},void 0,!1,void 0,this)]},B.id,!0,void 0,this)),I.length===0?N.jsxDEV("p",{className:"text-fg-subtle",children:"No history yet."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function DQ({api:e,def:t,id:n,onSaved:r,onDeleted:s,onBack:i,onError:c}){let u=n===null,[f,p]=fe.useState({}),[m,g]=fe.useState(!u),[y,v]=fe.useState(!1),x=gM(f[t.titleField]);vS(u?`New ${t.label.toLowerCase()}`:x||void 0);let[w,C]=fe.useState(!1),[I,R]=fe.useState(!1);fe.useEffect(()=>{if(u){p({});return}let _=!0;return g(!0),v(!1),e.call("collectionGet",{collection:t.slug,id:n}).then((W)=>{if(!_)return;if(W)p(W);else v(!0)}).catch((W)=>c(ht(W))).finally(()=>{if(_)g(!1)}),()=>{_=!1}},[e,t.slug,n,u,c]);let H=async()=>{C(!0);try{if(u)await e.call("collectionCreate",{collection:t.slug,values:f}),r();else{let _=await e.call("collectionUpdate",{collection:t.slug,id:n,values:f});if(_)p(_);R(!0),setTimeout(()=>R(!1),1200)}}catch(_){c(ht(_))}finally{C(!1)}},L=async()=>{if(u||!confirm(`Delete this ${t.label.toLowerCase()}? This cannot be undone.`))return;C(!0);try{await e.call("collectionDelete",{collection:t.slug,id:n}),s()}catch(_){c(ht(_))}finally{C(!1)}};return N.jsxDEV("div",{className:nn,children:[N.jsxDEV("div",{className:"mb-4 mt-2 flex items-center gap-3",children:[N.jsxDEV(me,{variant:"ghost",size:"sm",onPress:i,children:["← ",t.pluralLabel]},void 0,!0,void 0,this),N.jsxDEV("h1",{className:"text-[22px] font-normal text-fg",children:u?`New ${t.label.toLowerCase()}`:`Edit ${t.label.toLowerCase()}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y?N.jsxDEV("p",{className:"text-fg-subtle",children:"Not found."},void 0,!1,void 0,this):m?N.jsxDEV("p",{className:"text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this):N.jsxDEV("div",{className:"flex max-w-[720px] flex-col gap-4",children:[I?N.jsxDEV(ip,{ok:!0,children:"saved"},void 0,!1,void 0,this):null,!u&&n?N.jsxDEV(Pbe,{api:e,def:t,id:n,values:f,onChanged:p,onError:c},void 0,!1,void 0,this):null,N.jsxDEV(jh,{schema:t.fields,value:f,onChange:p,api:e},void 0,!1,void 0,this),N.jsxDEV("div",{className:"mt-2 flex items-center gap-2",children:[N.jsxDEV(me,{onPress:H,isDisabled:w,children:w?"Saving…":u?"Create":"Save"},void 0,!1,void 0,this),!u?N.jsxDEV(me,{variant:"ghost",className:"text-danger",onPress:L,isDisabled:w,children:"Delete"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Dbe({page:e,dirtyCount:t,onBack:n,backLabel:r,onAct:s,busy:i}){let[c,u]=fe.useState(null),[f,p]=fe.useState(!1),{api:m,setError:g}=nt(),y=Mbe(String(e.status)),[v,...x]=y,w=async()=>{p(!0);let C=window.open("","_blank");try{let I=await m.signPagePreview(e.id),R=mQ(I,{siteUrl:pQ(),origin:window.location.href,resolve:(H)=>m.resolve(H)});if(u(R),C)C.opener=null,C.location.replace(R);await navigator.clipboard?.writeText(R).catch(()=>{})}catch(I){C?.close(),u(null),g(ht(I))}finally{p(!1)}};return N.jsxDEV(N.Fragment,{children:[N.jsxDEV("div",{className:`sticky ${x4} z-20 -mx-7 flex ${cQ} items-center gap-3 border-b border-border bg-surface px-7`,children:[N.jsxDEV(me,{variant:"ghost",size:"sm",className:"shrink-0",onPress:n,children:["← ",r]},void 0,!0,void 0,this),N.jsxDEV("span",{className:"min-w-0 truncate font-medium text-fg",children:e.title},void 0,!1,void 0,this),N.jsxDEV(op,{status:e.status,children:e.status},void 0,!1,void 0,this),N.jsxDEV("span",{className:"flex-1"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"shrink-0 text-caption text-fg-subtle",children:t>0?N.jsxDEV("span",{className:"text-accent-strong",children:["● saving ",t," change",t===1?"":"s","…"]},void 0,!0,void 0,this):"all changes saved"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"secondary",size:"sm",className:"shrink-0",isDisabled:f,onPress:()=>void w(),children:f?"Minting…":"Preview"},void 0,!1,void 0,this),v?N.jsxDEV(me,{size:"sm",className:"shrink-0",isDisabled:i,onPress:()=>s(v.action),children:v.label},void 0,!1,void 0,this):null,x.length>0?N.jsxDEV(sS,{children:[N.jsxDEV(me,{variant:"ghost",size:"sm",className:"shrink-0 px-2","aria-label":"More actions",children:"⋯"},void 0,!1,void 0,this),N.jsxDEV(iS,{"aria-label":"More page actions",onAction:(C)=>s(String(C)),children:x.map((C)=>N.jsxDEV($b,{id:C.action,children:C.label},C.action,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),c?N.jsxDEV("div",{className:"mt-3 flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-caption",children:[N.jsxDEV("span",{className:"shrink-0 text-fg-subtle",children:"Preview opened in a new tab — link copied:"},void 0,!1,void 0,this),N.jsxDEV("a",{className:"min-w-0 flex-1 truncate underline",href:c,target:"_blank",rel:"noreferrer",children:c},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",size:"sm",className:"shrink-0 px-2","aria-label":"Hide the preview link",onPress:()=>u(null),children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function LQ({api:e,page:t,blockTypes:n,tab:r,onTab:s,onBack:i,backLabel:c,onChange:u,registerGuard:f}){let{cms:{multilingual:p,siteFurniture:m,canEdit:g}}=nt(),[y,v]=fe.useState(null),[x,w]=fe.useState(null),[C,I]=fe.useState(""),R=fe.useRef(new Set),[H,L]=fe.useState(0),_=fe.useCallback((de,ge)=>{let Re=R.current;if(ge?Re.has(de):!Re.has(de))return;if(ge)Re.add(de);else Re.delete(de);L(Re.size)},[]),W=fe.useCallback(()=>R.current.size===0||window.confirm(`You have ${R.current.size} unsaved change${R.current.size===1?"":"s"}. Leave without saving?`),[]);fe.useEffect(()=>(f(W),()=>f(null)),[f,W]);let z=fe.useMemo(()=>new Map(n.map((de)=>[de.slug,de])),[n]),F=fe.useCallback(async()=>{try{let[de,ge]=await Promise.all([e.getContentType(t.typeId),e.getPagePreview(t.slug,t.locale)]);v(de??null),w(ge)}catch(de){I(ht(de))}},[e,t.typeId,t.slug,t.locale]);fe.useEffect(()=>{F()},[F]),fe.useEffect(()=>{if(H===0)return;let de=(ge)=>{ge.preventDefault(),ge.returnValue=""};return window.addEventListener("beforeunload",de),()=>window.removeEventListener("beforeunload",de)},[H]);let ne=y?.regions??[],V=y?.fieldsSchema??[],ie=(de,ge)=>w((Re)=>Re?{...Re,regions:{...Re.regions,[de]:ge(Re.regions[de]??[])}}:Re),ae=async(de,ge,Re)=>{let ye=`tmp:${crypto.randomUUID()}`,Ee=(x?.regions[de]??[]).map((Se)=>Se.id),ft=Re!=null&&Re>=0&&Re<Ee.length?Re:Ee.length;ie(de,(Se)=>{let Xt=[...Se];return Xt.splice(ft,0,{id:ye,block_id:ye,block_type:ge,title:null,fields:{},is_shared:!1,pending:!0}),Xt});try{let{block:Se,placement:Xt}=await e.call("addBlock",{pageId:t.id,blockTypeSlug:ge,region:de,fields:{}}),In={id:String(Xt.id),block_id:String(Se.id),block_type:ge,title:Se.title??null,fields:Se.fields??{},is_shared:Boolean(Xt.isShared)};if(ie(de,(xn)=>xn.map((sn)=>sn.id===ye?In:sn)),ft<Ee.length){let xn=[...Ee];xn.splice(ft,0,In.id),await D(de,xn)}}catch(Se){ie(de,(Xt)=>Xt.filter((In)=>In.id!==ye)),I(ht(Se))}},re=async(de)=>{try{await e.call("removeBlock",{pageBlockId:de.id}),await F()}catch(ge){I(ht(ge))}},D=async(de,ge)=>{try{await e.call("reorderRegion",{pageId:t.id,region:de,order:ge}),await F()}catch(Re){I(ht(Re))}},B=fe.useCallback((de,ge)=>{w((Re)=>{if(!Re)return Re;let ye={};for(let[Ee,ft]of Object.entries(Re.regions))ye[Ee]=ft.map((Se)=>Se.id===de?{...Se,fields:ge}:Se);return{...Re,regions:ye}})},[]),[U,Q]=fe.useState(null),xe=(de,ge)=>Q({region:de,from:ge,over:ge}),le=(de,ge)=>Q((Re)=>Re&&Re.region===de&&Re.over!==ge?{...Re,over:ge}:Re),k=()=>Q(null),te=(de)=>{if(Q(null),!U||U.region!==de||U.from===U.over)return;let ge=(x?.regions[de]??[]).map((ye)=>ye.id),[Re]=ge.splice(U.from,1);ge.splice(U.over,0,Re),D(de,ge)},[Ce,$e]=fe.useState(!1);return N.jsxDEV("div",{className:"px-7 pb-16",children:[N.jsxDEV(Dbe,{page:t,dirtyCount:H,busy:Ce,onAct:async(de)=>{$e(!0);try{let ge=await e.call(de,{pageId:t.id});if(ge?.page)u(ge.page)}catch(ge){I(ht(ge))}finally{$e(!1)}},backLabel:c,onBack:()=>{if(W())i()}},void 0,!1,void 0,this),C?N.jsxDEV(ip,{children:C},void 0,!1,void 0,this):null,N.jsxDEV("div",{className:"mt-4 grid items-start gap-6 grid-cols-[minmax(0,1fr)_340px] max-[980px]:grid-cols-1",children:[N.jsxDEV("div",{className:"min-w-0 py-1.5 pl-8 pr-2",children:[V.length?N.jsxDEV(Bbe,{api:e,page:t,schema:V,initialFields:x?.page.fields??{},onDirtyChange:_,onError:I},void 0,!1,void 0,this):null,ne.map((de)=>{let ge=x?.regions[de.name]??[],Re=de.allowedTypes&&de.allowedTypes.length?de.allowedTypes:n.map((ye)=>ye.slug);return N.jsxDEV("div",{className:"mb-10",children:[N.jsxDEV("div",{className:`sticky ${pM} z-10 -mx-2 mb-1 bg-surface px-2 py-1 text-caption font-medium uppercase tracking-wide text-fg-subtle`,children:de.label??de.name},void 0,!1,void 0,this),ge.map((ye,Ee)=>N.jsxDEV("div",{children:[N.jsxDEV(AQ,{compact:!0,allowed:Re,btBySlug:z,onAdd:(ft)=>ae(de.name,ft,Ee)},void 0,!1,void 0,this),N.jsxDEV(Lbe,{api:e,block:ye,blockType:z.get(ye.block_type),isFirst:Ee===0,isLast:Ee===ge.length-1,onMove:(ft)=>t1e(ge,de.name,Ee,ft,D),onRemove:()=>re(ye),onPatch:B,onDirtyChange:_,onError:I,dragging:U?.region===de.name&&U.from===Ee,isOver:!!U&&U.region===de.name&&U.over===Ee&&U.from!==Ee,onDragStartBlock:()=>xe(de.name,Ee),onDragOverBlock:()=>le(de.name,Ee),onDropBlock:()=>te(de.name),onDragEndBlock:k},void 0,!1,void 0,this)]},ye.id,!0,void 0,this)),N.jsxDEV("div",{className:"mt-1",children:N.jsxDEV(AQ,{allowed:Re,btBySlug:z,onAdd:(ye)=>ae(de.name,ye)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},de.name,!0,void 0,this)}),ne.length===0&&V.length===0?N.jsxDEV("p",{className:"text-fg-subtle",children:"This page's content type defines no fields or regions."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),N.jsxDEV("aside",{className:`sticky ${pM} max-h-[calc(100vh-8rem)] overflow-auto rounded-panel border border-border bg-surface-card p-5`,children:[N.jsxDEV("div",{className:"-mt-1 mb-4 flex gap-1 border-b border-border",children:bM(p,m).map((de)=>N.jsxDEV("button",{type:"button",className:`-mb-px border-b-2 px-2 pb-2 pt-1 text-sm ${r===de?"border-fg font-medium text-fg":"border-transparent text-fg-muted hover:text-fg"}`,onClick:()=>s(de),children:Rbe[de]},de,!1,void 0,this))},void 0,!1,void 0,this),r==="settings"?N.jsxDEV(Obe,{api:e,page:t,onSaved:u,onError:I},void 0,!1,void 0,this):null,r==="seo"?N.jsxDEV(Hbe,{api:e,page:t,onError:I},void 0,!1,void 0,this):null,r==="i18n"&&p?N.jsxDEV(Fbe,{api:e,page:t,onError:I},void 0,!1,void 0,this):null,r==="terms"?N.jsxDEV(_be,{api:e,pageId:t.id,canEdit:g,onError:I},void 0,!1,void 0,this):null,r==="audit"?N.jsxDEV(zbe,{api:e,pageId:t.id,onError:I},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Lbe({api:e,block:t,blockType:n,isFirst:r,isLast:s,onMove:i,onRemove:c,onPatch:u,onDirtyChange:f,onError:p,dragging:m,isOver:g,onDragStartBlock:y,onDragOverBlock:v,onDropBlock:x,onDragEndBlock:w}){let[C,I]=fe.useState(null),[R,H]=fe.useState(!1),[L,_]=fe.useState("idle"),W=fe.useRef(""),z=fe.useRef(null),{block_id:F,id:ne}=t;fe.useEffect(()=>{if(t.pending){I({}),W.current="{}";return}let U=!0;return e.call("getBlock",{blockId:F}).then((Q)=>{if(!U)return;let xe=Q?.fields??{};I(xe),W.current=JSON.stringify(xe)}).catch((Q)=>p(ht(Q))),()=>{U=!1}},[e,F,p,t.pending]);let V=C!=null&&JSON.stringify(C)!==W.current,ie=fe.useCallback(async()=>{if(t.pending||C==null)return;let U=JSON.stringify(C);if(U===W.current)return;_("saving");try{await e.call("updateBlock",{blockId:F,fields:C}),W.current=U,u(ne,C),_("saved"),setTimeout(()=>_((Q)=>Q==="saved"?"idle":Q),1500)}catch(Q){p(ht(Q)),_("idle")}},[e,F,ne,C,u,p,t.pending]),ae=fe.useRef(ie);ae.current=ie,fe.useEffect(()=>{if(C==null||t.pending)return;if(JSON.stringify(C)===W.current)return;let U=setTimeout(()=>void ae.current(),800);return()=>clearTimeout(U)},[C,t.pending]);let re=(U)=>I(U);fe.useEffect(()=>{f(ne,V)},[V,ne,f]),fe.useEffect(()=>()=>{f(ne,!1)},[ne,f]);let D=n?.fieldsSchema??[],B=n?.name??t.block_type;return N.jsxDEV("div",{ref:z,className:`group relative rounded-lg px-2 py-1 transition-colors ${g?"ring-2 ring-brand-green":""} ${m?"opacity-40":""} ${t.pending?"pointer-events-none opacity-60":""}`,onDragOver:(U)=>{U.preventDefault(),v()},onDrop:(U)=>{U.preventDefault(),x()},children:[N.jsxDEV("span",{draggable:!0,onDragStart:(U)=>{if(z.current)U.dataTransfer.setDragImage(z.current,12,12);U.dataTransfer.effectAllowed="move",U.dataTransfer.setData("text/plain",""),y()},onDragEnd:w,className:"absolute -left-6 top-1.5 cursor-grab select-none px-1 text-fg-subtle opacity-0 transition-opacity hover:text-fg group-hover:opacity-100 active:cursor-grabbing",title:"Drag to reorder",children:"⠿"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex items-center gap-2 opacity-60 transition-opacity group-hover:opacity-100",children:[N.jsxDEV("button",{type:"button",className:"w-4 shrink-0 text-fg-subtle hover:text-fg",title:R?"Expand":"Collapse",onClick:()=>H((U)=>!U),children:R?"▸":"▾"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-caption font-medium uppercase tracking-wide text-fg-subtle",children:B},void 0,!1,void 0,this),t.is_shared?N.jsxDEV("span",{className:"text-caption text-accent-strong",children:"shared"},void 0,!1,void 0,this):null,N.jsxDEV("span",{className:`text-caption ${V&&L!=="saving"?"text-accent-strong":"text-fg-subtle"}`,children:L==="saving"?"saving…":L==="saved"?"saved ✓":V?"● unsaved":""},void 0,!1,void 0,this),N.jsxDEV("span",{className:"flex-1"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",size:"sm",isDisabled:r,onPress:()=>i(-1),children:"↑"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",size:"sm",isDisabled:s,onPress:()=>i(1),children:"↓"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",size:"sm",className:"text-danger",onPress:c,children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),R?N.jsxDEV("div",{className:"cursor-pointer truncate pb-1 pl-6 text-small text-fg-subtle",onClick:()=>H(!1),children:C==null?"…":e1e(C)||N.jsxDEV("span",{className:"italic",children:"empty"},void 0,!1,void 0,this)},void 0,!1,void 0,this):N.jsxDEV("div",{className:"pb-1 pl-6",children:C==null?N.jsxDEV("p",{className:"text-small text-fg-subtle",children:"loading…"},void 0,!1,void 0,this):D.length===0?N.jsxDEV("p",{className:"text-small text-fg-subtle",children:"This block has no editable fields."},void 0,!1,void 0,this):N.jsxDEV(N.Fragment,{children:[N.jsxDEV(jh,{schema:D,value:C,onChange:re,api:e},void 0,!1,void 0,this),V||L==="saving"?N.jsxDEV("div",{className:"mt-2 flex items-center gap-2",children:[N.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>void ie(),isDisabled:!V||L==="saving"||t.pending,children:L==="saving"?"Saving…":"Save now"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-caption text-fg-subtle",children:L==="saving"?"":"Autosaving…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function AQ({allowed:e,btBySlug:t,onAdd:n,compact:r}){let[s,i]=fe.useState(!1),[c,u]=fe.useState(""),[f,p]=fe.useState(0),m=fe.useRef(null),g=fe.useMemo(()=>{let x=e.map((C)=>({slug:C,name:t.get(C)?.name??C})),w=c.trim().toLowerCase();return w?x.filter((C)=>C.name.toLowerCase().includes(w)||C.slug.toLowerCase().includes(w)):x},[e,t,c]);fe.useEffect(()=>{if(s)m.current?.focus()},[s]),fe.useEffect(()=>{p(0)},[c]);let y=()=>{i(!1),u("")},v=(x)=>{if(x)n(x);y()};if(!s){if(r)return N.jsxDEV("button",{type:"button",onClick:()=>i(!0),"aria-label":"Insert block here",className:"group/ins flex h-3 w-full items-center justify-center opacity-0 transition-opacity hover:opacity-100",children:N.jsxDEV("span",{className:"flex h-full w-full items-center",children:[N.jsxDEV("span",{className:"h-px flex-1 bg-brand-green/40"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"mx-1 rounded bg-brand-green/15 px-1 text-caption leading-none text-brand-green",children:"+"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"h-px flex-1 bg-brand-green/40"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return N.jsxDEV("button",{type:"button",onClick:()=>i(!0),className:"flex w-full items-center gap-2 rounded-lg px-1 py-1.5 text-left text-small text-fg-subtle opacity-70 transition-colors hover:bg-surface-muted hover:text-fg-muted hover:opacity-100",children:[N.jsxDEV("span",{className:"text-base leading-none",children:"+"},void 0,!1,void 0,this),N.jsxDEV("span",{children:"Add block"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}return N.jsxDEV("div",{className:"rounded-lg border border-border bg-surface-card p-1 shadow-md",children:[N.jsxDEV("input",{ref:m,value:c,placeholder:"Filter blocks…",spellCheck:!1,className:"mb-1 w-full rounded-md bg-surface px-2.5 py-1.5 text-small text-fg outline-none placeholder:text-fg-subtle",onChange:(x)=>u(x.target.value),onBlur:()=>setTimeout(y,120),onKeyDown:(x)=>{if(x.key==="Escape")y();else if(x.key==="ArrowDown")x.preventDefault(),p((w)=>(w+1)%Math.max(g.length,1));else if(x.key==="ArrowUp")x.preventDefault(),p((w)=>(w-1+Math.max(g.length,1))%Math.max(g.length,1));else if(x.key==="Enter")x.preventDefault(),v(g[f]?.slug)}},void 0,!1,void 0,this),N.jsxDEV("div",{className:"max-h-64 overflow-auto",children:g.length===0?N.jsxDEV("div",{className:"px-2.5 py-2 text-small text-fg-subtle",children:"No matching block types"},void 0,!1,void 0,this):g.map((x,w)=>N.jsxDEV("button",{type:"button",onMouseEnter:()=>p(w),onMouseDown:(C)=>C.preventDefault(),onClick:()=>v(x.slug),className:`flex w-full items-center rounded-md px-2.5 py-1.5 text-left text-small ${w===f?"bg-surface-muted text-fg":"text-fg-muted hover:bg-surface-muted"}`,children:x.name},x.slug,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Obe({api:e,page:t,onSaved:n,onError:r}){let{cms:{multilingual:s,locales:i}}=nt(),[c,u]=fe.useState(t.title),[f,p]=fe.useState(t.slug),[m,g]=fe.useState(t.locale),[y,v]=fe.useState(!1),[x,w]=fe.useState(!1);fe.useEffect(()=>{u(t.title),p(t.slug),g(t.locale)},[t.id,t.title,t.slug,t.locale]);let C=c!==t.title||f.trim()!==t.slug||s&&m!==t.locale,I=async()=>{w(!0);try{let R=s?{title:c,slug:f.trim(),locale:m}:{title:c,slug:f.trim()},H=await e.call("updatePage",{pageId:t.id,...R});if(H?.page)n(H.page);v(!0),setTimeout(()=>v(!1),1500)}catch(R){r(ht(R))}finally{w(!1)}};return N.jsxDEV("div",{className:"flex flex-col gap-4",children:[y?N.jsxDEV(ip,{ok:!0,children:"saved"},void 0,!1,void 0,this):null,N.jsxDEV(pn,{label:"Title",value:c,onChange:u},void 0,!1,void 0,this),N.jsxDEV(pn,{label:"Slug",value:f,onChange:p},void 0,!1,void 0,this),s?N.jsxDEV("label",{className:"flex flex-col gap-1 text-sm",children:[N.jsxDEV("span",{className:"font-medium text-fg",children:"Locale"},void 0,!1,void 0,this),N.jsxDEV("select",{className:at,value:m,onChange:(R)=>g(R.target.value),children:[i.includes(m)?null:N.jsxDEV("option",{value:m,children:[m||"(unset)"," — not a declared locale"]},void 0,!0,void 0,this),i.map((R)=>N.jsxDEV("option",{value:R,children:R},R,!1,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,N.jsxDEV(me,{onPress:I,isDisabled:x||!C||!c.trim()||!f.trim(),children:x?"Saving…":"Save settings"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Bbe({api:e,page:t,schema:n,initialFields:r,onDirtyChange:s,onError:i}){let[c,u]=fe.useState(r),[f,p]=fe.useState("idle"),m=fe.useRef(JSON.stringify(r)),g=JSON.stringify(c)!==m.current,y=fe.useRef(t.id);fe.useEffect(()=>{if(y.current===t.id)return;y.current=t.id,u(r),m.current=JSON.stringify(r)},[t.id,r]),fe.useEffect(()=>{s("page",g)},[g,s]),fe.useEffect(()=>()=>{s("page",!1)},[s]);let v=fe.useCallback(async()=>{let w=JSON.stringify(c);if(w===m.current)return;p("saving");try{await e.call("updatePage",{pageId:t.id,fields:c}),m.current=w,p("saved"),setTimeout(()=>p((C)=>C==="saved"?"idle":C),1500)}catch(C){i(ht(C)),p("idle")}},[e,t.id,c,i]),x=fe.useRef(v);return x.current=v,fe.useEffect(()=>{if(!g)return;let w=setTimeout(()=>void x.current(),800);return()=>clearTimeout(w)},[c,g]),N.jsxDEV("div",{className:"mb-10",children:[N.jsxDEV("div",{className:"mb-1 flex items-center gap-2",children:[N.jsxDEV("span",{className:"text-caption font-medium uppercase tracking-wide text-fg-subtle",children:"Page fields"},void 0,!1,void 0,this),N.jsxDEV("span",{className:`text-caption ${g&&f!=="saving"?"text-accent-strong":"text-fg-subtle"}`,children:f==="saving"?"saving…":f==="saved"?"saved ✓":g?"● unsaved":""},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV(jh,{schema:n,value:c,onChange:u,api:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Hbe({api:e,page:t,onError:n}){let[r,s]=fe.useState({metaTitle:t.metaTitle??"",metaDescription:t.metaDescription??"",canonicalUrl:t.canonicalUrl??"",robots:t.robots??"",ogTitle:t.ogTitle??"",ogDescription:t.ogDescription??""}),[i,c]=fe.useState(!1),u=async()=>{try{await e.call("updatePageSeo",{pageId:t.id,...r}),c(!0),setTimeout(()=>c(!1),1500)}catch(p){n(ht(p))}},f=(p,m,g=!1)=>g?N.jsxDEV(fh,{label:m,value:r[p],onChange:(y)=>s({...r,[p]:y})},void 0,!1,void 0,this):N.jsxDEV(pn,{label:m,value:r[p],onChange:(y)=>s({...r,[p]:y})},void 0,!1,void 0,this);return N.jsxDEV("div",{className:"flex flex-col gap-4",children:[N.jsxDEV(sp,{children:"SEO"},void 0,!1,void 0,this),i?N.jsxDEV(ip,{ok:!0,children:"saved"},void 0,!1,void 0,this):null,f("metaTitle","Meta title"),f("metaDescription","Meta description",!0),f("canonicalUrl","Canonical URL"),f("robots","Robots (e.g. noindex)"),f("ogTitle","OG title"),f("ogDescription","OG description",!0),N.jsxDEV(me,{className:"w-full",onPress:u,children:"Save SEO"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Fbe({api:e,page:t,onError:n}){let[r,s]=fe.useState([]),[i,c]=fe.useState(""),u=fe.useCallback(()=>e.call("listTranslations",{pageId:t.id}).then(s).catch((p)=>n(ht(p))),[e,t.id,n]);fe.useEffect(()=>{u()},[u]);let f=async()=>{try{await e.call("createTranslation",{pageId:t.id,locale:i}),c(""),u()}catch(p){n(ht(p))}};return N.jsxDEV("div",{children:[N.jsxDEV(sp,{children:"Translations"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex flex-col gap-2",children:r.map((p)=>N.jsxDEV("div",{className:Za,children:[N.jsxDEV("span",{className:"flex-1 truncate font-medium",children:p.locale},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-fg-subtle",children:["/",p.slug]},void 0,!0,void 0,this),N.jsxDEV(op,{status:p.status,children:p.status},void 0,!1,void 0,this)]},p.id,!0,void 0,this))},void 0,!1,void 0,this),N.jsxDEV("div",{className:"mt-2 flex items-end gap-1.5",children:[N.jsxDEV(pn,{label:"",value:i,onChange:c,placeholder:"locale (e.g. cs)"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"secondary",onPress:f,isDisabled:!i,children:"add"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function _be({api:e,pageId:t,canEdit:n,onError:r}){let[s,i]=fe.useState(null),[c,u]=fe.useState({}),[f,p]=fe.useState(()=>new Set),[m,g]=fe.useState(!1),[y,v]=fe.useState(!1);fe.useEffect(()=>{let C=!0;return(async()=>{try{let I=await e.listTaxonomies("page");if(!C)return;i(I);let[R,H]=await Promise.all([Promise.all(I.map(async(L)=>[L.slug,E1(await e.getTermTree(L.slug)).map((_)=>_.term)])),e.listPageTerms(t)]);if(!C)return;u(Object.fromEntries(R)),p(new Set(H.map((L)=>L.id)))}catch(I){if(C)r(ht(I))}})(),()=>{C=!1}},[e,t,r]);let x=(C)=>{p((I)=>{let R=new Set(I);if(R.has(C))R.delete(C);else R.add(C);return R})},w=async()=>{g(!0);try{await e.setPageTerms(t,[...f]),v(!0),setTimeout(()=>v(!1),1200)}catch(C){r(ht(C))}finally{g(!1)}};if(s===null)return N.jsxDEV("p",{className:"text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this);if(s.length===0)return N.jsxDEV("p",{className:"text-fg-subtle",children:"No vocabularies apply to pages yet — set one up under Taxonomies."},void 0,!1,void 0,this);return N.jsxDEV("div",{className:"flex flex-col gap-4",children:[y?N.jsxDEV(ip,{ok:!0,children:"saved"},void 0,!1,void 0,this):null,s.map((C)=>N.jsxDEV("div",{children:[N.jsxDEV(sp,{children:C.label},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex flex-col gap-1",children:[(c[C.slug]??[]).length===0?N.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"No terms yet."},void 0,!1,void 0,this):null,(c[C.slug]??[]).map((I)=>N.jsxDEV("label",{className:"flex items-center gap-2",children:[N.jsxDEV("input",{type:"checkbox",disabled:!n,checked:f.has(I.id),onChange:()=>x(I.id)},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-sm text-fg",children:I.label},void 0,!1,void 0,this)]},I.id,!0,void 0,this))]},void 0,!0,void 0,this)]},C.id,!0,void 0,this)),n?N.jsxDEV(me,{size:"sm",className:"self-start",onPress:w,isDisabled:m,children:m?"Saving…":"Save terms"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function zbe({api:e,pageId:t,onError:n}){let[r,s]=fe.useState([]);return fe.useEffect(()=>{e.listPageAudit(t).then(s).catch((i)=>n(ht(i)))},[e,t,n]),N.jsxDEV("div",{children:[N.jsxDEV(sp,{children:"Audit trail"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex flex-col gap-2",children:[r.map((i)=>N.jsxDEV("div",{className:`${Za} text-xs`,children:[N.jsxDEV("span",{className:"rounded-full bg-surface-muted px-2 py-0.5 font-mono text-xs text-fg-muted",children:i.action},void 0,!1,void 0,this),N.jsxDEV("span",{className:"flex-1 truncate text-fg-subtle",children:[i.fromStatus," → ",i.toStatus]},void 0,!0,void 0,this),N.jsxDEV("span",{className:"text-fg-subtle",children:i.actor??"system"},void 0,!1,void 0,this)]},i.id,!0,void 0,this)),r.length===0?N.jsxDEV("p",{className:"text-fg-subtle",children:"No history yet."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function kQ({active:e,onPress:t,children:n}){return N.jsxDEV(me,{variant:"ghost",size:"sm","aria-pressed":e,className:`rounded-full px-3 py-1 text-compact ${e?"bg-surface-muted font-medium text-fg":"text-fg-muted hover:text-fg"}`,onPress:t,children:n},void 0,!1,void 0,this)}function Ube(e,t,n){if(e===0)return n?"No matches":"None yet";return e===1&&!t?"1 file":`${e}${t?"+":""} files`}function OQ({api:e,onError:t}){let{cms:{mediaTerms:n,canEdit:r}}=nt(),[s,i]=fe.useState([]),[c,u]=fe.useState(0),[f,p]=fe.useState(!1),[m,g]=fe.useState(null),[y,v]=fe.useState(!1),x=fe.useRef(null),[w,C]=fe.useState([]),[I,R]=fe.useState(!1),[H,L]=fe.useState("newest"),[_,W]=fe.useState(null),[z,F]=fe.useState(""),[ne,V]=fe.useState("");fe.useEffect(()=>{let se=setTimeout(()=>V(z.trim()),Vbe);return()=>clearTimeout(se)},[z]);let[ie,ae]=fe.useState(null),[re,D]=fe.useState([]),[B,U]=fe.useState({});fe.useEffect(()=>{if(!n)return;let se=!0;return(async()=>{try{let de=await e.listTaxonomies("media"),ge=await Promise.all(de.map(async(Re)=>[Re.slug,E1(await e.getTermTree(Re.slug)).map((ye)=>ye.term)]));if(!se)return;D(de),U(Object.fromEntries(ge))}catch{if(se)D([]),U({})}})(),()=>{se=!1}},[e,n]);let Q=re.flatMap((se)=>(B[se.slug]??[]).map((de)=>({id:de.id,label:de.label,group:se.label}))),xe=_!==null||ie!==null||ne!=="",le=fe.useCallback((se)=>{e.listMedia({limit:RQ,offset:se,sort:H,kind:_??void 0,q:ne||void 0,term:ie??void 0}).then((de)=>{i((ge)=>se===0?de:[...ge,...de]),p(de.length===RQ),u(se+de.length)}).catch((de)=>t(ht(de)))},[e,t,H,_,ne,ie]),k=fe.useCallback(()=>{e.listTrash().then((se)=>C(se.media??[])).catch((se)=>t(ht(se)))},[e,t]);fe.useEffect(()=>{le(0)},[le]),fe.useEffect(()=>{k()},[k]);let te=async(se)=>{try{await e.restoreMedia(se),k(),le(0)}catch(de){t(ht(de))}},Ce=async(se)=>{if(!confirm("Delete this file permanently? The file itself is removed and cannot be recovered."))return;try{await e.purgeMedia(se),k()}catch(de){t(ht(de))}},$e=async(se)=>{if(!se?.length)return;v(!0),t("");try{for(let de of Array.from(se))await e.uploadMedia(de);le(0)}catch(de){t(ht(de))}finally{v(!1)}};return N.jsxDEV(N.Fragment,{children:[N.jsxDEV(A1,{lead:"Media",em:Ube(s.length,f,xe),children:[N.jsxDEV("input",{ref:x,type:"file",multiple:!0,hidden:!0,disabled:y,onChange:(se)=>{$e(se.target.files),se.target.value=""}},void 0,!1,void 0,this),N.jsxDEV(me,{className:"shrink-0",isDisabled:y,onPress:()=>x.current?.click(),children:y?"Uploading…":"+ Upload"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:nn,children:[N.jsxDEV("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[N.jsxDEV(Nj,{"aria-label":"Search media",placeholder:"Search files…",value:z,onChange:F,className:"w-[220px] shrink-0"},void 0,!1,void 0,this),N.jsxDEV(sS,{children:[N.jsxDEV(me,{variant:"secondary",size:"sm",className:"shrink-0 px-3 py-1 text-compact",children:IA[H]},void 0,!1,void 0,this),N.jsxDEV(iS,{"aria-label":"Sort media",onAction:(se)=>L(se),children:OK.map((se)=>N.jsxDEV($b,{id:se,children:IA[se]},se,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),n&&Q.length>0?N.jsxDEV(sS,{children:[N.jsxDEV(me,{variant:"secondary",size:"sm",className:"shrink-0 px-3 py-1 text-compact",children:ie?Q.find((se)=>se.id===ie)?.label??"Tag":"All tags"},void 0,!1,void 0,this),N.jsxDEV(iS,{"aria-label":"Filter media by tag",onAction:(se)=>ae(se===MQ?null:String(se)),children:[N.jsxDEV($b,{id:MQ,children:"All tags"},void 0,!1,void 0,this),Q.map((se)=>N.jsxDEV($b,{id:se.id,children:[se.group," · ",se.label]},se.id,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,N.jsxDEV("div",{className:"flex flex-wrap items-center gap-1",children:[N.jsxDEV(kQ,{active:_===null,onPress:()=>W(null),children:"All"},void 0,!1,void 0,this),BK.map((se)=>N.jsxDEV(kQ,{active:_===se,onPress:()=>W(_===se?null:se),children:HK[se]},se,!1,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),s.length===0?xe?N.jsxDEV("div",{className:"flex flex-wrap items-center gap-3",children:[N.jsxDEV("p",{className:"text-fg-subtle",children:"No files match this filter."},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>{F(""),V(""),W(null),ae(null)},children:"Clear filters"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):N.jsxDEV("p",{className:"text-fg-subtle",children:"No media yet. Upload images to use them in blocks and SEO."},void 0,!1,void 0,this):N.jsxDEV("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2.5",children:s.map((se)=>N.jsxDEV("div",{className:`cursor-pointer overflow-hidden rounded-lg border bg-surface-card ${m?.id===se.id?"border-fg":"border-border"}`,onClick:()=>g(se),children:[FQ(se)?N.jsxDEV("img",{className:"block h-[130px] w-full object-cover",src:e.resolve(`/media/${se.file.key}`),alt:se.alt??""},void 0,!1,void 0,this):N.jsxDEV("div",{className:"flex h-[130px] items-center justify-center bg-surface-muted font-mono text-xs text-fg-subtle",children:_Q(se)},void 0,!1,void 0,this),N.jsxDEV("div",{className:"truncate px-2 py-1.5 text-[11px] text-fg-muted",children:se.file.filename??se.id},void 0,!1,void 0,this)]},se.id,!0,void 0,this))},void 0,!1,void 0,this),f?N.jsxDEV("div",{className:"mt-3.5 text-center",children:N.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>le(c),children:"Load more"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,w.length>0?N.jsxDEV("div",{className:"mt-6 border-t border-border pt-4",children:[N.jsxDEV("button",{type:"button",className:"text-small text-fg-muted underline",onClick:()=>R((se)=>!se),children:[I?"Hide":"Show"," trash (",w.length,")"]},void 0,!0,void 0,this),I?N.jsxDEV(N.Fragment,{children:[N.jsxDEV("p",{className:"mt-2 text-small text-fg-subtle",children:"Trashed files are hidden from the library but the file itself still exists — a page published while it was in use keeps showing it. Delete permanently to remove the file."},void 0,!1,void 0,this),N.jsxDEV("div",{className:"mt-2.5 flex flex-col gap-1.5",children:w.map((se)=>N.jsxDEV("div",{className:"flex items-center gap-2.5 rounded-lg border border-border bg-surface-muted px-3 py-2",children:[N.jsxDEV("span",{className:"flex-1 truncate text-small text-fg-muted",children:se.file?.filename??se.id},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>te(se.id),children:"Restore"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>Ce(se.id),children:"Delete permanently"},void 0,!1,void 0,this)]},se.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this):null,m?N.jsxDEV(jbe,{api:e,media:m,taxa:n?re:[],terms:B,canEdit:r,onClose:()=>g(null),onSaved:(se)=>{g(se),i((de)=>de.map((ge)=>ge.id===se.id?se:ge))},onDeleted:(se)=>{g(null),i((de)=>de.filter((ge)=>ge.id!==se)),k()},onTermsSaved:()=>{if(ie)le(0)},onError:t},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function jbe({api:e,media:t,taxa:n,terms:r,canEdit:s,onClose:i,onSaved:c,onDeleted:u,onTermsSaved:f,onError:p}){let[m,g]=fe.useState(t.alt??""),[y,v]=fe.useState(!1);fe.useEffect(()=>g(t.alt??""),[t]);let x=e.resolve(`/media/${t.file.key}`),w=async()=>{v(!0);try{c(await e.updateMedia(t.id,m||null))}catch(I){p(ht(I))}finally{v(!1)}},C=async()=>{if(!confirm("Move this file to the trash? It disappears from the library, but a page published while it was in use keeps showing it — delete it permanently from the trash to remove the file itself."))return;v(!0);try{await e.deleteMedia(t.id),u(t.id)}catch(I){p(ht(I))}finally{v(!1)}};return N.jsxDEV(yM,{onClose:i,size:"lg",title:N.jsxDEV(N.Fragment,{children:[N.jsxDEV(Gh,{children:"Media"},void 0,!1,void 0,this)," ",t.file.filename??""]},void 0,!0,void 0,this),children:[FQ(t)?N.jsxDEV("img",{className:"mx-auto mb-3.5 block max-h-[340px] max-w-full rounded-lg bg-surface-muted object-contain",src:x,alt:t.alt??""},void 0,!1,void 0,this):N.jsxDEV("div",{className:"mb-3.5 flex h-[200px] items-center justify-center rounded-lg bg-surface-muted font-mono text-fg-subtle",children:_Q(t)},void 0,!1,void 0,this),N.jsxDEV("div",{className:"mb-4",children:N.jsxDEV(pn,{label:"Alt text (for accessibility & SEO)",value:m,onChange:g,placeholder:"Describe the image…"},void 0,!1,void 0,this)},void 0,!1,void 0,this),N.jsxDEV(vM,{children:[N.jsxDEV("span",{children:"Type"},void 0,!1,void 0,this),N.jsxDEV("span",{children:t.file.contentType??"—"},void 0,!1,void 0,this),N.jsxDEV("span",{children:"Size"},void 0,!1,void 0,this),N.jsxDEV("span",{children:Xbe(t.file.size)},void 0,!1,void 0,this),N.jsxDEV("span",{children:"Uploaded"},void 0,!1,void 0,this),N.jsxDEV("span",{children:t.file.uploadedAt?new Date(t.file.uploadedAt).toLocaleString():t.createdAt??"—"},void 0,!1,void 0,this),N.jsxDEV("span",{children:"URL"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"break-all",children:N.jsxDEV("a",{className:"underline underline-offset-2",href:x,target:"_blank",rel:"noreferrer",children:["/media/",t.file.key]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),n.length>0?N.jsxDEV(Kbe,{api:e,mediaId:t.id,taxa:n,terms:r,canEdit:s,onSaved:f,onError:p},void 0,!1,void 0,this):null,N.jsxDEV("div",{className:"mt-3.5 flex items-center gap-2",children:[N.jsxDEV(me,{onPress:w,isDisabled:y||m===(t.alt??""),children:"Save"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>navigator.clipboard?.writeText(x),children:"Copy URL"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"flex-1"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",className:"text-danger",onPress:C,isDisabled:y,children:"Delete"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",onPress:i,children:"Close"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Kbe({api:e,mediaId:t,taxa:n,terms:r,canEdit:s,onSaved:i,onError:c}){let[u,f]=fe.useState(null),[p,m]=fe.useState(!1),[g,y]=fe.useState(!1);fe.useEffect(()=>{let w=!0;return f(null),e.listMediaTerms(t).then((C)=>{if(w)f(new Set(C.map((I)=>I.id)))}).catch((C)=>{if(w)f(new Set),c(ht(C))}),()=>{w=!1}},[e,t,c]);let v=(w)=>{f((C)=>{let I=new Set(C??[]);if(I.has(w))I.delete(w);else I.add(w);return I})},x=async()=>{m(!0);try{await e.setMediaTerms(t,[...u??[]]),y(!0),setTimeout(()=>y(!1),1200),i()}catch(w){c(ht(w))}finally{m(!1)}};if(u===null)return N.jsxDEV("div",{className:"mt-4 border-t border-border pt-3.5 text-small text-fg-subtle",children:"Loading tags…"},void 0,!1,void 0,this);return N.jsxDEV("div",{className:"mt-4 border-t border-border pt-3.5",children:[N.jsxDEV(sp,{children:"Tags"},void 0,!1,void 0,this),g?N.jsxDEV(ip,{ok:!0,children:"saved"},void 0,!1,void 0,this):null,N.jsxDEV("div",{className:"flex flex-col gap-2.5",children:n.map((w)=>{let C=r[w.slug]??[];return N.jsxDEV("div",{children:[N.jsxDEV("div",{className:"mb-1 text-caption text-fg-subtle",children:w.label},void 0,!1,void 0,this),C.length===0?N.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"No terms yet."},void 0,!1,void 0,this):N.jsxDEV("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:C.map((I)=>N.jsxDEV("label",{className:"flex items-center gap-2",children:[N.jsxDEV("input",{type:"checkbox",disabled:!s,checked:u.has(I.id),onChange:()=>v(I.id)},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-sm text-fg",children:I.label},void 0,!1,void 0,this)]},I.id,!0,void 0,this))},void 0,!1,void 0,this)]},w.id,!0,void 0,this)})},void 0,!1,void 0,this),s?N.jsxDEV(me,{size:"sm",variant:"secondary",className:"mt-2.5 self-start",onPress:x,isDisabled:p,children:p?"Saving…":"Save tags"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function Gbe(e){let t=e.roles;if(Array.isArray(t))return t.filter((n)=>typeof n==="string");if(typeof t==="string")try{let n=JSON.parse(t);return Array.isArray(n)?n:[]}catch{return[]}return[]}function BQ({api:e,me:t,onError:n}){let[r,s]=fe.useState([]),[i,c]=fe.useState(!1),[u,f]=fe.useState(""),p=fe.useCallback(()=>{e.call("listUsers",{limit:200}).then(s).catch((v)=>n(ht(v)))},[e,n]);fe.useEffect(()=>{p()},[p]);let m=async(v,x)=>{f(v.username);try{await e.call("setUserRoles",{username:v.username,roles:x}),p()}catch(w){n(ht(w))}finally{f("")}},g=async(v,x)=>{f(v.username);try{await e.call("setUserActive",{username:v.username,active:x}),p()}catch(w){n(ht(w))}finally{f("")}},y=async(v)=>{if(!confirm(`Delete user ${v.username}? This cannot be undone.`))return;f(v.username);try{await e.call("deleteUser",{username:v.username}),p()}catch(x){n(ht(x))}finally{f("")}};return N.jsxDEV(N.Fragment,{children:[N.jsxDEV(A1,{lead:"Users",em:r.length===0?"None yet":r.length===1?"1 account":`${r.length} accounts`,children:N.jsxDEV(me,{className:"shrink-0",onPress:()=>c(!0),children:"+ Invite"},void 0,!1,void 0,this)},void 0,!1,void 0,this),N.jsxDEV("div",{className:nn,children:N.jsxDEV("div",{className:"flex flex-col gap-2",children:[r.map((v)=>{let x=Gbe(v),w=t?.userId===v.username,C=v.active===void 0||v.active===null?!0:Boolean(Number(v.active));return N.jsxDEV("div",{className:`${Za} flex-wrap items-start`,children:[N.jsxDEV("div",{className:"flex min-w-[200px] flex-1 flex-col gap-0.5",children:[N.jsxDEV("span",{className:"font-semibold",children:[v.username,w?N.jsxDEV("span",{className:"ml-1.5 font-normal text-fg-subtle",children:"(you)"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),v.email&&v.email!==v.username?N.jsxDEV("span",{className:"text-xs text-fg-subtle",children:v.email},void 0,!1,void 0,this):null,v.createdAt?N.jsxDEV("span",{className:"text-[11px] text-fg-subtle",children:["joined ",new Date(Number(v.createdAt)).toLocaleDateString()]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),N.jsxDEV(qbe,{value:x,disabled:u===v.username,onSave:(I)=>m(v,I)},void 0,!1,void 0,this),N.jsxDEV(op,{status:C?"active":"inactive",children:C?"active":"inactive"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",size:"sm",isDisabled:u===v.username||w,onPress:()=>g(v,!C),children:C?"Deactivate":"Activate"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",size:"sm",className:"text-danger",isDisabled:u===v.username||w,onPress:()=>y(v),children:"Delete"},void 0,!1,void 0,this)]},v.username,!0,void 0,this)}),r.length===0?N.jsxDEV("p",{className:"text-fg-subtle",children:"No users yet. Invite someone to get started."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),i?N.jsxDEV(Wbe,{api:e,onClose:()=>c(!1),onInvited:()=>{c(!1),p()},onError:n},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function qbe({value:e,disabled:t,onSave:n}){let[r,s]=fe.useState(e.join(", ")),[i,c]=fe.useState(!1);fe.useEffect(()=>{s(e.join(", "))},[e]);let u=()=>{c(!1);let f=r.split(",").map((p)=>p.trim()).filter(Boolean);if(f.length===0){s(e.join(", "));return}if(f.length===e.length&&f.every((p,m)=>p===e[m]))return;n(f)};if(i)return N.jsxDEV("input",{autoFocus:!0,className:"h-10 w-[220px] rounded-lg border border-border bg-surface-card px-4 text-sm text-fg outline-none focus:border-brand-green",value:r,disabled:t,onChange:(f)=>s(f.target.value),onBlur:u,onKeyDown:(f)=>{if(f.key==="Enter")u();if(f.key==="Escape")s(e.join(", ")),c(!1)}},void 0,!1,void 0,this);return N.jsxDEV("span",{className:"flex cursor-pointer flex-wrap gap-1",onClick:()=>c(!0),title:"Click to edit",children:e.length===0?N.jsxDEV(op,{children:"no roles"},void 0,!1,void 0,this):e.map((f)=>N.jsxDEV(op,{status:f==="admin"?"published":void 0,children:f},f,!1,void 0,this))},void 0,!1,void 0,this)}function Wbe({api:e,onClose:t,onInvited:n,onError:r}){let[s,i]=fe.useState(""),[c,u]=fe.useState("editor"),[f,p]=fe.useState(!1);return N.jsxDEV(yM,{onClose:t,title:N.jsxDEV(N.Fragment,{children:["Invite an ",N.jsxDEV(Gh,{children:"editor"},void 0,!1,void 0,this)," or teammate"]},void 0,!0,void 0,this),description:"They'll get a one-time magic link that logs them in and creates their account.",children:N.jsxDEV("div",{className:"flex flex-col gap-4",children:[N.jsxDEV(pn,{label:"Email",type:"email",autoFocus:!0,value:s,onChange:i,placeholder:"them@example.com"},void 0,!1,void 0,this),N.jsxDEV(pn,{label:"Roles (comma-separated — e.g. editor, reviewer, admin)",value:c,onChange:u,placeholder:"editor"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"mt-2 flex justify-end gap-2",children:[N.jsxDEV(me,{variant:"ghost",onPress:t,children:"Cancel"},void 0,!1,void 0,this),N.jsxDEV(me,{onPress:async()=>{p(!0);try{let g=c.split(",").map((y)=>y.trim()).filter(Boolean);await e.call("inviteUser",{email:s,roles:g}),n()}catch(g){r(ht(g))}finally{p(!1)}},isDisabled:f||!s,children:f?"Sending…":"Send invite"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function HQ({api:e,cfg:t,me:n,onSignOut:r,onError:s}){return N.jsxDEV(N.Fragment,{children:[N.jsxDEV(A1,{lead:"Settings",em:n?.userId??"your account"},void 0,!1,void 0,this),N.jsxDEV("div",{className:`${nn} grid grid-cols-2 gap-5 max-[820px]:grid-cols-1`,children:[N.jsxDEV(Zbe,{api:e,me:n,onError:s,onSignOut:r},void 0,!1,void 0,this),N.jsxDEV(Ybe,{cfg:t,me:n},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Zbe({api:e,me:t,onError:n,onSignOut:r}){let[s,i]=fe.useState(""),[c,u]=fe.useState(""),[f,p]=fe.useState(""),[m,g]=fe.useState(""),[y,v]=fe.useState(!1),x=(I)=>{g(I),setTimeout(()=>g(""),1800)},w=async()=>{v(!0);try{await e.call("changeEmail",{email:s}),i(""),x("Contact email updated")}catch(I){n(ht(I))}finally{v(!1)}},C=async()=>{v(!0);try{await e.call("changePassword",{currentPassword:c,newPassword:f}),u(""),p(""),x("Password updated")}catch(I){n(ht(I))}finally{v(!1)}};return N.jsxDEV(NQ,{children:[N.jsxDEV(sp,{children:"My account"},void 0,!1,void 0,this),m?N.jsxDEV(ip,{ok:!0,children:m},void 0,!1,void 0,this):null,N.jsxDEV(vM,{className:"mb-4",children:[N.jsxDEV("span",{children:"Username"},void 0,!1,void 0,this),N.jsxDEV("span",{children:t?.userId??"—"},void 0,!1,void 0,this),N.jsxDEV("span",{children:"Roles"},void 0,!1,void 0,this),N.jsxDEV("span",{children:(t?.roles??[]).join(", ")||"—"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"flex flex-col gap-4",children:[N.jsxDEV(pn,{label:"Change contact email",type:"email",value:s,onChange:i,placeholder:"you@example.com"},void 0,!1,void 0,this),N.jsxDEV(me,{className:"w-full",onPress:w,isDisabled:y||!s,children:"Save email"},void 0,!1,void 0,this),N.jsxDEV(pn,{label:"Current password",type:"password",value:c,onChange:u,autoComplete:"current-password"},void 0,!1,void 0,this),N.jsxDEV(pn,{label:"New password (at least 8 characters)",type:"password",value:f,onChange:p,autoComplete:"new-password"},void 0,!1,void 0,this),N.jsxDEV(me,{className:"w-full",onPress:C,isDisabled:y||f.length<8||c.length===0,children:"Change password"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",className:"mt-2 w-full text-danger",onPress:r,children:"Sign out"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Ybe({cfg:e,me:t}){return N.jsxDEV(NQ,{children:[N.jsxDEV(sp,{children:"About"},void 0,!1,void 0,this),N.jsxDEV(vM,{children:[N.jsxDEV("span",{children:"Tenant"},void 0,!1,void 0,this),N.jsxDEV("span",{children:e.tenant||"main"},void 0,!1,void 0,this),N.jsxDEV("span",{children:"API"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"break-all",children:e.baseUrl},void 0,!1,void 0,this),N.jsxDEV("span",{children:"Signed in as"},void 0,!1,void 0,this),N.jsxDEV("span",{children:t?.userId??"—"},void 0,!1,void 0,this),N.jsxDEV("span",{children:"Editor"},void 0,!1,void 0,this),N.jsxDEV("span",{children:"pramen · cms-editor"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function FQ(e){return(e.file.contentType??"").startsWith("image/")}function _Q(e){let t=(e.file.contentType??"").split("/")[1];return(e.file.filename?.split(".").pop()??t??"file").slice(0,5).toUpperCase()}function Xbe(e){if(!e||e<=0)return"—";let t=["B","KB","MB","GB"],n=0,r=e;while(r>=1024&&n<t.length-1)r/=1024,n++;return`${r<10&&n>0?r.toFixed(1):Math.round(r)} ${t[n]}`}function ht(e){if(e instanceof mh)return e.message;return e instanceof Error?e.message:String(e)}function Jbe(e){return e.replace(/<[^>]*>/g," ").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\s+/g," ").trim()}function Qbe(e){if(typeof e==="string")return Jbe(e);if(Uh(e))return T1(e).replace(/\s+/g," ").trim();return""}function e1e(e){let t="";for(let n of Object.values(e))if(t=Qbe(n),t)break;if(!t)return"";return t.length>90?t.slice(0,90)+"…":t}function t1e(e,t,n,r,s){let i=n+r;if(i<0||i>=e.length)return;let c=e.map((u)=>u.id);[c[n],c[i]]=[c[i],c[n]],s(t,c)}var fe,N,kbe,Rbe,A1,Gh=({children:e})=>N.jsxDEV("span",{className:"text-fg-subtle",children:e},void 0,!1,void 0,this),IQ=50,EQ=50,RQ=60,Vbe=250,MQ="__all";var vo=E(()=>{Ur();$A();I1();xS();mM();Rn();dM();wc();Pf();fe=O(ee(),1),N=O(Me(),1),kbe=["settings","seo","i18n","terms","audit"],Rbe={settings:"Settings",seo:"SEO",i18n:"Translations",terms:"Terms",audit:"History"};A1=$4});function n1e(){try{return localStorage.getItem(UQ)==="dark"?"dark":"light"}catch{return"light"}}function jQ(e){if(typeof document<"u")document.documentElement.dataset.theme=e}function KQ(){k1=n1e(),jQ(k1)}function zQ(){return k1}function GQ(e){if(e===k1)return;k1=e,jQ(e);try{localStorage.setItem(UQ,e)}catch{}for(let t of[...xM])t()}function o1e(e){return xM.add(e),()=>xM.delete(e)}function A4(){return VQ.useSyncExternalStore(o1e,zQ,zQ)}var VQ,UQ="pramen.cms.theme",k1="light",xM;var k4=E(()=>{VQ=O(ee(),1),xM=new Set});function ree({api:e,slug:t,label:n,onError:r}){let[s,i]=ui.useState(null),[c,u]=ui.useState({}),[f,p]=ui.useState(!1),[m,g]=ui.useState(!1),[y,v]=ui.useState(null),x=ui.useCallback(async(w)=>{p(!0),g(!1);try{let C=await e.adminPageInteract({page:t,type:w?.type??"page_load",...w??{}});i(C),u(v1e(C.blocks)),v(C.toast??null)}catch(C){g(!0),r(String(C.message??C))}finally{p(!1)}},[e,t,r]);return ui.useEffect(()=>{x()},[x]),ui.useEffect(()=>{if(!y)return;let w=setTimeout(()=>v(null),3000);return()=>clearTimeout(w)},[y]),Le.jsxDEV("div",{className:nn,children:[Le.jsxDEV("div",{className:"mb-6 mt-6 flex items-center gap-3",children:[Le.jsxDEV("h1",{className:"m-0 text-[32px] font-normal leading-[1.1] tracking-[-0.01em] text-fg",children:n},void 0,!1,void 0,this),f?Le.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"working…"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),y?Le.jsxDEV("div",{className:`mb-4 rounded-lg border px-3.5 py-2.5 text-small ${y.tone==="error"?"border-danger bg-surface-card text-danger":y.tone==="success"?"border-brand-green bg-brand-green/20 text-fg":"border-border bg-surface-card text-fg-muted"}`,children:y.text},void 0,!1,void 0,this):null,s===null?Le.jsxDEV("p",{className:"text-fg-subtle",children:m?"This screen could not be loaded.":"Loading…"},void 0,!1,void 0,this):Le.jsxDEV(wM,{blocks:s.blocks,values:c,setValue:(w,C)=>u((I)=>({...I,[w]:C})),disabled:f,onFire:(w)=>void x({...w,values:c})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function wM({blocks:e,values:t,setValue:n,disabled:r,onFire:s}){return Le.jsxDEV("div",{className:"flex flex-col gap-4",children:e.map((i,c)=>Le.jsxDEV(p1e,{block:i,values:t,setValue:n,disabled:r,onFire:s},f1e(i,c),!1,void 0,this))},void 0,!1,void 0,this)}function f1e(e,t){let n=e.type==="form"||e.type==="actions"||e.type==="table"?e.block_id:void 0;return n?`id:${n}`:`${e.type}:${t}`}function p1e({block:e,values:t,setValue:n,disabled:r,onFire:s}){switch(e.type){case"header":return Le.jsxDEV(Qo,{level:e.level===3?"3":e.level===2?"2":"1",className:"font-normal",children:e.text},void 0,!1,void 0,this);case"section":return Le.jsxDEV("p",{className:"max-w-[72ch] whitespace-pre-wrap text-sm text-fg",children:e.text},void 0,!1,void 0,this);case"context":return Le.jsxDEV("p",{className:"max-w-[72ch] text-caption text-fg-subtle",children:e.text},void 0,!1,void 0,this);case"divider":return Le.jsxDEV("hr",{className:"border-t border-border"},void 0,!1,void 0,this);case"empty":return Le.jsxDEV("div",{className:"rounded-lg border border-dashed border-border px-5 py-8 text-center",children:[Le.jsxDEV("p",{className:"text-sm text-fg-muted",children:e.text},void 0,!1,void 0,this),e.hint?Le.jsxDEV("p",{className:"mt-1 text-caption text-fg-subtle",children:e.hint},void 0,!1,void 0,this):null]},void 0,!0,void 0,this);case"fields":return Le.jsxDEV("div",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 text-[13px]",children:e.fields.map((i,c)=>Le.jsxDEV("div",{className:"contents",children:[Le.jsxDEV("span",{className:"text-fg-subtle",children:i.label},void 0,!1,void 0,this),Le.jsxDEV("span",{className:"text-fg",children:i.value},void 0,!1,void 0,this)]},c,!0,void 0,this))},void 0,!1,void 0,this);case"stats":return Le.jsxDEV("div",{className:"flex flex-wrap gap-3",children:e.stats.map((i,c)=>Le.jsxDEV("div",{className:"min-w-[140px] flex-1 rounded-lg border border-border bg-surface-card p-4",children:[Le.jsxDEV("div",{className:"text-caption text-fg-subtle",children:i.label},void 0,!1,void 0,this),Le.jsxDEV("div",{className:"mt-1 text-[24px] leading-none text-fg",children:i.value},void 0,!1,void 0,this),i.hint?Le.jsxDEV("div",{className:"mt-1 text-caption text-fg-subtle",children:i.hint},void 0,!1,void 0,this):null]},c,!0,void 0,this))},void 0,!1,void 0,this);case"table":return Le.jsxDEV(m1e,{block:e,values:t,setValue:n,disabled:r,onFire:s},void 0,!1,void 0,this);case"image":return Le.jsxDEV("figure",{className:"m-0",children:[Le.jsxDEV("img",{src:e.url,alt:e.alt??"",className:"max-w-full rounded-lg"},void 0,!1,void 0,this),e.caption?Le.jsxDEV("figcaption",{className:"mt-1 text-caption text-fg-subtle",children:e.caption},void 0,!1,void 0,this):null]},void 0,!0,void 0,this);case"columns":return Le.jsxDEV("div",{className:"grid gap-4 max-[820px]:grid-cols-1",style:{gridTemplateColumns:`repeat(${e.columns.length}, minmax(0, 1fr))`},children:e.columns.map((i,c)=>Le.jsxDEV(wM,{blocks:i,values:t,setValue:n,disabled:r,onFire:s},c,!1,void 0,this))},void 0,!1,void 0,this);case"accordion":return Le.jsxDEV("details",{className:"rounded-lg border border-border bg-surface-card px-4 py-3",open:e.open,children:[Le.jsxDEV("summary",{className:"cursor-pointer text-sm font-medium text-fg",children:e.title},void 0,!1,void 0,this),Le.jsxDEV("div",{className:"mt-3",children:Le.jsxDEV(wM,{blocks:e.blocks,values:t,setValue:n,disabled:r,onFire:s},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);case"actions":return Le.jsxDEV(b1e,{block:e,values:t,setValue:n,disabled:r,onFire:s},void 0,!1,void 0,this);case"form":return Le.jsxDEV(y1e,{block:e,values:t,setValue:n,disabled:r,onFire:s},void 0,!1,void 0,this);default:return Le.jsxDEV("p",{className:"text-caption text-fg-subtle",children:["[unsupported block: ",e.type,"]"]},void 0,!0,void 0,this)}}function m1e({block:e,values:t,setValue:n,disabled:r,onFire:s}){if(e.rows.length===0)return Le.jsxDEV("p",{className:"text-sm text-fg-subtle",children:e.empty??"Nothing here."},void 0,!1,void 0,this);return Le.jsxDEV("div",{className:"overflow-x-auto rounded-lg border border-border bg-surface-card",children:Le.jsxDEV("table",{className:"w-full border-collapse text-[13px]",children:[Le.jsxDEV("thead",{children:Le.jsxDEV("tr",{children:e.columns.map((i)=>Le.jsxDEV("th",{className:"border-b border-border px-3 py-2 text-left font-medium text-fg-subtle",children:i.label},i.key,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),Le.jsxDEV("tbody",{children:e.rows.map((i,c)=>Le.jsxDEV("tr",{children:e.columns.map((u)=>Le.jsxDEV("td",{className:"border-b border-border px-3 py-2 text-fg",children:Le.jsxDEV(h1e,{value:i[u.key],blockId:e.block_id,values:t,setValue:n,disabled:r,onFire:s},void 0,!1,void 0,this)},u.key,!1,void 0,this))},c,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function h1e({value:e,blockId:t,values:n,setValue:r,disabled:s,onFire:i}){if(aee(e))return Le.jsxDEV(see,{el:e,blockId:t,compact:!0,values:n,setValue:r,disabled:s,onFire:i},void 0,!1,void 0,this);return Le.jsxDEV(Le.Fragment,{children:g1e(e)},void 0,!1,void 0,this)}function aee(e){return e!==null&&typeof e==="object"&&DK.includes(e.type)}function g1e(e){if(e===null||e===void 0)return"";if(typeof e==="boolean")return e?"yes":"no";if(typeof e==="object")return`[unsupported cell: ${String(e.type)}]`;return String(e)}function b1e({block:e,values:t,setValue:n,disabled:r,onFire:s}){return Le.jsxDEV("div",{className:"flex flex-wrap items-end gap-3",children:e.elements.map((i,c)=>Le.jsxDEV(see,{el:i,blockId:e.block_id,values:t,setValue:n,disabled:r,onFire:s},i.type==="button"?`b:${c}`:`i:${i.action_id}`,!1,void 0,this))},void 0,!1,void 0,this)}function see({el:e,blockId:t,compact:n,values:r,setValue:s,disabled:i,onFire:c}){if(e.type==="button")return Le.jsxDEV(me,{size:n?"sm":void 0,variant:e.style==="primary"?"primary":e.style==="danger"?"ghost":"secondary",className:e.style==="danger"?"text-danger":void 0,isDisabled:i,onPress:()=>{if(e.confirm&&!confirm(e.confirm))return;c({type:"block_action",action_id:e.action_id,block_id:t,value:e.value??null})},children:e.label},void 0,!1,void 0,this);return Le.jsxDEV(iee,{input:e,value:r[e.action_id],onChange:(u)=>s(e.action_id,u),disabled:i},void 0,!1,void 0,this)}function y1e({block:e,values:t,setValue:n,disabled:r,onFire:s}){let i=e.fields.filter((c)=>c.type!=="toggle"&&c.required&&S1e(t[c.action_id]));return Le.jsxDEV("form",{className:"flex max-w-[720px] flex-col gap-3 rounded-lg border border-border bg-surface-card p-5",onSubmit:(c)=>{if(c.preventDefault(),i.length>0||r)return;s({type:"form_submit",action_id:e.submit.action_id,block_id:e.block_id})},children:[e.fields.map((c)=>Le.jsxDEV(iee,{input:c,value:t[c.action_id],onChange:(u)=>n(c.action_id,u),disabled:r},c.action_id,!1,void 0,this)),Le.jsxDEV("div",{className:"mt-1",children:[Le.jsxDEV(me,{type:"submit",isDisabled:r||i.length>0,children:e.submit.label},void 0,!1,void 0,this),i.length>0?Le.jsxDEV("span",{className:"ml-3 text-caption text-fg-subtle",children:["Fill in: ",i.map((c)=>c.label??c.action_id).join(", ")]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function TM(e,t=[]){for(let n of e)if(n.type==="form")t.push(...n.fields);else if(n.type==="actions")t.push(...n.elements.filter(oee));else if(n.type==="table")for(let r of n.rows)for(let s of n.columns){let i=r[s.key];if(aee(i)&&oee(i))t.push(i)}else if(n.type==="columns")for(let r of n.columns)TM(r,t);else if(n.type==="accordion")TM(n.blocks,t);return t}function v1e(e){return x1e(TM(e))}function x1e(e){let t={};for(let n of e)if(n.type==="toggle")t[n.action_id]=n.initial_value??!1;else if(n.type==="number_input")t[n.action_id]=n.initial_value??null;else if(n.type==="secret_input")t[n.action_id]="";else t[n.action_id]=n.initial_value??"";return t}function iee({input:e,value:t,onChange:n,disabled:r}){let s=e.label?Le.jsxDEV("span",{className:"text-caption text-fg-subtle",children:[e.label,e.type!=="toggle"&&e.required?Le.jsxDEV("span",{className:"text-danger",children:" *"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null,i=e.error?Le.jsxDEV("span",{role:"alert",className:"text-caption text-danger",children:e.error},void 0,!1,void 0,this):null;if(e.type==="toggle")return Le.jsxDEV("label",{className:"flex items-center gap-2",children:[Le.jsxDEV("input",{type:"checkbox",checked:t===!0,disabled:r,"aria-invalid":e.error?!0:void 0,onChange:(c)=>n(c.target.checked)},void 0,!1,void 0,this),Le.jsxDEV("span",{className:"text-sm text-fg",children:e.label??e.action_id},void 0,!1,void 0,this),i]},void 0,!0,void 0,this);return Le.jsxDEV("label",{className:"flex min-w-[180px] flex-col gap-1.5",children:[s,e.type==="select"?Le.jsxDEV("select",{className:at,value:typeof t==="string"?t:"",disabled:r,"aria-invalid":e.error?!0:void 0,"aria-label":e.label??e.action_id,onChange:(c)=>n(c.target.value),children:[Le.jsxDEV("option",{value:"",children:"—"},void 0,!1,void 0,this),e.options.map((c)=>Le.jsxDEV("option",{value:c.value,children:c.label},c.value,!1,void 0,this))]},void 0,!0,void 0,this):e.type==="number_input"?Le.jsxDEV("input",{className:at,type:"number",min:e.min,max:e.max,placeholder:e.placeholder,disabled:r,"aria-invalid":e.error?!0:void 0,"aria-label":e.label??e.action_id,value:typeof t==="number"?String(t):"",onChange:(c)=>n(c.target.value===""?null:Number(c.target.value))},void 0,!1,void 0,this):e.type==="text_input"&&e.multiline?Le.jsxDEV("textarea",{className:`${at} h-auto min-h-24 py-2.5`,placeholder:e.placeholder,disabled:r,"aria-invalid":e.error?!0:void 0,"aria-label":e.label??e.action_id,value:typeof t==="string"?t:"",onChange:(c)=>n(c.target.value)},void 0,!1,void 0,this):Le.jsxDEV("input",{className:at,type:e.type==="secret_input"?"password":"text",autoComplete:e.type==="secret_input"?"new-password":void 0,placeholder:e.placeholder,disabled:r,"aria-invalid":e.error?!0:void 0,"aria-label":e.label??e.action_id,value:typeof t==="string"?t:"",onChange:(c)=>n(c.target.value)},void 0,!1,void 0,this),i]},void 0,!0,void 0,this)}var ui,Le,oee=(e)=>e.type!=="button",S1e=(e)=>e===void 0||e===null||e==="";var lee=E(()=>{Ur();I1();Pf();ui=O(ee(),1),Le=O(Me(),1)});function C1e(e){let t=e instanceof Error?e.message:String(e);return t.trim()===""?"threw a value with no message":t}var cee,R1,IM;var uee=E(()=>{cee=O(ee(),1),R1=O(Me(),1);IM=class IM extends cee.Component{state={failure:null};static getDerivedStateFromError(e){return{failure:C1e(e)}}componentDidCatch(e,t){console.error(`pramen/cms-editor: panel '${this.props.slug}' failed to render`,e,t.componentStack)}componentDidUpdate(e){if(e.slug!==this.props.slug&&this.state.failure!==null)this.setState({failure:null})}render(){if(this.state.failure===null)return this.props.children;return R1.jsxDEV("div",{role:"alert",className:"rounded-panel border border-border bg-surface-card px-6 py-5 text-sm text-fg-muted",children:[R1.jsxDEV("p",{className:"mb-1 text-fg",children:["The ",R1.jsxDEV("strong",{children:this.props.slug},void 0,!1,void 0,this)," panel failed to render."]},void 0,!0,void 0,this),R1.jsxDEV("p",{className:"font-mono text-caption",children:this.state.failure},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}}});function R4(){fee+=1;for(let e of[...AM])e()}function dee(e,t,n){RM.set(e,t),n(`pramen/cms-editor: ${t}`),R4()}function $1e(e,t,n=1){if(typeof t!=="number"||!Number.isInteger(t)||t<1)return`The '${e}' panel did not state which panel runtime contract it was built against. Add \`contract: ${n}\` to its registerPanel() call and rebuild it against the @pramen/cms-editor this admin serves (React 19).`;if(t<n)return`The '${e}' panel was built against panel runtime contract ${t}, and this editor implements ${n}. Rebuild the bundle against the @pramen/cms-editor this admin serves (React 19) and set \`contract: ${n}\` in its registerPanel() call.`;if(t>n)return`The '${e}' panel was built against panel runtime contract ${t}, and this editor implements ${n}. Upgrade @pramen/cms-editor — and the shell that serves it — to the release implementing contract ${t}, or rebuild the panel against this one.`;return}function pee(e,t=console.warn){let n=typeof e?.slug==="string"?e.slug.trim():"";if(!n){t("pramen/cms-editor: ignoring a panel registered with no slug — the slug is what matches it to its adminPanel() entry.");return}let r=$1e(n,e.contract);if(r!==void 0)return dee(n,r,t);let s=typeof e.render;if(s!=="function")return dee(n,`The '${n}' panel was ignored: 'render' must be a React component, and this one is of type ${s}.`,t);if(EM.has(n))t(`pramen/cms-editor: panel '${n}' was registered twice — the last registration wins.`);RM.delete(n),EM.set(n,{slug:n,render:e.render}),R4()}function mee(e){return EM.get(e)}function hee(e){return RM.get(e)}function gee(){return kM===0}function MM(){return fee}function bee(e){return AM.add(e),()=>AM.delete(e)}function w1e(e,t){if(typeof e!=="string"||e.trim()==="")return;let n;try{n=new URL(e.trim(),t)}catch{return}if(n.protocol!=="http:"&&n.protocol!=="https:")return;return n.href}function yee(e,t,n=console.warn){let r=e?.PRAMEN_CMS_EDITOR?.panels;if(r===void 0)return[];if(!Array.isArray(r))return n("pramen/cms-editor: ignoring `panels` — it must be an array of module URLs."),[];let s=[];for(let i of r){let c=w1e(i,t);if(c===void 0)n(`pramen/cms-editor: ignoring unusable panel bundle URL ${JSON.stringify(i)} — it must be an http(s) URL or a path.`);else s.push(c)}return s}async function vee(e,t=T1e,n=console.warn){if(e.length===0)return;kM+=e.length,R4(),await Promise.all(e.map((r)=>t(r).catch((s)=>{n(`pramen/cms-editor: panel bundle ${r} failed to load — ${String(s?.message??s)}`)}).finally(()=>{kM-=1,R4()})))}var EM,AM,kM=0,fee=0,RM,T1e=(e)=>import(e);var M4=E(()=>{EM=new Map,AM=new Set,RM=new Map});function E1e({slug:e}){let{api:t,setError:n}=nt(),r=A4(),s=Ol().basePath,i=N4.useSyncExternalStore(bee,MM,MM),c=N4.useMemo(()=>mee(e),[e,i]);if(!c){let f=hee(e);return td.jsxDEV(Ut,{children:f??(gee()?`No panel is registered for '${e}'. Check that this deployment's panel bundle is listed in the admin's \`panels\` config and calls registerPanel({ slug: "${e}", … }).`:"Loading…")},void 0,!1,void 0,this)}let u={api:t,basePath:s,theme:r,setError:n};return td.jsxDEV(IM,{slug:e,children:td.jsxDEV(c.render,{...u},void 0,!1,void 0,this)},e,!1,void 0,this)}var N4,td,I1e;var xee=E(()=>{Dn();Rn();lee();vo();uee();M4();k4();Pf();Ur();N4=O(ee(),1),td=O(Me(),1),I1e=Tt().params({slug:"string"}).route("/apps/:slug").render(function({params:t}){let{api:n,adminPages:r,setError:s}=nt(),i=Bt(),c=r.find((u)=>u.slug===t.slug);if(!c)return td.jsxDEV(Ut,{action:r.length>0?td.jsxDEV(me,{variant:"ghost",size:"sm",onPress:()=>i("home"),children:"← Pages"},void 0,!1,void 0,this):void 0,children:r.length===0?"Loading…":`Unknown page: ${t.slug}`},void 0,!1,void 0,this);if(LK(c)==="panel")return td.jsxDEV(E1e,{slug:c.slug},void 0,!1,void 0,this);return td.jsxDEV(ree,{api:n,slug:c.slug,label:c.label,onError:s},c.slug,!1,void 0,this)})});function k1e(e){let t=e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^A-Za-z0-9]+/g," ").trim().split(" ").filter(Boolean);if(t.length===0)return"";let[n,...r]=t,s=n.toLowerCase()+r.map((i)=>i[0].toUpperCase()+i.slice(1).toLowerCase()).join("");return $ee.test(s)?s:`f${s}`}function LM({schema:e,onChange:t,depth:n=0}){let r=(f,p)=>t(e.map((m,g)=>g===f?p:m)),s=(f)=>t(e.filter((p,m)=>m!==f)),i=(f,p)=>{let m=f+p;if(m<0||m>=e.length)return;let g=e.slice(),[y]=g.splice(f,1);g.splice(m,0,y),t(g)},c=()=>{let f=e.length+1;while(e.some((p)=>p.name===`field${f}`))f++;t([...e,{name:`field${f}`,type:"text"}])},u=e.map((f)=>f.name);return Y.jsxDEV("div",{className:"flex flex-col gap-2",children:[e.length===0?Y.jsxDEV("p",{className:"text-sm text-fg-subtle",children:"No fields yet."},void 0,!1,void 0,this):null,e.map((f,p)=>Y.jsxDEV(R1e,{def:f,siblings:u,siblingFields:e,index:p,count:e.length,depth:n,onChange:(m)=>r(p,m),onMove:(m)=>i(p,m),onDelete:()=>s(p)},p,!1,void 0,this)),n+1<See?Y.jsxDEV(me,{variant:"secondary",size:"sm",className:"self-start",onPress:c,children:"+ Add field"},void 0,!1,void 0,this):Y.jsxDEV("p",{className:"text-caption text-fg-subtle",children:["Fields cannot nest deeper than ",See," levels."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function R1e({def:e,siblings:t,siblingFields:n,index:r,count:s,depth:i,onChange:c,onMove:u,onDelete:f}){let p=(v)=>c({...e,...v}),m=t.filter((v)=>v===e.name).length>1,g=e.name!==""&&!$ee.test(e.name),y=(v)=>{let x={name:e.name,type:v};if(e.label)x.label=e.label;if(e.required)x.required=!0;if(NM.includes(v))x.fields=NM.includes(e.type)?e.fields??[]:[];c(x)};return Y.jsxDEV("div",{className:"rounded-lg border border-border bg-surface-muted",children:[Y.jsxDEV("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:r+1},void 0,!1,void 0,this),Y.jsxDEV("span",{className:"min-w-0 flex-1 truncate text-sm text-fg",children:[e.label||e.name," ",Y.jsxDEV("span",{className:"text-fg-subtle",children:["· ",e.type]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg disabled:opacity-30",title:"Move up",disabled:r===0,onClick:()=>u(-1),children:"↑"},void 0,!1,void 0,this),Y.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg disabled:opacity-30",title:"Move down",disabled:r===s-1,onClick:()=>u(1),children:"↓"},void 0,!1,void 0,this),Y.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-danger",title:"Remove",onClick:f,children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("div",{className:"flex flex-col gap-3 p-3.5",children:[Y.jsxDEV("div",{className:"grid grid-cols-3 gap-3 max-[720px]:grid-cols-1",children:[Y.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Label"},void 0,!1,void 0,this),Y.jsxDEV("input",{className:at,value:e.label??"",placeholder:e.name,onChange:(v)=>{let x=v.target.value,w=/^field\d+$/.test(e.name)?k1e(x):"";p(w?{label:x,name:w}:{label:x})}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Name (the stored key)"},void 0,!1,void 0,this),Y.jsxDEV("input",{className:at,value:e.name,onChange:(v)=>p({name:v.target.value.trim()})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Type"},void 0,!1,void 0,this),Y.jsxDEV("select",{className:at,value:e.type,onChange:(v)=>y(v.target.value),children:A1e.map((v)=>Y.jsxDEV("option",{value:v,children:v},v,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m?Y.jsxDEV("p",{className:"text-caption text-danger",children:["Two fields here are called “",e.name,"” — they would write the same key, and one could never be saved."]},void 0,!0,void 0,this):null,g?Y.jsxDEV("p",{className:"text-caption text-danger",children:"A name must start with a letter or underscore and hold only letters, digits and underscores."},void 0,!1,void 0,this):null,Y.jsxDEV("label",{className:"flex items-center gap-2",children:[Y.jsxDEV("input",{type:"checkbox",checked:e.required===!0,onChange:(v)=>p({required:v.target.checked||void 0})},void 0,!1,void 0,this),Y.jsxDEV("span",{className:"text-sm text-fg",children:"Required"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.type==="select"?Y.jsxDEV(M1e,{def:e,patch:p},void 0,!1,void 0,this):null,e.type==="reference"?Y.jsxDEV(P1e,{def:e,patch:p},void 0,!1,void 0,this):null,e.type==="slug"?Y.jsxDEV(D1e,{def:e,siblingFields:n,patch:p},void 0,!1,void 0,this):null,e.type==="repeater"?Y.jsxDEV(L1e,{def:e,patch:p},void 0,!1,void 0,this):null,NM.includes(e.type)?Y.jsxDEV("div",{className:"rounded-lg border border-border bg-surface-card p-3.5",children:[Y.jsxDEV("p",{className:"mb-2 text-caption text-fg-subtle",children:"Nested fields"},void 0,!1,void 0,this),Y.jsxDEV(LM,{schema:e.fields??[],onChange:(v)=>p({fields:v}),depth:i+1},void 0,!1,void 0,this),(e.fields??[]).length===0?Y.jsxDEV("p",{className:"mt-2 text-caption text-danger",children:["A ",e.type," needs at least one nested field."]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function M1e({def:e,patch:t}){let n=Boolean(e.optionsFrom);return Y.jsxDEV("div",{className:"flex flex-col gap-2",children:[Y.jsxDEV("label",{className:"flex items-center gap-2",children:[Y.jsxDEV("input",{type:"checkbox",checked:n,onChange:(r)=>t(r.target.checked?{optionsFrom:"",options:void 0}:{optionsFrom:void 0,options:[]})},void 0,!1,void 0,this),Y.jsxDEV("span",{className:"text-sm text-fg",children:"Fetch the options from a query handler"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),n?Y.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:["Handler name (returns ",Y.jsxDEV("code",{children:"{ value, label }[]"},void 0,!1,void 0,this),")"]},void 0,!0,void 0,this),Y.jsxDEV("input",{className:at,value:e.optionsFrom??"",onChange:(r)=>t({optionsFrom:r.target.value.trim()})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Y.jsxDEV(N1e,{options:e.options??[],onChange:(r)=>t({options:r})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function N1e({options:e,onChange:t}){let[n,r]=on.useState(()=>e.join(`
|
|
399
|
+
`).trim()}var sbe;var dM=E(()=>{sbe=new Set(["paragraph","heading","listItem","taskItem","blockquote","codeBlock","horizontalRule"])});function tp({label:e,children:t}){return be.jsxDEV("label",{className:"flex w-full flex-col gap-2",children:[e===void 0?null:be.jsxDEV("span",{className:"text-sm font-medium text-fg",children:e},void 0,!1,void 0,this),t]},void 0,!0,void 0,this)}function y4(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let n=(r)=>String(r).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function v4(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toISOString()}function np(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function ibe(e){let[t,n]=Lt.useState(0);Lt.useEffect(()=>{if(e===null)return;let r=e-Date.now();if(r<=0)return;let s=setTimeout(()=>n((i)=>i+1),Math.min(r+1000,2147483647));return()=>clearTimeout(s)},[e,t])}function lbe({value:e,onChange:t}){let[n,r]=Lt.useState(!1),[s,i]=Lt.useState(""),c=Boolean(e),u=c?new Date(e).getTime():Number.NaN,f=Number.isFinite(u)&&u>Date.now();ibe(f?u:null);let p=!c?{text:"Not published",tone:"text-fg-muted"}:f?{text:`Scheduled for ${np(e)}`,tone:"text-accent-strong"}:{text:`Published ${np(e)}`,tone:"text-fg"},m=()=>{i(y4(e)),r((g)=>!g)};return be.jsxDEV("div",{className:"flex flex-col gap-2",children:[be.jsxDEV("span",{className:`text-sm ${p.tone}`,children:p.text},void 0,!1,void 0,this),be.jsxDEV("div",{className:"flex flex-wrap items-center gap-2",children:[!c||f?be.jsxDEV(me,{size:"sm",onPress:()=>{r(!1),t(new Date().toISOString())},children:"Publish now"},void 0,!1,void 0,this):null,be.jsxDEV(me,{variant:"secondary",size:"sm",onPress:m,children:f?"Change schedule":c?"Change time":"Schedule…"},void 0,!1,void 0,this),c?be.jsxDEV(me,{variant:"ghost",size:"sm",className:"text-danger",onPress:()=>{r(!1),t(null)},children:"Unpublish"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),n?be.jsxDEV("input",{className:at,type:"datetime-local",value:s,autoFocus:!0,onChange:(g)=>{i(g.target.value);let y=g.target.value?v4(g.target.value):null;if(y)t(y)}},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function jh({schema:e,value:t,onChange:n,api:r}){let s=(i,c)=>n({...t,[i]:c});return be.jsxDEV("div",{className:"flex flex-col gap-4",children:e.map((i)=>be.jsxDEV(rQ,{def:i,value:t[i.name],onChange:(c)=>s(i.name,c),api:r,siblings:t},i.name,!1,void 0,this))},void 0,!1,void 0,this)}function rQ({def:e,value:t,onChange:n,api:r,hideLabelAs:s,siblings:i}){let c=s!==void 0?void 0:be.jsxDEV(be.Fragment,{children:[e.label??e.name," ",e.required?be.jsxDEV("span",{className:"text-danger",children:"*"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),u=(f)=>typeof f==="string"?f:f==null?"":JSON.stringify(f);switch(e.type){case"text":case"url":{let f=e.type==="url"?"https://…":"";return s!==void 0?be.jsxDEV("input",{className:at,type:"text","aria-label":s,placeholder:f,value:t??"",onChange:(p)=>n(p.target.value)},void 0,!1,void 0,this):be.jsxDEV(pn,{label:c,value:t??"",onChange:n,placeholder:f},void 0,!1,void 0,this)}case"textarea":return s!==void 0?be.jsxDEV("textarea",{className:`${at} h-auto min-h-20 py-2.5`,"aria-label":s,value:u(t),onChange:(f)=>n(f.target.value)},void 0,!1,void 0,this):be.jsxDEV(fh,{label:c,value:u(t),onChange:n},void 0,!1,void 0,this);case"richtext":return be.jsxDEV(tp,{label:c,children:be.jsxDEV(fM,{value:t,onChange:n},void 0,!1,void 0,this)},void 0,!1,void 0,this);case"number":return be.jsxDEV(tp,{label:c,children:be.jsxDEV("input",{className:at,type:"number","aria-label":s,value:t==null?"":String(t),onChange:(f)=>n(f.target.value===""?null:Number(f.target.value))},void 0,!1,void 0,this)},void 0,!1,void 0,this);case"date":case"datetime":return be.jsxDEV(tp,{label:c,children:be.jsxDEV("input",{className:at,type:e.type==="date"?"date":"datetime-local","aria-label":s,value:t??"",onChange:(f)=>n(f.target.value||null)},void 0,!1,void 0,this)},void 0,!1,void 0,this);case"slug":return be.jsxDEV(ube,{def:e,label:c,value:typeof t==="string"?t:"",source:typeof i?.[e.from??""]==="string"?i[e.from??""]:"",onChange:n},void 0,!1,void 0,this);case"publish":return be.jsxDEV("div",{className:"flex w-full flex-col gap-2",children:[be.jsxDEV("span",{className:"text-sm font-medium text-fg",children:c},void 0,!1,void 0,this),be.jsxDEV(lbe,{value:typeof t==="string"?t:"",onChange:n},void 0,!1,void 0,this)]},void 0,!0,void 0,this);case"boolean":return be.jsxDEV("label",{className:"flex items-center gap-2",children:[be.jsxDEV("input",{type:"checkbox",checked:Boolean(t),onChange:(f)=>n(f.target.checked)},void 0,!1,void 0,this),be.jsxDEV("span",{className:"text-sm text-fg",children:e.label??e.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this);case"select":return be.jsxDEV(tp,{label:c,children:be.jsxDEV(dbe,{def:e,value:t,onChange:n,api:r,ariaLabel:s},void 0,!1,void 0,this)},void 0,!1,void 0,this);case"media":return be.jsxDEV(tp,{label:c,children:be.jsxDEV(fbe,{value:t,onChange:n,api:r},void 0,!1,void 0,this)},void 0,!1,void 0,this);case"reference":return be.jsxDEV("div",{className:"flex w-full flex-col gap-2",children:[c===void 0?null:be.jsxDEV("span",{className:"text-sm font-medium text-fg",children:c},void 0,!1,void 0,this),be.jsxDEV(gbe,{def:e,value:t,onChange:n,api:r,ariaLabel:s},void 0,!1,void 0,this)]},void 0,!0,void 0,this);case"group":return be.jsxDEV(tp,{label:c,children:be.jsxDEV("div",{className:"rounded-lg border border-border bg-surface-muted p-3.5",children:be.jsxDEV(jh,{schema:e.fields??[],value:t??{},onChange:n,api:r},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);case"repeater":return be.jsxDEV(cbe,{def:e,value:t??[],onChange:n,api:r,label:c},void 0,!1,void 0,this);default:return null}}function tQ(e){try{return EZ(e,aQ)}catch(t){return console.error("pramen/cms-editor: could not parse editor HTML",t),{type:"doc",content:[]}}}function nQ(e){if(typeof e==="string")return e;if(!Uh(e))return"";try{return IZ(e,aQ)}catch(t){return console.error("pramen/cms-editor: rich-text document uses nodes this editor cannot render",t),""}}function fM({value:e,onChange:t}){let[n,r]=Lt.useState(()=>nQ(e)),s=Lt.useRef(null),i=Lt.useRef(!1);return Lt.useEffect(()=>{if(i.current||typeof e!=="string"||e==="")return;i.current=!0;let u=tQ(e);s.current=u,t(u)},[e,t]),Lt.useEffect(()=>{if(e!==null&&e===s.current)return;r(nQ(e))},[e]),be.jsxDEV(uM,{value:n,onChange:(u)=>{r(u);let f=tQ(u);s.current=f,t(f)},minHeight:180,placeholder:"Write, or press '/' for blocks…"},void 0,!1,void 0,this)}function cbe({def:e,value:t,onChange:n,api:r,label:s}){let i=Array.isArray(t)?t:[],c=e.fields??[],u=c.length===1&&!["repeater","group","richtext","media"].includes(c[0].type),[f,p]=Lt.useState(null),m=(z,F)=>n(i.map((ne,V)=>V===z?F:ne)),g=()=>n([...i,{}]),y=(z)=>n(i.filter((F,ne)=>ne!==z)),v=(z,F)=>{if(z===F||F<0||F>=i.length)return;let ne=i.slice(),[V]=ne.splice(z,1);ne.splice(F,0,V),n(ne)},x=(z,F)=>v(z,z+F),w=e.max!=null&&i.length>=e.max,C=e.min!=null&&i.length<=e.min,I=(z)=>{let F=["text","textarea","richtext","select","url"];for(let ne of c){if(!F.includes(ne.type))continue;let V=z[ne.name],ae=(Uh(V)?T1(V):typeof V==="string"?V.replace(/<[^>]+>/g," "):"").replace(/\s+/g," ").trim();if(ae)return ae.slice(0,80)}return""},R=(z)=>({onDragOver:(F)=>{if(!f)return;F.preventDefault(),p((ne)=>ne&&ne.over!==z?{...ne,over:z}:ne)},onDrop:(F)=>{if(!f)return;F.preventDefault(),v(f.from,z),p(null)}}),H=(z)=>be.jsxDEV("span",{draggable:!0,onDragStart:(F)=>{F.dataTransfer.effectAllowed="move",F.dataTransfer.setData("text/plain",""),p({from:z,over:z})},onDragEnd:()=>p(null),className:"cursor-grab select-none px-1 text-fg-subtle transition-colors hover:text-fg active:cursor-grabbing",title:"Drag to reorder","aria-hidden":!0,children:"⠿"},void 0,!1,void 0,this),L=(z)=>`${f&&f.over===z&&f.from!==z?"ring-2 ring-brand-green":""} ${f&&f.from===z?"opacity-40":""}`,_="opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 [@media(hover:none)]:opacity-100",W=(z)=>be.jsxDEV("div",{className:"flex shrink-0 items-center",children:[be.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg disabled:opacity-30",title:"Move up",disabled:z===0,onClick:()=>x(z,-1),children:"↑"},void 0,!1,void 0,this),be.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg disabled:opacity-30",title:"Move down",disabled:z===i.length-1,onClick:()=>x(z,1),children:"↓"},void 0,!1,void 0,this),be.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-danger disabled:opacity-30",title:"Remove",disabled:C,onClick:()=>y(z),children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return be.jsxDEV("div",{className:"flex flex-col gap-2",children:[be.jsxDEV("span",{className:"text-sm font-medium text-fg",children:s},void 0,!1,void 0,this),i.length===0?be.jsxDEV("span",{className:"text-sm text-fg-muted",children:"None yet."},void 0,!1,void 0,this):null,be.jsxDEV("div",{className:`flex flex-col ${u?"gap-1":"gap-2"}`,children:i.map((z,F)=>u?be.jsxDEV("div",{className:`group/row flex items-center gap-1 rounded-lg px-1 py-0.5 transition-colors ${L(F)}`,...R(F),children:[H(F),be.jsxDEV("div",{className:"min-w-0 flex-1",children:be.jsxDEV(rQ,{def:c[0],hideLabelAs:`${e.label??e.name} ${F+1}`,value:z[c[0].name],onChange:(ne)=>m(F,{...z,[c[0].name]:ne}),api:r},void 0,!1,void 0,this)},void 0,!1,void 0,this),be.jsxDEV("div",{className:"opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 [@media(hover:none)]:opacity-100",children:W(F)},void 0,!1,void 0,this)]},F,!0,void 0,this):be.jsxDEV("div",{className:`rounded-lg border border-border bg-surface-muted transition-colors ${L(F)}`,...R(F),children:[be.jsxDEV("div",{className:"flex items-center gap-1 border-b border-border px-2 py-1.5",children:[H(F),be.jsxDEV("span",{className:"text-caption text-fg-subtle",children:F+1},void 0,!1,void 0,this),be.jsxDEV("span",{className:"min-w-0 flex-1 truncate text-sm text-fg-muted",children:I(z)},void 0,!1,void 0,this),W(F)]},void 0,!0,void 0,this),be.jsxDEV("div",{className:"p-3.5",children:be.jsxDEV(jh,{schema:c,value:z,onChange:(ne)=>m(F,ne),api:r},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},F,!0,void 0,this))},void 0,!1,void 0,this),be.jsxDEV(me,{variant:"secondary",size:"sm",className:"self-start",onPress:g,isDisabled:w,children:["+ Add ",e.label??e.name]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function da(e){return sQ(e).replace(/-+$/,"")}function sQ(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/-{2,}/g,"-").replace(/^-+/,"").slice(0,80)}function ube({def:e,label:t,value:n,source:r,onChange:s}){let i=Lt.useRef(null),c=Lt.useRef(!1),u=Lt.useRef(null);Lt.useEffect(()=>{if(!e.from)return;let m=u.current;if(u.current=r,m===null||m===r||!r)return;if(c.current)return;if(n!==""&&n!==i.current)return;let g=da(r);if(g===n)return;i.current=g,s(g)},[r,n,e.from,s]);let f=r?da(r):"",p=Boolean(f)&&f!==n;return be.jsxDEV(tp,{label:t,children:[be.jsxDEV("input",{className:at,value:n,onChange:(m)=>{c.current=!0,i.current=null,s(sQ(m.target.value))},onBlur:()=>{let m=da(n);if(m!==n)s(m)},placeholder:f},void 0,!1,void 0,this),p?be.jsxDEV("button",{type:"button",className:"self-start text-caption text-fg-subtle underline hover:text-fg",onClick:()=>{i.current=f,c.current=!1,s(f)},children:["Generate from ",e.from,": ",f]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function dbe({def:e,value:t,onChange:n,api:r,ariaLabel:s}){let[i,c]=Lt.useState(null),u=e.optionsFrom;Lt.useEffect(()=>{if(!u)return;let m=!0;return r.call(u).then((g)=>{if(m)c(Array.isArray(g)?g:[])}).catch(()=>{if(m)c([])}),()=>{m=!1}},[u,r]);let f=Boolean(u)&&i===null,p=u?i??[]:(e.options??[]).map((m)=>({value:m,label:m}));return be.jsxDEV("select",{className:at,"aria-label":s,value:t??"",onChange:(m)=>n(m.target.value||null),children:[be.jsxDEV("option",{value:"",children:f?"Načítám…":"—"},void 0,!1,void 0,this),p.map((m)=>be.jsxDEV("option",{value:m.value,children:m.label},m.value,!1,void 0,this))]},void 0,!0,void 0,this)}function fbe({value:e,onChange:t,api:n}){let[r,s]=Lt.useState(!1),[i,c]=Lt.useState(null);return Lt.useEffect(()=>{if(e)n.call("getMedia",{id:e}).then(c).catch(()=>c(null));else c(null)},[e,n]),be.jsxDEV("div",{children:[be.jsxDEV("div",{className:"flex items-center gap-3 rounded-[14px] border border-transparent bg-surface-card px-[18px] py-3.5",children:[i?be.jsxDEV("img",{className:"h-10 w-10 rounded object-cover",src:n.resolve(`/media/${i.file.key}`),alt:""},void 0,!1,void 0,this):be.jsxDEV("span",{className:"text-fg-subtle",children:"no media"},void 0,!1,void 0,this),be.jsxDEV("span",{className:"flex-1 truncate text-fg-subtle",children:i?.file.filename??e??""},void 0,!1,void 0,this),be.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>s(!0),children:"pick"},void 0,!1,void 0,this),e?be.jsxDEV(me,{variant:"ghost",size:"sm",className:"text-danger",onPress:()=>t(null),children:"clear"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),r?be.jsxDEV(pbe,{api:n,onClose:()=>s(!1),onPick:(u)=>{t(u),s(!1)}},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function pbe({api:e,onClose:t,onPick:n}){let[r,s]=Lt.useState([]),[i,c]=Lt.useState(!1),[u,f]=Lt.useState(""),p=()=>e.listMedia().then(s).catch((g)=>f(String(g.message??g)));Lt.useEffect(()=>{p()},[]);let m=async(g)=>{c(!0),f("");try{let y=await e.uploadMedia(g);n(y.id)}catch(y){f(String(y.message??y))}finally{c(!1)}};return be.jsxDEV(oS,{isOpen:!0,isDismissable:!0,onOpenChange:(g)=>!g&&t(),children:be.jsxDEV(rS,{className:"w-full max-w-[680px] px-9 py-8",children:be.jsxDEV(aS,{className:"max-h-[86vh] overflow-auto outline-none",children:[be.jsxDEV(Qo,{level:"1",className:"mb-5 font-normal",children:["Choose ",be.jsxDEV("span",{className:"text-fg-subtle",children:"a file"},void 0,!1,void 0,this)," from the library"]},void 0,!0,void 0,this),u?be.jsxDEV("div",{className:"my-2 rounded-lg border border-danger bg-surface-card px-3.5 py-2.5 text-small text-danger",children:u},void 0,!1,void 0,this):null,be.jsxDEV("label",{className:"mb-4 flex w-full flex-col gap-2",children:[be.jsxDEV(cS,{size:"small",weight:"medium",children:"Upload a new file"},void 0,!1,void 0,this),be.jsxDEV("input",{type:"file",className:"text-small text-fg-muted",disabled:i,onChange:(g)=>g.target.files?.[0]&&m(g.target.files[0])},void 0,!1,void 0,this)]},void 0,!0,void 0,this),be.jsxDEV("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2.5",children:r.map((g)=>be.jsxDEV("div",{className:"cursor-pointer overflow-hidden rounded-lg border border-border bg-surface-card",onClick:()=>n(g.id),children:[(g.file.contentType??"").startsWith("image/")?be.jsxDEV("img",{className:"block h-[130px] w-full object-cover",src:e.resolve(`/media/${g.file.key}`),alt:""},void 0,!1,void 0,this):be.jsxDEV("div",{className:"h-[130px] bg-surface-muted"},void 0,!1,void 0,this),be.jsxDEV("div",{className:"truncate px-2 py-1.5 text-caption text-fg-muted",children:g.file.filename??g.id},void 0,!1,void 0,this)]},g.id,!0,void 0,this))},void 0,!1,void 0,this),be.jsxDEV("div",{className:"mt-3 text-right",children:be.jsxDEV(me,{variant:"ghost",onPress:t,children:"close"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function iQ(e){if(Array.isArray(e))return{items:e};let t=e;return{items:Array.isArray(t?.items)?t.items:[],hasMore:t?.hasMore}}function mbe(e,t,n){let[r,s]=Lt.useState(()=>new Map),i=JSON.stringify(n);return Lt.useEffect(()=>{if(!t)return;let u=JSON.parse(i).filter((p)=>!r.has(p));if(u.length===0)return;let f=!0;return e.call(t,{ids:u}).then((p)=>{if(!f)return;let m=iQ(p).items;s((g)=>{let y=new Map(g);for(let v of m)y.set(v.value,v);for(let v of u)if(!y.has(v))y.set(v,{value:v,label:""});return y})}).catch(()=>{if(!f)return;s((p)=>{let m=new Map(p);for(let g of u)if(!m.has(g))m.set(g,{value:g,label:""});return m})}),()=>{f=!1}},[e,t,i,r]),r}function hbe(e,t){let n=t.get(e);if(!n)return{label:"Loading...",muted:!0};return n.label?{label:n.label,muted:!1}:{label:e,muted:!0}}function gbe({def:e,value:t,onChange:n,api:r,ariaLabel:s}){let i=e.multiple===!0,c=i?Array.isArray(t)?t.filter((y)=>typeof y==="string"):[]:typeof t==="string"&&t!==""?[t]:[],u=mbe(r,e.referenceFrom,c),[f,p]=Lt.useState(!1),m=(y)=>{if(i){if(!c.includes(y.value))n([...c,y.value])}else n(y.value),p(!1)},g=(y)=>n(i?c.filter((v)=>v!==y):null);if(!e.referenceFrom)return be.jsxDEV("span",{className:"text-sm text-danger",children:"This reference field declares no `referenceFrom` handler."},void 0,!1,void 0,this);return be.jsxDEV("div",{className:"flex flex-col gap-2",children:[c.length===0?be.jsxDEV("span",{className:"text-sm text-fg-muted",children:"Nothing selected."},void 0,!1,void 0,this):be.jsxDEV("div",{className:"flex flex-col gap-1",children:c.map((y)=>{let{label:v,muted:x}=hbe(y,u),w=u.get(y)?.hint;return be.jsxDEV("div",{className:"flex items-center gap-2 rounded-[14px] bg-surface-card px-4 py-2.5",children:[be.jsxDEV("span",{className:`min-w-0 flex-1 truncate text-sm ${x?"text-fg-subtle":"text-fg"}`,children:v},void 0,!1,void 0,this),w?be.jsxDEV("span",{className:"shrink-0 text-caption text-fg-subtle",children:w},void 0,!1,void 0,this):null,be.jsxDEV(me,{variant:"ghost",size:"sm",className:"text-danger",onPress:()=>g(y),children:"remove"},void 0,!1,void 0,this)]},y,!0,void 0,this)})},void 0,!1,void 0,this),be.jsxDEV(me,{variant:"secondary",size:"sm",className:"self-start","aria-label":s,onPress:()=>p(!0),children:i?"+ Add":c.length>0?"Change":"Choose"},void 0,!1,void 0,this),f?be.jsxDEV(bbe,{api:r,from:e.referenceFrom,title:e.label??e.name,selected:c,multiple:i,onPick:m,onClose:()=>p(!1)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function bbe({api:e,from:t,title:n,selected:r,multiple:s,onPick:i,onClose:c}){let[u,f]=Lt.useState(""),[p,m]=Lt.useState([]),[g,y]=Lt.useState(!1),[v,x]=Lt.useState(!0),[w,C]=Lt.useState(""),[I,R]=Lt.useState("");Lt.useEffect(()=>{let L=setTimeout(()=>R(u.trim()),250);return()=>clearTimeout(L)},[u]);let H=Lt.useCallback((L)=>(x(!0),C(""),e.call(t,{search:I||void 0,limit:oQ,offset:L}).then((_)=>{let W=iQ(_);m((z)=>L===0?W.items:[...z,...W.items]),y(W.hasMore??W.items.length===oQ)}).catch((_)=>C(String(_?.message??_))).finally(()=>x(!1))),[e,t,I]);return Lt.useEffect(()=>{H(0)},[H]),be.jsxDEV(oS,{isOpen:!0,isDismissable:!0,onOpenChange:(L)=>!L&&c(),children:be.jsxDEV(rS,{className:"w-full max-w-[560px] px-9 py-8",children:be.jsxDEV(aS,{className:"max-h-[86vh] overflow-auto outline-none",children:[be.jsxDEV(Qo,{level:"1",className:"mb-5 font-normal",children:["Choose ",be.jsxDEV("span",{className:"text-fg-subtle",children:n.toLowerCase()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),be.jsxDEV("input",{className:`${at} mb-3`,type:"search",autoFocus:!0,placeholder:"Search","aria-label":"Search",value:u,onChange:(L)=>f(L.target.value)},void 0,!1,void 0,this),w?be.jsxDEV("div",{className:"mb-2 rounded-lg border border-danger bg-surface-card px-3.5 py-2.5 text-small text-danger",children:w},void 0,!1,void 0,this):null,be.jsxDEV("div",{className:"flex flex-col gap-1",children:[p.map((L)=>{let _=r.includes(L.value);return be.jsxDEV("button",{type:"button",disabled:_,onClick:()=>i(L),className:"flex items-center gap-3 rounded-lg px-3 py-2 text-left transition-colors hover:bg-surface-muted disabled:opacity-40",children:[be.jsxDEV("span",{className:"min-w-0 flex-1",children:[be.jsxDEV("span",{className:"block truncate text-sm text-fg",children:L.label},void 0,!1,void 0,this),L.hint?be.jsxDEV("span",{className:"block truncate text-caption text-fg-subtle",children:L.hint},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),_?be.jsxDEV("span",{className:"shrink-0 text-caption text-fg-subtle",children:"selected"},void 0,!1,void 0,this):null]},L.value,!0,void 0,this)}),!v&&p.length===0?be.jsxDEV("p",{className:"px-3 py-2 text-sm text-fg-subtle",children:"Nothing matches."},void 0,!1,void 0,this):null,v?be.jsxDEV("p",{className:"px-3 py-2 text-sm text-fg-subtle",children:"Loading..."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),g&&!v?be.jsxDEV("div",{className:"mt-3 text-center",children:be.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>void H(p.length),children:"Load more"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,be.jsxDEV("div",{className:"mt-3 text-right",children:be.jsxDEV(me,{variant:"ghost",onPress:c,children:s?"done":"close"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var Lt,be,at="h-10 w-full rounded-lg border border-border bg-surface-card px-4 text-sm text-fg outline-none transition-colors placeholder:text-fg-muted focus:border-brand-green",aQ,oQ=20;var I1=E(()=>{Ur();eQ();rt();sM();lM();iM();aM();dM();Lt=O(ee(),1),be=O(Me(),1);aQ=[p4.configure({heading:{levels:[1,2,3]},link:{openOnClick:!1,autolink:!0}}),m4,h4,g4.configure({nested:!0})]});var nn="mx-auto max-w-[1200px] px-7 pb-8 pt-2",Za="flex items-center gap-3 rounded-[14px] border border-transparent bg-surface-card px-[18px] py-3.5",lQ="h-11",x4="top-11",cQ="h-14",pM="top-[6.25rem]";function S4(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t>>>0}function ybe(e){let t=e>>>0;return()=>{t=t+1831565813>>>0;let n=t;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function vbe(e){return uQ[S4(`${e}:accent`)%uQ.length]}function xbe(e,t,n){let r=e,s=t;return n?`M${r+0.5} ${s} A0.5 0.5 0 0 0 ${r+1} ${s+0.5} M${r} ${s+0.5} A0.5 0.5 0 0 0 ${r+0.5} ${s+1}`:`M${r} ${s+0.5} A0.5 0.5 0 0 0 ${r+0.5} ${s} M${r+1} ${s+0.5} A0.5 0.5 0 0 0 ${r+0.5} ${s+1}`}function dQ({seed:e}){let t=ybe(S4(e)),n=vbe(e),r=55+t()*40,s=20+t()*60,i=[];for(let u=0;u<5;u++)for(let f=0;f<20;f++)i.push(xbe(f,u,t()>0.5));let c=Array.from({length:5},()=>({cx:1+t()*18,cy:0.5+t()*4,r:0.09+t()*0.11}));return li.jsxDEV("svg",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 h-full w-full text-fg",viewBox:"0 0 20 5",preserveAspectRatio:"xMidYMid slice",children:[li.jsxDEV("defs",{children:li.jsxDEV("radialGradient",{id:`wash-${S4(e)}`,cx:`${r}%`,cy:`${s}%`,r:"70%",children:[li.jsxDEV("stop",{offset:"0%",stopColor:n,stopOpacity:"0.34"},void 0,!1,void 0,this),li.jsxDEV("stop",{offset:"100%",stopColor:n,stopOpacity:"0"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),li.jsxDEV("rect",{width:20,height:5,fill:`url(#wash-${S4(e)})`},void 0,!1,void 0,this),li.jsxDEV("g",{fill:"none",stroke:"currentColor",strokeWidth:"0.035",strokeLinecap:"round",opacity:"0.28",children:i.map((u)=>li.jsxDEV("path",{d:u},u,!1,void 0,this))},void 0,!1,void 0,this),li.jsxDEV("g",{fill:n,opacity:"0.5",children:c.map((u)=>li.jsxDEV("circle",{cx:u.cx,cy:u.cy,r:u.r},`${u.cx}-${u.cy}`,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var li,uQ;var fQ=E(()=>{li=O(Me(),1);uQ=["var(--color-accent-strong)","var(--color-brand-green)","var(--color-accent-green-lighter)","var(--color-accent-yellow)","var(--color-accent-pink)"]});function $be(){let[e,t]=C4.useState(!1);return C4.useEffect(()=>{let n=()=>t((r)=>r?window.scrollY>Cbe:window.scrollY>Sbe);return n(),window.addEventListener("scroll",n,{passive:!0}),()=>window.removeEventListener("scroll",n)},[]),e}function $4({lead:e,em:t,children:n}){let r=$be();return $c.jsxDEV("div",{className:`sticky ${x4} z-20 mx-auto max-w-[1200px] bg-surface px-7 pb-4`,children:$c.jsxDEV("div",{className:"relative isolate overflow-hidden rounded-panel border border-border bg-surface-card",children:[$c.jsxDEV(dQ,{seed:e},void 0,!1,void 0,this),$c.jsxDEV("div",{className:"absolute inset-0 bg-gradient-to-r from-surface-card via-surface-card/70 to-transparent"},void 0,!1,void 0,this),$c.jsxDEV("div",{className:`relative grid grid-cols-[1fr_auto] items-center gap-6 px-8 transition-[padding] duration-150 ease-out max-[820px]:grid-cols-1 ${r?"py-3.5":"py-9"}`,children:[$c.jsxDEV("h1",{className:`m-0 font-normal tracking-[-0.01em] ${r?"flex items-baseline gap-2 text-[22px] leading-tight":"text-[56px] leading-[1.05] max-[820px]:text-[40px]"}`,children:[$c.jsxDEV("span",{className:r?"text-fg-subtle":"block text-fg-subtle",children:e},void 0,!1,void 0,this),$c.jsxDEV("span",{className:r?"text-fg":"block text-fg",children:t},void 0,!1,void 0,this)]},void 0,!0,void 0,this),n]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var C4,$c,Sbe=120,Cbe=16;var mM=E(()=>{fQ();C4=O(ee(),1),$c=O(Me(),1)});function pQ(e=globalThis){let t=e.PRAMEN_CMS_EDITOR?.previewUrl;if(typeof t!=="string")return;let n=t.trim();return n===""?void 0:n}function mQ(e,t){let n=t.siteUrl;if(!n)return t.resolve(e.url);let r=n.includes("?")?"&":"?",s=`${n}${r}token=${encodeURIComponent(e.token)}`;try{return new URL(s,t.origin).href}catch{return s}}function Vn(e){return String(e?.message??e)}function hQ(){return G.jsxDEV("div",{className:"rounded-lg border border-brand-green bg-brand-green/20 px-3.5 py-2.5 text-small text-fg",children:"saved"},void 0,!1,void 0,this)}function I4({label:e,keyValue:t,onLabel:n,onKey:r,keyHint:s}){return G.jsxDEV("div",{className:"grid grid-cols-2 gap-3 max-[720px]:grid-cols-1",children:[G.jsxDEV(pn,{label:"Label",value:e,onChange:n},void 0,!1,void 0,this),G.jsxDEV("label",{className:"flex flex-col gap-2",children:[G.jsxDEV("span",{className:"text-sm font-medium text-fg",children:"Key"},void 0,!1,void 0,this),G.jsxDEV("input",{className:at,value:t,onChange:(i)=>r(i.target.value.trim())},void 0,!1,void 0,this),G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:s},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function gQ({api:e,onOpen:t,onError:n,canEdit:r}){let[s,i]=_e.useState(null),[c,u]=_e.useState(""),[f,p]=_e.useState(""),[m,g]=_e.useState(!1),[y,v]=_e.useState(!1),x=_e.useCallback(()=>{e.listMenus().then(i).catch((C)=>{i([]),n(Vn(C))})},[e,n]);_e.useEffect(x,[x]);let w=async()=>{v(!0);try{let C=await e.createMenu(f,c);u(""),p(""),g(!1),t(C.name)}catch(C){n(Vn(C))}finally{v(!1)}};return G.jsxDEV(G.Fragment,{children:[G.jsxDEV(T4,{lead:"Navigation",em:s===null?"Menus":s.length===1?"1 menu":`${s.length} menus`},void 0,!1,void 0,this),G.jsxDEV("div",{className:nn,children:[G.jsxDEV("div",{className:"flex flex-col gap-2",children:[s===null?G.jsxDEV("p",{className:"text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this):null,s?.length===0?G.jsxDEV("p",{className:"text-fg-subtle",children:["No menus yet. A menu is read by name — ",G.jsxDEV("code",{children:'getMenu("primary")'},void 0,!1,void 0,this)," — from your layout."]},void 0,!0,void 0,this):null,(s??[]).map((C)=>G.jsxDEV("div",{className:`${Za} cursor-pointer hover:bg-surface-muted`,onClick:()=>t(C.name),children:[G.jsxDEV("span",{className:"min-w-0 flex-1 truncate font-medium",children:C.label},void 0,!1,void 0,this),G.jsxDEV("span",{className:"shrink-0 truncate text-fg-subtle",children:C.name},void 0,!1,void 0,this),G.jsxDEV("span",{className:"shrink-0 text-caption text-fg-subtle",children:[bQ(C.items??[])," item(s)"]},void 0,!0,void 0,this)]},C.id,!0,void 0,this))]},void 0,!0,void 0,this),r?G.jsxDEV("div",{className:"mt-6 max-w-[720px] rounded-lg border border-border bg-surface-muted p-4",children:[G.jsxDEV(Qo,{level:"2",className:"mb-3 font-normal",children:"New menu"},void 0,!1,void 0,this),G.jsxDEV(I4,{label:c,keyValue:f,onLabel:(C)=>{if(u(C),!m)p(da(C))},onKey:(C)=>{g(!0),p(C)},keyHint:"What your layout asks for. Not renameable afterwards."},void 0,!1,void 0,this),G.jsxDEV(me,{className:"mt-3",onPress:w,isDisabled:y||!c.trim()||!f.trim(),children:"Create menu"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function bQ(e){return e.reduce((t,n)=>t+1+bQ(n.children??[]),0)}function yQ(e,t=[]){let n=[];return e.forEach((r,s)=>{let i=[...t,s];n.push({item:r,path:i,depth:t.length}),n.push(...yQ(r.children??[],i))}),n}function Kh(e,t){let n=e;for(let r=0;r<t.length-1;r++)n=n[t[r]].children??[];return{list:n,index:t[t.length-1]}}function w4(e){return e.map((t)=>({...t,children:t.children?w4(t.children):void 0}))}function hM(e,t){let n=w4(e),{list:r,index:s}=Kh(n,t),[i]=r.splice(s,1);return{tree:n,removed:i}}function vQ({api:e,name:t,collections:n,onBack:r,onDeleted:s,onError:i,canEdit:c}){let[u,f]=_e.useState(null),[p,m]=_e.useState([]);vS(u?.label);let[g,y]=_e.useState(""),[v,x]=_e.useState("");gh(u!==null&&JSON.stringify({label:g,items:p})!==v);let[w,C]=_e.useState(void 0),[I,R]=_e.useState(!1),[H,L]=_e.useState(!1),[_,W]=_e.useState(!1),[z,F]=_e.useState([]),[ne,V]=_e.useState([]);_e.useEffect(()=>{let k=!0;return e.listMenus().then((te)=>{if(!k)return;let Ce=te.find(($e)=>$e.name===t);if(!Ce){R(!0);return}f(Ce),y(Ce.label),m(Ce.items??[]),C(Ce.version),x(JSON.stringify({label:Ce.label,items:Ce.items??[]}))}).catch((te)=>i(Vn(te))),e.listPages({limit:200}).then((te)=>k&&F(te)).catch(()=>F([])),e.listTaxonomies().then(async(te)=>{let Ce=await Promise.all(te.map(async(se)=>[se,await e.getTermTree(se.slug).catch(()=>[])])),$e=[];for(let[se,de]of Ce){let ge=(Re,ye)=>{for(let Ee of Re)if($e.push({id:Ee.id,label:`${ye}${Ee.label}`,taxonomy:se.label}),Ee.children)ge(Ee.children,`${ye}${Ee.label} / `)};ge(de,"")}if(k)V($e)}).catch(()=>V([])),()=>{k=!1}},[e,t,i]);let ie=async()=>{if(!u)return;L(!0);try{let k=await e.updateMenu(u.id,{label:g,items:p,expectedVersion:w});C(k.version),x(JSON.stringify({label:g,items:p})),W(!0),setTimeout(()=>W(!1),1200)}catch(k){i(Vn(k))}finally{L(!1)}},ae=async()=>{if(!u||!confirm(`Delete the menu “${u.label}”? Any layout reading it will render nothing.`))return;L(!0);try{await e.deleteMenu(u.id),s()}catch(k){i(Vn(k))}finally{L(!1)}},re=yQ(p),D=(k,te)=>{let Ce=w4(p),{list:$e,index:se}=Kh(Ce,k);$e[se]={...$e[se],...te},m(Ce)},B=(k)=>m(hM(p,k).tree),U=(k,te)=>{let Ce=w4(p),{list:$e,index:se}=Kh(Ce,k),de=se+te;if(de<0||de>=$e.length)return;let[ge]=$e.splice(se,1);$e.splice(de,0,ge),m(Ce)},Q=(k,te)=>{let{index:Ce}=Kh(p,k);if(Ce===0||te+1>=wA)return;let{tree:$e,removed:se}=hM(p,k),{list:de}=Kh($e,k),ge=de[Ce-1];ge.children=[...ge.children??[],se],m($e)},xe=(k)=>{if(k.length<2)return;let{tree:te,removed:Ce}=hM(p,k),$e=k.slice(0,-1),{list:se,index:de}=Kh(te,$e);se.splice(de+1,0,Ce),m(te)},le=()=>m([...p,{id:crypto.randomUUID(),label:"New item",kind:"custom",url:"/"}]);if(I)return G.jsxDEV("div",{className:nn,children:G.jsxDEV("p",{className:"pt-8 text-fg-subtle",children:["Unknown menu: ",t]},void 0,!0,void 0,this)},void 0,!1,void 0,this);if(!u)return G.jsxDEV("div",{className:nn,children:G.jsxDEV("p",{className:"pt-8 text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this)},void 0,!1,void 0,this);return G.jsxDEV("div",{className:nn,children:[G.jsxDEV("div",{className:"mb-4 mt-2 flex items-center gap-3",children:[G.jsxDEV(me,{variant:"ghost",size:"sm",onPress:r,children:"← Menus"},void 0,!1,void 0,this),G.jsxDEV("h1",{className:"text-[22px] font-normal text-fg",children:u.label},void 0,!1,void 0,this),G.jsxDEV("span",{className:"text-fg-subtle",children:u.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("div",{className:"flex max-w-[860px] flex-col gap-4",children:[_?G.jsxDEV(hQ,{},void 0,!1,void 0,this):null,G.jsxDEV(pn,{label:"Label",value:g,onChange:y},void 0,!1,void 0,this),G.jsxDEV("div",{className:"flex flex-col gap-2",children:[re.length===0?G.jsxDEV("p",{className:"text-sm text-fg-subtle",children:"No items yet."},void 0,!1,void 0,this):null,re.map(({item:k,path:te,depth:Ce})=>G.jsxDEV("div",{style:{marginLeft:Ce*24},children:G.jsxDEV(Tbe,{item:k,depth:Ce,pages:z,terms:ne,collections:n,onPatch:($e)=>D(te,$e),onMove:($e)=>U(te,$e),onIndent:()=>Q(te,Ce),onOutdent:()=>xe(te),onRemove:()=>B(te)},void 0,!1,void 0,this)},k.id,!1,void 0,this))]},void 0,!0,void 0,this),c?G.jsxDEV("div",{className:"flex items-center gap-2",children:[G.jsxDEV(me,{variant:"secondary",size:"sm",onPress:le,children:"+ Add item"},void 0,!1,void 0,this),G.jsxDEV(me,{onPress:ie,isDisabled:H,children:H?"Saving…":"Save menu"},void 0,!1,void 0,this),G.jsxDEV(me,{variant:"ghost",className:"text-danger",onPress:ae,isDisabled:H,children:"Delete menu"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Tbe({item:e,depth:t,pages:n,terms:r,collections:s,onPatch:i,onMove:c,onIndent:u,onOutdent:f,onRemove:p}){let m=e.kind??"custom";return G.jsxDEV("div",{className:"rounded-lg border border-border bg-surface-muted p-3.5",children:[G.jsxDEV("div",{className:"grid grid-cols-[1fr_auto] gap-3",children:[G.jsxDEV("div",{className:"grid grid-cols-2 gap-3 max-[720px]:grid-cols-1",children:[G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Label"},void 0,!1,void 0,this),G.jsxDEV("input",{className:at,value:e.label,onChange:(g)=>i({label:g.target.value})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Points at"},void 0,!1,void 0,this),G.jsxDEV("select",{className:at,value:m,onChange:(g)=>i({kind:g.target.value,ref:null,url:g.target.value==="custom"?"/":void 0}),children:wbe.map((g)=>G.jsxDEV("option",{value:g.value,children:g.label},g.value,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("div",{className:"flex shrink-0 items-start gap-0.5 pt-5",children:[G.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg",title:"Move up",onClick:()=>c(-1),children:"↑"},void 0,!1,void 0,this),G.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg",title:"Move down",onClick:()=>c(1),children:"↓"},void 0,!1,void 0,this),G.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg disabled:opacity-30",title:"Nest under the item above",disabled:t+1>=wA,onClick:u,children:"→"},void 0,!1,void 0,this),G.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg disabled:opacity-30",title:"Move out a level",disabled:t===0,onClick:f,children:"←"},void 0,!1,void 0,this),G.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-danger",title:"Remove",onClick:p,children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("div",{className:"mt-3 grid grid-cols-2 gap-3 max-[720px]:grid-cols-1",children:[m==="custom"?G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"URL"},void 0,!1,void 0,this),G.jsxDEV("input",{className:at,value:e.url??"",placeholder:"/about or https://…",onChange:(g)=>i({url:g.target.value})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Target"},void 0,!1,void 0,this),G.jsxDEV("select",{className:at,value:e.ref??"",onChange:(g)=>i({ref:g.target.value||null}),children:[G.jsxDEV("option",{value:"",children:"— pick one —"},void 0,!1,void 0,this),m==="page"?n.map((g)=>G.jsxDEV("option",{value:g.id,children:[g.title," (",g.slug,")"]},g.id,!0,void 0,this)):null,m==="term"?r.map((g)=>G.jsxDEV("option",{value:g.id,children:[g.taxonomy,": ",g.label]},g.id,!0,void 0,this)):null,m==="collection"?s.map((g)=>G.jsxDEV("option",{value:g.slug,children:g.pluralLabel},g.slug,!1,void 0,this)):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Opens in"},void 0,!1,void 0,this),G.jsxDEV("select",{className:at,value:e.target??"",onChange:(g)=>i({target:g.target.value||void 0}),children:[G.jsxDEV("option",{value:"",children:"this tab"},void 0,!1,void 0,this),G.jsxDEV("option",{value:"_blank",children:"a new tab"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m!=="custom"&&!e.ref?G.jsxDEV("p",{className:"mt-2 text-caption text-danger",children:"Pick a target, or this item cannot be saved."},void 0,!1,void 0,this):null,m!=="custom"?G.jsxDEV("p",{className:"mt-2 text-caption text-fg-subtle",children:"The URL is worked out when the menu is read, so it follows the target. An item whose target is unpublished or gone is left out of the public menu rather than rendered as a dead link."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function xQ({api:e,onError:t,canEdit:n}){let[r,s]=_e.useState(null),[i,c]=_e.useState(""),[u,f]=_e.useState(""),[p,m]=_e.useState(301),[g,y]=_e.useState(!1),v=_e.useCallback(()=>{e.listRedirects().then(s).catch((I)=>{s([]),t(Vn(I))})},[e,t]);_e.useEffect(v,[v]);let x=async()=>{y(!0);try{await e.createRedirect({fromPath:i,toPath:u,status:p}),c(""),f(""),v()}catch(I){t(Vn(I))}finally{y(!1)}},w=async(I,R)=>{try{await e.updateRedirect(I.id,R),v()}catch(H){t(Vn(H))}},C=async(I)=>{if(!confirm(`Delete the redirect from ${I.fromPath}?`))return;try{await e.deleteRedirect(I.id),v()}catch(R){t(Vn(R))}};return G.jsxDEV(G.Fragment,{children:[G.jsxDEV(T4,{lead:"Old URLs, kept alive",em:r===null?"Redirects":r.length===1?"1 redirect":`${r.length} redirects`},void 0,!1,void 0,this),G.jsxDEV("div",{className:nn,children:[G.jsxDEV("p",{className:"mb-4 max-w-[62ch] text-sm text-fg-muted",children:"Changing a page's slug changes a live URL and breaks every link to it. A redirect is how the old one keeps working. Disabling one keeps the record of what the old URL was, which deleting it does not."},void 0,!1,void 0,this),G.jsxDEV("div",{className:"flex flex-col gap-2",children:[r===null?G.jsxDEV("p",{className:"text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this):null,r?.length===0?G.jsxDEV("p",{className:"text-fg-subtle",children:"No redirects yet."},void 0,!1,void 0,this):null,(r??[]).map((I)=>G.jsxDEV("div",{className:`${Za} ${I.enabled?"":"opacity-60"}`,children:[G.jsxDEV("span",{className:"min-w-0 flex-1 truncate font-medium",children:I.fromPath},void 0,!1,void 0,this),G.jsxDEV("span",{className:"shrink-0 text-fg-subtle",children:"→"},void 0,!1,void 0,this),G.jsxDEV("span",{className:"min-w-0 flex-1 truncate text-fg-muted",children:I.toPath},void 0,!1,void 0,this),G.jsxDEV("span",{className:"shrink-0 text-caption text-fg-subtle",children:I.status},void 0,!1,void 0,this),n?G.jsxDEV(G.Fragment,{children:[G.jsxDEV(me,{variant:"ghost",size:"sm",onPress:()=>w(I,{enabled:!I.enabled}),children:I.enabled?"disable":"enable"},void 0,!1,void 0,this),G.jsxDEV(me,{variant:"ghost",size:"sm",className:"text-danger",onPress:()=>C(I),children:"delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},I.id,!0,void 0,this))]},void 0,!0,void 0,this),n?G.jsxDEV("div",{className:"mt-6 max-w-[860px] rounded-lg border border-border bg-surface-muted p-4",children:[G.jsxDEV(Qo,{level:"2",className:"mb-3 font-normal",children:"New redirect"},void 0,!1,void 0,this),G.jsxDEV("div",{className:"grid grid-cols-[1fr_1fr_auto] gap-3 max-[720px]:grid-cols-1",children:[G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"From (a path on this site)"},void 0,!1,void 0,this),G.jsxDEV("input",{className:at,value:i,placeholder:"/old-page",onChange:(I)=>c(I.target.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"To (a path, or a full URL)"},void 0,!1,void 0,this),G.jsxDEV("input",{className:at,value:u,placeholder:"/new-page",onChange:(I)=>f(I.target.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Status"},void 0,!1,void 0,this),G.jsxDEV("select",{className:at,value:p,onChange:(I)=>m(Number(I.target.value)),children:NK.map((I)=>G.jsxDEV("option",{value:I,children:[I,I===301||I===308?" permanent":" temporary"]},I,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV(me,{className:"mt-3",onPress:x,isDisabled:g||!i.trim()||!u.trim(),children:"Add redirect"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function SQ({value:e,onChange:t,disabled:n}){let r=(s)=>{let i=(e??[]).includes(s)?(e??[]).filter((c)=>c!==s):[...e??[],s];t(i.length===0?null:i)};return G.jsxDEV("div",{className:"mt-3",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Applies to"},void 0,!1,void 0,this),G.jsxDEV("div",{className:"mt-1 flex flex-col gap-1",children:[G.jsxDEV("label",{className:"flex items-center gap-2",children:[G.jsxDEV("input",{type:"radio",checked:e===null,disabled:n,onChange:()=>t(null)},void 0,!1,void 0,this),G.jsxDEV("span",{className:"text-sm text-fg",children:"Everything"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 pl-5",children:PK.map((s)=>G.jsxDEV("label",{className:"flex items-center gap-2",children:[G.jsxDEV("input",{type:"checkbox",checked:(e??[]).includes(s),disabled:n,onChange:()=>r(s)},void 0,!1,void 0,this),G.jsxDEV("span",{className:"text-sm text-fg",children:TA[s]},void 0,!1,void 0,this)]},s,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Ibe(e){let t=e.appliesTo;if(!Array.isArray(t)||t.length===0)return"everything";return t.map((n)=>TA[n]??n).join(" + ").toLowerCase()}function CQ({api:e,onOpen:t,onError:n,canEdit:r}){let[s,i]=_e.useState(null),[c,u]=_e.useState(""),[f,p]=_e.useState(""),[m,g]=_e.useState(!1),[y,v]=_e.useState(!1),[x,w]=_e.useState(null),[C,I]=_e.useState(!1),{cms:{mediaTerms:R}}=nt(),H=_e.useCallback(()=>{e.listTaxonomies().then(i).catch((_)=>{i([]),n(Vn(_))})},[e,n]);_e.useEffect(H,[H]);let L=async()=>{I(!0);try{let _=await e.createTaxonomy({slug:f,label:c,hierarchical:y,appliesTo:R?x:null});u(""),p(""),g(!1),v(!1),w(null),t(_.slug)}catch(_){n(Vn(_))}finally{I(!1)}};return G.jsxDEV(G.Fragment,{children:[G.jsxDEV(T4,{lead:"How this site",em:"is classified"},void 0,!1,void 0,this),G.jsxDEV("div",{className:nn,children:[G.jsxDEV("p",{className:"mb-4 max-w-[62ch] text-sm text-fg-muted",children:"A vocabulary is a way of grouping pages — categories, tags, regions. There are no built-in ones: a deployment declares what it sorts by, the same way it declares its content types."},void 0,!1,void 0,this),G.jsxDEV("div",{className:"flex flex-col gap-2",children:[s===null?G.jsxDEV("p",{className:"text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this):null,s?.length===0?G.jsxDEV("p",{className:"text-fg-subtle",children:"No vocabularies yet."},void 0,!1,void 0,this):null,(s??[]).map((_)=>G.jsxDEV("div",{className:`${Za} cursor-pointer hover:bg-surface-muted`,onClick:()=>t(_.slug),children:[G.jsxDEV("span",{className:"min-w-0 flex-1 truncate font-medium",children:_.label},void 0,!1,void 0,this),G.jsxDEV("span",{className:"shrink-0 truncate text-fg-subtle",children:_.slug},void 0,!1,void 0,this),G.jsxDEV("span",{className:"shrink-0 text-caption text-fg-subtle",children:_.hierarchical?"nested":"flat"},void 0,!1,void 0,this),R?G.jsxDEV("span",{className:"shrink-0 text-caption text-fg-subtle",children:Ibe(_)},void 0,!1,void 0,this):null]},_.id,!0,void 0,this))]},void 0,!0,void 0,this),r?G.jsxDEV("div",{className:"mt-6 max-w-[720px] rounded-lg border border-border bg-surface-muted p-4",children:[G.jsxDEV(Qo,{level:"2",className:"mb-3 font-normal",children:"New vocabulary"},void 0,!1,void 0,this),G.jsxDEV(I4,{label:c,keyValue:f,onLabel:(_)=>{if(u(_),!m)p(da(_))},onKey:(_)=>{g(!0),p(_)},keyHint:"A URL segment — terms live under it. Not renameable afterwards."},void 0,!1,void 0,this),G.jsxDEV("label",{className:"mt-3 flex items-center gap-2",children:[G.jsxDEV("input",{type:"checkbox",checked:y,onChange:(_)=>v(_.target.checked)},void 0,!1,void 0,this),G.jsxDEV("span",{className:"text-sm text-fg",children:"Terms can nest (categories rather than tags)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),R?G.jsxDEV(SQ,{value:x,onChange:w},void 0,!1,void 0,this):null,G.jsxDEV(me,{className:"mt-3",onPress:L,isDisabled:C||!c.trim()||!f.trim(),children:"Create vocabulary"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function $Q({api:e,slug:t,onBack:n,onDeleted:r,onError:s,canEdit:i}){let[c,u]=_e.useState(null),[f,p]=_e.useState(null),[m,g]=_e.useState(!1),[y,v]=_e.useState(""),[x,w]=_e.useState(""),[C,I]=_e.useState(!1),[R,H]=_e.useState(""),[L,_]=_e.useState(!1),{cms:{mediaTerms:W}}=nt(),z=_e.useCallback(()=>{e.getTermTree(t).then(p).catch((D)=>{p([]),s(Vn(D))})},[e,t,s]);_e.useEffect(()=>{let D=!0;return e.listTaxonomies().then((B)=>{if(!D)return;let U=B.find((Q)=>Q.slug===t);if(!U){g(!0);return}u(U)}).catch((B)=>s(Vn(B))),()=>{D=!1}},[e,t,s]),_e.useEffect(z,[z]);let F=f?E1(f):[],ne=async()=>{_(!0);try{await e.createTerm({taxonomy:t,slug:x,label:y,parentId:R||null}),v(""),w(""),I(!1),H(""),z()}catch(D){s(Vn(D))}finally{_(!1)}},V=async(D)=>{if(!confirm(`Delete “${D.label}”? Pages tagged with it lose the tag; any terms under it move to the top level.`))return;try{await e.deleteTerm(D.id),z()}catch(B){s(Vn(B))}},ie=async(D,B)=>{if(B===D.label)return;try{await e.updateTerm(D.id,{label:B}),z()}catch(U){s(Vn(U))}},ae=async(D)=>{if(!c)return;let B=c.appliesTo??null;u({...c,appliesTo:D});try{s(""),await e.updateTaxonomy(c.id,{appliesTo:D})}catch(U){u({...c,appliesTo:B}),s(Vn(U))}},re=async()=>{if(!c||!confirm(`Delete the vocabulary “${c.label}”? Every term in it goes too, along with every page's assignments.`))return;try{await e.deleteTaxonomy(c.id),r()}catch(D){s(Vn(D))}};if(m)return G.jsxDEV("div",{className:nn,children:G.jsxDEV("p",{className:"pt-8 text-fg-subtle",children:["Unknown vocabulary: ",t]},void 0,!0,void 0,this)},void 0,!1,void 0,this);if(!c)return G.jsxDEV("div",{className:nn,children:G.jsxDEV("p",{className:"pt-8 text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this)},void 0,!1,void 0,this);return G.jsxDEV("div",{className:nn,children:[G.jsxDEV("div",{className:"mb-4 mt-2 flex items-center gap-3",children:[G.jsxDEV(me,{variant:"ghost",size:"sm",onPress:n,children:"← Taxonomies"},void 0,!1,void 0,this),G.jsxDEV("h1",{className:"text-[22px] font-normal text-fg",children:c.label},void 0,!1,void 0,this),G.jsxDEV("span",{className:"text-fg-subtle",children:c.slug},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("div",{className:"flex max-w-[860px] flex-col gap-4",children:[G.jsxDEV("div",{className:"flex flex-col gap-2",children:[f===null?G.jsxDEV("p",{className:"text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this):null,f?.length===0?G.jsxDEV("p",{className:"text-fg-subtle",children:"No terms yet."},void 0,!1,void 0,this):null,F.map(({term:D,depth:B})=>G.jsxDEV("div",{className:Za,style:{marginLeft:B*24},children:[G.jsxDEV("input",{className:`${at} flex-1`,defaultValue:D.label,"aria-label":`Label for ${D.label}`,disabled:!i,onBlur:(U)=>ie(D,U.target.value.trim())},void 0,!1,void 0,this),G.jsxDEV("span",{className:"shrink-0 truncate text-fg-subtle",children:D.slug},void 0,!1,void 0,this),i?G.jsxDEV(me,{variant:"ghost",size:"sm",className:"text-danger",onPress:()=>V(D),children:"delete"},void 0,!1,void 0,this):null]},D.id,!0,void 0,this))]},void 0,!0,void 0,this),i?G.jsxDEV("div",{className:"rounded-lg border border-border bg-surface-muted p-4",children:[G.jsxDEV(Qo,{level:"2",className:"mb-3 font-normal",children:"New term"},void 0,!1,void 0,this),G.jsxDEV(I4,{label:y,keyValue:x,onLabel:(D)=>{if(v(D),!C)w(da(D))},onKey:(D)=>{I(!0),w(D)},keyHint:"The URL segment for this term."},void 0,!1,void 0,this),c.hierarchical?G.jsxDEV("label",{className:"mt-3 flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Nested under"},void 0,!1,void 0,this),G.jsxDEV("select",{className:at,value:R,onChange:(D)=>H(D.target.value),children:[G.jsxDEV("option",{value:"",children:"— top level —"},void 0,!1,void 0,this),F.map(({term:D,depth:B})=>G.jsxDEV("option",{value:D.id,children:["— ".repeat(B),D.label]},D.id,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,G.jsxDEV(me,{className:"mt-3",onPress:ne,isDisabled:L||!y.trim()||!x.trim(),children:"Add term"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,i&&W?G.jsxDEV("div",{className:"rounded-lg border border-border bg-surface-muted p-4",children:[G.jsxDEV(Qo,{level:"2",className:"mb-1 font-normal",children:"Where this vocabulary is offered"},void 0,!1,void 0,this),G.jsxDEV("p",{className:"max-w-[62ch] text-caption text-fg-subtle",children:"Narrowing is refused while the vocabulary is still assigned to something it would stop applying to — remove those assignments first, so nothing is left tagged with a vocabulary you can no longer see."},void 0,!1,void 0,this),G.jsxDEV(SQ,{value:c.appliesTo??null,onChange:ae},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,i?G.jsxDEV(me,{variant:"ghost",className:"self-start text-danger",onPress:re,children:"Delete this vocabulary"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function E1(e,t=0){let n=[];for(let r of e)if(n.push({term:r,depth:t}),r.children)n.push(...E1(r.children,t+1));return n}function wQ({api:e,onOpen:t,onError:n,canEdit:r}){let[s,i]=_e.useState(null),[c,u]=_e.useState(""),[f,p]=_e.useState(""),[m,g]=_e.useState(!1),[y,v]=_e.useState(!1),x=_e.useCallback(()=>{e.listWidgetAreas().then(i).catch((C)=>{i([]),n(Vn(C))})},[e,n]);_e.useEffect(x,[x]);let w=async()=>{v(!0);try{let C=await e.createWidgetArea(f,c);u(""),p(""),g(!1),t(C.name)}catch(C){n(Vn(C))}finally{v(!1)}};return G.jsxDEV(G.Fragment,{children:[G.jsxDEV(T4,{lead:"Parts of the layout",em:"you can fill in"},void 0,!1,void 0,this),G.jsxDEV("div",{className:nn,children:[G.jsxDEV("p",{className:"mb-4 max-w-[62ch] text-sm text-fg-muted",children:["A widget area is a named slot in your layout — a sidebar, a footer column — that an editor fills without touching code. Your layout reads one by name: ",G.jsxDEV("code",{children:'getWidgetArea("sidebar")'},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this),G.jsxDEV("div",{className:"flex flex-col gap-2",children:[s===null?G.jsxDEV("p",{className:"text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this):null,s?.length===0?G.jsxDEV("p",{className:"text-fg-subtle",children:"No widget areas yet."},void 0,!1,void 0,this):null,(s??[]).map((C)=>G.jsxDEV("div",{className:`${Za} cursor-pointer hover:bg-surface-muted`,onClick:()=>t(C.name),children:[G.jsxDEV("span",{className:"min-w-0 flex-1 truncate font-medium",children:C.label},void 0,!1,void 0,this),G.jsxDEV("span",{className:"shrink-0 truncate text-fg-subtle",children:C.name},void 0,!1,void 0,this),G.jsxDEV("span",{className:"shrink-0 text-caption text-fg-subtle",children:[(C.widgets??[]).length," widget(s)"]},void 0,!0,void 0,this)]},C.id,!0,void 0,this))]},void 0,!0,void 0,this),r?G.jsxDEV("div",{className:"mt-6 max-w-[720px] rounded-lg border border-border bg-surface-muted p-4",children:[G.jsxDEV(Qo,{level:"2",className:"mb-3 font-normal",children:"New widget area"},void 0,!1,void 0,this),G.jsxDEV(I4,{label:c,keyValue:f,onLabel:(C)=>{if(u(C),!m)p(da(C))},onKey:(C)=>{g(!0),p(C)},keyHint:"What your layout asks for. Not renameable afterwards."},void 0,!1,void 0,this),G.jsxDEV(me,{className:"mt-3",onPress:w,isDisabled:y||!c.trim()||!f.trim(),children:"Create widget area"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function TQ({api:e,name:t,onBack:n,onDeleted:r,onError:s,canEdit:i}){let[c,u]=_e.useState(null),[f,p]=_e.useState(""),[m,g]=_e.useState([]),[y,v]=_e.useState([]),[x,w]=_e.useState("");gh(c!==null&&JSON.stringify({label:f,widgets:m})!==x);let[C,I]=_e.useState(void 0),[R,H]=_e.useState(!1),[L,_]=_e.useState(!1),[W,z]=_e.useState(!1);_e.useEffect(()=>{let ae=!0;return e.listWidgetAreas().then((re)=>{if(!ae)return;let D=re.find((B)=>B.name===t);if(!D){H(!0);return}u(D),p(D.label),g(D.widgets??[]),I(D.version),w(JSON.stringify({label:D.label,widgets:D.widgets??[]}))}).catch((re)=>s(Vn(re))),e.listMenus().then((re)=>ae&&v(re)).catch(()=>v([])),()=>{ae=!1}},[e,t,s]);let F=async()=>{if(!c)return;_(!0);try{let ae=await e.updateWidgetArea(c.id,{label:f,widgets:m,expectedVersion:C});I(ae.version),w(JSON.stringify({label:f,widgets:m})),z(!0),setTimeout(()=>z(!1),1200)}catch(ae){s(Vn(ae))}finally{_(!1)}},ne=async()=>{if(!c||!confirm(`Delete the widget area “${c.label}”?`))return;try{await e.deleteWidgetArea(c.id),r()}catch(ae){s(Vn(ae))}},V=(ae,re)=>g(m.map((D,B)=>B===ae?re:D)),ie=(ae,re)=>{let D=ae+re;if(D<0||D>=m.length)return;let B=m.slice(),[U]=B.splice(ae,1);B.splice(D,0,U),g(B)};if(R)return G.jsxDEV("div",{className:nn,children:G.jsxDEV("p",{className:"pt-8 text-fg-subtle",children:["Unknown widget area: ",t]},void 0,!0,void 0,this)},void 0,!1,void 0,this);if(!c)return G.jsxDEV("div",{className:nn,children:G.jsxDEV("p",{className:"pt-8 text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this)},void 0,!1,void 0,this);return G.jsxDEV("div",{className:nn,children:[G.jsxDEV("div",{className:"mb-4 mt-2 flex items-center gap-3",children:[G.jsxDEV(me,{variant:"ghost",size:"sm",onPress:n,children:"← Widgets"},void 0,!1,void 0,this),G.jsxDEV("h1",{className:"text-[22px] font-normal text-fg",children:c.label},void 0,!1,void 0,this),G.jsxDEV("span",{className:"text-fg-subtle",children:c.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("div",{className:"flex max-w-[860px] flex-col gap-4",children:[W?G.jsxDEV(hQ,{},void 0,!1,void 0,this):null,G.jsxDEV(pn,{label:"Label",value:f,onChange:p},void 0,!1,void 0,this),G.jsxDEV("div",{className:"flex flex-col gap-2",children:[m.length===0?G.jsxDEV("p",{className:"text-sm text-fg-subtle",children:"No widgets yet."},void 0,!1,void 0,this):null,m.map((ae,re)=>G.jsxDEV(Ebe,{widget:ae,menus:y,onChange:(D)=>V(re,D),onMove:(D)=>ie(re,D),onRemove:()=>g(m.filter((D,B)=>B!==re))},ae.id,!1,void 0,this))]},void 0,!0,void 0,this),i?G.jsxDEV("div",{className:"flex flex-wrap items-center gap-2",children:[G.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>g([...m,{id:crypto.randomUUID(),type:"content",content:{type:"doc",content:[]}}]),children:"+ Text"},void 0,!1,void 0,this),G.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>g([...m,{id:crypto.randomUUID(),type:"menu",menuName:y[0]?.name??""}]),children:"+ Menu"},void 0,!1,void 0,this),G.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>g([...m,{id:crypto.randomUUID(),type:"component",componentId:""}]),children:"+ Component"},void 0,!1,void 0,this),G.jsxDEV(me,{onPress:F,isDisabled:L,children:L?"Saving…":"Save"},void 0,!1,void 0,this),G.jsxDEV(me,{variant:"ghost",className:"text-danger",onPress:ne,isDisabled:L,children:"Delete area"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Ebe({widget:e,menus:t,onChange:n,onMove:r,onRemove:s}){let i=(c)=>n({...e,...c});return G.jsxDEV("div",{className:"rounded-lg border border-border bg-surface-muted",children:[G.jsxDEV("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:e.type},void 0,!1,void 0,this),G.jsxDEV("input",{className:"min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-subtle",value:e.title??"",placeholder:"Title (optional)","aria-label":"Widget title",onChange:(c)=>i({title:c.target.value||null})},void 0,!1,void 0,this),G.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg",title:"Move up",onClick:()=>r(-1),children:"↑"},void 0,!1,void 0,this),G.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg",title:"Move down",onClick:()=>r(1),children:"↓"},void 0,!1,void 0,this),G.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-danger",title:"Remove",onClick:s,children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV("div",{className:"p-3.5",children:e.type==="content"?G.jsxDEV(fM,{value:e.content??null,onChange:(c)=>i({content:c})},void 0,!1,void 0,this):e.type==="menu"?G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Menu"},void 0,!1,void 0,this),G.jsxDEV("select",{className:at,value:e.menuName??"",onChange:(c)=>i({menuName:c.target.value}),children:[G.jsxDEV("option",{value:"",children:"— pick one —"},void 0,!1,void 0,this),t.map((c)=>G.jsxDEV("option",{value:c.name,children:c.label},c.name,!1,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):G.jsxDEV("div",{className:"flex flex-col gap-3",children:[G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Component id — your front end maps this to one of its own components"},void 0,!1,void 0,this),G.jsxDEV("input",{className:at,value:e.componentId??"",onChange:(c)=>i({componentId:c.target.value.trim()})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.jsxDEV(Abe,{value:e.componentProps,onChange:(c)=>i({componentProps:c})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Abe({value:e,onChange:t}){let[n,r]=_e.useState(()=>e?JSON.stringify(e,null,2):""),[s,i]=_e.useState(!1);return G.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[G.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Props (JSON object, optional)"},void 0,!1,void 0,this),G.jsxDEV("textarea",{className:`${at} h-auto min-h-24 py-2.5 font-mono text-[12px]`,value:n,onChange:(c)=>{let u=c.target.value;if(r(u),u.trim()===""){i(!1),t(void 0);return}try{let f=JSON.parse(u);if(f===null||typeof f!=="object"||Array.isArray(f)){i(!0);return}i(!1),t(f)}catch{i(!0)}}},void 0,!1,void 0,this),s?G.jsxDEV("span",{className:"text-caption text-danger",children:"Not a JSON object — the last valid value is what will be saved."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var _e,G,T4,wbe;var wc=E(()=>{Ur();Rn();I1();xS();mM();Pf();_e=O(ee(),1),G=O(Me(),1);T4=$4;wbe=[{value:"custom",label:"A URL"},{value:"page",label:"A page"},{value:"term",label:"A term"},{value:"collection",label:"A collection"}]});function Mbe(e){switch(e){case"review":return[{label:"Approve & publish",action:"approve"},{label:"Reject",action:"reject"},{label:"Publish directly",action:"publishPage"}];case"published":return[{label:"Publish changes",action:"publishPage"},{label:"Unpublish",action:"unpublishPage"}];default:return[{label:"Publish",action:"publishPage"},{label:"Submit for review",action:"submitForReview"}]}}function bM(e,t=!1){return kbe.filter((n)=>n==="i18n"?e:n==="terms"?t:!0)}function rp(){return typeof window<"u"&&window.PRAMEN_CMS_EDITOR?.hidePages===!0}function ap(e,t,n=rp()){return!n&&t.pagesByType&&e!==null&&e.length>1}function sp({children:e}){return N.jsxDEV("div",{className:"mb-2 mt-[18px] text-sm text-fg-subtle first:mt-0",children:e},void 0,!1,void 0,this)}function op({status:e,children:t}){return N.jsxDEV("span",{className:`inline-block whitespace-nowrap rounded-full border px-2.5 py-0.5 text-caption font-medium ${e==="published"||e==="active"?"bg-brand-green text-fg-on-brand border-transparent":e==="in_review"||e==="review"?"bg-accent-yellow text-fg-on-brand border-transparent":e==="rejected"||e==="archived"||e==="inactive"?"border-danger text-danger bg-surface-card":"border-border text-fg-muted bg-surface-card"}`,children:t},void 0,!1,void 0,this)}function yM({onClose:e,size:t,title:n,description:r,children:s}){return N.jsxDEV(Mf,{isOpen:!0,isDismissable:!0,size:t,title:n,description:r,onOpenChange:(i)=>!i&&e(),children:s},void 0,!1,void 0,this)}function vM({children:e,className:t}){return N.jsxDEV("div",{className:`grid grid-cols-[auto_1fr] gap-x-3.5 gap-y-2 text-[13px] text-fg-muted [&>span:nth-child(odd)]:text-fg-subtle ${t??""}`,children:e},void 0,!1,void 0,this)}function NQ({children:e}){return N.jsxDEV("div",{className:"overflow-auto rounded-lg border border-border bg-surface-card p-6",children:e},void 0,!1,void 0,this)}function ip({ok:e,children:t}){return N.jsxDEV("div",{className:`my-2 rounded-lg border px-3.5 py-2.5 text-small ${e?"border-brand-green bg-brand-green/20 text-fg":"border-danger bg-surface-card text-danger"}`,children:t},void 0,!1,void 0,this)}function Ut({children:e,action:t}){return N.jsxDEV("div",{className:"mx-auto flex max-w-[1200px] items-center gap-2 px-7 pt-8",children:[N.jsxDEV("p",{className:"text-fg-subtle",children:e},void 0,!1,void 0,this),t]},void 0,!0,void 0,this)}function E4({api:e,type:t,onOpen:n,onError:r}){let{cms:{multilingual:s}}=nt(),[i,c]=fe.useState([]),[u,f]=fe.useState(0),[p,m]=fe.useState(!1),[g,y]=fe.useState(!0),[v,x]=fe.useState([]),[w,C]=fe.useState(!1),I=t?.slug,R=fe.useCallback((L)=>(y(!0),e.listPages({contentType:I,limit:IQ,offset:L}).then((_)=>{c((W)=>L===0?_:[...W,..._]),m(_.length===IQ),f(L+_.length)}).catch((_)=>r(ht(_))).finally(()=>y(!1))),[e,I,r]);fe.useEffect(()=>{c([]),f(0),m(!1),R(0)},[R]),fe.useEffect(()=>{e.listBlockTypes().then(x).catch((L)=>r(ht(L)))},[e,r]);let H=i.length===0?"None yet":i.length===1?"1 page total":`${i.length}${p?"+":""} pages total`;return N.jsxDEV(N.Fragment,{children:[N.jsxDEV(A1,{lead:t?.name??"Pages",em:g&&i.length===0?"Loading…":H,children:N.jsxDEV(me,{className:"shrink-0",onPress:()=>C(!0),children:"+ New page"},void 0,!1,void 0,this)},void 0,!1,void 0,this),N.jsxDEV("div",{className:nn,children:[N.jsxDEV("div",{className:"flex flex-col gap-2",children:[i.map((L)=>N.jsxDEV("div",{className:`${Za} cursor-pointer hover:bg-surface-muted`,onClick:()=>n(L),children:[N.jsxDEV("span",{className:"flex-1 truncate font-medium",children:L.title},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-fg-subtle",children:["/",L.slug]},void 0,!0,void 0,this),s?N.jsxDEV("span",{className:"text-fg-subtle",children:L.locale},void 0,!1,void 0,this):null,N.jsxDEV(op,{status:L.status,children:L.status},void 0,!1,void 0,this)]},L.id,!0,void 0,this)),!g&&i.length===0?N.jsxDEV("p",{className:"text-fg-subtle",children:["No pages yet. ",v.length===0?"Define block types + a content type first (via the API/admin).":"Create one."]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),p?N.jsxDEV("div",{className:"mt-4 flex justify-center",children:N.jsxDEV(me,{variant:"ghost",onPress:()=>void R(u),isDisabled:g,children:g?"Loading…":"Load more"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),w?N.jsxDEV(Nbe,{api:e,type:t,onClose:()=>C(!1),onCreated:()=>{C(!1),R(0)},onError:r},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function Nbe({api:e,type:t,onClose:n,onCreated:r,onError:s}){let{contentTypes:i}=nt(),c=i??[],[u,f]=fe.useState(t?.id??""),[p,m]=fe.useState(""),[g,y]=fe.useState("");fe.useEffect(()=>{if(t){f(t.id);return}let x=i??[];f((w)=>w&&x.some((C)=>C.id===w)?w:x[0]?.id??"")},[t,i]);let v=async()=>{try{await e.call("createPage",{typeId:u,title:p,slug:g||da(p)}),r()}catch(x){s(ht(x))}};return N.jsxDEV(yM,{onClose:n,size:"full",title:N.jsxDEV(N.Fragment,{children:["Create a ",N.jsxDEV(Gh,{children:"new page"},void 0,!1,void 0,this),t?N.jsxDEV(N.Fragment,{children:[" in ",N.jsxDEV(Gh,{children:t.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null," and define the essentials",N.jsxDEV(Gh,{children:"."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:N.jsxDEV("div",{className:"m-auto flex w-full max-w-[560px] flex-col gap-4",children:[N.jsxDEV("div",{className:`w-full flex-col gap-2 ${t?"hidden":"flex"}`,children:[N.jsxDEV("span",{className:"text-sm font-medium text-fg",children:"Content type"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex flex-wrap gap-2",children:c.map((x)=>N.jsxDEV("button",{type:"button",onClick:()=>f(x.id),className:`rounded-lg border px-4 py-2.5 text-sm font-medium transition-colors ${u===x.id?"border-brand-green bg-surface-muted text-fg":"border-border bg-surface-card text-fg-muted hover:border-fg-subtle hover:text-fg"}`,children:x.name},x.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV(pn,{label:"Title",value:p,onChange:m},void 0,!1,void 0,this),N.jsxDEV(pn,{label:"Slug",value:g,onChange:y,placeholder:da(p)},void 0,!1,void 0,this),N.jsxDEV("div",{className:"mt-2 flex justify-end gap-2",children:[N.jsxDEV(me,{variant:"ghost",onPress:n,children:"cancel"},void 0,!1,void 0,this),N.jsxDEV(me,{onPress:v,isDisabled:!u||!p,children:"Create"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function gM(e){if(e==null)return"";if(typeof e==="boolean")return e?"yes":"no";if(Array.isArray(e))return e.length===1?"1 item":`${e.length} items`;if(Uh(e)){let t=T1(e).replace(/\s+/g," ").trim();return t.length>80?t.slice(0,80)+"…":t}if(typeof e==="object")return"—";return String(e)}function PQ({api:e,def:t,onOpen:n,onNew:r,onError:s}){let[i,c]=fe.useState([]),[u,f]=fe.useState(0),[p,m]=fe.useState(!1),[g,y]=fe.useState(!0),v=fe.useCallback((w)=>(y(!0),e.call("collectionList",{collection:t.slug,limit:EQ,offset:w}).then((C)=>{c((I)=>w===0?C:[...I,...C]),m(C.length===EQ),f(w+C.length)}).catch((C)=>s(ht(C))).finally(()=>y(!1))),[e,t.slug,s]);fe.useEffect(()=>{c([]),f(0),m(!1),v(0)},[v]);let x=(w)=>t.fields.find((C)=>C.name===w)?.label??w;return N.jsxDEV(N.Fragment,{children:[N.jsxDEV(A1,{lead:t.pluralLabel,em:i.length===0?"None yet":i.length===1?`1 ${t.label.toLowerCase()}`:`${i.length}${p?"+":""} ${t.pluralLabel.toLowerCase()}`,children:N.jsxDEV(me,{className:"shrink-0",onPress:r,children:["+ New ",t.label.toLowerCase()]},void 0,!0,void 0,this)},void 0,!1,void 0,this),N.jsxDEV("div",{className:nn,children:[N.jsxDEV("div",{className:"flex flex-col gap-2",children:[i.map((w)=>{let C=String(w[t.idField]??""),[I,...R]=t.list;return N.jsxDEV("div",{className:`${Za} cursor-pointer hover:bg-surface-muted`,onClick:()=>n(C),children:[N.jsxDEV("span",{className:"flex-1 truncate font-medium",children:gM(w[I??t.titleField])||N.jsxDEV(Gh,{children:"untitled"},void 0,!1,void 0,this)},void 0,!1,void 0,this),R.map((H)=>N.jsxDEV("span",{className:"truncate text-fg-subtle",title:x(H),children:gM(w[H])},H,!1,void 0,this))]},C,!0,void 0,this)}),!g&&i.length===0?N.jsxDEV("p",{className:"text-fg-subtle",children:["No ",t.pluralLabel.toLowerCase()," yet. Create one."]},void 0,!0,void 0,this):null,g?N.jsxDEV("p",{className:"text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),p&&!g?N.jsxDEV("div",{className:"mt-3.5 text-center",children:N.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>void v(u),children:"Load more"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Pbe({api:e,def:t,id:n,values:r,onChanged:s,onError:i}){let c=t.supports??[],[u,f]=fe.useState(!1),[p,m]=fe.useState(!1),[g,y]=fe.useState(""),[v,x]=fe.useState(""),[w,C]=fe.useState(null),[I,R]=fe.useState(null),H=typeof r.status==="string"?r.status:"draft",L=H==="published",_=(B)=>typeof r[B]==="string"&&r[B]!==""?r[B]:null,W=_("scheduledAt"),z=_("unpublishAt"),F=_("publishedAt");if(c.length===0)return null;let ne=async(B,U={})=>{f(!0);try{let Q=await e.call(B,{collection:t.slug,id:n,...U});if(Q&&typeof Q==="object"&&t.idField in Q)s(Q);else{let xe=await e.call("collectionGet",{collection:t.slug,id:n});if(xe)s(xe)}return!0}catch(Q){return i(ht(Q)),!1}finally{f(!1)}},V=async()=>{let B=g?v4(g):null;if(!B)return i("Pick a publication date and time first.");let U=v?v4(v):null;if(v&&!U)return i("That takedown date is not a valid date and time.");if(await ne("collectionSchedule",{publishAt:Date.parse(B),unpublishAt:U?Date.parse(U):null}))m(!1)},ie=()=>{y(y4(W??F??new Date().toISOString())),x(z?y4(z):""),m((B)=>!B)},ae=async()=>{f(!0);try{let B=await e.call("signCollectionPreview",{collection:t.slug,id:n}),U=e.resolve(B.url);C(U),await navigator.clipboard?.writeText(U).catch(()=>{})}catch(B){i(ht(B))}finally{f(!1)}},re=async()=>{if(I)return R(null);try{R(await e.call("collectionListRevisions",{collection:t.slug,id:n}))}catch(B){i(ht(B))}},D=async(B)=>{if(!confirm("Restore this version? The current content is snapshotted first, so this is itself undoable."))return;if(await ne("collectionRestoreRevision",{revisionId:B}))R(null)};return N.jsxDEV("div",{className:"flex flex-col gap-3 rounded-[14px] border border-border bg-surface-card px-[18px] py-4",children:[N.jsxDEV("div",{className:"flex flex-wrap items-center gap-2",children:[N.jsxDEV("span",{className:"text-fg-subtle",children:"Status"},void 0,!1,void 0,this),N.jsxDEV(op,{status:H,children:H},void 0,!1,void 0,this),F&&L?N.jsxDEV("span",{className:"text-fg-subtle",children:["since ",np(F)]},void 0,!0,void 0,this):null,W?N.jsxDEV("span",{className:"text-accent-strong",children:["publishes ",np(W)]},void 0,!0,void 0,this):null,z?N.jsxDEV("span",{className:"text-danger",children:["comes down ",np(z)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"flex flex-wrap items-center gap-2",children:[c.includes("drafts")&&!L?N.jsxDEV(me,{size:"sm",isDisabled:u,onPress:()=>void ne("collectionPublish"),children:"Publish now"},void 0,!1,void 0,this):null,c.includes("drafts")&&L?N.jsxDEV(me,{variant:"secondary",size:"sm",isDisabled:u,onPress:()=>void ne("collectionUnpublish"),children:"Unpublish"},void 0,!1,void 0,this):null,c.includes("scheduling")?N.jsxDEV(me,{variant:"secondary",size:"sm",isDisabled:u,onPress:ie,children:W?"Change schedule":"Schedule…"},void 0,!1,void 0,this):null,c.includes("preview")?N.jsxDEV(me,{variant:"ghost",size:"sm",isDisabled:u,onPress:()=>void ae(),children:"Preview link"},void 0,!1,void 0,this):null,c.includes("revisions")?N.jsxDEV(me,{variant:"ghost",size:"sm",isDisabled:u,onPress:()=>void re(),children:I?"Hide history":"History"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),p?N.jsxDEV("div",{className:"flex flex-col gap-2 border-t border-border pt-3",children:[N.jsxDEV("label",{className:"flex flex-col gap-1 text-sm",children:[N.jsxDEV("span",{className:"font-medium text-fg",children:"Publish at"},void 0,!1,void 0,this),N.jsxDEV("input",{className:at,type:"datetime-local",value:g,onChange:(B)=>y(B.target.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("label",{className:"flex flex-col gap-1 text-sm",children:[N.jsxDEV("span",{className:"font-medium text-fg",children:"Take down at (optional)"},void 0,!1,void 0,this),N.jsxDEV("input",{className:at,type:"datetime-local",value:v,onChange:(B)=>x(B.target.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("p",{className:"text-fg-subtle",children:"Scheduling does not take a live row down — it publishes at the first instant. A takedown must be after the publication time. Leave it empty to cancel one."},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex gap-2",children:[N.jsxDEV(me,{size:"sm",isDisabled:u,onPress:()=>void V(),children:"Save schedule"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",size:"sm",onPress:()=>m(!1),children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,w?N.jsxDEV("div",{className:"border-t border-border pt-3 text-sm",children:[N.jsxDEV("span",{className:"text-fg-subtle",children:"Preview link (copied): "},void 0,!1,void 0,this),N.jsxDEV("a",{className:"break-all underline",href:w,target:"_blank",rel:"noreferrer",children:w},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,I?N.jsxDEV("div",{className:"flex flex-col gap-2 border-t border-border pt-3",children:[I.map((B)=>N.jsxDEV("div",{className:`${Za} text-xs`,children:[N.jsxDEV("span",{className:"rounded-full bg-surface-muted px-2 py-0.5 font-mono text-xs text-fg-muted",children:["#",B.revision]},void 0,!0,void 0,this),N.jsxDEV("span",{className:"flex-1 truncate text-fg-subtle",children:[B.note??"edit"," · ",B.actor??"system"," · ",np(B.createdAt)]},void 0,!0,void 0,this),N.jsxDEV(me,{variant:"ghost",size:"sm",isDisabled:u,onPress:()=>void D(B.id),children:"Restore"},void 0,!1,void 0,this)]},B.id,!0,void 0,this)),I.length===0?N.jsxDEV("p",{className:"text-fg-subtle",children:"No history yet."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function DQ({api:e,def:t,id:n,onSaved:r,onDeleted:s,onBack:i,onError:c}){let u=n===null,[f,p]=fe.useState({}),[m,g]=fe.useState(!u),[y,v]=fe.useState(!1),x=gM(f[t.titleField]);vS(u?`New ${t.label.toLowerCase()}`:x||void 0);let[w,C]=fe.useState(!1),[I,R]=fe.useState(!1);fe.useEffect(()=>{if(u){p({});return}let _=!0;return g(!0),v(!1),e.call("collectionGet",{collection:t.slug,id:n}).then((W)=>{if(!_)return;if(W)p(W);else v(!0)}).catch((W)=>c(ht(W))).finally(()=>{if(_)g(!1)}),()=>{_=!1}},[e,t.slug,n,u,c]);let H=async()=>{C(!0);try{if(u)await e.call("collectionCreate",{collection:t.slug,values:f}),r();else{let _=await e.call("collectionUpdate",{collection:t.slug,id:n,values:f});if(_)p(_);R(!0),setTimeout(()=>R(!1),1200)}}catch(_){c(ht(_))}finally{C(!1)}},L=async()=>{if(u||!confirm(`Delete this ${t.label.toLowerCase()}? This cannot be undone.`))return;C(!0);try{await e.call("collectionDelete",{collection:t.slug,id:n}),s()}catch(_){c(ht(_))}finally{C(!1)}};return N.jsxDEV("div",{className:nn,children:[N.jsxDEV("div",{className:"mb-4 mt-2 flex items-center gap-3",children:[N.jsxDEV(me,{variant:"ghost",size:"sm",onPress:i,children:["← ",t.pluralLabel]},void 0,!0,void 0,this),N.jsxDEV("h1",{className:"text-[22px] font-normal text-fg",children:u?`New ${t.label.toLowerCase()}`:`Edit ${t.label.toLowerCase()}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y?N.jsxDEV("p",{className:"text-fg-subtle",children:"Not found."},void 0,!1,void 0,this):m?N.jsxDEV("p",{className:"text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this):N.jsxDEV("div",{className:"flex max-w-[720px] flex-col gap-4",children:[I?N.jsxDEV(ip,{ok:!0,children:"saved"},void 0,!1,void 0,this):null,!u&&n?N.jsxDEV(Pbe,{api:e,def:t,id:n,values:f,onChanged:p,onError:c},void 0,!1,void 0,this):null,N.jsxDEV(jh,{schema:t.fields,value:f,onChange:p,api:e},void 0,!1,void 0,this),N.jsxDEV("div",{className:"mt-2 flex items-center gap-2",children:[N.jsxDEV(me,{onPress:H,isDisabled:w,children:w?"Saving…":u?"Create":"Save"},void 0,!1,void 0,this),!u?N.jsxDEV(me,{variant:"ghost",className:"text-danger",onPress:L,isDisabled:w,children:"Delete"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Dbe({page:e,dirtyCount:t,onBack:n,backLabel:r,onAct:s,busy:i}){let[c,u]=fe.useState(null),[f,p]=fe.useState(!1),{api:m,setError:g}=nt(),y=Mbe(String(e.status)),[v,...x]=y,w=async()=>{p(!0);let C=window.open("","_blank");try{let I=await m.signPagePreview(e.id),R=mQ(I,{siteUrl:pQ(),origin:window.location.href,resolve:(H)=>m.resolve(H)});if(u(R),C)C.opener=null,C.location.replace(R);await navigator.clipboard?.writeText(R).catch(()=>{})}catch(I){C?.close(),u(null),g(ht(I))}finally{p(!1)}};return N.jsxDEV(N.Fragment,{children:[N.jsxDEV("div",{className:`sticky ${x4} z-20 -mx-7 flex ${cQ} items-center gap-3 border-b border-border bg-surface px-7`,children:[N.jsxDEV(me,{variant:"ghost",size:"sm",className:"shrink-0",onPress:n,children:["← ",r]},void 0,!0,void 0,this),N.jsxDEV("span",{className:"min-w-0 truncate font-medium text-fg",children:e.title},void 0,!1,void 0,this),N.jsxDEV(op,{status:e.status,children:e.status},void 0,!1,void 0,this),N.jsxDEV("span",{className:"flex-1"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"shrink-0 text-caption text-fg-subtle",children:t>0?N.jsxDEV("span",{className:"text-accent-strong",children:["● saving ",t," change",t===1?"":"s","…"]},void 0,!0,void 0,this):"all changes saved"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"secondary",size:"sm",className:"shrink-0",isDisabled:f,onPress:()=>void w(),children:f?"Minting…":"Preview"},void 0,!1,void 0,this),v?N.jsxDEV(me,{size:"sm",className:"shrink-0",isDisabled:i,onPress:()=>s(v.action),children:v.label},void 0,!1,void 0,this):null,x.length>0?N.jsxDEV(sS,{children:[N.jsxDEV(me,{variant:"ghost",size:"sm",className:"shrink-0 px-2","aria-label":"More actions",children:"⋯"},void 0,!1,void 0,this),N.jsxDEV(iS,{"aria-label":"More page actions",onAction:(C)=>s(String(C)),children:x.map((C)=>N.jsxDEV($b,{id:C.action,children:C.label},C.action,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),c?N.jsxDEV("div",{className:"mt-3 flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-caption",children:[N.jsxDEV("span",{className:"shrink-0 text-fg-subtle",children:"Preview opened in a new tab — link copied:"},void 0,!1,void 0,this),N.jsxDEV("a",{className:"min-w-0 flex-1 truncate underline",href:c,target:"_blank",rel:"noreferrer",children:c},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",size:"sm",className:"shrink-0 px-2","aria-label":"Hide the preview link",onPress:()=>u(null),children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function LQ({api:e,page:t,blockTypes:n,tab:r,onTab:s,onBack:i,backLabel:c,onChange:u,registerGuard:f}){let{cms:{multilingual:p,siteFurniture:m,canEdit:g}}=nt(),[y,v]=fe.useState(null),[x,w]=fe.useState(null),[C,I]=fe.useState(""),R=fe.useRef(new Set),[H,L]=fe.useState(0),_=fe.useCallback((de,ge)=>{let Re=R.current;if(ge?Re.has(de):!Re.has(de))return;if(ge)Re.add(de);else Re.delete(de);L(Re.size)},[]),W=fe.useCallback(()=>R.current.size===0||window.confirm(`You have ${R.current.size} unsaved change${R.current.size===1?"":"s"}. Leave without saving?`),[]);fe.useEffect(()=>(f(W),()=>f(null)),[f,W]);let z=fe.useMemo(()=>new Map(n.map((de)=>[de.slug,de])),[n]),F=fe.useCallback(async()=>{try{let[de,ge]=await Promise.all([e.getContentType(t.typeId),e.getPagePreview(t.slug,t.locale)]);v(de??null),w(ge)}catch(de){I(ht(de))}},[e,t.typeId,t.slug,t.locale]);fe.useEffect(()=>{F()},[F]),fe.useEffect(()=>{if(H===0)return;let de=(ge)=>{ge.preventDefault(),ge.returnValue=""};return window.addEventListener("beforeunload",de),()=>window.removeEventListener("beforeunload",de)},[H]);let ne=y?.regions??[],V=y?.fieldsSchema??[],ie=(de,ge)=>w((Re)=>Re?{...Re,regions:{...Re.regions,[de]:ge(Re.regions[de]??[])}}:Re),ae=async(de,ge,Re)=>{let ye=`tmp:${crypto.randomUUID()}`,Ee=(x?.regions[de]??[]).map((Se)=>Se.id),ft=Re!=null&&Re>=0&&Re<Ee.length?Re:Ee.length;ie(de,(Se)=>{let Xt=[...Se];return Xt.splice(ft,0,{id:ye,block_id:ye,block_type:ge,title:null,fields:{},is_shared:!1,pending:!0}),Xt});try{let{block:Se,placement:Xt}=await e.call("addBlock",{pageId:t.id,blockTypeSlug:ge,region:de,fields:{}}),In={id:String(Xt.id),block_id:String(Se.id),block_type:ge,title:Se.title??null,fields:Se.fields??{},is_shared:Boolean(Xt.isShared)};if(ie(de,(xn)=>xn.map((sn)=>sn.id===ye?In:sn)),ft<Ee.length){let xn=[...Ee];xn.splice(ft,0,In.id),await D(de,xn)}}catch(Se){ie(de,(Xt)=>Xt.filter((In)=>In.id!==ye)),I(ht(Se))}},re=async(de)=>{try{await e.call("removeBlock",{pageBlockId:de.id}),await F()}catch(ge){I(ht(ge))}},D=async(de,ge)=>{try{await e.call("reorderRegion",{pageId:t.id,region:de,order:ge}),await F()}catch(Re){I(ht(Re))}},B=fe.useCallback((de,ge)=>{w((Re)=>{if(!Re)return Re;let ye={};for(let[Ee,ft]of Object.entries(Re.regions))ye[Ee]=ft.map((Se)=>Se.id===de?{...Se,fields:ge}:Se);return{...Re,regions:ye}})},[]),[U,Q]=fe.useState(null),xe=(de,ge)=>Q({region:de,from:ge,over:ge}),le=(de,ge)=>Q((Re)=>Re&&Re.region===de&&Re.over!==ge?{...Re,over:ge}:Re),k=()=>Q(null),te=(de)=>{if(Q(null),!U||U.region!==de||U.from===U.over)return;let ge=(x?.regions[de]??[]).map((ye)=>ye.id),[Re]=ge.splice(U.from,1);ge.splice(U.over,0,Re),D(de,ge)},[Ce,$e]=fe.useState(!1);return N.jsxDEV("div",{className:"px-7 pb-16",children:[N.jsxDEV(Dbe,{page:t,dirtyCount:H,busy:Ce,onAct:async(de)=>{$e(!0);try{let ge=await e.call(de,{pageId:t.id});if(ge?.page)u(ge.page)}catch(ge){I(ht(ge))}finally{$e(!1)}},backLabel:c,onBack:()=>{if(W())i()}},void 0,!1,void 0,this),C?N.jsxDEV(ip,{children:C},void 0,!1,void 0,this):null,N.jsxDEV("div",{className:"mt-4 grid items-start gap-6 grid-cols-[minmax(0,1fr)_340px] max-[980px]:grid-cols-1",children:[N.jsxDEV("div",{className:"min-w-0 py-1.5 pl-8 pr-2",children:[V.length?N.jsxDEV(Bbe,{api:e,page:t,schema:V,initialFields:x?.page.fields??{},onDirtyChange:_,onError:I},void 0,!1,void 0,this):null,ne.map((de)=>{let ge=x?.regions[de.name]??[],Re=de.allowedTypes&&de.allowedTypes.length?de.allowedTypes:n.map((ye)=>ye.slug);return N.jsxDEV("div",{className:"mb-10",children:[N.jsxDEV("div",{className:`sticky ${pM} z-10 -mx-2 mb-1 bg-surface px-2 py-1 text-caption font-medium uppercase tracking-wide text-fg-subtle`,children:de.label??de.name},void 0,!1,void 0,this),ge.map((ye,Ee)=>N.jsxDEV("div",{children:[N.jsxDEV(AQ,{compact:!0,allowed:Re,btBySlug:z,onAdd:(ft)=>ae(de.name,ft,Ee)},void 0,!1,void 0,this),N.jsxDEV(Lbe,{api:e,block:ye,blockType:z.get(ye.block_type),isFirst:Ee===0,isLast:Ee===ge.length-1,onMove:(ft)=>t1e(ge,de.name,Ee,ft,D),onRemove:()=>re(ye),onPatch:B,onDirtyChange:_,onError:I,dragging:U?.region===de.name&&U.from===Ee,isOver:!!U&&U.region===de.name&&U.over===Ee&&U.from!==Ee,onDragStartBlock:()=>xe(de.name,Ee),onDragOverBlock:()=>le(de.name,Ee),onDropBlock:()=>te(de.name),onDragEndBlock:k},void 0,!1,void 0,this)]},ye.id,!0,void 0,this)),N.jsxDEV("div",{className:"mt-1",children:N.jsxDEV(AQ,{allowed:Re,btBySlug:z,onAdd:(ye)=>ae(de.name,ye)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},de.name,!0,void 0,this)}),ne.length===0&&V.length===0?N.jsxDEV("p",{className:"text-fg-subtle",children:"This page's content type defines no fields or regions."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),N.jsxDEV("aside",{className:`sticky ${pM} max-h-[calc(100vh-8rem)] overflow-auto rounded-panel border border-border bg-surface-card p-5`,children:[N.jsxDEV("div",{className:"-mt-1 mb-4 flex gap-1 border-b border-border",children:bM(p,m).map((de)=>N.jsxDEV("button",{type:"button",className:`-mb-px border-b-2 px-2 pb-2 pt-1 text-sm ${r===de?"border-fg font-medium text-fg":"border-transparent text-fg-muted hover:text-fg"}`,onClick:()=>s(de),children:Rbe[de]},de,!1,void 0,this))},void 0,!1,void 0,this),r==="settings"?N.jsxDEV(Obe,{api:e,page:t,onSaved:u,onError:I},void 0,!1,void 0,this):null,r==="seo"?N.jsxDEV(Hbe,{api:e,page:t,onError:I},void 0,!1,void 0,this):null,r==="i18n"&&p?N.jsxDEV(Fbe,{api:e,page:t,onError:I},void 0,!1,void 0,this):null,r==="terms"?N.jsxDEV(_be,{api:e,pageId:t.id,canEdit:g,onError:I},void 0,!1,void 0,this):null,r==="audit"?N.jsxDEV(zbe,{api:e,pageId:t.id,onError:I},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Lbe({api:e,block:t,blockType:n,isFirst:r,isLast:s,onMove:i,onRemove:c,onPatch:u,onDirtyChange:f,onError:p,dragging:m,isOver:g,onDragStartBlock:y,onDragOverBlock:v,onDropBlock:x,onDragEndBlock:w}){let[C,I]=fe.useState(null),[R,H]=fe.useState(!1),[L,_]=fe.useState("idle"),W=fe.useRef(""),z=fe.useRef(null),{block_id:F,id:ne}=t;fe.useEffect(()=>{if(t.pending){I({}),W.current="{}";return}let U=!0;return e.call("getBlock",{blockId:F}).then((Q)=>{if(!U)return;let xe=Q?.fields??{};I(xe),W.current=JSON.stringify(xe)}).catch((Q)=>p(ht(Q))),()=>{U=!1}},[e,F,p,t.pending]);let V=C!=null&&JSON.stringify(C)!==W.current,ie=fe.useCallback(async()=>{if(t.pending||C==null)return;let U=JSON.stringify(C);if(U===W.current)return;_("saving");try{await e.call("updateBlock",{blockId:F,fields:C}),W.current=U,u(ne,C),_("saved"),setTimeout(()=>_((Q)=>Q==="saved"?"idle":Q),1500)}catch(Q){p(ht(Q)),_("idle")}},[e,F,ne,C,u,p,t.pending]),ae=fe.useRef(ie);ae.current=ie,fe.useEffect(()=>{if(C==null||t.pending)return;if(JSON.stringify(C)===W.current)return;let U=setTimeout(()=>void ae.current(),800);return()=>clearTimeout(U)},[C,t.pending]);let re=(U)=>I(U);fe.useEffect(()=>{f(ne,V)},[V,ne,f]),fe.useEffect(()=>()=>{f(ne,!1)},[ne,f]);let D=n?.fieldsSchema??[],B=n?.name??t.block_type;return N.jsxDEV("div",{ref:z,className:`group relative rounded-lg px-2 py-1 transition-colors ${g?"ring-2 ring-brand-green":""} ${m?"opacity-40":""} ${t.pending?"pointer-events-none opacity-60":""}`,onDragOver:(U)=>{U.preventDefault(),v()},onDrop:(U)=>{U.preventDefault(),x()},children:[N.jsxDEV("span",{draggable:!0,onDragStart:(U)=>{if(z.current)U.dataTransfer.setDragImage(z.current,12,12);U.dataTransfer.effectAllowed="move",U.dataTransfer.setData("text/plain",""),y()},onDragEnd:w,className:"absolute -left-6 top-1.5 cursor-grab select-none px-1 text-fg-subtle opacity-0 transition-opacity hover:text-fg group-hover:opacity-100 active:cursor-grabbing",title:"Drag to reorder",children:"⠿"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex items-center gap-2 opacity-60 transition-opacity group-hover:opacity-100",children:[N.jsxDEV("button",{type:"button",className:"w-4 shrink-0 text-fg-subtle hover:text-fg",title:R?"Expand":"Collapse",onClick:()=>H((U)=>!U),children:R?"▸":"▾"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-caption font-medium uppercase tracking-wide text-fg-subtle",children:B},void 0,!1,void 0,this),t.is_shared?N.jsxDEV("span",{className:"text-caption text-accent-strong",children:"shared"},void 0,!1,void 0,this):null,N.jsxDEV("span",{className:`text-caption ${V&&L!=="saving"?"text-accent-strong":"text-fg-subtle"}`,children:L==="saving"?"saving…":L==="saved"?"saved ✓":V?"● unsaved":""},void 0,!1,void 0,this),N.jsxDEV("span",{className:"flex-1"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",size:"sm",isDisabled:r,onPress:()=>i(-1),children:"↑"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",size:"sm",isDisabled:s,onPress:()=>i(1),children:"↓"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",size:"sm",className:"text-danger",onPress:c,children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),R?N.jsxDEV("div",{className:"cursor-pointer truncate pb-1 pl-6 text-small text-fg-subtle",onClick:()=>H(!1),children:C==null?"…":e1e(C)||N.jsxDEV("span",{className:"italic",children:"empty"},void 0,!1,void 0,this)},void 0,!1,void 0,this):N.jsxDEV("div",{className:"pb-1 pl-6",children:C==null?N.jsxDEV("p",{className:"text-small text-fg-subtle",children:"loading…"},void 0,!1,void 0,this):D.length===0?N.jsxDEV("p",{className:"text-small text-fg-subtle",children:"This block has no editable fields."},void 0,!1,void 0,this):N.jsxDEV(N.Fragment,{children:[N.jsxDEV(jh,{schema:D,value:C,onChange:re,api:e},void 0,!1,void 0,this),V||L==="saving"?N.jsxDEV("div",{className:"mt-2 flex items-center gap-2",children:[N.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>void ie(),isDisabled:!V||L==="saving"||t.pending,children:L==="saving"?"Saving…":"Save now"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-caption text-fg-subtle",children:L==="saving"?"":"Autosaving…"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function AQ({allowed:e,btBySlug:t,onAdd:n,compact:r}){let[s,i]=fe.useState(!1),[c,u]=fe.useState(""),[f,p]=fe.useState(0),m=fe.useRef(null),g=fe.useMemo(()=>{let x=e.map((C)=>({slug:C,name:t.get(C)?.name??C})),w=c.trim().toLowerCase();return w?x.filter((C)=>C.name.toLowerCase().includes(w)||C.slug.toLowerCase().includes(w)):x},[e,t,c]);fe.useEffect(()=>{if(s)m.current?.focus()},[s]),fe.useEffect(()=>{p(0)},[c]);let y=()=>{i(!1),u("")},v=(x)=>{if(x)n(x);y()};if(!s){if(r)return N.jsxDEV("button",{type:"button",onClick:()=>i(!0),"aria-label":"Insert block here",className:"group/ins flex h-3 w-full items-center justify-center opacity-0 transition-opacity hover:opacity-100",children:N.jsxDEV("span",{className:"flex h-full w-full items-center",children:[N.jsxDEV("span",{className:"h-px flex-1 bg-brand-green/40"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"mx-1 rounded bg-brand-green/15 px-1 text-caption leading-none text-brand-green",children:"+"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"h-px flex-1 bg-brand-green/40"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return N.jsxDEV("button",{type:"button",onClick:()=>i(!0),className:"flex w-full items-center gap-2 rounded-lg px-1 py-1.5 text-left text-small text-fg-subtle opacity-70 transition-colors hover:bg-surface-muted hover:text-fg-muted hover:opacity-100",children:[N.jsxDEV("span",{className:"text-base leading-none",children:"+"},void 0,!1,void 0,this),N.jsxDEV("span",{children:"Add block"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}return N.jsxDEV("div",{className:"rounded-lg border border-border bg-surface-card p-1 shadow-md",children:[N.jsxDEV("input",{ref:m,value:c,placeholder:"Filter blocks…",spellCheck:!1,className:"mb-1 w-full rounded-md bg-surface px-2.5 py-1.5 text-small text-fg outline-none placeholder:text-fg-subtle",onChange:(x)=>u(x.target.value),onBlur:()=>setTimeout(y,120),onKeyDown:(x)=>{if(x.key==="Escape")y();else if(x.key==="ArrowDown")x.preventDefault(),p((w)=>(w+1)%Math.max(g.length,1));else if(x.key==="ArrowUp")x.preventDefault(),p((w)=>(w-1+Math.max(g.length,1))%Math.max(g.length,1));else if(x.key==="Enter")x.preventDefault(),v(g[f]?.slug)}},void 0,!1,void 0,this),N.jsxDEV("div",{className:"max-h-64 overflow-auto",children:g.length===0?N.jsxDEV("div",{className:"px-2.5 py-2 text-small text-fg-subtle",children:"No matching block types"},void 0,!1,void 0,this):g.map((x,w)=>N.jsxDEV("button",{type:"button",onMouseEnter:()=>p(w),onMouseDown:(C)=>C.preventDefault(),onClick:()=>v(x.slug),className:`flex w-full items-center rounded-md px-2.5 py-1.5 text-left text-small ${w===f?"bg-surface-muted text-fg":"text-fg-muted hover:bg-surface-muted"}`,children:x.name},x.slug,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Obe({api:e,page:t,onSaved:n,onError:r}){let{cms:{multilingual:s,locales:i}}=nt(),[c,u]=fe.useState(t.title),[f,p]=fe.useState(t.slug),[m,g]=fe.useState(t.locale),[y,v]=fe.useState(!1),[x,w]=fe.useState(!1);fe.useEffect(()=>{u(t.title),p(t.slug),g(t.locale)},[t.id,t.title,t.slug,t.locale]);let C=c!==t.title||f.trim()!==t.slug||s&&m!==t.locale,I=async()=>{w(!0);try{let R=s?{title:c,slug:f.trim(),locale:m}:{title:c,slug:f.trim()},H=await e.call("updatePage",{pageId:t.id,...R});if(H?.page)n(H.page);v(!0),setTimeout(()=>v(!1),1500)}catch(R){r(ht(R))}finally{w(!1)}};return N.jsxDEV("div",{className:"flex flex-col gap-4",children:[y?N.jsxDEV(ip,{ok:!0,children:"saved"},void 0,!1,void 0,this):null,N.jsxDEV(pn,{label:"Title",value:c,onChange:u},void 0,!1,void 0,this),N.jsxDEV(pn,{label:"Slug",value:f,onChange:p},void 0,!1,void 0,this),s?N.jsxDEV("label",{className:"flex flex-col gap-1 text-sm",children:[N.jsxDEV("span",{className:"font-medium text-fg",children:"Locale"},void 0,!1,void 0,this),N.jsxDEV("select",{className:at,value:m,onChange:(R)=>g(R.target.value),children:[i.includes(m)?null:N.jsxDEV("option",{value:m,children:[m||"(unset)"," — not a declared locale"]},void 0,!0,void 0,this),i.map((R)=>N.jsxDEV("option",{value:R,children:R},R,!1,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,N.jsxDEV(me,{onPress:I,isDisabled:x||!C||!c.trim()||!f.trim(),children:x?"Saving…":"Save settings"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Bbe({api:e,page:t,schema:n,initialFields:r,onDirtyChange:s,onError:i}){let[c,u]=fe.useState(r),[f,p]=fe.useState("idle"),m=fe.useRef(JSON.stringify(r)),g=JSON.stringify(c)!==m.current,y=fe.useRef(t.id);fe.useEffect(()=>{if(y.current===t.id)return;y.current=t.id,u(r),m.current=JSON.stringify(r)},[t.id,r]),fe.useEffect(()=>{s("page",g)},[g,s]),fe.useEffect(()=>()=>{s("page",!1)},[s]);let v=fe.useCallback(async()=>{let w=JSON.stringify(c);if(w===m.current)return;p("saving");try{await e.call("updatePage",{pageId:t.id,fields:c}),m.current=w,p("saved"),setTimeout(()=>p((C)=>C==="saved"?"idle":C),1500)}catch(C){i(ht(C)),p("idle")}},[e,t.id,c,i]),x=fe.useRef(v);return x.current=v,fe.useEffect(()=>{if(!g)return;let w=setTimeout(()=>void x.current(),800);return()=>clearTimeout(w)},[c,g]),N.jsxDEV("div",{className:"mb-10",children:[N.jsxDEV("div",{className:"mb-1 flex items-center gap-2",children:[N.jsxDEV("span",{className:"text-caption font-medium uppercase tracking-wide text-fg-subtle",children:"Page fields"},void 0,!1,void 0,this),N.jsxDEV("span",{className:`text-caption ${g&&f!=="saving"?"text-accent-strong":"text-fg-subtle"}`,children:f==="saving"?"saving…":f==="saved"?"saved ✓":g?"● unsaved":""},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV(jh,{schema:n,value:c,onChange:u,api:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Hbe({api:e,page:t,onError:n}){let[r,s]=fe.useState({metaTitle:t.metaTitle??"",metaDescription:t.metaDescription??"",canonicalUrl:t.canonicalUrl??"",robots:t.robots??"",ogTitle:t.ogTitle??"",ogDescription:t.ogDescription??""}),[i,c]=fe.useState(!1),u=async()=>{try{await e.call("updatePageSeo",{pageId:t.id,...r}),c(!0),setTimeout(()=>c(!1),1500)}catch(p){n(ht(p))}},f=(p,m,g=!1)=>g?N.jsxDEV(fh,{label:m,value:r[p],onChange:(y)=>s({...r,[p]:y})},void 0,!1,void 0,this):N.jsxDEV(pn,{label:m,value:r[p],onChange:(y)=>s({...r,[p]:y})},void 0,!1,void 0,this);return N.jsxDEV("div",{className:"flex flex-col gap-4",children:[N.jsxDEV(sp,{children:"SEO"},void 0,!1,void 0,this),i?N.jsxDEV(ip,{ok:!0,children:"saved"},void 0,!1,void 0,this):null,f("metaTitle","Meta title"),f("metaDescription","Meta description",!0),f("canonicalUrl","Canonical URL"),f("robots","Robots (e.g. noindex)"),f("ogTitle","OG title"),f("ogDescription","OG description",!0),N.jsxDEV(me,{className:"w-full",onPress:u,children:"Save SEO"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Fbe({api:e,page:t,onError:n}){let[r,s]=fe.useState([]),[i,c]=fe.useState(""),u=fe.useCallback(()=>e.call("listTranslations",{pageId:t.id}).then(s).catch((p)=>n(ht(p))),[e,t.id,n]);fe.useEffect(()=>{u()},[u]);let f=async()=>{try{await e.call("createTranslation",{pageId:t.id,locale:i}),c(""),u()}catch(p){n(ht(p))}};return N.jsxDEV("div",{children:[N.jsxDEV(sp,{children:"Translations"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex flex-col gap-2",children:r.map((p)=>N.jsxDEV("div",{className:Za,children:[N.jsxDEV("span",{className:"flex-1 truncate font-medium",children:p.locale},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-fg-subtle",children:["/",p.slug]},void 0,!0,void 0,this),N.jsxDEV(op,{status:p.status,children:p.status},void 0,!1,void 0,this)]},p.id,!0,void 0,this))},void 0,!1,void 0,this),N.jsxDEV("div",{className:"mt-2 flex items-end gap-1.5",children:[N.jsxDEV(pn,{label:"",value:i,onChange:c,placeholder:"locale (e.g. cs)"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"secondary",onPress:f,isDisabled:!i,children:"add"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function _be({api:e,pageId:t,canEdit:n,onError:r}){let[s,i]=fe.useState(null),[c,u]=fe.useState({}),[f,p]=fe.useState(()=>new Set),[m,g]=fe.useState(!1),[y,v]=fe.useState(!1);fe.useEffect(()=>{let C=!0;return(async()=>{try{let I=await e.listTaxonomies("page");if(!C)return;i(I);let[R,H]=await Promise.all([Promise.all(I.map(async(L)=>[L.slug,E1(await e.getTermTree(L.slug)).map((_)=>_.term)])),e.listPageTerms(t)]);if(!C)return;u(Object.fromEntries(R)),p(new Set(H.map((L)=>L.id)))}catch(I){if(C)r(ht(I))}})(),()=>{C=!1}},[e,t,r]);let x=(C)=>{p((I)=>{let R=new Set(I);if(R.has(C))R.delete(C);else R.add(C);return R})},w=async()=>{g(!0);try{await e.setPageTerms(t,[...f]),v(!0),setTimeout(()=>v(!1),1200)}catch(C){r(ht(C))}finally{g(!1)}};if(s===null)return N.jsxDEV("p",{className:"text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this);if(s.length===0)return N.jsxDEV("p",{className:"text-fg-subtle",children:"No vocabularies apply to pages yet — set one up under Taxonomies."},void 0,!1,void 0,this);return N.jsxDEV("div",{className:"flex flex-col gap-4",children:[y?N.jsxDEV(ip,{ok:!0,children:"saved"},void 0,!1,void 0,this):null,s.map((C)=>N.jsxDEV("div",{children:[N.jsxDEV(sp,{children:C.label},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex flex-col gap-1",children:[(c[C.slug]??[]).length===0?N.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"No terms yet."},void 0,!1,void 0,this):null,(c[C.slug]??[]).map((I)=>N.jsxDEV("label",{className:"flex items-center gap-2",children:[N.jsxDEV("input",{type:"checkbox",disabled:!n,checked:f.has(I.id),onChange:()=>x(I.id)},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-sm text-fg",children:I.label},void 0,!1,void 0,this)]},I.id,!0,void 0,this))]},void 0,!0,void 0,this)]},C.id,!0,void 0,this)),n?N.jsxDEV(me,{size:"sm",className:"self-start",onPress:w,isDisabled:m,children:m?"Saving…":"Save terms"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function zbe({api:e,pageId:t,onError:n}){let[r,s]=fe.useState([]);return fe.useEffect(()=>{e.listPageAudit(t).then(s).catch((i)=>n(ht(i)))},[e,t,n]),N.jsxDEV("div",{children:[N.jsxDEV(sp,{children:"Audit trail"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex flex-col gap-2",children:[r.map((i)=>N.jsxDEV("div",{className:`${Za} text-xs`,children:[N.jsxDEV("span",{className:"rounded-full bg-surface-muted px-2 py-0.5 font-mono text-xs text-fg-muted",children:i.action},void 0,!1,void 0,this),N.jsxDEV("span",{className:"flex-1 truncate text-fg-subtle",children:[i.fromStatus," → ",i.toStatus]},void 0,!0,void 0,this),N.jsxDEV("span",{className:"text-fg-subtle",children:i.actor??"system"},void 0,!1,void 0,this)]},i.id,!0,void 0,this)),r.length===0?N.jsxDEV("p",{className:"text-fg-subtle",children:"No history yet."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function kQ({active:e,onPress:t,children:n}){return N.jsxDEV(me,{variant:"ghost",size:"sm","aria-pressed":e,className:`rounded-full px-3 py-1 text-compact ${e?"bg-surface-muted font-medium text-fg":"text-fg-muted hover:text-fg"}`,onPress:t,children:n},void 0,!1,void 0,this)}function Ube(e,t,n){if(e===0)return n?"No matches":"None yet";return e===1&&!t?"1 file":`${e}${t?"+":""} files`}function OQ({api:e,onError:t}){let{cms:{mediaTerms:n,canEdit:r}}=nt(),[s,i]=fe.useState([]),[c,u]=fe.useState(0),[f,p]=fe.useState(!1),[m,g]=fe.useState(null),[y,v]=fe.useState(!1),x=fe.useRef(null),[w,C]=fe.useState([]),[I,R]=fe.useState(!1),[H,L]=fe.useState("newest"),[_,W]=fe.useState(null),[z,F]=fe.useState(""),[ne,V]=fe.useState("");fe.useEffect(()=>{let se=setTimeout(()=>V(z.trim()),Vbe);return()=>clearTimeout(se)},[z]);let[ie,ae]=fe.useState(null),[re,D]=fe.useState([]),[B,U]=fe.useState({});fe.useEffect(()=>{if(!n)return;let se=!0;return(async()=>{try{let de=await e.listTaxonomies("media"),ge=await Promise.all(de.map(async(Re)=>[Re.slug,E1(await e.getTermTree(Re.slug)).map((ye)=>ye.term)]));if(!se)return;D(de),U(Object.fromEntries(ge))}catch{if(se)D([]),U({})}})(),()=>{se=!1}},[e,n]);let Q=re.flatMap((se)=>(B[se.slug]??[]).map((de)=>({id:de.id,label:de.label,group:se.label}))),xe=_!==null||ie!==null||ne!=="",le=fe.useCallback((se)=>{e.listMedia({limit:RQ,offset:se,sort:H,kind:_??void 0,q:ne||void 0,term:ie??void 0}).then((de)=>{i((ge)=>se===0?de:[...ge,...de]),p(de.length===RQ),u(se+de.length)}).catch((de)=>t(ht(de)))},[e,t,H,_,ne,ie]),k=fe.useCallback(()=>{e.listTrash().then((se)=>C(se.media??[])).catch((se)=>t(ht(se)))},[e,t]);fe.useEffect(()=>{le(0)},[le]),fe.useEffect(()=>{k()},[k]);let te=async(se)=>{try{await e.restoreMedia(se),k(),le(0)}catch(de){t(ht(de))}},Ce=async(se)=>{if(!confirm("Delete this file permanently? The file itself is removed and cannot be recovered."))return;try{await e.purgeMedia(se),k()}catch(de){t(ht(de))}},$e=async(se)=>{if(!se?.length)return;v(!0),t("");try{for(let de of Array.from(se))await e.uploadMedia(de);le(0)}catch(de){t(ht(de))}finally{v(!1)}};return N.jsxDEV(N.Fragment,{children:[N.jsxDEV(A1,{lead:"Media",em:Ube(s.length,f,xe),children:[N.jsxDEV("input",{ref:x,type:"file",multiple:!0,hidden:!0,disabled:y,onChange:(se)=>{$e(se.target.files),se.target.value=""}},void 0,!1,void 0,this),N.jsxDEV(me,{className:"shrink-0",isDisabled:y,onPress:()=>x.current?.click(),children:y?"Uploading…":"+ Upload"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:nn,children:[N.jsxDEV("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[N.jsxDEV(Nj,{"aria-label":"Search media",placeholder:"Search files…",value:z,onChange:F,className:"w-[220px] shrink-0"},void 0,!1,void 0,this),N.jsxDEV(sS,{children:[N.jsxDEV(me,{variant:"secondary",size:"sm",className:"shrink-0 px-3 py-1 text-compact",children:IA[H]},void 0,!1,void 0,this),N.jsxDEV(iS,{"aria-label":"Sort media",onAction:(se)=>L(se),children:OK.map((se)=>N.jsxDEV($b,{id:se,children:IA[se]},se,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),n&&Q.length>0?N.jsxDEV(sS,{children:[N.jsxDEV(me,{variant:"secondary",size:"sm",className:"shrink-0 px-3 py-1 text-compact",children:ie?Q.find((se)=>se.id===ie)?.label??"Tag":"All tags"},void 0,!1,void 0,this),N.jsxDEV(iS,{"aria-label":"Filter media by tag",onAction:(se)=>ae(se===MQ?null:String(se)),children:[N.jsxDEV($b,{id:MQ,children:"All tags"},void 0,!1,void 0,this),Q.map((se)=>N.jsxDEV($b,{id:se.id,children:[se.group," · ",se.label]},se.id,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null,N.jsxDEV("div",{className:"flex flex-wrap items-center gap-1",children:[N.jsxDEV(kQ,{active:_===null,onPress:()=>W(null),children:"All"},void 0,!1,void 0,this),BK.map((se)=>N.jsxDEV(kQ,{active:_===se,onPress:()=>W(_===se?null:se),children:HK[se]},se,!1,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),s.length===0?xe?N.jsxDEV("div",{className:"flex flex-wrap items-center gap-3",children:[N.jsxDEV("p",{className:"text-fg-subtle",children:"No files match this filter."},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>{F(""),V(""),W(null),ae(null)},children:"Clear filters"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):N.jsxDEV("p",{className:"text-fg-subtle",children:"No media yet. Upload images to use them in blocks and SEO."},void 0,!1,void 0,this):N.jsxDEV("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2.5",children:s.map((se)=>N.jsxDEV("div",{className:`cursor-pointer overflow-hidden rounded-lg border bg-surface-card ${m?.id===se.id?"border-fg":"border-border"}`,onClick:()=>g(se),children:[FQ(se)?N.jsxDEV("img",{className:"block h-[130px] w-full object-cover",src:e.resolve(`/media/${se.file.key}`),alt:se.alt??""},void 0,!1,void 0,this):N.jsxDEV("div",{className:"flex h-[130px] items-center justify-center bg-surface-muted font-mono text-xs text-fg-subtle",children:_Q(se)},void 0,!1,void 0,this),N.jsxDEV("div",{className:"truncate px-2 py-1.5 text-[11px] text-fg-muted",children:se.file.filename??se.id},void 0,!1,void 0,this)]},se.id,!0,void 0,this))},void 0,!1,void 0,this),f?N.jsxDEV("div",{className:"mt-3.5 text-center",children:N.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>le(c),children:"Load more"},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,w.length>0?N.jsxDEV("div",{className:"mt-6 border-t border-border pt-4",children:[N.jsxDEV("button",{type:"button",className:"text-small text-fg-muted underline",onClick:()=>R((se)=>!se),children:[I?"Hide":"Show"," trash (",w.length,")"]},void 0,!0,void 0,this),I?N.jsxDEV(N.Fragment,{children:[N.jsxDEV("p",{className:"mt-2 text-small text-fg-subtle",children:"Trashed files are hidden from the library but the file itself still exists — a page published while it was in use keeps showing it. Delete permanently to remove the file."},void 0,!1,void 0,this),N.jsxDEV("div",{className:"mt-2.5 flex flex-col gap-1.5",children:w.map((se)=>N.jsxDEV("div",{className:"flex items-center gap-2.5 rounded-lg border border-border bg-surface-muted px-3 py-2",children:[N.jsxDEV("span",{className:"flex-1 truncate text-small text-fg-muted",children:se.file?.filename??se.id},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>te(se.id),children:"Restore"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>Ce(se.id),children:"Delete permanently"},void 0,!1,void 0,this)]},se.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this):null,m?N.jsxDEV(jbe,{api:e,media:m,taxa:n?re:[],terms:B,canEdit:r,onClose:()=>g(null),onSaved:(se)=>{g(se),i((de)=>de.map((ge)=>ge.id===se.id?se:ge))},onDeleted:(se)=>{g(null),i((de)=>de.filter((ge)=>ge.id!==se)),k()},onTermsSaved:()=>{if(ie)le(0)},onError:t},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function jbe({api:e,media:t,taxa:n,terms:r,canEdit:s,onClose:i,onSaved:c,onDeleted:u,onTermsSaved:f,onError:p}){let[m,g]=fe.useState(t.alt??""),[y,v]=fe.useState(!1);fe.useEffect(()=>g(t.alt??""),[t]);let x=e.resolve(`/media/${t.file.key}`),w=async()=>{v(!0);try{c(await e.updateMedia(t.id,m||null))}catch(I){p(ht(I))}finally{v(!1)}},C=async()=>{if(!confirm("Move this file to the trash? It disappears from the library, but a page published while it was in use keeps showing it — delete it permanently from the trash to remove the file itself."))return;v(!0);try{await e.deleteMedia(t.id),u(t.id)}catch(I){p(ht(I))}finally{v(!1)}};return N.jsxDEV(yM,{onClose:i,size:"lg",title:N.jsxDEV(N.Fragment,{children:[N.jsxDEV(Gh,{children:"Media"},void 0,!1,void 0,this)," ",t.file.filename??""]},void 0,!0,void 0,this),children:[FQ(t)?N.jsxDEV("img",{className:"mx-auto mb-3.5 block max-h-[340px] max-w-full rounded-lg bg-surface-muted object-contain",src:x,alt:t.alt??""},void 0,!1,void 0,this):N.jsxDEV("div",{className:"mb-3.5 flex h-[200px] items-center justify-center rounded-lg bg-surface-muted font-mono text-fg-subtle",children:_Q(t)},void 0,!1,void 0,this),N.jsxDEV("div",{className:"mb-4",children:N.jsxDEV(pn,{label:"Alt text (for accessibility & SEO)",value:m,onChange:g,placeholder:"Describe the image…"},void 0,!1,void 0,this)},void 0,!1,void 0,this),N.jsxDEV(vM,{children:[N.jsxDEV("span",{children:"Type"},void 0,!1,void 0,this),N.jsxDEV("span",{children:t.file.contentType??"—"},void 0,!1,void 0,this),N.jsxDEV("span",{children:"Size"},void 0,!1,void 0,this),N.jsxDEV("span",{children:Xbe(t.file.size)},void 0,!1,void 0,this),N.jsxDEV("span",{children:"Uploaded"},void 0,!1,void 0,this),N.jsxDEV("span",{children:t.file.uploadedAt?new Date(t.file.uploadedAt).toLocaleString():t.createdAt??"—"},void 0,!1,void 0,this),N.jsxDEV("span",{children:"URL"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"break-all",children:N.jsxDEV("a",{className:"underline underline-offset-2",href:x,target:"_blank",rel:"noreferrer",children:["/media/",t.file.key]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),n.length>0?N.jsxDEV(Kbe,{api:e,mediaId:t.id,taxa:n,terms:r,canEdit:s,onSaved:f,onError:p},void 0,!1,void 0,this):null,N.jsxDEV("div",{className:"mt-3.5 flex items-center gap-2",children:[N.jsxDEV(me,{onPress:w,isDisabled:y||m===(t.alt??""),children:"Save"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"secondary",size:"sm",onPress:()=>navigator.clipboard?.writeText(x),children:"Copy URL"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"flex-1"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",className:"text-danger",onPress:C,isDisabled:y,children:"Delete"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",onPress:i,children:"Close"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Kbe({api:e,mediaId:t,taxa:n,terms:r,canEdit:s,onSaved:i,onError:c}){let[u,f]=fe.useState(null),[p,m]=fe.useState(!1),[g,y]=fe.useState(!1);fe.useEffect(()=>{let w=!0;return f(null),e.listMediaTerms(t).then((C)=>{if(w)f(new Set(C.map((I)=>I.id)))}).catch((C)=>{if(w)f(new Set),c(ht(C))}),()=>{w=!1}},[e,t,c]);let v=(w)=>{f((C)=>{let I=new Set(C??[]);if(I.has(w))I.delete(w);else I.add(w);return I})},x=async()=>{m(!0);try{await e.setMediaTerms(t,[...u??[]]),y(!0),setTimeout(()=>y(!1),1200),i()}catch(w){c(ht(w))}finally{m(!1)}};if(u===null)return N.jsxDEV("div",{className:"mt-4 border-t border-border pt-3.5 text-small text-fg-subtle",children:"Loading tags…"},void 0,!1,void 0,this);return N.jsxDEV("div",{className:"mt-4 border-t border-border pt-3.5",children:[N.jsxDEV(sp,{children:"Tags"},void 0,!1,void 0,this),g?N.jsxDEV(ip,{ok:!0,children:"saved"},void 0,!1,void 0,this):null,N.jsxDEV("div",{className:"flex flex-col gap-2.5",children:n.map((w)=>{let C=r[w.slug]??[];return N.jsxDEV("div",{children:[N.jsxDEV("div",{className:"mb-1 text-caption text-fg-subtle",children:w.label},void 0,!1,void 0,this),C.length===0?N.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"No terms yet."},void 0,!1,void 0,this):N.jsxDEV("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:C.map((I)=>N.jsxDEV("label",{className:"flex items-center gap-2",children:[N.jsxDEV("input",{type:"checkbox",disabled:!s,checked:u.has(I.id),onChange:()=>v(I.id)},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-sm text-fg",children:I.label},void 0,!1,void 0,this)]},I.id,!0,void 0,this))},void 0,!1,void 0,this)]},w.id,!0,void 0,this)})},void 0,!1,void 0,this),s?N.jsxDEV(me,{size:"sm",variant:"secondary",className:"mt-2.5 self-start",onPress:x,isDisabled:p,children:p?"Saving…":"Save tags"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function Gbe(e){let t=e.roles;if(Array.isArray(t))return t.filter((n)=>typeof n==="string");if(typeof t==="string")try{let n=JSON.parse(t);return Array.isArray(n)?n:[]}catch{return[]}return[]}function BQ({api:e,me:t,onError:n}){let[r,s]=fe.useState([]),[i,c]=fe.useState(!1),[u,f]=fe.useState(""),p=fe.useCallback(()=>{e.call("listUsers",{limit:200}).then(s).catch((v)=>n(ht(v)))},[e,n]);fe.useEffect(()=>{p()},[p]);let m=async(v,x)=>{f(v.username);try{await e.call("setUserRoles",{username:v.username,roles:x}),p()}catch(w){n(ht(w))}finally{f("")}},g=async(v,x)=>{f(v.username);try{await e.call("setUserActive",{username:v.username,active:x}),p()}catch(w){n(ht(w))}finally{f("")}},y=async(v)=>{if(!confirm(`Delete user ${v.username}? This cannot be undone.`))return;f(v.username);try{await e.call("deleteUser",{username:v.username}),p()}catch(x){n(ht(x))}finally{f("")}};return N.jsxDEV(N.Fragment,{children:[N.jsxDEV(A1,{lead:"Users",em:r.length===0?"None yet":r.length===1?"1 account":`${r.length} accounts`,children:N.jsxDEV(me,{className:"shrink-0",onPress:()=>c(!0),children:"+ Invite"},void 0,!1,void 0,this)},void 0,!1,void 0,this),N.jsxDEV("div",{className:nn,children:N.jsxDEV("div",{className:"flex flex-col gap-2",children:[r.map((v)=>{let x=Gbe(v),w=t?.userId===v.username,C=v.active===void 0||v.active===null?!0:Boolean(Number(v.active));return N.jsxDEV("div",{className:`${Za} flex-wrap items-start`,children:[N.jsxDEV("div",{className:"flex min-w-[200px] flex-1 flex-col gap-0.5",children:[N.jsxDEV("span",{className:"font-semibold",children:[v.username,w?N.jsxDEV("span",{className:"ml-1.5 font-normal text-fg-subtle",children:"(you)"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),v.email&&v.email!==v.username?N.jsxDEV("span",{className:"text-xs text-fg-subtle",children:v.email},void 0,!1,void 0,this):null,v.createdAt?N.jsxDEV("span",{className:"text-[11px] text-fg-subtle",children:["joined ",new Date(Number(v.createdAt)).toLocaleDateString()]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),N.jsxDEV(qbe,{value:x,disabled:u===v.username,onSave:(I)=>m(v,I)},void 0,!1,void 0,this),N.jsxDEV(op,{status:C?"active":"inactive",children:C?"active":"inactive"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",size:"sm",isDisabled:u===v.username||w,onPress:()=>g(v,!C),children:C?"Deactivate":"Activate"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",size:"sm",className:"text-danger",isDisabled:u===v.username||w,onPress:()=>y(v),children:"Delete"},void 0,!1,void 0,this)]},v.username,!0,void 0,this)}),r.length===0?N.jsxDEV("p",{className:"text-fg-subtle",children:"No users yet. Invite someone to get started."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this),i?N.jsxDEV(Wbe,{api:e,onClose:()=>c(!1),onInvited:()=>{c(!1),p()},onError:n},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function qbe({value:e,disabled:t,onSave:n}){let[r,s]=fe.useState(e.join(", ")),[i,c]=fe.useState(!1);fe.useEffect(()=>{s(e.join(", "))},[e]);let u=()=>{c(!1);let f=r.split(",").map((p)=>p.trim()).filter(Boolean);if(f.length===0){s(e.join(", "));return}if(f.length===e.length&&f.every((p,m)=>p===e[m]))return;n(f)};if(i)return N.jsxDEV("input",{autoFocus:!0,className:"h-10 w-[220px] rounded-lg border border-border bg-surface-card px-4 text-sm text-fg outline-none focus:border-brand-green",value:r,disabled:t,onChange:(f)=>s(f.target.value),onBlur:u,onKeyDown:(f)=>{if(f.key==="Enter")u();if(f.key==="Escape")s(e.join(", ")),c(!1)}},void 0,!1,void 0,this);return N.jsxDEV("span",{className:"flex cursor-pointer flex-wrap gap-1",onClick:()=>c(!0),title:"Click to edit",children:e.length===0?N.jsxDEV(op,{children:"no roles"},void 0,!1,void 0,this):e.map((f)=>N.jsxDEV(op,{status:f==="admin"?"published":void 0,children:f},f,!1,void 0,this))},void 0,!1,void 0,this)}function Wbe({api:e,onClose:t,onInvited:n,onError:r}){let[s,i]=fe.useState(""),[c,u]=fe.useState("editor"),[f,p]=fe.useState(!1);return N.jsxDEV(yM,{onClose:t,title:N.jsxDEV(N.Fragment,{children:["Invite an ",N.jsxDEV(Gh,{children:"editor"},void 0,!1,void 0,this)," or teammate"]},void 0,!0,void 0,this),description:"They'll get a one-time magic link that logs them in and creates their account.",children:N.jsxDEV("div",{className:"flex flex-col gap-4",children:[N.jsxDEV(pn,{label:"Email",type:"email",autoFocus:!0,value:s,onChange:i,placeholder:"them@example.com"},void 0,!1,void 0,this),N.jsxDEV(pn,{label:"Roles (comma-separated — e.g. editor, reviewer, admin)",value:c,onChange:u,placeholder:"editor"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"mt-2 flex justify-end gap-2",children:[N.jsxDEV(me,{variant:"ghost",onPress:t,children:"Cancel"},void 0,!1,void 0,this),N.jsxDEV(me,{onPress:async()=>{p(!0);try{let g=c.split(",").map((y)=>y.trim()).filter(Boolean);await e.call("inviteUser",{email:s,roles:g}),n()}catch(g){r(ht(g))}finally{p(!1)}},isDisabled:f||!s,children:f?"Sending…":"Send invite"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function HQ({api:e,cfg:t,me:n,onSignOut:r,onError:s}){return N.jsxDEV(N.Fragment,{children:[N.jsxDEV(A1,{lead:"Settings",em:n?.userId??"your account"},void 0,!1,void 0,this),N.jsxDEV("div",{className:`${nn} grid grid-cols-2 gap-5 max-[820px]:grid-cols-1`,children:[N.jsxDEV(Zbe,{api:e,me:n,onError:s,onSignOut:r},void 0,!1,void 0,this),N.jsxDEV(Ybe,{cfg:t,me:n},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Zbe({api:e,me:t,onError:n,onSignOut:r}){let[s,i]=fe.useState(""),[c,u]=fe.useState(""),[f,p]=fe.useState(""),[m,g]=fe.useState(""),[y,v]=fe.useState(!1),x=(I)=>{g(I),setTimeout(()=>g(""),1800)},w=async()=>{v(!0);try{await e.call("changeEmail",{email:s}),i(""),x("Contact email updated")}catch(I){n(ht(I))}finally{v(!1)}},C=async()=>{v(!0);try{await e.call("changePassword",{currentPassword:c,newPassword:f}),u(""),p(""),x("Password updated")}catch(I){n(ht(I))}finally{v(!1)}};return N.jsxDEV(NQ,{children:[N.jsxDEV(sp,{children:"My account"},void 0,!1,void 0,this),m?N.jsxDEV(ip,{ok:!0,children:m},void 0,!1,void 0,this):null,N.jsxDEV(vM,{className:"mb-4",children:[N.jsxDEV("span",{children:"Username"},void 0,!1,void 0,this),N.jsxDEV("span",{children:t?.userId??"—"},void 0,!1,void 0,this),N.jsxDEV("span",{children:"Roles"},void 0,!1,void 0,this),N.jsxDEV("span",{children:(t?.roles??[]).join(", ")||"—"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"flex flex-col gap-4",children:[N.jsxDEV(pn,{label:"Change contact email",type:"email",value:s,onChange:i,placeholder:"you@example.com"},void 0,!1,void 0,this),N.jsxDEV(me,{className:"w-full",onPress:w,isDisabled:y||!s,children:"Save email"},void 0,!1,void 0,this),N.jsxDEV(pn,{label:"Current password",type:"password",value:c,onChange:u,autoComplete:"current-password"},void 0,!1,void 0,this),N.jsxDEV(pn,{label:"New password (at least 8 characters)",type:"password",value:f,onChange:p,autoComplete:"new-password"},void 0,!1,void 0,this),N.jsxDEV(me,{className:"w-full",onPress:C,isDisabled:y||f.length<8||c.length===0,children:"Change password"},void 0,!1,void 0,this),N.jsxDEV(me,{variant:"ghost",className:"mt-2 w-full text-danger",onPress:r,children:"Sign out"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Ybe({cfg:e,me:t}){return N.jsxDEV(NQ,{children:[N.jsxDEV(sp,{children:"About"},void 0,!1,void 0,this),N.jsxDEV(vM,{children:[N.jsxDEV("span",{children:"Tenant"},void 0,!1,void 0,this),N.jsxDEV("span",{children:e.tenant||"main"},void 0,!1,void 0,this),N.jsxDEV("span",{children:"API"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"break-all",children:e.baseUrl},void 0,!1,void 0,this),N.jsxDEV("span",{children:"Signed in as"},void 0,!1,void 0,this),N.jsxDEV("span",{children:t?.userId??"—"},void 0,!1,void 0,this),N.jsxDEV("span",{children:"Editor"},void 0,!1,void 0,this),N.jsxDEV("span",{children:"pramen · cms-editor"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function FQ(e){return(e.file.contentType??"").startsWith("image/")}function _Q(e){let t=(e.file.contentType??"").split("/")[1];return(e.file.filename?.split(".").pop()??t??"file").slice(0,5).toUpperCase()}function Xbe(e){if(!e||e<=0)return"—";let t=["B","KB","MB","GB"],n=0,r=e;while(r>=1024&&n<t.length-1)r/=1024,n++;return`${r<10&&n>0?r.toFixed(1):Math.round(r)} ${t[n]}`}function ht(e){if(e instanceof mh)return e.message;return e instanceof Error?e.message:String(e)}function Jbe(e){return e.replace(/<[^>]*>/g," ").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\s+/g," ").trim()}function Qbe(e){if(typeof e==="string")return Jbe(e);if(Uh(e))return T1(e).replace(/\s+/g," ").trim();return""}function e1e(e){let t="";for(let n of Object.values(e))if(t=Qbe(n),t)break;if(!t)return"";return t.length>90?t.slice(0,90)+"…":t}function t1e(e,t,n,r,s){let i=n+r;if(i<0||i>=e.length)return;let c=e.map((u)=>u.id);[c[n],c[i]]=[c[i],c[n]],s(t,c)}var fe,N,kbe,Rbe,A1,Gh=({children:e})=>N.jsxDEV("span",{className:"text-fg-subtle",children:e},void 0,!1,void 0,this),IQ=50,EQ=50,RQ=60,Vbe=250,MQ="__all";var vo=E(()=>{Ur();$A();I1();xS();mM();Rn();dM();wc();Pf();fe=O(ee(),1),N=O(Me(),1),kbe=["settings","seo","i18n","terms","audit"],Rbe={settings:"Settings",seo:"SEO",i18n:"Translations",terms:"Terms",audit:"History"};A1=$4});function n1e(){try{return localStorage.getItem(UQ)==="dark"?"dark":"light"}catch{return"light"}}function jQ(e){if(typeof document<"u")document.documentElement.dataset.theme=e}function KQ(){k1=n1e(),jQ(k1)}function zQ(){return k1}function GQ(e){if(e===k1)return;k1=e,jQ(e);try{localStorage.setItem(UQ,e)}catch{}for(let t of[...xM])t()}function o1e(e){return xM.add(e),()=>xM.delete(e)}function A4(){return VQ.useSyncExternalStore(o1e,zQ,zQ)}var VQ,UQ="pramen.cms.theme",k1="light",xM;var k4=E(()=>{VQ=O(ee(),1),xM=new Set});function ree({api:e,slug:t,label:n,onError:r}){let[s,i]=ui.useState(null),[c,u]=ui.useState({}),[f,p]=ui.useState(!1),[m,g]=ui.useState(!1),[y,v]=ui.useState(null),x=ui.useCallback(async(w)=>{p(!0),g(!1);try{let C=await e.adminPageInteract({page:t,type:w?.type??"page_load",...w??{}});i(C),u(v1e(C.blocks)),v(C.toast??null)}catch(C){g(!0),r(String(C.message??C))}finally{p(!1)}},[e,t,r]);return ui.useEffect(()=>{x()},[x]),ui.useEffect(()=>{if(!y)return;let w=setTimeout(()=>v(null),3000);return()=>clearTimeout(w)},[y]),Le.jsxDEV("div",{className:nn,children:[Le.jsxDEV("div",{className:"mb-6 mt-6 flex items-center gap-3",children:[Le.jsxDEV("h1",{className:"m-0 text-[32px] font-normal leading-[1.1] tracking-[-0.01em] text-fg",children:n},void 0,!1,void 0,this),f?Le.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"working…"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),y?Le.jsxDEV("div",{className:`mb-4 rounded-lg border px-3.5 py-2.5 text-small ${y.tone==="error"?"border-danger bg-surface-card text-danger":y.tone==="success"?"border-brand-green bg-brand-green/20 text-fg":"border-border bg-surface-card text-fg-muted"}`,children:y.text},void 0,!1,void 0,this):null,s===null?Le.jsxDEV("p",{className:"text-fg-subtle",children:m?"This screen could not be loaded.":"Loading…"},void 0,!1,void 0,this):Le.jsxDEV(wM,{blocks:s.blocks,values:c,setValue:(w,C)=>u((I)=>({...I,[w]:C})),disabled:f,onFire:(w)=>void x({...w,values:c})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function wM({blocks:e,values:t,setValue:n,disabled:r,onFire:s}){return Le.jsxDEV("div",{className:"flex flex-col gap-4",children:e.map((i,c)=>Le.jsxDEV(p1e,{block:i,values:t,setValue:n,disabled:r,onFire:s},f1e(i,c),!1,void 0,this))},void 0,!1,void 0,this)}function f1e(e,t){let n=e.type==="form"||e.type==="actions"||e.type==="table"?e.block_id:void 0;return n?`id:${n}`:`${e.type}:${t}`}function p1e({block:e,values:t,setValue:n,disabled:r,onFire:s}){switch(e.type){case"header":return Le.jsxDEV(Qo,{level:e.level===3?"3":e.level===2?"2":"1",className:"font-normal",children:e.text},void 0,!1,void 0,this);case"section":return Le.jsxDEV("p",{className:"max-w-[72ch] whitespace-pre-wrap text-sm text-fg",children:e.text},void 0,!1,void 0,this);case"context":return Le.jsxDEV("p",{className:"max-w-[72ch] text-caption text-fg-subtle",children:e.text},void 0,!1,void 0,this);case"divider":return Le.jsxDEV("hr",{className:"border-t border-border"},void 0,!1,void 0,this);case"empty":return Le.jsxDEV("div",{className:"rounded-lg border border-dashed border-border px-5 py-8 text-center",children:[Le.jsxDEV("p",{className:"text-sm text-fg-muted",children:e.text},void 0,!1,void 0,this),e.hint?Le.jsxDEV("p",{className:"mt-1 text-caption text-fg-subtle",children:e.hint},void 0,!1,void 0,this):null]},void 0,!0,void 0,this);case"fields":return Le.jsxDEV("div",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 text-[13px]",children:e.fields.map((i,c)=>Le.jsxDEV("div",{className:"contents",children:[Le.jsxDEV("span",{className:"text-fg-subtle",children:i.label},void 0,!1,void 0,this),Le.jsxDEV("span",{className:"text-fg",children:i.value},void 0,!1,void 0,this)]},c,!0,void 0,this))},void 0,!1,void 0,this);case"stats":return Le.jsxDEV("div",{className:"flex flex-wrap gap-3",children:e.stats.map((i,c)=>Le.jsxDEV("div",{className:"min-w-[140px] flex-1 rounded-lg border border-border bg-surface-card p-4",children:[Le.jsxDEV("div",{className:"text-caption text-fg-subtle",children:i.label},void 0,!1,void 0,this),Le.jsxDEV("div",{className:"mt-1 text-[24px] leading-none text-fg",children:i.value},void 0,!1,void 0,this),i.hint?Le.jsxDEV("div",{className:"mt-1 text-caption text-fg-subtle",children:i.hint},void 0,!1,void 0,this):null]},c,!0,void 0,this))},void 0,!1,void 0,this);case"table":return Le.jsxDEV(m1e,{block:e,values:t,setValue:n,disabled:r,onFire:s},void 0,!1,void 0,this);case"image":return Le.jsxDEV("figure",{className:"m-0",children:[Le.jsxDEV("img",{src:e.url,alt:e.alt??"",className:"max-w-full rounded-lg"},void 0,!1,void 0,this),e.caption?Le.jsxDEV("figcaption",{className:"mt-1 text-caption text-fg-subtle",children:e.caption},void 0,!1,void 0,this):null]},void 0,!0,void 0,this);case"columns":return Le.jsxDEV("div",{className:"grid gap-4 max-[820px]:grid-cols-1",style:{gridTemplateColumns:`repeat(${e.columns.length}, minmax(0, 1fr))`},children:e.columns.map((i,c)=>Le.jsxDEV(wM,{blocks:i,values:t,setValue:n,disabled:r,onFire:s},c,!1,void 0,this))},void 0,!1,void 0,this);case"accordion":return Le.jsxDEV("details",{className:"rounded-lg border border-border bg-surface-card px-4 py-3",open:e.open,children:[Le.jsxDEV("summary",{className:"cursor-pointer text-sm font-medium text-fg",children:e.title},void 0,!1,void 0,this),Le.jsxDEV("div",{className:"mt-3",children:Le.jsxDEV(wM,{blocks:e.blocks,values:t,setValue:n,disabled:r,onFire:s},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);case"actions":return Le.jsxDEV(b1e,{block:e,values:t,setValue:n,disabled:r,onFire:s},void 0,!1,void 0,this);case"form":return Le.jsxDEV(y1e,{block:e,values:t,setValue:n,disabled:r,onFire:s},void 0,!1,void 0,this);default:return Le.jsxDEV("p",{className:"text-caption text-fg-subtle",children:["[unsupported block: ",e.type,"]"]},void 0,!0,void 0,this)}}function m1e({block:e,values:t,setValue:n,disabled:r,onFire:s}){if(e.rows.length===0)return Le.jsxDEV("p",{className:"text-sm text-fg-subtle",children:e.empty??"Nothing here."},void 0,!1,void 0,this);return Le.jsxDEV("div",{className:"overflow-x-auto rounded-lg border border-border bg-surface-card",children:Le.jsxDEV("table",{className:"w-full border-collapse text-[13px]",children:[Le.jsxDEV("thead",{children:Le.jsxDEV("tr",{children:e.columns.map((i)=>Le.jsxDEV("th",{className:"border-b border-border px-3 py-2 text-left font-medium text-fg-subtle",children:i.label},i.key,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),Le.jsxDEV("tbody",{children:e.rows.map((i,c)=>Le.jsxDEV("tr",{children:e.columns.map((u)=>Le.jsxDEV("td",{className:"border-b border-border px-3 py-2 text-fg",children:Le.jsxDEV(h1e,{value:i[u.key],blockId:e.block_id,values:t,setValue:n,disabled:r,onFire:s},void 0,!1,void 0,this)},u.key,!1,void 0,this))},c,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function h1e({value:e,blockId:t,values:n,setValue:r,disabled:s,onFire:i}){if(aee(e))return Le.jsxDEV(see,{el:e,blockId:t,compact:!0,values:n,setValue:r,disabled:s,onFire:i},void 0,!1,void 0,this);return Le.jsxDEV(Le.Fragment,{children:g1e(e)},void 0,!1,void 0,this)}function aee(e){return e!==null&&typeof e==="object"&&DK.includes(e.type)}function g1e(e){if(e===null||e===void 0)return"";if(typeof e==="boolean")return e?"yes":"no";if(typeof e==="object")return`[unsupported cell: ${String(e.type)}]`;return String(e)}function b1e({block:e,values:t,setValue:n,disabled:r,onFire:s}){return Le.jsxDEV("div",{className:"flex flex-wrap items-end gap-3",children:e.elements.map((i,c)=>Le.jsxDEV(see,{el:i,blockId:e.block_id,values:t,setValue:n,disabled:r,onFire:s},i.type==="button"?`b:${c}`:`i:${i.action_id}`,!1,void 0,this))},void 0,!1,void 0,this)}function see({el:e,blockId:t,compact:n,values:r,setValue:s,disabled:i,onFire:c}){if(e.type==="button")return Le.jsxDEV(me,{size:n?"sm":void 0,variant:e.style==="primary"?"primary":e.style==="danger"?"ghost":"secondary",className:e.style==="danger"?"text-danger":void 0,isDisabled:i,onPress:()=>{if(e.confirm&&!confirm(e.confirm))return;c({type:"block_action",action_id:e.action_id,block_id:t,value:e.value??null})},children:e.label},void 0,!1,void 0,this);return Le.jsxDEV(iee,{input:e,value:r[e.action_id],onChange:(u)=>s(e.action_id,u),disabled:i},void 0,!1,void 0,this)}function y1e({block:e,values:t,setValue:n,disabled:r,onFire:s}){let i=e.fields.filter((c)=>c.type!=="toggle"&&c.required&&S1e(t[c.action_id]));return Le.jsxDEV("form",{className:"flex max-w-[720px] flex-col gap-3 rounded-lg border border-border bg-surface-card p-5",onSubmit:(c)=>{if(c.preventDefault(),i.length>0||r)return;s({type:"form_submit",action_id:e.submit.action_id,block_id:e.block_id})},children:[e.fields.map((c)=>Le.jsxDEV(iee,{input:c,value:t[c.action_id],onChange:(u)=>n(c.action_id,u),disabled:r},c.action_id,!1,void 0,this)),Le.jsxDEV("div",{className:"mt-1",children:[Le.jsxDEV(me,{type:"submit",isDisabled:r||i.length>0,children:e.submit.label},void 0,!1,void 0,this),i.length>0?Le.jsxDEV("span",{className:"ml-3 text-caption text-fg-subtle",children:["Fill in: ",i.map((c)=>c.label??c.action_id).join(", ")]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function TM(e,t=[]){for(let n of e)if(n.type==="form")t.push(...n.fields);else if(n.type==="actions")t.push(...n.elements.filter(oee));else if(n.type==="table")for(let r of n.rows)for(let s of n.columns){let i=r[s.key];if(aee(i)&&oee(i))t.push(i)}else if(n.type==="columns")for(let r of n.columns)TM(r,t);else if(n.type==="accordion")TM(n.blocks,t);return t}function v1e(e){return x1e(TM(e))}function x1e(e){let t={};for(let n of e)if(n.type==="toggle")t[n.action_id]=n.initial_value??!1;else if(n.type==="number_input")t[n.action_id]=n.initial_value??null;else if(n.type==="secret_input")t[n.action_id]="";else t[n.action_id]=n.initial_value??"";return t}function iee({input:e,value:t,onChange:n,disabled:r}){let s=e.label?Le.jsxDEV("span",{className:"text-caption text-fg-subtle",children:[e.label,e.type!=="toggle"&&e.required?Le.jsxDEV("span",{className:"text-danger",children:" *"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null,i=e.error?Le.jsxDEV("span",{role:"alert",className:"text-caption text-danger",children:e.error},void 0,!1,void 0,this):null;if(e.type==="toggle")return Le.jsxDEV("label",{className:"flex items-center gap-2",children:[Le.jsxDEV("input",{type:"checkbox",checked:t===!0,disabled:r,"aria-invalid":e.error?!0:void 0,onChange:(c)=>n(c.target.checked)},void 0,!1,void 0,this),Le.jsxDEV("span",{className:"text-sm text-fg",children:e.label??e.action_id},void 0,!1,void 0,this),i]},void 0,!0,void 0,this);return Le.jsxDEV("label",{className:"flex min-w-[180px] flex-col gap-1.5",children:[s,e.type==="select"?Le.jsxDEV("select",{className:at,value:typeof t==="string"?t:"",disabled:r,"aria-invalid":e.error?!0:void 0,"aria-label":e.label??e.action_id,onChange:(c)=>n(c.target.value),children:[Le.jsxDEV("option",{value:"",children:"—"},void 0,!1,void 0,this),e.options.map((c)=>Le.jsxDEV("option",{value:c.value,children:c.label},c.value,!1,void 0,this))]},void 0,!0,void 0,this):e.type==="number_input"?Le.jsxDEV("input",{className:at,type:"number",min:e.min,max:e.max,placeholder:e.placeholder,disabled:r,"aria-invalid":e.error?!0:void 0,"aria-label":e.label??e.action_id,value:typeof t==="number"?String(t):"",onChange:(c)=>n(c.target.value===""?null:Number(c.target.value))},void 0,!1,void 0,this):e.type==="text_input"&&e.multiline?Le.jsxDEV("textarea",{className:`${at} h-auto min-h-24 py-2.5`,placeholder:e.placeholder,disabled:r,"aria-invalid":e.error?!0:void 0,"aria-label":e.label??e.action_id,value:typeof t==="string"?t:"",onChange:(c)=>n(c.target.value)},void 0,!1,void 0,this):Le.jsxDEV("input",{className:at,type:e.type==="secret_input"?"password":"text",autoComplete:e.type==="secret_input"?"new-password":void 0,placeholder:e.placeholder,disabled:r,"aria-invalid":e.error?!0:void 0,"aria-label":e.label??e.action_id,value:typeof t==="string"?t:"",onChange:(c)=>n(c.target.value)},void 0,!1,void 0,this),i]},void 0,!0,void 0,this)}var ui,Le,oee=(e)=>e.type!=="button",S1e=(e)=>e===void 0||e===null||e==="";var lee=E(()=>{Ur();I1();Pf();ui=O(ee(),1),Le=O(Me(),1)});function C1e(e){let t=e instanceof Error?e.message:String(e);return t.trim()===""?"threw a value with no message":t}var cee,R1,IM;var uee=E(()=>{cee=O(ee(),1),R1=O(Me(),1);IM=class IM extends cee.Component{state={failure:null};static getDerivedStateFromError(e){return{failure:C1e(e)}}componentDidCatch(e,t){console.error(`pramen/cms-editor: panel '${this.props.slug}' failed to render`,e,t.componentStack)}componentDidUpdate(e){if(e.slug!==this.props.slug&&this.state.failure!==null)this.setState({failure:null})}render(){if(this.state.failure===null)return this.props.children;return R1.jsxDEV("div",{role:"alert",className:"rounded-panel border border-border bg-surface-card px-6 py-5 text-sm text-fg-muted",children:[R1.jsxDEV("p",{className:"mb-1 text-fg",children:["The ",R1.jsxDEV("strong",{children:this.props.slug},void 0,!1,void 0,this)," panel failed to render."]},void 0,!0,void 0,this),R1.jsxDEV("p",{className:"font-mono text-caption",children:this.state.failure},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}}});function R4(){fee+=1;for(let e of[...AM])e()}function dee(e,t,n){RM.set(e,t),n(`pramen/cms-editor: ${t}`),R4()}function $1e(e,t,n=1){if(typeof t!=="number"||!Number.isInteger(t)||t<1)return`The '${e}' panel did not state which panel runtime contract it was built against. Add \`contract: ${n}\` to its registerPanel() call and rebuild it against the @pramen/cms-editor this admin serves (React 19).`;if(t<n)return`The '${e}' panel was built against panel runtime contract ${t}, and this editor implements ${n}. Rebuild the bundle against the @pramen/cms-editor this admin serves (React 19) and set \`contract: ${n}\` in its registerPanel() call.`;if(t>n)return`The '${e}' panel was built against panel runtime contract ${t}, and this editor implements ${n}. Upgrade @pramen/cms-editor — and the shell that serves it — to the release implementing contract ${t}, or rebuild the panel against this one.`;return}function pee(e,t=console.warn){let n=typeof e?.slug==="string"?e.slug.trim():"";if(!n){t("pramen/cms-editor: ignoring a panel registered with no slug — the slug is what matches it to its adminPanel() entry.");return}let r=$1e(n,e.contract);if(r!==void 0)return dee(n,r,t);let s=typeof e.render;if(s!=="function")return dee(n,`The '${n}' panel was ignored: 'render' must be a React component, and this one is of type ${s}.`,t);if(EM.has(n))t(`pramen/cms-editor: panel '${n}' was registered twice — the last registration wins.`);RM.delete(n),EM.set(n,{slug:n,render:e.render}),R4()}function mee(e){return EM.get(e)}function hee(e){return RM.get(e)}function gee(){return kM===0}function MM(){return fee}function bee(e){return AM.add(e),()=>AM.delete(e)}function w1e(e,t){if(typeof e!=="string"||e.trim()==="")return;let n;try{n=new URL(e.trim(),t)}catch{return}if(n.protocol!=="http:"&&n.protocol!=="https:")return;return n.href}function yee(e,t,n=console.warn){let r=e?.PRAMEN_CMS_EDITOR?.panels;if(r===void 0)return[];if(!Array.isArray(r))return n("pramen/cms-editor: ignoring `panels` — it must be an array of module URLs."),[];let s=[];for(let i of r){let c=w1e(i,t);if(c===void 0)n(`pramen/cms-editor: ignoring unusable panel bundle URL ${JSON.stringify(i)} — it must be an http(s) URL or a path.`);else s.push(c)}return s}async function vee(e,t=T1e,n=console.warn){if(e.length===0)return;kM+=e.length,R4(),await Promise.all(e.map((r)=>t(r).catch((s)=>{n(`pramen/cms-editor: panel bundle ${r} failed to load — ${String(s?.message??s)}`)}).finally(()=>{kM-=1,R4()})))}var EM,AM,kM=0,fee=0,RM,T1e=(e)=>import(e);var M4=E(()=>{EM=new Map,AM=new Set,RM=new Map});function E1e({slug:e}){let{api:t,setError:n}=nt(),r=A4(),s=Ol().basePath,i=N4.useSyncExternalStore(bee,MM,MM),c=N4.useMemo(()=>mee(e),[e,i]);if(!c){let f=hee(e);return td.jsxDEV(Ut,{children:f??(gee()?`No panel is registered for '${e}'. Check that this deployment's panel bundle is listed in the admin's \`panels\` config and calls registerPanel({ slug: "${e}", … }).`:"Loading…")},void 0,!1,void 0,this)}let u={api:t,basePath:s,theme:r,setError:n};return td.jsxDEV(IM,{slug:e,children:td.jsxDEV(c.render,{...u},void 0,!1,void 0,this)},e,!1,void 0,this)}var N4,td,I1e;var xee=E(()=>{Dn();Rn();lee();vo();uee();M4();k4();Pf();Ur();N4=O(ee(),1),td=O(Me(),1),I1e=Tt().params({slug:"string"}).route("/apps/:slug").render(function({params:t}){let{api:n,adminPages:r,setError:s}=nt(),i=Bt(),c=r.find((u)=>u.slug===t.slug);if(!c)return td.jsxDEV(Ut,{action:r.length>0?td.jsxDEV(me,{variant:"ghost",size:"sm",onPress:()=>i("home"),children:"← Pages"},void 0,!1,void 0,this):void 0,children:r.length===0?"Loading…":`Unknown page: ${t.slug}`},void 0,!1,void 0,this);if(LK(c)==="panel")return td.jsxDEV(E1e,{slug:c.slug},void 0,!1,void 0,this);return td.jsxDEV(ree,{api:n,slug:c.slug,label:c.label,onError:s},c.slug,!1,void 0,this)})});function k1e(e){let t=e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^A-Za-z0-9]+/g," ").trim().split(" ").filter(Boolean);if(t.length===0)return"";let[n,...r]=t,s=n.toLowerCase()+r.map((i)=>i[0].toUpperCase()+i.slice(1).toLowerCase()).join("");return $ee.test(s)?s:`f${s}`}function LM({schema:e,onChange:t,depth:n=0}){let r=(f,p)=>t(e.map((m,g)=>g===f?p:m)),s=(f)=>t(e.filter((p,m)=>m!==f)),i=(f,p)=>{let m=f+p;if(m<0||m>=e.length)return;let g=e.slice(),[y]=g.splice(f,1);g.splice(m,0,y),t(g)},c=()=>{let f=e.length+1;while(e.some((p)=>p.name===`field${f}`))f++;t([...e,{name:`field${f}`,type:"text"}])},u=e.map((f)=>f.name);return Y.jsxDEV("div",{className:"flex flex-col gap-2",children:[e.length===0?Y.jsxDEV("p",{className:"text-sm text-fg-subtle",children:"No fields yet."},void 0,!1,void 0,this):null,e.map((f,p)=>Y.jsxDEV(R1e,{def:f,siblings:u,siblingFields:e,index:p,count:e.length,depth:n,onChange:(m)=>r(p,m),onMove:(m)=>i(p,m),onDelete:()=>s(p)},p,!1,void 0,this)),n+1<See?Y.jsxDEV(me,{variant:"secondary",size:"sm",className:"self-start",onPress:c,children:"+ Add field"},void 0,!1,void 0,this):Y.jsxDEV("p",{className:"text-caption text-fg-subtle",children:["Fields cannot nest deeper than ",See," levels."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function R1e({def:e,siblings:t,siblingFields:n,index:r,count:s,depth:i,onChange:c,onMove:u,onDelete:f}){let p=(v)=>c({...e,...v}),m=t.filter((v)=>v===e.name).length>1,g=e.name!==""&&!$ee.test(e.name),y=(v)=>{let x={name:e.name,type:v};if(e.label)x.label=e.label;if(e.required)x.required=!0;if(NM.includes(v))x.fields=NM.includes(e.type)?e.fields??[]:[];c(x)};return Y.jsxDEV("div",{className:"rounded-lg border border-border bg-surface-muted",children:[Y.jsxDEV("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:r+1},void 0,!1,void 0,this),Y.jsxDEV("span",{className:"min-w-0 flex-1 truncate text-sm text-fg",children:[e.label||e.name," ",Y.jsxDEV("span",{className:"text-fg-subtle",children:["· ",e.type]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg disabled:opacity-30",title:"Move up",disabled:r===0,onClick:()=>u(-1),children:"↑"},void 0,!1,void 0,this),Y.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-fg disabled:opacity-30",title:"Move down",disabled:r===s-1,onClick:()=>u(1),children:"↓"},void 0,!1,void 0,this),Y.jsxDEV("button",{type:"button",className:"px-1.5 text-fg-subtle hover:text-danger",title:"Remove",onClick:f,children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("div",{className:"flex flex-col gap-3 p-3.5",children:[Y.jsxDEV("div",{className:"grid grid-cols-3 gap-3 max-[720px]:grid-cols-1",children:[Y.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Label"},void 0,!1,void 0,this),Y.jsxDEV("input",{className:at,value:e.label??"",placeholder:e.name,onChange:(v)=>{let x=v.target.value,w=/^field\d+$/.test(e.name)?k1e(x):"";p(w?{label:x,name:w}:{label:x})}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Name (the stored key)"},void 0,!1,void 0,this),Y.jsxDEV("input",{className:at,value:e.name,onChange:(v)=>p({name:v.target.value.trim()})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Type"},void 0,!1,void 0,this),Y.jsxDEV("select",{className:at,value:e.type,onChange:(v)=>y(v.target.value),children:A1e.map((v)=>Y.jsxDEV("option",{value:v,children:v},v,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m?Y.jsxDEV("p",{className:"text-caption text-danger",children:["Two fields here are called “",e.name,"” — they would write the same key, and one could never be saved."]},void 0,!0,void 0,this):null,g?Y.jsxDEV("p",{className:"text-caption text-danger",children:"A name must start with a letter or underscore and hold only letters, digits and underscores."},void 0,!1,void 0,this):null,Y.jsxDEV("label",{className:"flex items-center gap-2",children:[Y.jsxDEV("input",{type:"checkbox",checked:e.required===!0,onChange:(v)=>p({required:v.target.checked||void 0})},void 0,!1,void 0,this),Y.jsxDEV("span",{className:"text-sm text-fg",children:"Required"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.type==="select"?Y.jsxDEV(M1e,{def:e,patch:p},void 0,!1,void 0,this):null,e.type==="reference"?Y.jsxDEV(P1e,{def:e,patch:p},void 0,!1,void 0,this):null,e.type==="slug"?Y.jsxDEV(D1e,{def:e,siblingFields:n,patch:p},void 0,!1,void 0,this):null,e.type==="repeater"?Y.jsxDEV(L1e,{def:e,patch:p},void 0,!1,void 0,this):null,NM.includes(e.type)?Y.jsxDEV("div",{className:"rounded-lg border border-border bg-surface-card p-3.5",children:[Y.jsxDEV("p",{className:"mb-2 text-caption text-fg-subtle",children:"Nested fields"},void 0,!1,void 0,this),Y.jsxDEV(LM,{schema:e.fields??[],onChange:(v)=>p({fields:v}),depth:i+1},void 0,!1,void 0,this),(e.fields??[]).length===0?Y.jsxDEV("p",{className:"mt-2 text-caption text-danger",children:["A ",e.type," needs at least one nested field."]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function M1e({def:e,patch:t}){let n=Boolean(e.optionsFrom);return Y.jsxDEV("div",{className:"flex flex-col gap-2",children:[Y.jsxDEV("label",{className:"flex items-center gap-2",children:[Y.jsxDEV("input",{type:"checkbox",checked:n,onChange:(r)=>t(r.target.checked?{optionsFrom:"",options:void 0}:{optionsFrom:void 0,options:[]})},void 0,!1,void 0,this),Y.jsxDEV("span",{className:"text-sm text-fg",children:"Fetch the options from a query handler"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),n?Y.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:["Handler name (returns ",Y.jsxDEV("code",{children:"{ value, label }[]"},void 0,!1,void 0,this),")"]},void 0,!0,void 0,this),Y.jsxDEV("input",{className:at,value:e.optionsFrom??"",onChange:(r)=>t({optionsFrom:r.target.value.trim()})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Y.jsxDEV(N1e,{options:e.options??[],onChange:(r)=>t({options:r})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function N1e({options:e,onChange:t}){let[n,r]=on.useState(()=>e.join(`
|
|
400
400
|
`)),s=on.useRef(null);return on.useEffect(()=>{if(e===s.current)return;r(e.join(`
|
|
401
401
|
`))},[e]),Y.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Options, one per line"},void 0,!1,void 0,this),Y.jsxDEV("textarea",{className:`${at} h-auto min-h-20 py-2.5`,value:n,onChange:(i)=>{r(i.target.value);let c=i.target.value.split(`
|
|
402
402
|
`).map((u)=>u.trim()).filter(Boolean);s.current=c,t(c)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function P1e({def:e,patch:t}){return Y.jsxDEV("div",{className:"flex flex-col gap-2",children:[Y.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:["Handler name — answers ",Y.jsxDEV("code",{children:"{ search, limit, offset }"},void 0,!1,void 0,this)," and ",Y.jsxDEV("code",{children:"{ ids }"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("input",{className:at,value:e.referenceFrom??"",onChange:(n)=>t({referenceFrom:n.target.value.trim()})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("label",{className:"flex items-center gap-2",children:[Y.jsxDEV("input",{type:"checkbox",checked:e.multiple===!0,onChange:(n)=>t({multiple:n.target.checked||void 0})},void 0,!1,void 0,this),Y.jsxDEV("span",{className:"text-sm text-fg",children:"Allow several"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.referenceFrom?null:Y.jsxDEV("p",{className:"text-caption text-danger",children:"A reference needs a handler to resolve it."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function D1e({def:e,siblingFields:t,patch:n}){let r=t.filter((s)=>s.name!==e.name&&PM.includes(s.type));return Y.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Derived from (a text field beside it — optional)"},void 0,!1,void 0,this),Y.jsxDEV("select",{className:at,value:e.from??"",onChange:(s)=>n({from:s.target.value||void 0}),children:[Y.jsxDEV("option",{value:"",children:"— typed by hand —"},void 0,!1,void 0,this),r.map((s)=>Y.jsxDEV("option",{value:s.name,children:s.label??s.name},s.name,!1,void 0,this))]},void 0,!0,void 0,this),Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:r.length>0?`The source must be a ${PM.join(" / ")} field.`:`No ${PM.join(" / ")} field stands beside this one yet.`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function L1e({def:e,patch:t}){let n=(r)=>r===""?void 0:Math.max(0,Math.trunc(Number(r)));return Y.jsxDEV("div",{className:"grid grid-cols-2 gap-3 max-[720px]:grid-cols-1",children:[Y.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Minimum items"},void 0,!1,void 0,this),Y.jsxDEV("input",{className:at,type:"number",min:0,value:e.min??"",onChange:(r)=>t({min:n(r.target.value)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Maximum items"},void 0,!1,void 0,this),Y.jsxDEV("input",{className:at,type:"number",min:1,value:e.max??"",onChange:(r)=>t({max:n(r.target.value)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function P4(){return Y.jsxDEV("span",{className:"shrink-0 rounded-full border border-border px-2 py-0.5 text-caption text-fg-subtle",title:"Defined in code — read-only here",children:"code"},void 0,!1,void 0,this)}function wee({id:e,what:t,defineFn:n,slug:r,owner:s}){return Y.jsxDEV("div",{id:e,className:"mb-4 max-w-[860px] rounded-lg border border-border bg-surface-muted px-3.5 py-3 text-small text-fg-muted",children:["This ",t," is ",Y.jsxDEV("strong",{className:"font-medium text-fg",children:"defined in code"},void 0,!1,void 0,this)," —"," ",Y.jsxDEV("code",{className:"text-fg",children:[n,'("',r,'", …)']},void 0,!0,void 0,this),", applied on every boot by"," ",Y.jsxDEV("code",{className:"text-fg",children:"cmsBootstrap"},void 0,!1,void 0,this),s&&s!=="cms"?Y.jsxDEV(Y.Fragment,{children:[" (owner ",Y.jsxDEV("code",{className:"text-fg",children:s},void 0,!1,void 0,this),")"]},void 0,!0,void 0,this):null,". It is read-only here: a change saved from this screen would be reverted at the next deploy or cold start. Edit the declaration and redeploy."]},void 0,!0,void 0,this)}function Tee({locked:e,describedBy:t,label:n,className:r,children:s}){return Y.jsxDEV("fieldset",{disabled:e,"aria-describedby":e?t:void 0,className:`m-0 min-w-0 border-0 p-0 ${r} ${e?"select-none opacity-60 [&_*]:cursor-not-allowed":""}`,children:[Y.jsxDEV("legend",{className:"sr-only",children:n},void 0,!1,void 0,this),s]},void 0,!0,void 0,this)}function Iee({api:e,codeDefinedTypes:t,onOpenBlockType:n,onOpenContentType:r,onError:s}){let[i,c]=on.useState(null),[u,f]=on.useState(null);return on.useEffect(()=>{let p=!0;return e.listBlockTypes().then((m)=>p&&c(m)).catch((m)=>s(String(m.message??m))),e.listContentTypes().then((m)=>p&&f(m)).catch((m)=>s(String(m.message??m))),()=>{p=!1}},[e,s]),Y.jsxDEV("div",{className:nn,children:[Y.jsxDEV("div",{className:"mb-6 mt-6",children:[Y.jsxDEV("h1",{className:"m-0 text-[40px] font-normal leading-[1.1] tracking-[-0.01em]",children:[Y.jsxDEV("span",{className:"block text-fg-subtle",children:"The shape of"},void 0,!1,void 0,this),Y.jsxDEV("span",{className:"block text-fg",children:"this site"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("p",{className:"mt-3 max-w-[62ch] text-sm text-fg-muted",children:["A ",Y.jsxDEV("strong",{className:"font-medium text-fg",children:"block type"},void 0,!1,void 0,this)," is a set of fields an editor fills in. A ",Y.jsxDEV("strong",{className:"font-medium text-fg",children:"content type"},void 0,!1,void 0,this)," is a kind of page: the regions it has, and which block types may go in each. Nothing can be authored until there is one of each."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV(Cee,{title:"Block types",empty:"No block types yet. A page is built from these, so start here.",rows:i,newLabel:"+ New block type",onNew:()=>n("new"),render:(p)=>Y.jsxDEV("div",{className:"flex cursor-pointer items-center gap-3 rounded-[14px] border border-transparent bg-surface-card px-[18px] py-3.5 hover:bg-surface-muted",onClick:()=>n(p.slug),children:[Y.jsxDEV("span",{className:"w-6 shrink-0 text-center",children:p.icon??""},void 0,!1,void 0,this),Y.jsxDEV("span",{className:"min-w-0 flex-1 truncate font-medium",children:p.name},void 0,!1,void 0,this),t&&p.managedBy?Y.jsxDEV(P4,{},void 0,!1,void 0,this):null,Y.jsxDEV("span",{className:"shrink-0 truncate text-fg-subtle",children:p.slug},void 0,!1,void 0,this),Y.jsxDEV("span",{className:"shrink-0 text-caption text-fg-subtle",children:[(p.fieldsSchema??[]).length," field(s)"]},void 0,!0,void 0,this)]},p.id,!0,void 0,this)},void 0,!1,void 0,this),Y.jsxDEV(Cee,{title:"Content types",empty:"No content types yet. A page needs one — it is what declares the regions blocks go into.",rows:u,newLabel:"+ New content type",onNew:()=>r("new"),render:(p)=>Y.jsxDEV("div",{className:"flex cursor-pointer items-center gap-3 rounded-[14px] border border-transparent bg-surface-card px-[18px] py-3.5 hover:bg-surface-muted",onClick:()=>r(p.slug),children:[Y.jsxDEV("span",{className:"min-w-0 flex-1 truncate font-medium",children:p.name},void 0,!1,void 0,this),t&&p.managedBy?Y.jsxDEV(P4,{},void 0,!1,void 0,this):null,Y.jsxDEV("span",{className:"shrink-0 truncate text-fg-subtle",children:p.slug},void 0,!1,void 0,this),Y.jsxDEV("span",{className:"shrink-0 text-caption text-fg-subtle",children:[(p.regions??[]).length," region(s)"]},void 0,!0,void 0,this)]},p.id,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Cee({title:e,empty:t,rows:n,newLabel:r,onNew:s,render:i}){return Y.jsxDEV("section",{className:"mb-8",children:[Y.jsxDEV("div",{className:"mb-2 flex items-center gap-3",children:[Y.jsxDEV(Qo,{level:"2",className:"font-normal",children:e},void 0,!1,void 0,this),Y.jsxDEV(me,{variant:"secondary",size:"sm",onPress:s,children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this),n===null?Y.jsxDEV("p",{className:"text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this):n.length===0?Y.jsxDEV("p",{className:"text-fg-subtle",children:t},void 0,!1,void 0,this):Y.jsxDEV("div",{className:"flex flex-col gap-2",children:n.map(i)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Eee({api:e,codeDefinedTypes:t,slug:n,onSaved:r,onBack:s,onError:i}){let c=n==="new",[u,f]=on.useState({name:"",slug:"",fieldsSchema:[]}),[p,m]=on.useState(null),[g,y]=on.useState(null),[v,x]=on.useState(!c),[w,C]=on.useState(!1),[I,R]=on.useState(!1),[H,L]=on.useState(!1),[_,W]=on.useState(c),[z,F]=on.useState(()=>JSON.stringify({name:"",slug:"",fieldsSchema:[]}));gh(JSON.stringify(u)!==z),on.useEffect(()=>{if(c)return;let ie=!0;return x(!0),e.listBlockTypes().then((ae)=>{if(!ie)return;let re=ae.find((B)=>B.slug===n);if(!re){C(!0);return}m(re.id),y(re.managedBy??null);let D={name:re.name,slug:re.slug,description:re.description??null,icon:re.icon??null,category:re.category??null,fieldsSchema:re.fieldsSchema??[]};f(D),F(JSON.stringify(D))}).catch((ae)=>{if(ie)C(!0);i(String(ae.message??ae))}).finally(()=>{if(ie)x(!1)}),()=>{ie=!1}},[e,n,c,i]);let ne=async()=>{R(!0);try{if(c){let ie=await e.createBlockType(u);r(ie.slug)}else await e.updateBlockType(p,{name:u.name,description:u.description,icon:u.icon,category:u.category,fieldsSchema:u.fieldsSchema}),F(JSON.stringify(u)),L(!0),setTimeout(()=>L(!1),1200)}catch(ie){i(String(ie.message??ie))}finally{R(!1)}};if(w)return Y.jsxDEV("div",{className:nn,children:Y.jsxDEV("p",{className:"pt-8 text-fg-subtle",children:["Unknown block type: ",n]},void 0,!0,void 0,this)},void 0,!1,void 0,this);if(v)return Y.jsxDEV("div",{className:nn,children:Y.jsxDEV("p",{className:"pt-8 text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this)},void 0,!1,void 0,this);let V=t&&g!==null;return Y.jsxDEV("div",{className:nn,children:[Y.jsxDEV("div",{className:"mb-4 mt-2 flex items-center gap-3",children:[Y.jsxDEV(me,{variant:"ghost",size:"sm",onPress:s,children:"← Types"},void 0,!1,void 0,this),Y.jsxDEV("h1",{className:"text-[22px] font-normal text-fg",children:c?"New block type":u.name},void 0,!1,void 0,this),V?Y.jsxDEV(P4,{},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),V?Y.jsxDEV(wee,{id:D4,what:"block type",defineFn:"defineBlockType",slug:u.slug,owner:g},void 0,!1,void 0,this):null,Y.jsxDEV(Tee,{locked:V,describedBy:D4,label:"Block type",className:"flex max-w-[860px] flex-col gap-4",children:[H?Y.jsxDEV("div",{className:"rounded-lg border border-brand-green bg-brand-green/20 px-3.5 py-2.5 text-small text-fg",children:"saved"},void 0,!1,void 0,this):null,Y.jsxDEV("div",{className:"grid grid-cols-2 gap-3 max-[720px]:grid-cols-1",children:[Y.jsxDEV(pn,{label:"Name",value:u.name,onChange:(ie)=>f((ae)=>({...ae,name:ie,..._?{slug:da(ie)}:{}}))},void 0,!1,void 0,this),Y.jsxDEV("label",{className:"flex flex-col gap-2",children:[Y.jsxDEV("span",{className:"text-sm font-medium text-fg",children:["Slug ",c?null:Y.jsxDEV("span",{className:"text-fg-subtle",children:"(fixed)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("input",{className:at,value:u.slug,disabled:!c,onChange:(ie)=>{W(!1),f((ae)=>({...ae,slug:ie.target.value.trim()}))}},void 0,!1,void 0,this),Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:c?"The key a front end maps to a component. Lowercase letters, digits, hyphens or underscores.":"A block type's slug is its registry key — renaming it would orphan every block of this type."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("div",{className:"grid grid-cols-2 gap-3 max-[720px]:grid-cols-1",children:[Y.jsxDEV("label",{className:"flex flex-col gap-2",children:[Y.jsxDEV("span",{className:"text-sm font-medium text-fg",children:"Icon"},void 0,!1,void 0,this),Y.jsxDEV("input",{className:at,value:u.icon??"",placeholder:"e.g. \uD83D\uDDBC",onChange:(ie)=>f((ae)=>({...ae,icon:DM(ie.target.value)}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("label",{className:"flex flex-col gap-2",children:[Y.jsxDEV("span",{className:"text-sm font-medium text-fg",children:"Category"},void 0,!1,void 0,this),Y.jsxDEV("input",{className:at,value:u.category??"",placeholder:"e.g. Layout",onChange:(ie)=>f((ae)=>({...ae,category:DM(ie.target.value)}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV(fh,{label:"Description",value:u.description??"",onChange:(ie)=>f((ae)=>({...ae,description:DM(ie)}))},void 0,!1,void 0,this),Y.jsxDEV("div",{children:[Y.jsxDEV(Qo,{level:"2",className:"mb-2 font-normal",children:"Fields"},void 0,!1,void 0,this),Y.jsxDEV("p",{className:"mb-3 max-w-[62ch] text-caption text-fg-subtle",children:"These are what an editor fills in for every block of this type. Removing one leaves the values already written under its name in the store, but nothing will render or edit them."},void 0,!1,void 0,this),Y.jsxDEV(LM,{schema:u.fieldsSchema??[],onChange:(ie)=>f((ae)=>({...ae,fieldsSchema:ie}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),V?null:Y.jsxDEV("div",{className:"mt-2",children:Y.jsxDEV(me,{onPress:ne,isDisabled:I||u.name.trim()===""||u.slug.trim()==="",children:I?"Saving…":c?"Create":"Save"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Aee({api:e,codeDefinedTypes:t,slug:n,onSaved:r,onBack:s,onError:i}){let c=n==="new",[u,f]=on.useState({name:"",slug:"",regions:[{name:"content",label:"Content",allowedTypes:null}],fieldsSchema:[],defaultBlocks:[]}),[p,m]=on.useState(null),[g,y]=on.useState(null),[v,x]=on.useState([]),[w,C]=on.useState(!c),[I,R]=on.useState(!1),[H,L]=on.useState(!1),[_,W]=on.useState(!1),[z,F]=on.useState(c),[ne,V]=on.useState(()=>JSON.stringify({name:"",slug:"",regions:[{name:"content",label:"Content",allowedTypes:null}],fieldsSchema:[],defaultBlocks:[]}));gh(JSON.stringify(u)!==ne),on.useEffect(()=>{let D=!0;return e.listBlockTypes().then((B)=>D&&x(B)).catch(()=>x([])),()=>{D=!1}},[e]),on.useEffect(()=>{if(c)return;let D=!0;return C(!0),e.listContentTypes().then((B)=>{if(!D)return;let U=B.find((xe)=>xe.slug===n);if(!U){R(!0);return}m(U.id),y(U.managedBy??null);let Q={name:U.name,slug:U.slug,regions:U.regions??[],fieldsSchema:U.fieldsSchema??[],defaultBlocks:U.defaultBlocks??[]};f(Q),V(JSON.stringify(Q))}).catch((B)=>{if(D)R(!0);i(String(B.message??B))}).finally(()=>{if(D)C(!1)}),()=>{D=!1}},[e,n,c,i]);let ie=async()=>{let D=(u.defaultBlocks??[]).filter((B)=>!ae.some((U)=>U.name===B.region));if(D.length>0){let B=[...new Set(D.map((U)=>U.region))].join(", ");if(!confirm(`${D.length} default block(s) point at a region that no longer exists (${B}). Remove them and save?`))return;f((U)=>({...U,defaultBlocks:(U.defaultBlocks??[]).filter((Q)=>ae.some((xe)=>xe.name===Q.region))}));return}L(!0);try{if(c){let B=await e.createContentType(u);r(B.slug)}else await e.updateContentType(p,{name:u.name,regions:u.regions,fieldsSchema:u.fieldsSchema,defaultBlocks:u.defaultBlocks}),V(JSON.stringify(u)),W(!0),setTimeout(()=>W(!1),1200)}catch(B){i(String(B.message??B))}finally{L(!1)}};if(I)return Y.jsxDEV("div",{className:nn,children:Y.jsxDEV("p",{className:"pt-8 text-fg-subtle",children:["Unknown content type: ",n]},void 0,!0,void 0,this)},void 0,!1,void 0,this);if(w)return Y.jsxDEV("div",{className:nn,children:Y.jsxDEV("p",{className:"pt-8 text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this)},void 0,!1,void 0,this);let ae=u.regions??[],re=t&&g!==null;return Y.jsxDEV("div",{className:nn,children:[Y.jsxDEV("div",{className:"mb-4 mt-2 flex items-center gap-3",children:[Y.jsxDEV(me,{variant:"ghost",size:"sm",onPress:s,children:"← Types"},void 0,!1,void 0,this),Y.jsxDEV("h1",{className:"text-[22px] font-normal text-fg",children:c?"New content type":u.name},void 0,!1,void 0,this),re?Y.jsxDEV(P4,{},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),re?Y.jsxDEV(wee,{id:D4,what:"content type",defineFn:"defineContentType",slug:u.slug,owner:g},void 0,!1,void 0,this):null,Y.jsxDEV(Tee,{locked:re,describedBy:D4,label:"Content type",className:"flex max-w-[860px] flex-col gap-5",children:[_?Y.jsxDEV("div",{className:"rounded-lg border border-brand-green bg-brand-green/20 px-3.5 py-2.5 text-small text-fg",children:"saved"},void 0,!1,void 0,this):null,Y.jsxDEV("div",{className:"grid grid-cols-2 gap-3 max-[720px]:grid-cols-1",children:[Y.jsxDEV(pn,{label:"Name",value:u.name,onChange:(D)=>f((B)=>({...B,name:D,...z?{slug:da(D)}:{}}))},void 0,!1,void 0,this),Y.jsxDEV("label",{className:"flex flex-col gap-2",children:[Y.jsxDEV("span",{className:"text-sm font-medium text-fg",children:["Slug ",c?null:Y.jsxDEV("span",{className:"text-fg-subtle",children:"(fixed)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("input",{className:at,value:u.slug,disabled:!c,onChange:(D)=>{F(!1),f((B)=>({...B,slug:D.target.value.trim()}))}},void 0,!1,void 0,this),Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:c?"A URL segment: lowercase letters, digits and single hyphens.":"This slug addresses the type's own page list — renaming it would break every link to it."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("div",{children:[Y.jsxDEV(Qo,{level:"2",className:"mb-2 font-normal",children:"Regions"},void 0,!1,void 0,this),Y.jsxDEV("p",{className:"mb-3 max-w-[62ch] text-caption text-fg-subtle",children:"A region is a named slot on the page. The allow-list decides what may be placed there; leave it empty for “any block type”."},void 0,!1,void 0,this),Y.jsxDEV(O1e,{regions:ae,blockTypes:v,onChange:(D)=>f((B)=>({...B,regions:D})),onRegionRemoved:(D)=>f((B)=>({...B,defaultBlocks:(B.defaultBlocks??[]).filter((U)=>U.region!==D)}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("div",{children:[Y.jsxDEV(Qo,{level:"2",className:"mb-2 font-normal",children:"Page fields"},void 0,!1,void 0,this),Y.jsxDEV("p",{className:"mb-3 max-w-[62ch] text-caption text-fg-subtle",children:"Structured data on the page itself, beside its blocks — a lead image, a byline, a category."},void 0,!1,void 0,this),Y.jsxDEV(LM,{schema:u.fieldsSchema??[],onChange:(D)=>f((B)=>({...B,fieldsSchema:D}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("div",{children:[Y.jsxDEV(Qo,{level:"2",className:"mb-2 font-normal",children:"Default blocks"},void 0,!1,void 0,this),Y.jsxDEV("p",{className:"mb-3 max-w-[62ch] text-caption text-fg-subtle",children:"Created automatically in a region when a page of this type is created."},void 0,!1,void 0,this),Y.jsxDEV(B1e,{blocks:u.defaultBlocks??[],regions:ae,blockTypes:v,onChange:(D)=>f((B)=>({...B,defaultBlocks:D}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),re?null:Y.jsxDEV("div",{children:[Y.jsxDEV(me,{onPress:ie,isDisabled:H||u.name.trim()===""||u.slug.trim()===""||ae.length===0,children:H?"Saving…":c?"Create":"Save"},void 0,!1,void 0,this),ae.length===0?Y.jsxDEV("p",{className:"mt-2 text-caption text-danger",children:"A content type needs at least one region."},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function O1e({regions:e,blockTypes:t,onChange:n,onRegionRemoved:r}){let s=(u,f)=>n(e.map((p,m)=>m===u?f:p)),i=()=>{let u=e.length+1;while(e.some((f)=>f.name===`region${u}`))u++;n([...e,{name:`region${u}`,allowedTypes:null}])},c=(u,f)=>{let p=e[u],m=p.allowedTypes??[],g=m.includes(f)?m.filter((y)=>y!==f):[...m,f];s(u,{...p,allowedTypes:g.length>0?g:null})};return Y.jsxDEV("div",{className:"flex flex-col gap-2",children:[e.map((u,f)=>Y.jsxDEV("div",{className:"rounded-lg border border-border bg-surface-muted p-3.5",children:[Y.jsxDEV("div",{className:"mb-3 grid grid-cols-[1fr_1fr_auto] items-end gap-3 max-[720px]:grid-cols-1",children:[Y.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Name (the key blocks are placed under)"},void 0,!1,void 0,this),Y.jsxDEV("input",{className:at,value:u.name,onChange:(p)=>s(f,{...u,name:p.target.value.trim()})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Label"},void 0,!1,void 0,this),Y.jsxDEV("input",{className:at,value:u.label??"",placeholder:u.name,onChange:(p)=>s(f,{...u,label:p.target.value||void 0})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("button",{type:"button",className:"px-2 py-2 text-fg-subtle hover:text-danger",title:"Remove region",onClick:()=>{n(e.filter((p,m)=>m!==f)),r(u.name)},children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("p",{className:"mb-1.5 text-caption text-fg-subtle",children:["Allowed block types ",u.allowedTypes===null||u.allowedTypes===void 0?Y.jsxDEV("span",{className:"text-fg",children:"— any"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),Y.jsxDEV("div",{className:"flex flex-wrap gap-x-4 gap-y-1.5",children:[t.length===0?Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"No block types defined yet."},void 0,!1,void 0,this):null,t.map((p)=>Y.jsxDEV("label",{className:"flex items-center gap-1.5",children:[Y.jsxDEV("input",{type:"checkbox",checked:(u.allowedTypes??[]).includes(p.slug),onChange:()=>c(f,p.slug)},void 0,!1,void 0,this),Y.jsxDEV("span",{className:"text-sm text-fg",children:p.name},void 0,!1,void 0,this)]},p.slug,!0,void 0,this))]},void 0,!0,void 0,this)]},f,!0,void 0,this)),Y.jsxDEV(me,{variant:"secondary",size:"sm",className:"self-start",onPress:i,children:"+ Add region"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function B1e({blocks:e,regions:t,blockTypes:n,onChange:r}){let s=(u,f)=>r(e.map((p,m)=>m===u?f:p)),i=(u)=>{let f=t.find((p)=>p.name===u)?.allowedTypes;return f?n.filter((p)=>f.includes(p.slug)):n},c=()=>{let u=t[0]?.name??"";r([...e,{region:u,blockTypeSlug:i(u)[0]?.slug??""}])};return Y.jsxDEV("div",{className:"flex flex-col gap-2",children:[e.map((u,f)=>{let p=i(u.region);return Y.jsxDEV("div",{className:"grid grid-cols-[1fr_1fr_auto] items-end gap-3 rounded-lg border border-border bg-surface-muted p-3.5 max-[720px]:grid-cols-1",children:[Y.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Region"},void 0,!1,void 0,this),Y.jsxDEV("select",{className:at,value:u.region,onChange:(m)=>{let g=m.target.value,y=i(g).some((v)=>v.slug===u.blockTypeSlug);s(f,{...u,region:g,blockTypeSlug:y?u.blockTypeSlug:i(g)[0]?.slug??""})},children:t.map((m)=>Y.jsxDEV("option",{value:m.name,children:m.label??m.name},m.name,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("label",{className:"flex flex-col gap-1.5",children:[Y.jsxDEV("span",{className:"text-caption text-fg-subtle",children:"Block type"},void 0,!1,void 0,this),Y.jsxDEV("select",{className:at,value:u.blockTypeSlug,onChange:(m)=>s(f,{...u,blockTypeSlug:m.target.value}),children:p.map((m)=>Y.jsxDEV("option",{value:m.slug,children:m.name},m.slug,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.jsxDEV("button",{type:"button",className:"px-2 py-2 text-fg-subtle hover:text-danger",title:"Remove",onClick:()=>r(e.filter((m,g)=>g!==f)),children:"✕"},void 0,!1,void 0,this)]},f,!0,void 0,this)}),Y.jsxDEV(me,{variant:"secondary",size:"sm",className:"self-start",onPress:c,isDisabled:t.length===0||n.length===0,children:"+ Add default block"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var on,Y,A1e,See=5,NM,PM,$ee,D4="cms-managed-notice",DM=(e)=>e.trim()===""?null:e.trim();var L4=E(()=>{Ur();Rn();I1();on=O(ee(),1),Y=O(Me(),1),A1e=["text","textarea","richtext","url","number","boolean","date","datetime","publish","slug","media","select","reference","repeater","group"],NM=["group","repeater"],PM=["text","textarea","select","url"],$ee=/^[A-Za-z_][A-Za-z0-9_]*$/});var OM,H1e;var kee=E(()=>{Dn();Rn();vo();L4();OM=O(Me(),1),H1e=Tt().params({slug:"string"}).route("/schema/blocks/:slug").render(function({params:t}){let{api:n,cms:r,setError:s}=nt(),i=Bt();if(!r.canEdit)return OM.jsxDEV(Ut,{children:"Authoring types needs an editor role."},void 0,!1,void 0,this);return OM.jsxDEV(Eee,{api:n,codeDefinedTypes:r.codeDefinedTypes,slug:t.slug,onSaved:(c)=>i("block-type",{params:{slug:c}}),onBack:()=>i("schema"),onError:s},t.slug,!1,void 0,this)})});var O4,F1e;var Ree=E(()=>{Dn();Ur();Rn();vo();O4=O(Me(),1),F1e=Tt().params({slug:"string",id:"string"}).route("/collections/:slug/:id").render(function({params:t}){let{api:n,collections:r,setError:s}=nt(),i=Bt(),c=r.find((f)=>f.slug===t.slug),u=()=>i("collection",{params:{slug:t.slug}});if(!c)return O4.jsxDEV(Ut,{action:r.length>0?O4.jsxDEV(me,{variant:"ghost",size:"sm",onPress:()=>i("home"),children:"← Pages"},void 0,!1,void 0,this):void 0,children:r.length===0?"Loading…":`Unknown collection: ${t.slug}`},void 0,!1,void 0,this);return O4.jsxDEV(DQ,{api:n,def:c,id:t.id==="new"?null:t.id,onSaved:u,onDeleted:u,onBack:u,onError:s},void 0,!1,void 0,this)})});var B4,_1e;var Mee=E(()=>{Dn();Ur();Rn();vo();B4=O(Me(),1),_1e=Tt().params({slug:"string"}).route("/collections/:slug").render(function({params:t}){let{api:n,collections:r,setError:s}=nt(),i=Bt(),c=r.find((u)=>u.slug===t.slug);if(!c)return B4.jsxDEV(Ut,{action:r.length>0?B4.jsxDEV(me,{variant:"ghost",size:"sm",onPress:()=>i("home"),children:"← Pages"},void 0,!1,void 0,this):void 0,children:r.length===0?"Loading…":`Unknown collection: ${t.slug}`},void 0,!1,void 0,this);return B4.jsxDEV(PQ,{api:n,def:c,onOpen:(u)=>i("collection-item",{params:{slug:c.slug,id:u}}),onNew:()=>i("collection-item",{params:{slug:c.slug,id:"new"}}),onError:s},void 0,!1,void 0,this)})});var BM,z1e;var Nee=E(()=>{Dn();Rn();vo();L4();BM=O(Me(),1),z1e=Tt().params({slug:"string"}).route("/schema/content/:slug").render(function({params:t}){let{api:n,cms:r,setError:s,refreshContentTypes:i}=nt(),c=Bt();if(!r.canEdit)return BM.jsxDEV(Ut,{children:"Authoring types needs an editor role."},void 0,!1,void 0,this);return BM.jsxDEV(Aee,{api:n,codeDefinedTypes:r.codeDefinedTypes,slug:t.slug,onSaved:(u)=>{i(),c("content-type",{params:{slug:u}})},onBack:()=>c("schema"),onError:s},t.slug,!1,void 0,this)})});var Pee,Dee,V1e;var Lee=E(()=>{Dn();Rn();vo();Pee=O(ee(),1),Dee=O(Me(),1),V1e=Tt().route("/").render(function(){let{api:t,setError:n,collections:r,contentTypes:s,cms:i}=nt(),c=Bt(),u=rp(),f=r[0]?.slug,p=ap(s,i,u),m=(s??[]).find((y)=>y.slug!=="")?.slug,g=p&&m!==void 0?m:void 0;if(Pee.useEffect(()=>{if(u&&f)c("collection",{params:{slug:f},replace:!0});else if(g!==void 0)c("type",{params:{slug:g},replace:!0})},[u,f,g,c]),u)return null;if(g!==void 0)return null;if(s===null)return null;return Dee.jsxDEV(E4,{api:t,onOpen:(y)=>c("page",{params:{pageId:y.id}}),onError:n},void 0,!1,void 0,this)})});var Oee,U1e;var Bee=E(()=>{Dn();Rn();vo();Oee=O(Me(),1),U1e=Tt().route("/media").render(function(){let{api:t,setError:n}=nt();return Oee.jsxDEV(OQ,{api:t,onError:n},void 0,!1,void 0,this)})});var HM,j1e;var Hee=E(()=>{Dn();Rn();vo();wc();HM=O(Me(),1),j1e=Tt().params({name:"string"}).route("/menus/:name").render(function({params:t}){let{api:n,cms:r,collections:s,setError:i}=nt(),c=Bt();if(!r.siteFurniture)return HM.jsxDEV(Ut,{children:"This deployment's CMS does not provide site furniture."},void 0,!1,void 0,this);return HM.jsxDEV(vQ,{api:n,name:t.name,canEdit:r.canEdit,collections:s,onBack:()=>c("menus"),onDeleted:()=>c("menus"),onError:i},t.name,!1,void 0,this)})});var FM,K1e;var Fee=E(()=>{Dn();Rn();vo();wc();FM=O(Me(),1),K1e=Tt().route("/menus").render(function(){let{api:t,cms:n,setError:r}=nt(),s=Bt();if(!n.siteFurniture)return FM.jsxDEV(Ut,{children:"This deployment's CMS does not provide site furniture."},void 0,!1,void 0,this);return FM.jsxDEV(gQ,{api:t,canEdit:n.canEdit,onOpen:(i)=>s("menu",{params:{name:i}}),onError:r},void 0,!1,void 0,this)})});var lp,M1,G1e;var _ee=E(()=>{Dn();Ur();Rn();vo();lp=O(ee(),1),M1=O(Me(),1),G1e=Tt().params({pageId:"string",tab:"?string"}).route("/pages/:pageId").render(function({params:t}){let{api:n,cms:r,contentTypes:s,setError:i,setNavGuard:c}=nt(),u=Bt(),[f,p]=lp.useState(null),[m,g]=lp.useState([]),[y,v]=lp.useState(!1);lp.useEffect(()=>{let H=!0;return v(!1),n.getPageById(t.pageId).then((L)=>{if(!H)return;p(L??null),v(!L)}).catch((L)=>i(ht(L))),n.listBlockTypes().then((L)=>H&&g(L)).catch((L)=>i(ht(L))),()=>{H=!1}},[n,t.pageId,i]);let x=(s??[]).find((H)=>H.id===f?.typeId),w=()=>{if(ap(s,r)&&x)u("type",{params:{slug:x.slug}});else u("home")},I=bM(r.multilingual,r.siteFurniture).includes(t.tab)?t.tab:"settings",R=(H)=>u("page",{params:{pageId:t.pageId,tab:H},replace:!0});if(lp.useEffect(()=>{if(t.tab!==void 0&&t.tab!==I)R(I)},[t.tab,I]),y)return M1.jsxDEV(Ut,{action:M1.jsxDEV(me,{variant:"ghost",size:"sm",onPress:()=>u("home"),children:"← all pages"},void 0,!1,void 0,this),children:"Page not found."},void 0,!1,void 0,this);if(!f)return M1.jsxDEV(Ut,{children:"Loading…"},void 0,!1,void 0,this);return M1.jsxDEV(LQ,{api:n,page:f,blockTypes:m,tab:I,onTab:R,onBack:w,backLabel:ap(s,r)&&x?x.name:"Pages",onChange:p,registerGuard:c},void 0,!1,void 0,this)})});var _M,q1e;var zee=E(()=>{Dn();Rn();vo();wc();_M=O(Me(),1),q1e=Tt().route("/redirects").render(function(){let{api:t,cms:n,setError:r}=nt();if(!n.siteFurniture)return _M.jsxDEV(Ut,{children:"This deployment's CMS does not provide site furniture."},void 0,!1,void 0,this);return _M.jsxDEV(xQ,{api:t,canEdit:n.canEdit,onError:r},void 0,!1,void 0,this)})});var zM,W1e;var Vee=E(()=>{Dn();Rn();vo();L4();zM=O(Me(),1),W1e=Tt().route("/schema").render(function(){let{api:t,cms:n,setError:r}=nt(),s=Bt();if(!n.canEdit)return zM.jsxDEV(Ut,{children:"Authoring types needs an editor role."},void 0,!1,void 0,this);return zM.jsxDEV(Iee,{api:t,codeDefinedTypes:n.codeDefinedTypes,onOpenBlockType:(i)=>s("block-type",{params:{slug:i}}),onOpenContentType:(i)=>s("content-type",{params:{slug:i}}),onError:r},void 0,!1,void 0,this)})});var Uee,Z1e;var jee=E(()=>{Dn();Rn();vo();Uee=O(Me(),1),Z1e=Tt().route("/settings").render(function(){let{api:t,cfg:n,me:r,setError:s,reconfigure:i}=nt();return Uee.jsxDEV(HQ,{api:t,cfg:n,me:r,onSignOut:i,onError:s},void 0,!1,void 0,this)})});var VM,Y1e;var Kee=E(()=>{Dn();Rn();vo();wc();VM=O(Me(),1),Y1e=Tt().route("/taxonomies").render(function(){let{api:t,cms:n,setError:r}=nt(),s=Bt();if(!n.siteFurniture)return VM.jsxDEV(Ut,{children:"This deployment's CMS does not provide site furniture."},void 0,!1,void 0,this);return VM.jsxDEV(CQ,{api:t,canEdit:n.canEdit,onOpen:(i)=>s("taxonomy",{params:{slug:i}}),onError:r},void 0,!1,void 0,this)})});var UM,X1e;var Gee=E(()=>{Dn();Rn();vo();wc();UM=O(Me(),1),X1e=Tt().params({slug:"string"}).route("/taxonomies/:slug").render(function({params:t}){let{api:n,cms:r,setError:s}=nt(),i=Bt();if(!r.siteFurniture)return UM.jsxDEV(Ut,{children:"This deployment's CMS does not provide site furniture."},void 0,!1,void 0,this);return UM.jsxDEV($Q,{api:n,slug:t.slug,canEdit:r.canEdit,onBack:()=>i("taxonomies"),onDeleted:()=>i("taxonomies"),onError:s},t.slug,!1,void 0,this)})});var nd,J1e;var qee=E(()=>{Dn();Ur();Rn();vo();nd=O(Me(),1),J1e=Tt().params({slug:"string"}).route("/types/:slug").render(function({params:t}){let{contentTypes:n,contentTypesFailed:r,refreshContentTypes:s,api:i,setError:c}=nt(),u=Bt(),f=(n??[]).find((m)=>m.slug===t.slug),p=nd.jsxDEV(me,{variant:"ghost",size:"sm",onPress:()=>u("home"),children:"← Back"},void 0,!1,void 0,this);if(rp())return nd.jsxDEV(Ut,{action:p,children:"The page builder is not enabled on this deployment."},void 0,!1,void 0,this);if(r)return nd.jsxDEV(Ut,{action:nd.jsxDEV(me,{variant:"ghost",size:"sm",onPress:s,children:"Retry"},void 0,!1,void 0,this),children:"Couldn't load the content types."},void 0,!1,void 0,this);if(n===null)return nd.jsxDEV(Ut,{children:"Loading…"},void 0,!1,void 0,this);if(!f)return nd.jsxDEV(Ut,{action:p,children:["Unknown content type: ",t.slug]},void 0,!0,void 0,this);return nd.jsxDEV(E4,{api:i,type:f,onOpen:(m)=>u("page",{params:{pageId:m.id}}),onError:c},f.slug,!1,void 0,this)})});var cp,Q1e;var Wee=E(()=>{Dn();Ur();Rn();vo();cp=O(Me(),1),Q1e=Tt().route("/users").render(function(){let{api:t,me:n,isAdmin:r,setError:s}=nt(),i=Bt();if(n===null)return cp.jsxDEV("div",{className:"mx-auto max-w-[1200px] px-7 pt-8",children:cp.jsxDEV("p",{className:"text-fg-subtle",children:"Loading…"},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(!r)return cp.jsxDEV("div",{className:"mx-auto flex max-w-[1200px] items-center gap-2 px-7 pt-8",children:[cp.jsxDEV("p",{className:"text-fg-subtle",children:"Admins only."},void 0,!1,void 0,this),cp.jsxDEV(me,{variant:"ghost",size:"sm",onPress:()=>i("home"),children:"← back to pages"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return cp.jsxDEV(BQ,{api:t,me:n,onError:s},void 0,!1,void 0,this)})});var jM,eye;var Zee=E(()=>{Dn();Rn();vo();wc();jM=O(Me(),1),eye=Tt().params({name:"string"}).route("/widgets/:name").render(function({params:t}){let{api:n,cms:r,setError:s}=nt(),i=Bt();if(!r.siteFurniture)return jM.jsxDEV(Ut,{children:"This deployment's CMS does not provide site furniture."},void 0,!1,void 0,this);return jM.jsxDEV(TQ,{api:n,name:t.name,canEdit:r.canEdit,onBack:()=>i("widgets"),onDeleted:()=>i("widgets"),onError:s},t.name,!1,void 0,this)})});var KM,tye;var Yee=E(()=>{Dn();Rn();vo();wc();KM=O(Me(),1),tye=Tt().route("/widgets").render(function(){let{api:t,cms:n,setError:r}=nt(),s=Bt();if(!n.siteFurniture)return KM.jsxDEV(Ut,{children:"This deployment's CMS does not provide site furniture."},void 0,!1,void 0,this);return KM.jsxDEV(wQ,{api:t,canEdit:n.canEdit,onOpen:(i)=>s("widget-area",{params:{name:i}}),onError:r},void 0,!1,void 0,this)})});var od,nye;var Xee=E(()=>{Dn();Ur();od=O(Me(),1),nye=Tt().render(function(){let t=Bt();return od.jsxDEV("div",{className:"mx-auto max-w-[1200px] px-7 pt-8",children:[od.jsxDEV("h1",{className:"m-0 text-[56px] font-normal leading-[1.05] tracking-[-0.01em] max-[820px]:text-[40px]",children:[od.jsxDEV("span",{className:"block text-fg-subtle",children:"Not found"},void 0,!1,void 0,this),od.jsxDEV("span",{className:"block text-fg",children:"Nothing lives here"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),od.jsxDEV("div",{className:"mt-4 flex items-center gap-2",children:[od.jsxDEV("p",{className:"text-fg-subtle",children:"That page doesn't exist."},void 0,!1,void 0,this),od.jsxDEV(me,{variant:"ghost",size:"sm",onPress:()=>t("home"),children:"← back to pages"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)})});Dn();var H4=O(ee(),1),vte=O(XO(),1);Dn();var xo=O(ee(),1);Dn();Ur();Rn();xS();mS();var ci=O(ee(),1);var SS=O(ee(),1);var Df=O(ee(),1);var jK=O(ee(),1),KK=jK.createContext({color:"currentColor",size:"1em",weight:"regular",mirrored:!1});var Pt=Df.forwardRef((e,t)=>{let{alt:n,color:r,size:s,weight:i,mirrored:c,children:u,weights:f,...p}=e,{color:m="currentColor",size:g,weight:y="regular",mirrored:v=!1,...x}=Df.useContext(KK);return Df.createElement("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:s!=null?s:g,height:s!=null?s:g,fill:r!=null?r:m,viewBox:"0 0 256 256",transform:c||v?"scale(-1, 1)":void 0,...x,...p},!!n&&Df.createElement("title",null,n),u,f.get(i!=null?i:y))});Pt.displayName="IconBase";var eo=O(ee(),1),GK=new Map([["bold",eo.createElement(eo.Fragment,null,eo.createElement("path",{d:"M232.49,112.49l-48,48a12,12,0,0,1-17-17L195,116H128a84.09,84.09,0,0,0-84,84,12,12,0,0,1-24,0A108.12,108.12,0,0,1,128,92h67L167.51,64.48a12,12,0,0,1,17-17l48,48A12,12,0,0,1,232.49,112.49Z"}))],["duotone",eo.createElement(eo.Fragment,null,eo.createElement("path",{d:"M224,104l-48,48V56Z",opacity:"0.2"}),eo.createElement("path",{d:"M229.66,98.34l-48-48A8,8,0,0,0,168,56V96H128A104.11,104.11,0,0,0,24,200a8,8,0,0,0,16,0,88.1,88.1,0,0,1,88-88h40v40a8,8,0,0,0,13.66,5.66l48-48A8,8,0,0,0,229.66,98.34ZM184,132.69V75.31L212.69,104Z"}))],["fill",eo.createElement(eo.Fragment,null,eo.createElement("path",{d:"M229.66,109.66l-48,48A8,8,0,0,1,168,152V112H128a88.1,88.1,0,0,0-88,88,8,8,0,0,1-16,0A104.11,104.11,0,0,1,128,96h40V56a8,8,0,0,1,13.66-5.66l48,48A8,8,0,0,1,229.66,109.66Z"}))],["light",eo.createElement(eo.Fragment,null,eo.createElement("path",{d:"M228.24,108.24l-48,48a6,6,0,0,1-8.48-8.48L209.51,110H128a90.1,90.1,0,0,0-90,90,6,6,0,0,1-12,0A102.12,102.12,0,0,1,128,98h81.51L171.76,60.24a6,6,0,0,1,8.48-8.48l48,48A6,6,0,0,1,228.24,108.24Z"}))],["regular",eo.createElement(eo.Fragment,null,eo.createElement("path",{d:"M229.66,109.66l-48,48a8,8,0,0,1-11.32-11.32L204.69,112H128a88.1,88.1,0,0,0-88,88,8,8,0,0,1-16,0A104.11,104.11,0,0,1,128,96h76.69L170.34,61.66a8,8,0,0,1,11.32-11.32l48,48A8,8,0,0,1,229.66,109.66Z"}))],["thin",eo.createElement(eo.Fragment,null,eo.createElement("path",{d:"M226.83,106.83l-48,48a4,4,0,0,1-5.66-5.66L214.34,108H128a92.1,92.1,0,0,0-92,92,4,4,0,0,1-8,0A100.11,100.11,0,0,1,128,100h86.34L173.17,58.83a4,4,0,0,1,5.66-5.66l48,48A4,4,0,0,1,226.83,106.83Z"}))]]);var CS=SS.forwardRef((e,t)=>SS.createElement(Pt,{ref:t,...e,weights:GK}));CS.displayName="ArrowBendUpRightIcon";var $S=O(ee(),1);var to=O(ee(),1),qK=new Map([["bold",to.createElement(to.Fragment,null,to.createElement("path",{d:"M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z"}))],["duotone",to.createElement(to.Fragment,null,to.createElement("path",{d:"M184,80V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H176A8,8,0,0,1,184,80Z",opacity:"0.2"}),to.createElement("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"}))],["fill",to.createElement(to.Fragment,null,to.createElement("path",{d:"M192,136v72a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V80A16,16,0,0,1,48,64h72a8,8,0,0,1,0,16H48V208H176V136a8,8,0,0,1,16,0Zm32-96a8,8,0,0,0-8-8H152a8,8,0,0,0-5.66,13.66L172.69,72l-42.35,42.34a8,8,0,0,0,11.32,11.32L184,83.31l26.34,26.35A8,8,0,0,0,224,104Z"}))],["light",to.createElement(to.Fragment,null,to.createElement("path",{d:"M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z"}))],["regular",to.createElement(to.Fragment,null,to.createElement("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"}))],["thin",to.createElement(to.Fragment,null,to.createElement("path",{d:"M220,104a4,4,0,0,1-8,0V49.66l-73.16,73.17a4,4,0,0,1-5.66-5.66L206.34,44H152a4,4,0,0,1,0-8h64a4,4,0,0,1,4,4Zm-36,28a4,4,0,0,0-4,4v72a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4h72a4,4,0,0,0,0-8H48A12,12,0,0,0,36,80V208a12,12,0,0,0,12,12H176a12,12,0,0,0,12-12V136A4,4,0,0,0,184,132Z"}))]]);var wS=$S.forwardRef((e,t)=>$S.createElement(Pt,{ref:t,...e,weights:qK}));wS.displayName="ArrowSquareOutIcon";var TS=O(ee(),1);var no=O(ee(),1),WK=new Map([["bold",no.createElement(no.Fragment,null,no.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",no.createElement(no.Fragment,null,no.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),no.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",no.createElement(no.Fragment,null,no.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",no.createElement(no.Fragment,null,no.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",no.createElement(no.Fragment,null,no.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",no.createElement(no.Fragment,null,no.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]);var IS=TS.forwardRef((e,t)=>TS.createElement(Pt,{ref:t,...e,weights:WK}));IS.displayName="CaretDownIcon";var ES=O(ee(),1);var oo=O(ee(),1),ZK=new Map([["bold",oo.createElement(oo.Fragment,null,oo.createElement("path",{d:"M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z"}))],["duotone",oo.createElement(oo.Fragment,null,oo.createElement("path",{d:"M176,128,96,208V48Z",opacity:"0.2"}),oo.createElement("path",{d:"M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z"}))],["fill",oo.createElement(oo.Fragment,null,oo.createElement("path",{d:"M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z"}))],["light",oo.createElement(oo.Fragment,null,oo.createElement("path",{d:"M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z"}))],["regular",oo.createElement(oo.Fragment,null,oo.createElement("path",{d:"M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"}))],["thin",oo.createElement(oo.Fragment,null,oo.createElement("path",{d:"M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z"}))]]);var AS=ES.forwardRef((e,t)=>ES.createElement(Pt,{ref:t,...e,weights:ZK}));AS.displayName="CaretRightIcon";var kS=O(ee(),1);var ro=O(ee(),1),YK=new Map([["bold",ro.createElement(ro.Fragment,null,ro.createElement("path",{d:"M216.49,79.52l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40V216a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V88A12,12,0,0,0,216.49,79.52ZM160,57l23,23H160ZM60,212V44h76V92a12,12,0,0,0,12,12h48V212Zm112-80a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,132Zm0,40a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,172Z"}))],["duotone",ro.createElement(ro.Fragment,null,ro.createElement("path",{d:"M208,88H152V32Z",opacity:"0.2"}),ro.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-32-80a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,136Zm0,32a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,168Z"}))],["fill",ro.createElement(ro.Fragment,null,ro.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,176H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm-8-56V44l44,44Z"}))],["light",ro.createElement(ro.Fragment,null,ro.createElement("path",{d:"M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40V216a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158ZM200,218H56a2,2,0,0,1-2-2V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V216A2,2,0,0,1,200,218Zm-34-82a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,136Zm0,32a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,168Z"}))],["regular",ro.createElement(ro.Fragment,null,ro.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-32-80a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,136Zm0,32a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,168Z"}))],["thin",ro.createElement(ro.Fragment,null,ro.createElement("path",{d:"M210.83,85.17l-56-56A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40V216a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V88A4,4,0,0,0,210.83,85.17ZM156,41.65,198.34,84H156ZM200,220H56a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52V216A4,4,0,0,1,200,220Zm-36-84a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,136Zm0,32a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,168Z"}))]]);var RS=kS.forwardRef((e,t)=>kS.createElement(Pt,{ref:t,...e,weights:YK}));RS.displayName="FileTextIcon";var MS=O(ee(),1);var ao=O(ee(),1),XK=new Map([["bold",ao.createElement(ao.Fragment,null,ao.createElement("path",{d:"M216,68H133.39l-26-29.29a20,20,0,0,0-15-6.71H40A20,20,0,0,0,20,52V200.62A19.41,19.41,0,0,0,39.38,220H216.89A19.13,19.13,0,0,0,236,200.89V88A20,20,0,0,0,216,68ZM44,56H90.61l10.67,12H44ZM212,196H44V92H212Z"}))],["duotone",ao.createElement(ao.Fragment,null,ao.createElement("path",{d:"M128,80H32V56a8,8,0,0,1,8-8H92.69a8,8,0,0,1,5.65,2.34Z",opacity:"0.2"}),ao.createElement("path",{d:"M216,72H131.31L104,44.69A15.86,15.86,0,0,0,92.69,40H40A16,16,0,0,0,24,56V200.62A15.4,15.4,0,0,0,39.38,216H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72ZM92.69,56l16,16H40V56ZM216,200H40V88H216Z"}))],["fill",ao.createElement(ao.Fragment,null,ao.createElement("path",{d:"M216,72H131.31L104,44.69A15.88,15.88,0,0,0,92.69,40H40A16,16,0,0,0,24,56V200.62A15.41,15.41,0,0,0,39.39,216h177.5A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72ZM40,56H92.69l16,16H40Z"}))],["light",ao.createElement(ao.Fragment,null,ao.createElement("path",{d:"M216,74H130.49l-27.9-27.9a13.94,13.94,0,0,0-9.9-4.1H40A14,14,0,0,0,26,56V200.62A13.39,13.39,0,0,0,39.38,214H216.89A13.12,13.12,0,0,0,230,200.89V88A14,14,0,0,0,216,74ZM40,54H92.69a2,2,0,0,1,1.41.59L113.51,74H38V56A2,2,0,0,1,40,54ZM218,200.89a1.11,1.11,0,0,1-1.11,1.11H39.38A1.4,1.4,0,0,1,38,200.62V86H216a2,2,0,0,1,2,2Z"}))],["regular",ao.createElement(ao.Fragment,null,ao.createElement("path",{d:"M216,72H131.31L104,44.69A15.86,15.86,0,0,0,92.69,40H40A16,16,0,0,0,24,56V200.62A15.4,15.4,0,0,0,39.38,216H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72ZM40,56H92.69l16,16H40ZM216,200H40V88H216Z"}))],["thin",ao.createElement(ao.Fragment,null,ao.createElement("path",{d:"M216,76H129.66L101.17,47.52A11.9,11.9,0,0,0,92.69,44H40A12,12,0,0,0,28,56V200.62A11.4,11.4,0,0,0,39.38,212H216.89A11.12,11.12,0,0,0,228,200.89V88A12,12,0,0,0,216,76ZM36,56a4,4,0,0,1,4-4H92.69a4,4,0,0,1,2.82,1.17L118.34,76H36ZM220,200.89a3.12,3.12,0,0,1-3.11,3.11H39.38A3.39,3.39,0,0,1,36,200.62V84H216a4,4,0,0,1,4,4Z"}))]]);var Tb=MS.forwardRef((e,t)=>MS.createElement(Pt,{ref:t,...e,weights:XK}));Tb.displayName="FolderIcon";var NS=O(ee(),1);var so=O(ee(),1),JK=new Map([["bold",so.createElement(so.Fragment,null,so.createElement("path",{d:"M128,76a52,52,0,1,0,52,52A52.06,52.06,0,0,0,128,76Zm0,80a28,28,0,1,1,28-28A28,28,0,0,1,128,156Zm92-27.21v-1.58l14-17.51a12,12,0,0,0,2.23-10.59A111.75,111.75,0,0,0,225,71.89,12,12,0,0,0,215.89,66L193.61,63.5l-1.11-1.11L190,40.1A12,12,0,0,0,184.11,31a111.67,111.67,0,0,0-27.23-11.27A12,12,0,0,0,146.3,22L128.79,36h-1.58L109.7,22a12,12,0,0,0-10.59-2.23A111.75,111.75,0,0,0,71.89,31.05,12,12,0,0,0,66,40.11L63.5,62.39,62.39,63.5,40.1,66A12,12,0,0,0,31,71.89,111.67,111.67,0,0,0,19.77,99.12,12,12,0,0,0,22,109.7l14,17.51v1.58L22,146.3a12,12,0,0,0-2.23,10.59,111.75,111.75,0,0,0,11.29,27.22A12,12,0,0,0,40.11,190l22.28,2.48,1.11,1.11L66,215.9A12,12,0,0,0,71.89,225a111.67,111.67,0,0,0,27.23,11.27A12,12,0,0,0,109.7,234l17.51-14h1.58l17.51,14a12,12,0,0,0,10.59,2.23A111.75,111.75,0,0,0,184.11,225a12,12,0,0,0,5.91-9.06l2.48-22.28,1.11-1.11L215.9,190a12,12,0,0,0,9.06-5.91,111.67,111.67,0,0,0,11.27-27.23A12,12,0,0,0,234,146.3Zm-24.12-4.89a70.1,70.1,0,0,1,0,8.2,12,12,0,0,0,2.61,8.22l12.84,16.05A86.47,86.47,0,0,1,207,166.86l-20.43,2.27a12,12,0,0,0-7.65,4,69,69,0,0,1-5.8,5.8,12,12,0,0,0-4,7.65L166.86,207a86.47,86.47,0,0,1-10.49,4.35l-16.05-12.85a12,12,0,0,0-7.5-2.62c-.24,0-.48,0-.72,0a70.1,70.1,0,0,1-8.2,0,12.06,12.06,0,0,0-8.22,2.6L99.63,211.33A86.47,86.47,0,0,1,89.14,207l-2.27-20.43a12,12,0,0,0-4-7.65,69,69,0,0,1-5.8-5.8,12,12,0,0,0-7.65-4L49,166.86a86.47,86.47,0,0,1-4.35-10.49l12.84-16.05a12,12,0,0,0,2.61-8.22,70.1,70.1,0,0,1,0-8.2,12,12,0,0,0-2.61-8.22L44.67,99.63A86.47,86.47,0,0,1,49,89.14l20.43-2.27a12,12,0,0,0,7.65-4,69,69,0,0,1,5.8-5.8,12,12,0,0,0,4-7.65L89.14,49a86.47,86.47,0,0,1,10.49-4.35l16.05,12.85a12.06,12.06,0,0,0,8.22,2.6,70.1,70.1,0,0,1,8.2,0,12,12,0,0,0,8.22-2.6l16.05-12.85A86.47,86.47,0,0,1,166.86,49l2.27,20.43a12,12,0,0,0,4,7.65,69,69,0,0,1,5.8,5.8,12,12,0,0,0,7.65,4L207,89.14a86.47,86.47,0,0,1,4.35,10.49l-12.84,16.05A12,12,0,0,0,195.88,123.9Z"}))],["duotone",so.createElement(so.Fragment,null,so.createElement("path",{d:"M207.86,123.18l16.78-21a99.14,99.14,0,0,0-10.07-24.29l-26.7-3a81,81,0,0,0-6.81-6.81l-3-26.71a99.43,99.43,0,0,0-24.3-10l-21,16.77a81.59,81.59,0,0,0-9.64,0l-21-16.78A99.14,99.14,0,0,0,77.91,41.43l-3,26.7a81,81,0,0,0-6.81,6.81l-26.71,3a99.43,99.43,0,0,0-10,24.3l16.77,21a81.59,81.59,0,0,0,0,9.64l-16.78,21a99.14,99.14,0,0,0,10.07,24.29l26.7,3a81,81,0,0,0,6.81,6.81l3,26.71a99.43,99.43,0,0,0,24.3,10l21-16.77a81.59,81.59,0,0,0,9.64,0l21,16.78a99.14,99.14,0,0,0,24.29-10.07l3-26.7a81,81,0,0,0,6.81-6.81l26.71-3a99.43,99.43,0,0,0,10-24.3l-16.77-21A81.59,81.59,0,0,0,207.86,123.18ZM128,168a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z",opacity:"0.2"}),so.createElement("path",{d:"M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Zm88-29.84q.06-2.16,0-4.32l14.92-18.64a8,8,0,0,0,1.48-7.06,107.6,107.6,0,0,0-10.88-26.25,8,8,0,0,0-6-3.93l-23.72-2.64q-1.48-1.56-3-3L186,40.54a8,8,0,0,0-3.94-6,107.29,107.29,0,0,0-26.25-10.86,8,8,0,0,0-7.06,1.48L130.16,40Q128,40,125.84,40L107.2,25.11a8,8,0,0,0-7.06-1.48A107.6,107.6,0,0,0,73.89,34.51a8,8,0,0,0-3.93,6L67.32,64.27q-1.56,1.49-3,3L40.54,70a8,8,0,0,0-6,3.94,107.71,107.71,0,0,0-10.87,26.25,8,8,0,0,0,1.49,7.06L40,125.84Q40,128,40,130.16L25.11,148.8a8,8,0,0,0-1.48,7.06,107.6,107.6,0,0,0,10.88,26.25,8,8,0,0,0,6,3.93l23.72,2.64q1.49,1.56,3,3L70,215.46a8,8,0,0,0,3.94,6,107.71,107.71,0,0,0,26.25,10.87,8,8,0,0,0,7.06-1.49L125.84,216q2.16.06,4.32,0l18.64,14.92a8,8,0,0,0,7.06,1.48,107.21,107.21,0,0,0,26.25-10.88,8,8,0,0,0,3.93-6l2.64-23.72q1.56-1.48,3-3L215.46,186a8,8,0,0,0,6-3.94,107.71,107.71,0,0,0,10.87-26.25,8,8,0,0,0-1.49-7.06Zm-16.1-6.5a73.93,73.93,0,0,1,0,8.68,8,8,0,0,0,1.74,5.48l14.19,17.73a91.57,91.57,0,0,1-6.23,15L187,173.11a8,8,0,0,0-5.1,2.64,74.11,74.11,0,0,1-6.14,6.14,8,8,0,0,0-2.64,5.1l-2.51,22.58a91.32,91.32,0,0,1-15,6.23l-17.74-14.19a8,8,0,0,0-5-1.75h-.48a73.93,73.93,0,0,1-8.68,0,8.06,8.06,0,0,0-5.48,1.74L100.45,215.8a91.57,91.57,0,0,1-15-6.23L82.89,187a8,8,0,0,0-2.64-5.1,74.11,74.11,0,0,1-6.14-6.14,8,8,0,0,0-5.1-2.64L46.43,170.6a91.32,91.32,0,0,1-6.23-15l14.19-17.74a8,8,0,0,0,1.74-5.48,73.93,73.93,0,0,1,0-8.68,8,8,0,0,0-1.74-5.48L40.2,100.45a91.57,91.57,0,0,1,6.23-15L69,82.89a8,8,0,0,0,5.1-2.64,74.11,74.11,0,0,1,6.14-6.14A8,8,0,0,0,82.89,69L85.4,46.43a91.32,91.32,0,0,1,15-6.23l17.74,14.19a8,8,0,0,0,5.48,1.74,73.93,73.93,0,0,1,8.68,0,8.06,8.06,0,0,0,5.48-1.74L155.55,40.2a91.57,91.57,0,0,1,15,6.23L173.11,69a8,8,0,0,0,2.64,5.1,74.11,74.11,0,0,1,6.14,6.14,8,8,0,0,0,5.1,2.64l22.58,2.51a91.32,91.32,0,0,1,6.23,15l-14.19,17.74A8,8,0,0,0,199.87,123.66Z"}))],["fill",so.createElement(so.Fragment,null,so.createElement("path",{d:"M216,130.16q.06-2.16,0-4.32l14.92-18.64a8,8,0,0,0,1.48-7.06,107.6,107.6,0,0,0-10.88-26.25,8,8,0,0,0-6-3.93l-23.72-2.64q-1.48-1.56-3-3L186,40.54a8,8,0,0,0-3.94-6,107.29,107.29,0,0,0-26.25-10.86,8,8,0,0,0-7.06,1.48L130.16,40Q128,40,125.84,40L107.2,25.11a8,8,0,0,0-7.06-1.48A107.6,107.6,0,0,0,73.89,34.51a8,8,0,0,0-3.93,6L67.32,64.27q-1.56,1.49-3,3L40.54,70a8,8,0,0,0-6,3.94,107.71,107.71,0,0,0-10.87,26.25,8,8,0,0,0,1.49,7.06L40,125.84Q40,128,40,130.16L25.11,148.8a8,8,0,0,0-1.48,7.06,107.6,107.6,0,0,0,10.88,26.25,8,8,0,0,0,6,3.93l23.72,2.64q1.49,1.56,3,3L70,215.46a8,8,0,0,0,3.94,6,107.71,107.71,0,0,0,26.25,10.87,8,8,0,0,0,7.06-1.49L125.84,216q2.16.06,4.32,0l18.64,14.92a8,8,0,0,0,7.06,1.48,107.21,107.21,0,0,0,26.25-10.88,8,8,0,0,0,3.93-6l2.64-23.72q1.56-1.48,3-3L215.46,186a8,8,0,0,0,6-3.94,107.71,107.71,0,0,0,10.87-26.25,8,8,0,0,0-1.49-7.06ZM128,168a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z"}))],["light",so.createElement(so.Fragment,null,so.createElement("path",{d:"M128,82a46,46,0,1,0,46,46A46.06,46.06,0,0,0,128,82Zm0,80a34,34,0,1,1,34-34A34,34,0,0,1,128,162ZM214,130.84c.06-1.89.06-3.79,0-5.68L229.33,106a6,6,0,0,0,1.11-5.29A105.34,105.34,0,0,0,219.76,74.9a6,6,0,0,0-4.53-3l-24.45-2.71q-1.93-2.07-4-4l-2.72-24.46a6,6,0,0,0-3-4.53,105.65,105.65,0,0,0-25.77-10.66A6,6,0,0,0,150,26.68l-19.2,15.37c-1.89-.06-3.79-.06-5.68,0L106,26.67a6,6,0,0,0-5.29-1.11A105.34,105.34,0,0,0,74.9,36.24a6,6,0,0,0-3,4.53L69.23,65.22q-2.07,1.94-4,4L40.76,72a6,6,0,0,0-4.53,3,105.65,105.65,0,0,0-10.66,25.77A6,6,0,0,0,26.68,106l15.37,19.2c-.06,1.89-.06,3.79,0,5.68L26.67,150.05a6,6,0,0,0-1.11,5.29A105.34,105.34,0,0,0,36.24,181.1a6,6,0,0,0,4.53,3l24.45,2.71q1.94,2.07,4,4L72,215.24a6,6,0,0,0,3,4.53,105.65,105.65,0,0,0,25.77,10.66,6,6,0,0,0,5.29-1.11L125.16,214c1.89.06,3.79.06,5.68,0l19.21,15.38a6,6,0,0,0,3.75,1.31,6.2,6.2,0,0,0,1.54-.2,105.34,105.34,0,0,0,25.76-10.68,6,6,0,0,0,3-4.53l2.71-24.45q2.07-1.93,4-4l24.46-2.72a6,6,0,0,0,4.53-3,105.49,105.49,0,0,0,10.66-25.77,6,6,0,0,0-1.11-5.29Zm-3.1,41.63-23.64,2.63a6,6,0,0,0-3.82,2,75.14,75.14,0,0,1-6.31,6.31,6,6,0,0,0-2,3.82l-2.63,23.63A94.28,94.28,0,0,1,155.14,218l-18.57-14.86a6,6,0,0,0-3.75-1.31h-.36a78.07,78.07,0,0,1-8.92,0,6,6,0,0,0-4.11,1.3L100.87,218a94.13,94.13,0,0,1-17.34-7.17L80.9,187.21a6,6,0,0,0-2-3.82,75.14,75.14,0,0,1-6.31-6.31,6,6,0,0,0-3.82-2l-23.63-2.63A94.28,94.28,0,0,1,38,155.14l14.86-18.57a6,6,0,0,0,1.3-4.11,78.07,78.07,0,0,1,0-8.92,6,6,0,0,0-1.3-4.11L38,100.87a94.13,94.13,0,0,1,7.17-17.34L68.79,80.9a6,6,0,0,0,3.82-2,75.14,75.14,0,0,1,6.31-6.31,6,6,0,0,0,2-3.82l2.63-23.63A94.28,94.28,0,0,1,100.86,38l18.57,14.86a6,6,0,0,0,4.11,1.3,78.07,78.07,0,0,1,8.92,0,6,6,0,0,0,4.11-1.3L155.13,38a94.13,94.13,0,0,1,17.34,7.17l2.63,23.64a6,6,0,0,0,2,3.82,75.14,75.14,0,0,1,6.31,6.31,6,6,0,0,0,3.82,2l23.63,2.63A94.28,94.28,0,0,1,218,100.86l-14.86,18.57a6,6,0,0,0-1.3,4.11,78.07,78.07,0,0,1,0,8.92,6,6,0,0,0,1.3,4.11L218,155.13A94.13,94.13,0,0,1,210.85,172.47Z"}))],["regular",so.createElement(so.Fragment,null,so.createElement("path",{d:"M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Zm88-29.84q.06-2.16,0-4.32l14.92-18.64a8,8,0,0,0,1.48-7.06,107.21,107.21,0,0,0-10.88-26.25,8,8,0,0,0-6-3.93l-23.72-2.64q-1.48-1.56-3-3L186,40.54a8,8,0,0,0-3.94-6,107.71,107.71,0,0,0-26.25-10.87,8,8,0,0,0-7.06,1.49L130.16,40Q128,40,125.84,40L107.2,25.11a8,8,0,0,0-7.06-1.48A107.6,107.6,0,0,0,73.89,34.51a8,8,0,0,0-3.93,6L67.32,64.27q-1.56,1.49-3,3L40.54,70a8,8,0,0,0-6,3.94,107.71,107.71,0,0,0-10.87,26.25,8,8,0,0,0,1.49,7.06L40,125.84Q40,128,40,130.16L25.11,148.8a8,8,0,0,0-1.48,7.06,107.21,107.21,0,0,0,10.88,26.25,8,8,0,0,0,6,3.93l23.72,2.64q1.49,1.56,3,3L70,215.46a8,8,0,0,0,3.94,6,107.71,107.71,0,0,0,26.25,10.87,8,8,0,0,0,7.06-1.49L125.84,216q2.16.06,4.32,0l18.64,14.92a8,8,0,0,0,7.06,1.48,107.21,107.21,0,0,0,26.25-10.88,8,8,0,0,0,3.93-6l2.64-23.72q1.56-1.48,3-3L215.46,186a8,8,0,0,0,6-3.94,107.71,107.71,0,0,0,10.87-26.25,8,8,0,0,0-1.49-7.06Zm-16.1-6.5a73.93,73.93,0,0,1,0,8.68,8,8,0,0,0,1.74,5.48l14.19,17.73a91.57,91.57,0,0,1-6.23,15L187,173.11a8,8,0,0,0-5.1,2.64,74.11,74.11,0,0,1-6.14,6.14,8,8,0,0,0-2.64,5.1l-2.51,22.58a91.32,91.32,0,0,1-15,6.23l-17.74-14.19a8,8,0,0,0-5-1.75h-.48a73.93,73.93,0,0,1-8.68,0,8,8,0,0,0-5.48,1.74L100.45,215.8a91.57,91.57,0,0,1-15-6.23L82.89,187a8,8,0,0,0-2.64-5.1,74.11,74.11,0,0,1-6.14-6.14,8,8,0,0,0-5.1-2.64L46.43,170.6a91.32,91.32,0,0,1-6.23-15l14.19-17.74a8,8,0,0,0,1.74-5.48,73.93,73.93,0,0,1,0-8.68,8,8,0,0,0-1.74-5.48L40.2,100.45a91.57,91.57,0,0,1,6.23-15L69,82.89a8,8,0,0,0,5.1-2.64,74.11,74.11,0,0,1,6.14-6.14A8,8,0,0,0,82.89,69L85.4,46.43a91.32,91.32,0,0,1,15-6.23l17.74,14.19a8,8,0,0,0,5.48,1.74,73.93,73.93,0,0,1,8.68,0,8,8,0,0,0,5.48-1.74L155.55,40.2a91.57,91.57,0,0,1,15,6.23L173.11,69a8,8,0,0,0,2.64,5.1,74.11,74.11,0,0,1,6.14,6.14,8,8,0,0,0,5.1,2.64l22.58,2.51a91.32,91.32,0,0,1,6.23,15l-14.19,17.74A8,8,0,0,0,199.87,123.66Z"}))],["thin",so.createElement(so.Fragment,null,so.createElement("path",{d:"M128,84a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,84Zm0,80a36,36,0,1,1,36-36A36,36,0,0,1,128,164Zm83.93-32.49q.13-3.51,0-7l15.83-19.79a4,4,0,0,0,.75-3.53A103.64,103.64,0,0,0,218,75.9a4,4,0,0,0-3-2l-25.19-2.8c-1.58-1.71-3.24-3.37-4.95-4.95L182.07,41a4,4,0,0,0-2-3A104,104,0,0,0,154.82,27.5a4,4,0,0,0-3.53.74L131.51,44.07q-3.51-.14-7,0L104.7,28.24a4,4,0,0,0-3.53-.75A103.64,103.64,0,0,0,75.9,38a4,4,0,0,0-2,3l-2.8,25.19c-1.71,1.58-3.37,3.24-4.95,4.95L41,73.93a4,4,0,0,0-3,2A104,104,0,0,0,27.5,101.18a4,4,0,0,0,.74,3.53l15.83,19.78q-.14,3.51,0,7L28.24,151.3a4,4,0,0,0-.75,3.53A103.64,103.64,0,0,0,38,180.1a4,4,0,0,0,3,2l25.19,2.8c1.58,1.71,3.24,3.37,4.95,4.95l2.8,25.2a4,4,0,0,0,2,3,104,104,0,0,0,25.28,10.46,4,4,0,0,0,3.53-.74l19.78-15.83q3.51.13,7,0l19.79,15.83a4,4,0,0,0,2.5.88,4,4,0,0,0,1-.13A103.64,103.64,0,0,0,180.1,218a4,4,0,0,0,2-3l2.8-25.19c1.71-1.58,3.37-3.24,4.95-4.95l25.2-2.8a4,4,0,0,0,3-2,104,104,0,0,0,10.46-25.28,4,4,0,0,0-.74-3.53Zm.17,42.83-24.67,2.74a4,4,0,0,0-2.55,1.32,76.2,76.2,0,0,1-6.48,6.48,4,4,0,0,0-1.32,2.55l-2.74,24.66a95.45,95.45,0,0,1-19.64,8.15l-19.38-15.51a4,4,0,0,0-2.5-.87h-.24a73.67,73.67,0,0,1-9.16,0,4,4,0,0,0-2.74.87l-19.37,15.5a95.33,95.33,0,0,1-19.65-8.13l-2.74-24.67a4,4,0,0,0-1.32-2.55,76.2,76.2,0,0,1-6.48-6.48,4,4,0,0,0-2.55-1.32l-24.66-2.74a95.45,95.45,0,0,1-8.15-19.64l15.51-19.38a4,4,0,0,0,.87-2.74,77.76,77.76,0,0,1,0-9.16,4,4,0,0,0-.87-2.74l-15.5-19.37A95.33,95.33,0,0,1,43.9,81.66l24.67-2.74a4,4,0,0,0,2.55-1.32,76.2,76.2,0,0,1,6.48-6.48,4,4,0,0,0,1.32-2.55l2.74-24.66a95.45,95.45,0,0,1,19.64-8.15l19.38,15.51a4,4,0,0,0,2.74.87,73.67,73.67,0,0,1,9.16,0,4,4,0,0,0,2.74-.87l19.37-15.5a95.33,95.33,0,0,1,19.65,8.13l2.74,24.67a4,4,0,0,0,1.32,2.55,76.2,76.2,0,0,1,6.48,6.48,4,4,0,0,0,2.55,1.32l24.66,2.74a95.45,95.45,0,0,1,8.15,19.64l-15.51,19.38a4,4,0,0,0-.87,2.74,77.76,77.76,0,0,1,0,9.16,4,4,0,0,0,.87,2.74l15.5,19.37A95.33,95.33,0,0,1,212.1,174.34Z"}))]]);var yh=NS.forwardRef((e,t)=>NS.createElement(Pt,{ref:t,...e,weights:JK}));yh.displayName="GearIcon";var PS=O(ee(),1);var io=O(ee(),1),QK=new Map([["bold",io.createElement(io.Fragment,null,io.createElement("path",{d:"M144,96a16,16,0,1,1,16,16A16,16,0,0,1,144,96Zm92-40V200a20,20,0,0,1-20,20H40a20,20,0,0,1-20-20V56A20,20,0,0,1,40,36H216A20,20,0,0,1,236,56ZM44,60v79.72l33.86-33.86a20,20,0,0,1,28.28,0L147.31,147l17.18-17.17a20,20,0,0,1,28.28,0L212,149.09V60Zm0,136H162.34L92,125.66l-48,48Zm168,0V183l-33.37-33.37L164.28,164l32,32Z"}))],["duotone",io.createElement(io.Fragment,null,io.createElement("path",{d:"M224,56V178.06l-39.72-39.72a8,8,0,0,0-11.31,0L147.31,164,97.66,114.34a8,8,0,0,0-11.32,0L32,168.69V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z",opacity:"0.2"}),io.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"}))],["fill",io.createElement(io.Fragment,null,io.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM156,88a12,12,0,1,1-12,12A12,12,0,0,1,156,88Zm60,112H40V160.69l46.34-46.35a8,8,0,0,1,11.32,0h0L165,181.66a8,8,0,0,0,11.32-11.32l-17.66-17.65L173,138.34a8,8,0,0,1,11.31,0L216,170.07V200Z"}))],["light",io.createElement(io.Fragment,null,io.createElement("path",{d:"M216,42H40A14,14,0,0,0,26,56V200a14,14,0,0,0,14,14H216a14,14,0,0,0,14-14V56A14,14,0,0,0,216,42ZM40,54H216a2,2,0,0,1,2,2V163.57L188.53,134.1a14,14,0,0,0-19.8,0l-21.42,21.42L101.9,110.1a14,14,0,0,0-19.8,0L38,154.2V56A2,2,0,0,1,40,54ZM38,200V171.17l52.58-52.58a2,2,0,0,1,2.84,0L176.83,202H40A2,2,0,0,1,38,200Zm178,2H193.8l-38-38,21.41-21.42a2,2,0,0,1,2.83,0l38,38V200A2,2,0,0,1,216,202ZM146,100a10,10,0,1,1,10,10A10,10,0,0,1,146,100Z"}))],["regular",io.createElement(io.Fragment,null,io.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"}))],["thin",io.createElement(io.Fragment,null,io.createElement("path",{d:"M216,44H40A12,12,0,0,0,28,56V200a12,12,0,0,0,12,12H216a12,12,0,0,0,12-12V56A12,12,0,0,0,216,44ZM40,52H216a4,4,0,0,1,4,4V168.4l-32.89-32.89a12,12,0,0,0-17,0l-22.83,22.83-46.82-46.83a12,12,0,0,0-17,0L36,159V56A4,4,0,0,1,40,52ZM36,200V170.34l53.17-53.17a4,4,0,0,1,5.66,0L181.66,204H40A4,4,0,0,1,36,200Zm180,4H193l-40-40,22.83-22.83a4,4,0,0,1,5.66,0L220,179.71V200A4,4,0,0,1,216,204ZM148,100a8,8,0,1,1,8,8A8,8,0,0,1,148,100Z"}))]]);var DS=PS.forwardRef((e,t)=>PS.createElement(Pt,{ref:t,...e,weights:QK}));DS.displayName="ImageIcon";var LS=O(ee(),1);var lo=O(ee(),1),eG=new Map([["bold",lo.createElement(lo.Fragment,null,lo.createElement("path",{d:"M216,36H40A20,20,0,0,0,20,56V200a20,20,0,0,0,20,20H216a20,20,0,0,0,20-20V56A20,20,0,0,0,216,36Zm-4,24V92H44V60ZM44,116H92v80H44Zm72,80V116h96v80Z"}))],["duotone",lo.createElement(lo.Fragment,null,lo.createElement("path",{d:"M104,104V208H40a8,8,0,0,1-8-8V104Z",opacity:"0.2"}),lo.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V96H40V56ZM40,112H96v88H40Zm176,88H112V112H216v88Z"}))],["fill",lo.createElement(lo.Fragment,null,lo.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,56H216V96H40ZM216,200H112V112H216v88Z"}))],["light",lo.createElement(lo.Fragment,null,lo.createElement("path",{d:"M216,42H40A14,14,0,0,0,26,56V200a14,14,0,0,0,14,14H216a14,14,0,0,0,14-14V56A14,14,0,0,0,216,42ZM40,54H216a2,2,0,0,1,2,2V98H38V56A2,2,0,0,1,40,54ZM38,200V110H98v92H40A2,2,0,0,1,38,200Zm178,2H110V110H218v90A2,2,0,0,1,216,202Z"}))],["regular",lo.createElement(lo.Fragment,null,lo.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V96H40V56ZM40,112H96v88H40Zm176,88H112V112H216v88Z"}))],["thin",lo.createElement(lo.Fragment,null,lo.createElement("path",{d:"M216,44H40A12,12,0,0,0,28,56V200a12,12,0,0,0,12,12H216a12,12,0,0,0,12-12V56A12,12,0,0,0,216,44ZM40,52H216a4,4,0,0,1,4,4v44H36V56A4,4,0,0,1,40,52ZM36,200V108h64v96H40A4,4,0,0,1,36,200Zm180,4H108V108H220v92A4,4,0,0,1,216,204Z"}))]]);var OS=LS.forwardRef((e,t)=>LS.createElement(Pt,{ref:t,...e,weights:eG}));OS.displayName="LayoutIcon";var BS=O(ee(),1);var co=O(ee(),1),tG=new Map([["bold",co.createElement(co.Fragment,null,co.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H40a12,12,0,0,1,0-24H216A12,12,0,0,1,228,128ZM40,76H216a12,12,0,0,0,0-24H40a12,12,0,0,0,0,24ZM216,180H40a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24Z"}))],["duotone",co.createElement(co.Fragment,null,co.createElement("path",{d:"M216,64V192H40V64Z",opacity:"0.2"}),co.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM40,72H216a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"}))],["fill",co.createElement(co.Fragment,null,co.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM192,184H64a8,8,0,0,1,0-16H192a8,8,0,0,1,0,16Zm0-48H64a8,8,0,0,1,0-16H192a8,8,0,0,1,0,16Zm0-48H64a8,8,0,0,1,0-16H192a8,8,0,0,1,0,16Z"}))],["light",co.createElement(co.Fragment,null,co.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H40a6,6,0,0,1,0-12H216A6,6,0,0,1,222,128ZM40,70H216a6,6,0,0,0,0-12H40a6,6,0,0,0,0,12ZM216,186H40a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12Z"}))],["regular",co.createElement(co.Fragment,null,co.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM40,72H216a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"}))],["thin",co.createElement(co.Fragment,null,co.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H40a4,4,0,0,1,0-8H216A4,4,0,0,1,220,128ZM40,68H216a4,4,0,0,0,0-8H40a4,4,0,0,0,0,8ZM216,188H40a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8Z"}))]]);var HS=BS.forwardRef((e,t)=>BS.createElement(Pt,{ref:t,...e,weights:tG}));HS.displayName="ListIcon";var FS=O(ee(),1);var uo=O(ee(),1),nG=new Map([["bold",uo.createElement(uo.Fragment,null,uo.createElement("path",{d:"M84,64A12,12,0,0,1,96,52H216a12,12,0,0,1,0,24H96A12,12,0,0,1,84,64Zm132,52H96a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24Zm0,64H96a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24ZM56,52H40a12,12,0,0,0,0,24H56a12,12,0,0,0,0-24Zm0,64H40a12,12,0,0,0,0,24H56a12,12,0,0,0,0-24Zm0,64H40a12,12,0,0,0,0,24H56a12,12,0,0,0,0-24Z"}))],["duotone",uo.createElement(uo.Fragment,null,uo.createElement("path",{d:"M216,64V192H96V64Z",opacity:"0.2"}),uo.createElement("path",{d:"M88,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H96A8,8,0,0,1,88,64Zm128,56H96a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16Zm0,64H96a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16ZM56,56H40a8,8,0,0,0,0,16H56a8,8,0,0,0,0-16Zm0,64H40a8,8,0,1,0,0,16H56a8,8,0,0,0,0-16Zm0,64H40a8,8,0,1,0,0,16H56a8,8,0,0,0,0-16Z"}))],["fill",uo.createElement(uo.Fragment,null,uo.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,184H64a8,8,0,0,1,0-16h8a8,8,0,0,1,0,16Zm0-48H64a8,8,0,0,1,0-16h8a8,8,0,0,1,0,16Zm0-48H64a8,8,0,0,1,0-16h8a8,8,0,0,1,0,16Zm120,96H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Z"}))],["light",uo.createElement(uo.Fragment,null,uo.createElement("path",{d:"M90,64a6,6,0,0,1,6-6H216a6,6,0,0,1,0,12H96A6,6,0,0,1,90,64Zm126,58H96a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12Zm0,64H96a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12ZM56,58H40a6,6,0,0,0,0,12H56a6,6,0,0,0,0-12Zm0,64H40a6,6,0,0,0,0,12H56a6,6,0,0,0,0-12Zm0,64H40a6,6,0,0,0,0,12H56a6,6,0,0,0,0-12Z"}))],["regular",uo.createElement(uo.Fragment,null,uo.createElement("path",{d:"M88,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H96A8,8,0,0,1,88,64Zm128,56H96a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H96a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM56,56H40a8,8,0,0,0,0,16H56a8,8,0,0,0,0-16Zm0,64H40a8,8,0,0,0,0,16H56a8,8,0,0,0,0-16Zm0,64H40a8,8,0,0,0,0,16H56a8,8,0,0,0,0-16Z"}))],["thin",uo.createElement(uo.Fragment,null,uo.createElement("path",{d:"M92,64a4,4,0,0,1,4-4H216a4,4,0,0,1,0,8H96A4,4,0,0,1,92,64Zm124,60H96a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8Zm0,64H96a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8ZM56,60H40a4,4,0,0,0,0,8H56a4,4,0,0,0,0-8Zm0,64H40a4,4,0,0,0,0,8H56a4,4,0,0,0,0-8Zm0,64H40a4,4,0,0,0,0,8H56a4,4,0,0,0,0-8Z"}))]]);var _S=FS.forwardRef((e,t)=>FS.createElement(Pt,{ref:t,...e,weights:nG}));_S.displayName="ListDashesIcon";var zS=O(ee(),1);var fo=O(ee(),1),oG=new Map([["bold",fo.createElement(fo.Fragment,null,fo.createElement("path",{d:"M236.37,139.4a12,12,0,0,0-12-3A84.07,84.07,0,0,1,119.6,31.59a12,12,0,0,0-15-15A108.86,108.86,0,0,0,49.69,55.07,108,108,0,0,0,136,228a107.09,107.09,0,0,0,64.93-21.69,108.86,108.86,0,0,0,38.44-54.94A12,12,0,0,0,236.37,139.4Zm-49.88,47.74A84,84,0,0,1,68.86,69.51,84.93,84.93,0,0,1,92.27,48.29Q92,52.13,92,56A108.12,108.12,0,0,0,200,164q3.87,0,7.71-.27A84.79,84.79,0,0,1,186.49,187.14Z"}))],["duotone",fo.createElement(fo.Fragment,null,fo.createElement("path",{d:"M227.89,147.89A96,96,0,1,1,108.11,28.11,96.09,96.09,0,0,0,227.89,147.89Z",opacity:"0.2"}),fo.createElement("path",{d:"M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z"}))],["fill",fo.createElement(fo.Fragment,null,fo.createElement("path",{d:"M235.54,150.21a104.84,104.84,0,0,1-37,52.91A104,104,0,0,1,32,120,103.09,103.09,0,0,1,52.88,57.48a104.84,104.84,0,0,1,52.91-37,8,8,0,0,1,10,10,88.08,88.08,0,0,0,109.8,109.8,8,8,0,0,1,10,10Z"}))],["light",fo.createElement(fo.Fragment,null,fo.createElement("path",{d:"M232.13,143.64a6,6,0,0,0-6-1.49A90.07,90.07,0,0,1,113.86,29.85a6,6,0,0,0-7.49-7.48A102.88,102.88,0,0,0,54.48,58.68,102,102,0,0,0,197.32,201.52a102.88,102.88,0,0,0,36.31-51.89A6,6,0,0,0,232.13,143.64Zm-42,48.29a90,90,0,0,1-126-126A90.9,90.9,0,0,1,99.65,37.66,102.06,102.06,0,0,0,218.34,156.35,90.9,90.9,0,0,1,190.1,191.93Z"}))],["regular",fo.createElement(fo.Fragment,null,fo.createElement("path",{d:"M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z"}))],["thin",fo.createElement(fo.Fragment,null,fo.createElement("path",{d:"M230.72,145.06a4,4,0,0,0-4-1A92.08,92.08,0,0,1,111.94,29.27a4,4,0,0,0-5-5A100.78,100.78,0,0,0,56.08,59.88a100,100,0,0,0,140,140,100.78,100.78,0,0,0,35.59-50.87A4,4,0,0,0,230.72,145.06ZM191.3,193.53A92,92,0,0,1,62.47,64.7a93,93,0,0,1,39.88-30.35,100.09,100.09,0,0,0,119.3,119.3A93,93,0,0,1,191.3,193.53Z"}))]]);var VS=zS.forwardRef((e,t)=>zS.createElement(Pt,{ref:t,...e,weights:oG}));VS.displayName="MoonIcon";var US=O(ee(),1);var po=O(ee(),1),rG=new Map([["bold",po.createElement(po.Fragment,null,po.createElement("path",{d:"M216,36H40A20,20,0,0,0,20,56V200a20,20,0,0,0,20,20H216a20,20,0,0,0,20-20V56A20,20,0,0,0,216,36ZM44,60H76V196H44ZM212,196H100V60H212Z"}))],["duotone",po.createElement(po.Fragment,null,po.createElement("path",{d:"M88,48V208H40a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8Z",opacity:"0.2"}),po.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,56H80V200H40ZM216,200H96V56H216V200Z"}))],["fill",po.createElement(po.Fragment,null,po.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,160H88V56H216V200Z"}))],["light",po.createElement(po.Fragment,null,po.createElement("path",{d:"M216,42H40A14,14,0,0,0,26,56V200a14,14,0,0,0,14,14H216a14,14,0,0,0,14-14V56A14,14,0,0,0,216,42ZM38,200V56a2,2,0,0,1,2-2H82V202H40A2,2,0,0,1,38,200Zm180,0a2,2,0,0,1-2,2H94V54H216a2,2,0,0,1,2,2Z"}))],["regular",po.createElement(po.Fragment,null,po.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,56H80V200H40ZM216,200H96V56H216V200Z"}))],["thin",po.createElement(po.Fragment,null,po.createElement("path",{d:"M216,44H40A12,12,0,0,0,28,56V200a12,12,0,0,0,12,12H216a12,12,0,0,0,12-12V56A12,12,0,0,0,216,44ZM36,200V56a4,4,0,0,1,4-4H84V204H40A4,4,0,0,1,36,200Zm184,0a4,4,0,0,1-4,4H92V52H216a4,4,0,0,1,4,4Z"}))]]);var jS=US.forwardRef((e,t)=>US.createElement(Pt,{ref:t,...e,weights:rG}));jS.displayName="SidebarSimpleIcon";var KS=O(ee(),1);var mo=O(ee(),1),aG=new Map([["bold",mo.createElement(mo.Fragment,null,mo.createElement("path",{d:"M124,216a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V40A12,12,0,0,1,48,28h64a12,12,0,0,1,0,24H60V204h52A12,12,0,0,1,124,216Zm108.49-96.49-40-40a12,12,0,0,0-17,17L195,116H112a12,12,0,0,0,0,24h83l-19.52,19.51a12,12,0,0,0,17,17l40-40A12,12,0,0,0,232.49,119.51Z"}))],["duotone",mo.createElement(mo.Fragment,null,mo.createElement("path",{d:"M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z",opacity:"0.2"}),mo.createElement("path",{d:"M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z"}))],["fill",mo.createElement(mo.Fragment,null,mo.createElement("path",{d:"M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40A8,8,0,0,0,176,88v32H112a8,8,0,0,0,0,16h64v32a8,8,0,0,0,13.66,5.66l40-40A8,8,0,0,0,229.66,122.34Z"}))],["light",mo.createElement(mo.Fragment,null,mo.createElement("path",{d:"M118,216a6,6,0,0,1-6,6H48a6,6,0,0,1-6-6V40a6,6,0,0,1,6-6h64a6,6,0,0,1,0,12H54V210h58A6,6,0,0,1,118,216Zm110.24-92.24-40-40a6,6,0,0,0-8.48,8.48L209.51,122H112a6,6,0,0,0,0,12h97.51l-29.75,29.76a6,6,0,1,0,8.48,8.48l40-40A6,6,0,0,0,228.24,123.76Z"}))],["regular",mo.createElement(mo.Fragment,null,mo.createElement("path",{d:"M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z"}))],["thin",mo.createElement(mo.Fragment,null,mo.createElement("path",{d:"M116,216a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h64a4,4,0,0,1,0,8H52V212h60A4,4,0,0,1,116,216Zm110.83-90.83-40-40a4,4,0,0,0-5.66,5.66L214.34,124H112a4,4,0,0,0,0,8H214.34l-33.17,33.17a4,4,0,0,0,5.66,5.66l40-40A4,4,0,0,0,226.83,125.17Z"}))]]);var Ib=KS.forwardRef((e,t)=>KS.createElement(Pt,{ref:t,...e,weights:aG}));Ib.displayName="SignOutIcon";var GS=O(ee(),1);var ho=O(ee(),1),sG=new Map([["bold",ho.createElement(ho.Fragment,null,ho.createElement("path",{d:"M100,36H56A20,20,0,0,0,36,56v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V56A20,20,0,0,0,100,36ZM96,96H60V60H96ZM200,36H156a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,60H160V60h36Zm-96,40H56a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V156A20,20,0,0,0,100,136Zm-4,60H60V160H96Zm104-60H156a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V156A20,20,0,0,0,200,136Zm-4,60H160V160h36Z"}))],["duotone",ho.createElement(ho.Fragment,null,ho.createElement("path",{d:"M112,56v48a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8h48A8,8,0,0,1,112,56Zm88-8H152a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V56A8,8,0,0,0,200,48Zm-96,96H56a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V152A8,8,0,0,0,104,144Zm96,0H152a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V152A8,8,0,0,0,200,144Z",opacity:"0.2"}),ho.createElement("path",{d:"M200,136H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Zm0,64H152V152h48v48ZM104,40H56A16,16,0,0,0,40,56v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,104,40Zm0,64H56V56h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,64H152V56h48v48Zm-96,32H56a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,104,136Zm0,64H56V152h48v48Z"}))],["fill",ho.createElement(ho.Fragment,null,ho.createElement("path",{d:"M120,56v48a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40h48A16,16,0,0,1,120,56Zm80-16H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm-96,96H56a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,104,136Zm96,0H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Z"}))],["light",ho.createElement(ho.Fragment,null,ho.createElement("path",{d:"M104,42H56A14,14,0,0,0,42,56v48a14,14,0,0,0,14,14h48a14,14,0,0,0,14-14V56A14,14,0,0,0,104,42Zm2,62a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2h48a2,2,0,0,1,2,2Zm94-62H152a14,14,0,0,0-14,14v48a14,14,0,0,0,14,14h48a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,62a2,2,0,0,1-2,2H152a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2h48a2,2,0,0,1,2,2Zm-98,34H56a14,14,0,0,0-14,14v48a14,14,0,0,0,14,14h48a14,14,0,0,0,14-14V152A14,14,0,0,0,104,138Zm2,62a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V152a2,2,0,0,1,2-2h48a2,2,0,0,1,2,2Zm94-62H152a14,14,0,0,0-14,14v48a14,14,0,0,0,14,14h48a14,14,0,0,0,14-14V152A14,14,0,0,0,200,138Zm2,62a2,2,0,0,1-2,2H152a2,2,0,0,1-2-2V152a2,2,0,0,1,2-2h48a2,2,0,0,1,2,2Z"}))],["regular",ho.createElement(ho.Fragment,null,ho.createElement("path",{d:"M104,40H56A16,16,0,0,0,40,56v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,104,40Zm0,64H56V56h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,64H152V56h48v48Zm-96,32H56a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,104,136Zm0,64H56V152h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Zm0,64H152V152h48v48Z"}))],["thin",ho.createElement(ho.Fragment,null,ho.createElement("path",{d:"M104,44H56A12,12,0,0,0,44,56v48a12,12,0,0,0,12,12h48a12,12,0,0,0,12-12V56A12,12,0,0,0,104,44Zm4,60a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4Zm92-60H152a12,12,0,0,0-12,12v48a12,12,0,0,0,12,12h48a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,60a4,4,0,0,1-4,4H152a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4ZM104,140H56a12,12,0,0,0-12,12v48a12,12,0,0,0,12,12h48a12,12,0,0,0,12-12V152A12,12,0,0,0,104,140Zm4,60a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V152a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4Zm92-60H152a12,12,0,0,0-12,12v48a12,12,0,0,0,12,12h48a12,12,0,0,0,12-12V152A12,12,0,0,0,200,140Zm4,60a4,4,0,0,1-4,4H152a4,4,0,0,1-4-4V152a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4Z"}))]]);var qS=GS.forwardRef((e,t)=>GS.createElement(Pt,{ref:t,...e,weights:sG}));qS.displayName="SquaresFourIcon";var WS=O(ee(),1);var Fn=O(ee(),1),iG=new Map([["bold",Fn.createElement(Fn.Fragment,null,Fn.createElement("path",{d:"M234.36,170A12,12,0,0,1,230,186.37l-96,56a12,12,0,0,1-12.1,0l-96-56a12,12,0,0,1,12.09-20.74l90,52.48L218,165.63A12,12,0,0,1,234.36,170ZM218,117.63,128,170.11,38.05,117.63A12,12,0,0,0,26,138.37l96,56a12,12,0,0,0,12.1,0l96-56A12,12,0,0,0,218,117.63ZM20,80a12,12,0,0,1,6-10.37l96-56a12.06,12.06,0,0,1,12.1,0l96,56a12,12,0,0,1,0,20.74l-96,56a12,12,0,0,1-12.1,0l-96-56A12,12,0,0,1,20,80Zm35.82,0L128,122.11,200.18,80,128,37.89Z"}))],["duotone",Fn.createElement(Fn.Fragment,null,Fn.createElement("path",{d:"M224,80l-96,56L32,80l96-56Z",opacity:"0.2"}),Fn.createElement("path",{d:"M230.91,172A8,8,0,0,1,228,182.91l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,36,169.09l92,53.65,92-53.65A8,8,0,0,1,230.91,172ZM220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09ZM24,80a8,8,0,0,1,4-6.91l96-56a8,8,0,0,1,8.06,0l96,56a8,8,0,0,1,0,13.82l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,24,80Zm23.88,0L128,126.74,208.12,80,128,33.26Z"}))],["fill",Fn.createElement(Fn.Fragment,null,Fn.createElement("path",{d:"M220,169.09l-92,53.65L36,169.09A8,8,0,0,0,28,182.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,169.09Z"}),Fn.createElement("path",{d:"M220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09Z"}),Fn.createElement("path",{d:"M28,86.91l96,56a8,8,0,0,0,8.06,0l96-56a8,8,0,0,0,0-13.82l-96-56a8,8,0,0,0-8.06,0l-96,56a8,8,0,0,0,0,13.82Z"}))],["light",Fn.createElement(Fn.Fragment,null,Fn.createElement("path",{d:"M229.18,173a6,6,0,0,1-2.16,8.2l-96,56a6,6,0,0,1-6,0l-96-56a6,6,0,0,1,6-10.36l93,54.23,93-54.23A6,6,0,0,1,229.18,173ZM221,122.82l-93,54.23L35,122.82a6,6,0,0,0-6,10.36l96,56a6,6,0,0,0,6,0l96-56a6,6,0,0,0-6-10.36ZM26,80a6,6,0,0,1,3-5.18l96-56a6,6,0,0,1,6,0l96,56a6,6,0,0,1,0,10.36l-96,56a6,6,0,0,1-6,0l-96-56A6,6,0,0,1,26,80Zm17.91,0L128,129.05,212.09,80,128,31Z"}))],["regular",Fn.createElement(Fn.Fragment,null,Fn.createElement("path",{d:"M230.91,172A8,8,0,0,1,228,182.91l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,36,169.09l92,53.65,92-53.65A8,8,0,0,1,230.91,172ZM220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09ZM24,80a8,8,0,0,1,4-6.91l96-56a8,8,0,0,1,8.06,0l96,56a8,8,0,0,1,0,13.82l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,24,80Zm23.88,0L128,126.74,208.12,80,128,33.26Z"}))],["thin",Fn.createElement(Fn.Fragment,null,Fn.createElement("path",{d:"M227.45,174a4,4,0,0,1-1.44,5.48l-96,56a4,4,0,0,1-4,0l-96-56a4,4,0,0,1,4-6.92l94,54.83,94-54.83A4,4,0,0,1,227.45,174ZM222,124.54l-94,54.83L34,124.54a4,4,0,0,0-4,6.92l96,56a4,4,0,0,0,4,0l96-56a4,4,0,0,0-4-6.92ZM28,80a4,4,0,0,1,2-3.46l96-56a4,4,0,0,1,4,0l96,56a4,4,0,0,1,0,6.92l-96,56a4,4,0,0,1-4,0l-96-56A4,4,0,0,1,28,80Zm11.94,0L128,131.37,216.06,80,128,28.63Z"}))]]);var ZS=WS.forwardRef((e,t)=>WS.createElement(Pt,{ref:t,...e,weights:iG}));ZS.displayName="StackIcon";var YS=O(ee(),1);var go=O(ee(),1),lG=new Map([["bold",go.createElement(go.Fragment,null,go.createElement("path",{d:"M116,36V20a12,12,0,0,1,24,0V36a12,12,0,0,1-24,0Zm80,92a68,68,0,1,1-68-68A68.07,68.07,0,0,1,196,128Zm-24,0a44,44,0,1,0-44,44A44.05,44.05,0,0,0,172,128ZM51.51,68.49a12,12,0,1,0,17-17l-12-12a12,12,0,0,0-17,17Zm0,119-12,12a12,12,0,0,0,17,17l12-12a12,12,0,1,0-17-17ZM196,72a12,12,0,0,0,8.49-3.51l12-12a12,12,0,0,0-17-17l-12,12A12,12,0,0,0,196,72Zm8.49,115.51a12,12,0,0,0-17,17l12,12a12,12,0,0,0,17-17ZM48,128a12,12,0,0,0-12-12H20a12,12,0,0,0,0,24H36A12,12,0,0,0,48,128Zm80,80a12,12,0,0,0-12,12v16a12,12,0,0,0,24,0V220A12,12,0,0,0,128,208Zm108-92H220a12,12,0,0,0,0,24h16a12,12,0,0,0,0-24Z"}))],["duotone",go.createElement(go.Fragment,null,go.createElement("path",{d:"M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z",opacity:"0.2"}),go.createElement("path",{d:"M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"}))],["fill",go.createElement(go.Fragment,null,go.createElement("path",{d:"M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm8,24a64,64,0,1,0,64,64A64.07,64.07,0,0,0,128,64ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"}))],["light",go.createElement(go.Fragment,null,go.createElement("path",{d:"M122,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm68,88a62,62,0,1,1-62-62A62.07,62.07,0,0,1,190,128Zm-12,0a50,50,0,1,0-50,50A50.06,50.06,0,0,0,178,128ZM59.76,68.24a6,6,0,1,0,8.48-8.48l-16-16a6,6,0,0,0-8.48,8.48Zm0,119.52-16,16a6,6,0,1,0,8.48,8.48l16-16a6,6,0,1,0-8.48-8.48ZM192,70a6,6,0,0,0,4.24-1.76l16-16a6,6,0,0,0-8.48-8.48l-16,16A6,6,0,0,0,192,70Zm4.24,117.76a6,6,0,0,0-8.48,8.48l16,16a6,6,0,0,0,8.48-8.48ZM46,128a6,6,0,0,0-6-6H16a6,6,0,0,0,0,12H40A6,6,0,0,0,46,128Zm82,82a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V216A6,6,0,0,0,128,210Zm112-88H216a6,6,0,0,0,0,12h24a6,6,0,0,0,0-12Z"}))],["regular",go.createElement(go.Fragment,null,go.createElement("path",{d:"M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"}))],["thin",go.createElement(go.Fragment,null,go.createElement("path",{d:"M124,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm64,88a60,60,0,1,1-60-60A60.07,60.07,0,0,1,188,128Zm-8,0a52,52,0,1,0-52,52A52.06,52.06,0,0,0,180,128ZM61.17,66.83a4,4,0,0,0,5.66-5.66l-16-16a4,4,0,0,0-5.66,5.66Zm0,122.34-16,16a4,4,0,0,0,5.66,5.66l16-16a4,4,0,0,0-5.66-5.66ZM192,68a4,4,0,0,0,2.83-1.17l16-16a4,4,0,1,0-5.66-5.66l-16,16A4,4,0,0,0,192,68Zm2.83,121.17a4,4,0,0,0-5.66,5.66l16,16a4,4,0,0,0,5.66-5.66ZM40,124H16a4,4,0,0,0,0,8H40a4,4,0,0,0,0-8Zm88,88a4,4,0,0,0-4,4v24a4,4,0,0,0,8,0V216A4,4,0,0,0,128,212Zm112-88H216a4,4,0,0,0,0,8h24a4,4,0,0,0,0-8Z"}))]]);var XS=YS.forwardRef((e,t)=>YS.createElement(Pt,{ref:t,...e,weights:lG}));XS.displayName="SunIcon";var JS=O(ee(),1);var bo=O(ee(),1),cG=new Map([["bold",bo.createElement(bo.Fragment,null,bo.createElement("path",{d:"M246.15,133.18,146.83,33.86A19.85,19.85,0,0,0,132.69,28H40A12,12,0,0,0,28,40v92.69a19.85,19.85,0,0,0,5.86,14.14l99.32,99.32a20,20,0,0,0,28.28,0l84.69-84.69A20,20,0,0,0,246.15,133.18Zm-98.83,93.17L52,131V52h79l95.32,95.32ZM104,88A16,16,0,1,1,88,72,16,16,0,0,1,104,88Z"}))],["duotone",bo.createElement(bo.Fragment,null,bo.createElement("path",{d:"M237.66,153,153,237.66a8,8,0,0,1-11.31,0L42.34,138.34A8,8,0,0,1,40,132.69V40h92.69a8,8,0,0,1,5.65,2.34l99.32,99.32A8,8,0,0,1,237.66,153Z",opacity:"0.2"}),bo.createElement("path",{d:"M243.31,136,144,36.69A15.86,15.86,0,0,0,132.69,32H40a8,8,0,0,0-8,8v92.69A15.86,15.86,0,0,0,36.69,144L136,243.31a16,16,0,0,0,22.63,0l84.68-84.68a16,16,0,0,0,0-22.63Zm-96,96L48,132.69V48h84.69L232,147.31ZM96,84A12,12,0,1,1,84,72,12,12,0,0,1,96,84Z"}))],["fill",bo.createElement(bo.Fragment,null,bo.createElement("path",{d:"M243.31,136,144,36.69A15.86,15.86,0,0,0,132.69,32H40a8,8,0,0,0-8,8v92.69A15.86,15.86,0,0,0,36.69,144L136,243.31a16,16,0,0,0,22.63,0l84.68-84.68a16,16,0,0,0,0-22.63ZM84,96A12,12,0,1,1,96,84,12,12,0,0,1,84,96Z"}))],["light",bo.createElement(bo.Fragment,null,bo.createElement("path",{d:"M241.91,137.42,142.59,38.1a13.94,13.94,0,0,0-9.9-4.1H40a6,6,0,0,0-6,6v92.69a13.94,13.94,0,0,0,4.1,9.9l99.32,99.32a14,14,0,0,0,19.8,0l84.69-84.69A14,14,0,0,0,241.91,137.42Zm-8.49,11.31-84.69,84.69a2,2,0,0,1-2.83,0L46.59,134.1a2,2,0,0,1-.59-1.41V46h86.69a2,2,0,0,1,1.41.59l99.32,99.31A2,2,0,0,1,233.42,148.73ZM94,84A10,10,0,1,1,84,74,10,10,0,0,1,94,84Z"}))],["regular",bo.createElement(bo.Fragment,null,bo.createElement("path",{d:"M243.31,136,144,36.69A15.86,15.86,0,0,0,132.69,32H40a8,8,0,0,0-8,8v92.69A15.86,15.86,0,0,0,36.69,144L136,243.31a16,16,0,0,0,22.63,0l84.68-84.68a16,16,0,0,0,0-22.63Zm-96,96L48,132.69V48h84.69L232,147.31ZM96,84A12,12,0,1,1,84,72,12,12,0,0,1,96,84Z"}))],["thin",bo.createElement(bo.Fragment,null,bo.createElement("path",{d:"M240.49,138.83,141.17,39.51A11.93,11.93,0,0,0,132.69,36H40a4,4,0,0,0-4,4v92.69a11.93,11.93,0,0,0,3.51,8.48l99.32,99.32a12,12,0,0,0,17,0l84.69-84.69a12,12,0,0,0,0-17Zm-5.66,11.31-84.69,84.69a4,4,0,0,1-5.65,0L45.17,135.51A4,4,0,0,1,44,132.69V44h88.69a4,4,0,0,1,2.82,1.17l99.32,99.32A4,4,0,0,1,234.83,150.14ZM92,84a8,8,0,1,1-8-8A8,8,0,0,1,92,84Z"}))]]);var QS=JS.forwardRef((e,t)=>JS.createElement(Pt,{ref:t,...e,weights:cG}));QS.displayName="TagIcon";var eC=O(ee(),1);var yo=O(ee(),1),uG=new Map([["bold",yo.createElement(yo.Fragment,null,yo.createElement("path",{d:"M125.18,156.94a64,64,0,1,0-82.36,0,100.23,100.23,0,0,0-39.49,32,12,12,0,0,0,19.35,14.2,76,76,0,0,1,122.64,0,12,12,0,0,0,19.36-14.2A100.33,100.33,0,0,0,125.18,156.94ZM44,108a40,40,0,1,1,40,40A40,40,0,0,1,44,108Zm206.1,97.67a12,12,0,0,1-16.78-2.57A76.31,76.31,0,0,0,172,172a12,12,0,0,1,0-24,40,40,0,1,0-10.3-78.67,12,12,0,1,1-6.16-23.19,64,64,0,0,1,57.64,110.8,100.23,100.23,0,0,1,39.49,32A12,12,0,0,1,250.1,205.67Z"}))],["duotone",yo.createElement(yo.Fragment,null,yo.createElement("path",{d:"M136,108A52,52,0,1,1,84,56,52,52,0,0,1,136,108Z",opacity:"0.2"}),yo.createElement("path",{d:"M117.25,157.92a60,60,0,1,0-66.5,0A95.83,95.83,0,0,0,3.53,195.63a8,8,0,1,0,13.4,8.74,80,80,0,0,1,134.14,0,8,8,0,0,0,13.4-8.74A95.83,95.83,0,0,0,117.25,157.92ZM40,108a44,44,0,1,1,44,44A44.05,44.05,0,0,1,40,108Zm210.14,98.7a8,8,0,0,1-11.07-2.33A79.83,79.83,0,0,0,172,168a8,8,0,0,1,0-16,44,44,0,1,0-16.34-84.87,8,8,0,1,1-5.94-14.85,60,60,0,0,1,55.53,105.64,95.83,95.83,0,0,1,47.22,37.71A8,8,0,0,1,250.14,206.7Z"}))],["fill",yo.createElement(yo.Fragment,null,yo.createElement("path",{d:"M164.47,195.63a8,8,0,0,1-6.7,12.37H10.23a8,8,0,0,1-6.7-12.37,95.83,95.83,0,0,1,47.22-37.71,60,60,0,1,1,66.5,0A95.83,95.83,0,0,1,164.47,195.63Zm87.91-.15a95.87,95.87,0,0,0-47.13-37.56A60,60,0,0,0,144.7,54.59a4,4,0,0,0-1.33,6A75.83,75.83,0,0,1,147,150.53a4,4,0,0,0,1.07,5.53,112.32,112.32,0,0,1,29.85,30.83,23.92,23.92,0,0,1,3.65,16.47,4,4,0,0,0,3.95,4.64h60.3a8,8,0,0,0,7.73-5.93A8.22,8.22,0,0,0,252.38,195.48Z"}))],["light",yo.createElement(yo.Fragment,null,yo.createElement("path",{d:"M112.6,158.43a58,58,0,1,0-57.2,0A93.83,93.83,0,0,0,5.21,196.72a6,6,0,0,0,10.05,6.56,82,82,0,0,1,137.48,0,6,6,0,0,0,10-6.56A93.83,93.83,0,0,0,112.6,158.43ZM38,108a46,46,0,1,1,46,46A46.06,46.06,0,0,1,38,108Zm211,97a6,6,0,0,1-8.3-1.74A81.8,81.8,0,0,0,172,166a6,6,0,0,1,0-12,46,46,0,1,0-17.08-88.73,6,6,0,1,1-4.46-11.14,58,58,0,0,1,50.14,104.3,93.83,93.83,0,0,1,50.19,38.29A6,6,0,0,1,249,205Z"}))],["regular",yo.createElement(yo.Fragment,null,yo.createElement("path",{d:"M117.25,157.92a60,60,0,1,0-66.5,0A95.83,95.83,0,0,0,3.53,195.63a8,8,0,1,0,13.4,8.74,80,80,0,0,1,134.14,0,8,8,0,0,0,13.4-8.74A95.83,95.83,0,0,0,117.25,157.92ZM40,108a44,44,0,1,1,44,44A44.05,44.05,0,0,1,40,108Zm210.14,98.7a8,8,0,0,1-11.07-2.33A79.83,79.83,0,0,0,172,168a8,8,0,0,1,0-16,44,44,0,1,0-16.34-84.87,8,8,0,1,1-5.94-14.85,60,60,0,0,1,55.53,105.64,95.83,95.83,0,0,1,47.22,37.71A8,8,0,0,1,250.14,206.7Z"}))],["thin",yo.createElement(yo.Fragment,null,yo.createElement("path",{d:"M107.19,159a56,56,0,1,0-46.38,0A91.83,91.83,0,0,0,6.88,197.81a4,4,0,1,0,6.7,4.37,84,84,0,0,1,140.84,0,4,4,0,1,0,6.7-4.37A91.83,91.83,0,0,0,107.19,159ZM36,108a48,48,0,1,1,48,48A48.05,48.05,0,0,1,36,108Zm212,95.35a4,4,0,0,1-5.53-1.17A83.81,83.81,0,0,0,172,164a4,4,0,0,1,0-8,48,48,0,1,0-17.82-92.58,4,4,0,1,1-3-7.43,56,56,0,0,1,44,103,91.83,91.83,0,0,1,53.93,38.86A4,4,0,0,1,248,203.35Z"}))]]);var tC=eC.forwardRef((e,t)=>eC.createElement(Pt,{ref:t,...e,weights:uG}));tC.displayName="UsersIcon";var dG=HS,fG=jS,pG=IS,nC=AS,mG=XS,hG=VS;var gG={pages:RS,collection:Tb,media:DS,menus:_S,taxonomies:QS,widgets:OS,redirects:CS,app:qS,types:ZS,users:tC,settings:yh,link:wS};vo();gS();k4();Pf();function qQ(e,t){let n=e?.trim();return n?{kind:"emoji",char:n}:{kind:"glyph",name:t}}function WQ(e){let{collections:t,adminPages:n,contentTypes:r,cms:s,hidePages:i,splitByType:c,isAdmin:u,extraNav:f}=e,p=[];if(!i)if(c)for(let m of r??[])p.push({kind:"route",key:`type:${m.slug}`,order:cr.pages,icon:{kind:"glyph",name:"pages"},label:m.name,page:"type",params:{slug:m.slug}});else p.push({kind:"route",key:"pages",order:cr.pages,icon:{kind:"glyph",name:"pages"},label:"Pages",page:"home"});for(let m of t)p.push({kind:"route",key:`col:${m.slug}`,order:m.navOrder??cr.collections,icon:qQ(m.icon,"collection"),label:m.pluralLabel,page:"collection",params:{slug:m.slug}});if(p.push({kind:"route",key:"media",order:cr.media,icon:{kind:"glyph",name:"media"},label:"Media",page:"media"}),s.siteFurniture){if(p.push({kind:"route",key:"menus",order:cr.menus,icon:{kind:"glyph",name:"menus"},label:"Menus",page:"menus"}),!i)p.push({kind:"route",key:"taxonomies",order:cr.taxonomies,icon:{kind:"glyph",name:"taxonomies"},label:"Taxonomies",page:"taxonomies"});p.push({kind:"route",key:"widgets",order:cr.widgets,icon:{kind:"glyph",name:"widgets"},label:"Widgets",page:"widgets"}),p.push({kind:"route",key:"redirects",order:cr.redirects,icon:{kind:"glyph",name:"redirects"},label:"Redirects",page:"redirects"})}for(let m of n)p.push({kind:"route",key:`app:${m.slug}`,order:m.navOrder??cr.adminPages,icon:qQ(m.icon,"app"),label:m.label,page:"admin-page",params:{slug:m.slug}});if(!i&&s.canEdit)p.push({kind:"route",key:"types",order:cr.types,icon:{kind:"glyph",name:"types"},label:"Types",page:"schema"});if(u)p.push({kind:"route",key:"users",order:cr.users,icon:{kind:"glyph",name:"users"},label:"Users",page:"users"});p.push({kind:"route",key:"settings",order:cr.settings,icon:{kind:"glyph",name:"settings"},label:"Settings",page:"settings"});for(let m of f)p.push({kind:"link",key:`extra:${m.href}|${m.label}`,order:m.order??cr.extra,icon:{kind:"glyph",name:"link"},link:m});return p.sort((m,g)=>m.order-g.order)}var SM=[{id:"content",label:"Content",upTo:cr.menus},{id:"site",label:"Site",upTo:cr.adminPages},{id:"apps",label:"Apps",upTo:cr.types},{id:"system",label:"System",upTo:Number.POSITIVE_INFINITY}],ZQ=SM.map((e)=>e.id);function YQ(e){let t=SM.map((n)=>({id:n.id,label:n.label,entries:[]}));for(let n of e){let r=SM.findIndex((s)=>n.order<s.upTo);t[r===-1?t.length-1:r].entries.push(n)}return t.filter((n)=>n.entries.length>0)}function XQ(e){return e.length>1}function JQ(e,t){return e&&t}var qe=O(Me(),1),QQ="pramen.cms.nav.collapsed",eee="pramen.cms.nav.rail",r1e="(min-width: 48rem)";function a1e(e){let[t,n]=ci.useState(()=>{try{return globalThis.matchMedia?.(e).matches??!0}catch{return!0}});return ci.useEffect(()=>{let r=globalThis.matchMedia?.(e);if(!r)return;let s=()=>n(r.matches);return s(),r.addEventListener?.("change",s),()=>r.removeEventListener?.("change",s)},[e]),t}function s1e(){try{return localStorage.getItem(eee)==="narrow"}catch{return!1}}function i1e(){try{let e=localStorage.getItem(QQ),t=e?JSON.parse(e):null;return Array.isArray(t)?ZQ.filter((n)=>t.includes(n)):[]}catch{return[]}}function CM(e,t){if(!e.startsWith(t))return;let n=e.slice(t.length).split("/")[0];if(!n)return;try{return decodeURIComponent(n)}catch{return n}}function $M(){let{isAdmin:e,me:t,collections:n,adminPages:r,contentTypes:s,cms:i,error:c,reconfigure:u,confirmNavigation:f}=nt(),p=Bt(),{pathname:m}=nx(),g=(te)=>()=>{if(f())te()},y=A4(),[v,x]=ci.useState(!1);ci.useEffect(()=>{x(!1)},[m]);let[w,C]=ci.useState(()=>typeof localStorage>"u"?[]:i1e());ci.useEffect(()=>{try{localStorage.setItem(QQ,JSON.stringify(w))}catch{}},[w]);let I=(te)=>C((Ce)=>Ce.includes(te)?Ce.filter(($e)=>$e!==te):[...Ce,te]),[R,H]=ci.useState(s1e);ci.useEffect(()=>{try{localStorage.setItem(eee,R?"narrow":"wide")}catch{}},[R]);let L=JQ(R,a1e(r1e)),_=CM(m,"/collections/"),W=CM(m,"/types/"),z=CM(m,"/apps/"),F=_?`col:${_}`:W?`type:${W}`:z?`app:${z}`:m.startsWith("/pages")||m==="/"?"pages":m.startsWith("/media")?"media":m.startsWith("/schema")?"types":m.startsWith("/menus")?"menus":m.startsWith("/taxonomies")?"taxonomies":m.startsWith("/widgets")?"widgets":m.startsWith("/redirects")?"redirects":m.startsWith("/users")?"users":m.startsWith("/settings")?"settings":"",ne=typeof window<"u"?window.PRAMEN_CMS_EDITOR?.extraNav??[]:[],V=rp(),ie=ap(s,i,V),ae=WQ({collections:n,adminPages:r,contentTypes:s,cms:i,hidePages:V,splitByType:ie,isAdmin:e,extraNav:ne}),re=YQ(ae),D=XQ(re),B=ae.find((te)=>te.key===F),U=B?.kind==="route"?B:void 0,[Q,xe]=ci.useState(null),le=Ol().basePath,k=typeof window<"u"?window.location.href:"";return qe.jsxDEV("div",{className:`min-h-screen bg-surface text-fg md:grid ${L?"md:grid-cols-[3.5rem_1fr]":"md:grid-cols-[15rem_1fr]"}`,children:[qe.jsxDEV("aside",{"aria-label":"Sidebar",className:"border-b border-border bg-surface-card md:sticky md:top-0 md:h-screen md:self-start md:overflow-y-auto md:border-b-0 md:border-r",children:qe.jsxDEV("div",{className:"flex min-h-full flex-col",children:[qe.jsxDEV("div",{className:`flex h-12 shrink-0 items-center gap-1 ${L?"md:justify-center md:px-0":""} px-2`,children:[qe.jsxDEV("button",{type:"button",onClick:g(()=>p("home")),"aria-label":`${sa.spoken} — home`,className:`flex min-w-0 items-center gap-2 rounded-md py-1.5 text-left transition-colors hover:bg-surface-muted ${L?"md:flex-none md:px-1.5":"flex-1 px-2"}`,children:[qe.jsxDEV("span",{"aria-hidden":"true",className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-[5px] bg-fg text-[11px] font-bold leading-none text-fg-inverted",children:sa.name.slice(0,1).toUpperCase()},void 0,!1,void 0,this),qe.jsxDEV("span",{className:`min-w-0 truncate text-compact font-medium leading-4 text-fg ${L?"md:hidden":""}`,children:sa.name},void 0,!1,void 0,this),sa.suffix?qe.jsxDEV("span",{className:`shrink-0 text-caption text-fg-subtle ${L?"md:hidden":""}`,children:sa.suffix},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),qe.jsxDEV(me,{variant:"ghost",size:"sm","aria-label":v?"Hide navigation":"Show navigation","aria-expanded":v,"aria-controls":"pramen-cms-nav",className:"shrink-0 rounded-md px-2 py-2 text-fg-muted md:hidden",onPress:()=>x((te)=>!te),children:qe.jsxDEV(dG,{className:"h-4 w-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),qe.jsxDEV("div",{id:"pramen-cms-nav",className:`${v?"flex":"hidden"} flex-1 flex-col md:flex`,children:qe.jsxDEV("nav",{"aria-label":"Primary",className:`flex flex-col pb-2 ${L?"md:px-1.5":""} px-2`,children:re.map((te)=>{let Ce=D&&!L,$e=!Ce||!w.includes(te.id);return qe.jsxDEV("div",{className:`flex flex-col gap-px pt-4 first:pt-1 ${L?"md:mt-2 md:border-t md:border-border md:pt-2 md:first:mt-0 md:first:border-t-0 md:first:pt-1":""}`,children:[Ce?qe.jsxDEV(l1e,{label:te.label,open:$e,controls:`nav-group-${te.id}`,onPress:()=>I(te.id)},void 0,!1,void 0,this):null,qe.jsxDEV("div",{id:`nav-group-${te.id}`,className:"flex flex-col gap-px",hidden:!$e,children:te.entries.map((se)=>se.kind==="route"?qe.jsxDEV(c1e,{icon:se.icon,label:se.label,narrow:L,active:F===se.key,onPress:g(()=>p(se.page,se.params?{params:se.params}:void 0))},se.key,!1,void 0,this):qe.jsxDEV(d1e,{link:se.link,icon:se.icon,narrow:L,sameTab:RK(se.link.href,se.link.target,le,k),confirm:f},se.key,!1,void 0,this))},void 0,!1,void 0,this)]},te.id,!0,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),qe.jsxDEV("div",{className:"min-w-0",children:[qe.jsxDEV("div",{className:`sticky top-0 z-30 flex ${lQ} items-center gap-2 bg-surface px-7`,children:[qe.jsxDEV(me,{variant:"ghost",size:"sm","aria-label":L?"Expand the sidebar":"Collapse the sidebar","aria-expanded":!L,className:"-ml-2 hidden rounded-md px-2 py-1.5 text-fg-muted hover:text-fg md:inline-flex",onPress:()=>H((te)=>!te),children:qe.jsxDEV(fG,{className:"h-[17px] w-[17px]"},void 0,!1,void 0,this)},void 0,!1,void 0,this),qe.jsxDEV("nav",{"aria-label":"Breadcrumb",className:"flex min-w-0 items-center gap-1 text-compact",children:[U?Q?qe.jsxDEV(me,{variant:"ghost",size:"sm",className:"max-w-[220px] shrink-0 truncate rounded-md px-2 py-1 text-fg-muted hover:text-fg",onPress:g(()=>p(U.page,U.params?{params:U.params}:void 0)),children:U.label},void 0,!1,void 0,this):qe.jsxDEV("span",{className:"max-w-[220px] truncate px-2 py-1 text-fg-muted",children:U.label},void 0,!1,void 0,this):null,Q?qe.jsxDEV(qe.Fragment,{children:[U?qe.jsxDEV(nC,{"aria-hidden":"true",className:"h-3 w-3 shrink-0 text-fg-subtle"},void 0,!1,void 0,this):null,qe.jsxDEV("span",{"aria-current":"page",className:"min-w-0 truncate px-1 py-1 font-medium text-fg",children:Q},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),qe.jsxDEV("div",{className:"ml-auto pl-4",children:qe.jsxDEV(u1e,{me:t,theme:y,onTheme:()=>GQ(y==="dark"?"light":"dark"),onSettings:g(()=>p("settings")),onSignOut:g(u)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),c?qe.jsxDEV(Wj,{variant:"outlined",padding:"none",className:"mx-7 mt-2 border-danger px-4 py-2.5",children:qe.jsxDEV(cS,{size:"small",className:"text-danger",children:c},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,qe.jsxDEV(VK,{publish:xe,children:qe.jsxDEV(ym,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function tee({icon:e}){if(e.kind==="emoji")return qe.jsxDEV("span",{"aria-hidden":"true",className:"flex h-[15px] w-[15px] shrink-0 items-center justify-center text-[13px] leading-none",children:e.char},void 0,!1,void 0,this);let t=gG[e.name];return qe.jsxDEV(t,{className:"h-[15px] w-[15px] shrink-0"},void 0,!1,void 0,this)}var nee="flex w-full items-center justify-start gap-2 rounded-md px-2 py-[5px] text-left leading-4";function l1e({label:e,open:t,controls:n,onPress:r}){return qe.jsxDEV(me,{variant:"ghost",size:"sm","aria-expanded":t,"aria-controls":n,className:"flex w-full items-center justify-start gap-2 rounded-md px-2 py-1 text-left text-caption font-medium leading-4 text-fg-subtle hover:text-fg-muted",onPress:r,children:[qe.jsxDEV("span",{"aria-hidden":"true",className:"flex h-[15px] w-[15px] shrink-0 items-center justify-center",children:t?qe.jsxDEV(pG,{className:"h-3 w-3"},void 0,!1,void 0,this):qe.jsxDEV(nC,{className:"h-3 w-3"},void 0,!1,void 0,this)},void 0,!1,void 0,this),qe.jsxDEV("span",{className:"min-w-0 truncate",children:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function c1e({icon:e,label:t,narrow:n,active:r,onPress:s}){return qe.jsxDEV(me,{variant:"ghost",size:"sm",...n?{"aria-label":t}:{},className:`${nee} ${n?"md:justify-center md:px-0":""} ${r?"bg-surface-muted font-medium text-fg":"text-fg-muted hover:text-fg"}`,...r?{"aria-current":"page"}:{},onPress:s,children:[qe.jsxDEV(tee,{icon:e},void 0,!1,void 0,this),qe.jsxDEV("span",{title:t,className:`min-w-0 truncate ${n?"md:hidden":""}`,children:t},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function u1e({me:e,theme:t,onTheme:n,onSettings:r,onSignOut:s}){let i=e?.userId??"account";return qe.jsxDEV(eK,{triggerLabel:`Account — ${i}`,trigger:qe.jsxDEV(qe.Fragment,{children:[qe.jsxDEV(oK,{name:i,size:"sm",ring:!1},void 0,!1,void 0,this),qe.jsxDEV("span",{className:"max-w-[180px] truncate text-compact text-fg-muted max-[560px]:hidden",children:i},void 0,!1,void 0,this)]},void 0,!0,void 0,this),onAction:(c)=>{if(c==="theme")n();else if(c==="settings")r();else if(c==="signout")s()},children:[qe.jsxDEV(uS,{id:"theme",className:"gap-2.5",children:[t==="dark"?qe.jsxDEV(mG,{className:"h-[15px] w-[15px]"},void 0,!1,void 0,this):qe.jsxDEV(hG,{className:"h-[15px] w-[15px]"},void 0,!1,void 0,this),t==="dark"?"Light theme":"Dark theme"]},void 0,!0,void 0,this),qe.jsxDEV(uS,{id:"settings",className:"gap-2.5",children:[qe.jsxDEV(yh,{className:"h-[15px] w-[15px]"},void 0,!1,void 0,this),"Settings"]},void 0,!0,void 0,this),qe.jsxDEV(uS,{id:"signout",className:"gap-2.5",children:[qe.jsxDEV(Ib,{className:"h-[15px] w-[15px]"},void 0,!1,void 0,this),"Sign out"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function d1e({link:e,icon:t,narrow:n,sameTab:r,confirm:s}){return qe.jsxDEV("a",{href:e.href,rel:r?"noreferrer":"noopener noreferrer",onClick:r?(i)=>{if(!s())i.preventDefault()}:void 0,...r?{}:{target:"_blank"},...n?{"aria-label":e.label}:{},className:`${nee} ${n?"md:justify-center md:px-0":""} text-compact text-fg-muted no-underline transition-colors hover:bg-surface-muted hover:text-fg`,children:[qe.jsxDEV(tee,{icon:t},void 0,!1,void 0,this),qe.jsxDEV("span",{title:e.label,className:`min-w-0 truncate ${n?"md:hidden":""}`,children:e.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Jee=()=>Promise.resolve().then(() => (xee(),{})).then((e)=>({default:I1e.component})),Qee=()=>Promise.resolve().then(() => (kee(),{})).then((e)=>({default:H1e.component})),ete=()=>Promise.resolve().then(() => (Ree(),{})).then((e)=>({default:F1e.component})),tte=()=>Promise.resolve().then(() => (Mee(),{})).then((e)=>({default:_1e.component})),nte=()=>Promise.resolve().then(() => (Nee(),{})).then((e)=>({default:z1e.component})),ote=()=>Promise.resolve().then(() => (Lee(),{})).then((e)=>({default:V1e.component})),rte=()=>Promise.resolve().then(() => (Bee(),{})).then((e)=>({default:U1e.component})),ate=()=>Promise.resolve().then(() => (Hee(),{})).then((e)=>({default:j1e.component})),ste=()=>Promise.resolve().then(() => (Fee(),{})).then((e)=>({default:K1e.component})),ite=()=>Promise.resolve().then(() => (_ee(),{})).then((e)=>({default:G1e.component})),lte=()=>Promise.resolve().then(() => (zee(),{})).then((e)=>({default:q1e.component})),cte=()=>Promise.resolve().then(() => (Vee(),{})).then((e)=>({default:W1e.component})),ute=()=>Promise.resolve().then(() => (jee(),{})).then((e)=>({default:Z1e.component})),dte=()=>Promise.resolve().then(() => (Kee(),{})).then((e)=>({default:Y1e.component})),fte=()=>Promise.resolve().then(() => (Gee(),{})).then((e)=>({default:X1e.component})),pte=()=>Promise.resolve().then(() => (qee(),{})).then((e)=>({default:J1e.component})),mte=()=>Promise.resolve().then(() => (Wee(),{})).then((e)=>({default:Q1e.component})),hte=()=>Promise.resolve().then(() => (Zee(),{})).then((e)=>({default:eye.component})),gte=()=>Promise.resolve().then(() => (Yee(),{})).then((e)=>({default:tye.component})),bte=()=>Promise.resolve().then(() => (Xee(),{})).then((e)=>({default:nye.component})),GM={"admin-page":"/apps/:slug","block-type":"/schema/blocks/:slug","collection-item":"/collections/:slug/:id",collection:"/collections/:slug","content-type":"/schema/content/:slug",home:"/",media:"/media",menu:"/menus/:name",menus:"/menus",page:"/pages/:pageId",redirects:"/redirects",schema:"/schema",settings:"/settings",taxonomies:"/taxonomies",taxonomy:"/taxonomies/:slug",type:"/types/:slug",users:"/users","widget-area":"/widgets/:name",widgets:"/widgets"},oye=[{path:"/",component:$M,isLayout:!0,children:[{path:"/admin-page",matchPath:"/apps/:slug",component:xo.lazy(Jee),preload:Jee},{path:"/block-type",matchPath:"/schema/blocks/:slug",component:xo.lazy(Qee),preload:Qee},{path:"/collection-item",matchPath:"/collections/:slug/:id",component:xo.lazy(ete),preload:ete},{path:"/collection",matchPath:"/collections/:slug",component:xo.lazy(tte),preload:tte},{path:"/content-type",matchPath:"/schema/content/:slug",component:xo.lazy(nte),preload:nte},{path:"/home",matchPath:"/",component:xo.lazy(ote),preload:ote},{path:"/media",component:xo.lazy(rte),preload:rte},{path:"/menu",matchPath:"/menus/:name",component:xo.lazy(ate),preload:ate},{path:"/menus",component:xo.lazy(ste),preload:ste},{path:"/page",matchPath:"/pages/:pageId",component:xo.lazy(ite),preload:ite},{path:"/redirects",component:xo.lazy(lte),preload:lte},{path:"/schema",component:xo.lazy(cte),preload:cte},{path:"/settings",component:xo.lazy(ute),preload:ute},{path:"/taxonomies",component:xo.lazy(dte),preload:dte},{path:"/taxonomy",matchPath:"/taxonomies/:slug",component:xo.lazy(fte),preload:fte},{path:"/type",matchPath:"/types/:slug",component:xo.lazy(pte),preload:pte},{path:"/users",component:xo.lazy(mte),preload:mte},{path:"/widget-area",matchPath:"/widgets/:name",component:xo.lazy(hte),preload:hte},{path:"/widgets",component:xo.lazy(gte),preload:gte},{path:"/:__notFound+",component:xo.lazy(bte),preload:bte}]}],qM=wT(oye);Rn();mS();gS();M4();var rye=O(ee(),1),aye=O(vr(),1),sye=O(Hr(),1),iye=O(Me(),1),lye="PRAMEN_CMS_EDITOR_RUNTIME";function cye(){return{react:rye,reactDom:aye,jsxRuntime:sye,jsxDevRuntime:iye,registerPanel:(e)=>pee(e)}}function yte(e){e[lye]=cye()}M4();k4();var N1=O(Me(),1);document.title=IK;KQ();yte(globalThis);vee(yee(globalThis,typeof location>"u"?"":location.href));var WM=document.getElementById("app"),ZM=AK(WM);if(!hS(location.pathname,ZM))console.warn(`pramen/cms-editor: mounted for "${ZM}" but served at "${location.pathname}" — navigation will leave the editor.`);function uye({basePath:e}){let t=H4.useRef(null);return t.current??=new hm({routes:qM,adapter:kK(I0(),e),pageRegistry:GM,basePath:e}),N1.jsxDEV(tx,{router:t.current},void 0,!1,void 0,this)}if(WM)vte.createRoot(WM).render(N1.jsxDEV(H4.StrictMode,{children:N1.jsxDEV(_K,{children:N1.jsxDEV(uye,{basePath:ZM},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this));
|
package/package.json
CHANGED
package/src/components.tsx
CHANGED
|
@@ -47,9 +47,21 @@ export interface PageAction {
|
|
|
47
47
|
*
|
|
48
48
|
* The head of the list is the toolbar's primary button and the tail goes in its menu, so the
|
|
49
49
|
* ORDER is the contract: a draft's obvious next move is Publish, a page in review is waiting
|
|
50
|
-
* for Approve, and a
|
|
51
|
-
* server would reject (an "Approve" on a draft) is how a
|
|
52
|
-
* lie; the server still enforces the role gate on every
|
|
50
|
+
* for Approve, and a page that is already live is one someone came back to in order to
|
|
51
|
+
* change it. Showing transitions the server would reject (an "Approve" on a draft) is how a
|
|
52
|
+
* UI teaches someone that its buttons lie; the server still enforces the role gate on every
|
|
53
|
+
* one of these.
|
|
54
|
+
*
|
|
55
|
+
* `published` used to offer Unpublish and nothing else, on the reading that publishing is a
|
|
56
|
+
* one-way status flip and a live page has nowhere left to go. That reading is wrong about
|
|
57
|
+
* what `publishPage` DOES: it bakes the assembled page into a revision and points
|
|
58
|
+
* `currentRevisionId` at it, and that snapshot — not the row the editor has been writing to
|
|
59
|
+
* — is what the public content API serves. So an edit to a live page saves, versions,
|
|
60
|
+
* shows in History, and is invisible on the site, with no button anywhere that would put it
|
|
61
|
+
* there. The only way through was Unpublish followed by Publish, which takes the page OFF
|
|
62
|
+
* the internet to push a typo fix. Re-publishing is idempotent (`doPublish` re-snapshots and
|
|
63
|
+
* writes an audit row), so it is offered first and Unpublish moves to the menu, where a
|
|
64
|
+
* destructive action belongs anyway.
|
|
53
65
|
*/
|
|
54
66
|
export function pageWorkflowActions(status: string): PageAction[] {
|
|
55
67
|
switch (status) {
|
|
@@ -62,7 +74,12 @@ export function pageWorkflowActions(status: string): PageAction[] {
|
|
|
62
74
|
{ label: "Publish directly", action: "publishPage" },
|
|
63
75
|
];
|
|
64
76
|
case "published":
|
|
65
|
-
return [
|
|
77
|
+
return [
|
|
78
|
+
// "changes", not "Publish": the page is already published, so the bare verb would
|
|
79
|
+
// read as a no-op and leave the button looking like it belongs to some other page.
|
|
80
|
+
{ label: "Publish changes", action: "publishPage" },
|
|
81
|
+
{ label: "Unpublish", action: "unpublishPage" },
|
|
82
|
+
];
|
|
66
83
|
default: // draft | rejected | archived
|
|
67
84
|
return [
|
|
68
85
|
{ label: "Publish", action: "publishPage" },
|