Loheide-eu-mitarbeiterplatt.../public/build/assets/useMediaPicker-RkHk0sX_.js
Friederich Loheide 4d855c8a74
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m49s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m54s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 5m27s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 5m29s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 6m38s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 6m40s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 6m7s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m13s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m24s
QM: Wiedervorlage und Lesebestätigung, Platzhalter für Profilbilder (0.21.0)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 07:36:47 +00:00

1 line
No EOL
43 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{$ as e,D as t,E as n,Ft as r,Ht as i,J as a,On as o,St as s,Yt as c,Zn as l,_ as u,b as d,bt as f,g as p,gn as m,mt as h,o as g,qt as _,tr as v,tt as y,v as b,vn as x,wt as S,y as C}from"./runtime-core.esm-bundler-B8D2lM98.js";import{S as w,w as T,x as E}from"./runtime-dom.esm-bundler-BEWGoe8n.js";import{t as D}from"./createLucideIcon-VlaMqNX_.js";import{n as ee,t as O}from"./arrow-up-DXJcYM_I.js";import{t as k}from"./chevron-up-B0PLh6a4.js";import{c as te,i as ne,n as re,r as ie,s as ae,t as oe,u as A}from"./useMediaList-DYvwvSyx.js";import{t as j}from"./copy-CO_pOs8v.js";import{t as M}from"./external-link-Ddmamed9.js";import{t as N}from"./eye-off-CneL5LCR.js";import{t as se}from"./folder-tree-Cd0MblOB.js";import{i as P,n as F,r as ce,t as I}from"./vue-draggable-plus-BMJbPKYz.js";import{t as L}from"./image-off-BO5qjHGQ.js";import{t as R}from"./loader-circle-Wr6tQn-J.js";import{t as z}from"./message-square-warning-Bf7QtZts.js";import{t as B}from"./minus-CHpU4ANA.js";import{n as V,r as le,t as H}from"./PopoverTrigger-B7McAoPv.js";import{t as U}from"./play-BGJiFgAn.js";import{t as W}from"./plus-CQwC4vy-.js";import{t as ue}from"./search-x-Bfzq4V3S.js";import{t as de}from"./trash-CONUPzoz.js";import{t as fe}from"./upload-QwHKBTTM.js";import{t as G}from"./x-DU8daajy.js";import{n as K}from"./lib-Be7KNAML.js";import{A as pe,At as me,Ft as q,Ht as J,It as Y,Jt as X,Lt as he,O as ge,St as Z,V as _e,Wt as ve,Xt as ye,Zt as be,_t as xe,a as Se,d as Ce,f as Q,j as we,k as Te,l as Ee,m as De,n as Oe,o as ke,s as Ae,v as je,y as Me,yt as Ne}from"./app-C26o4VJm.js";import{t as Pe}from"./registry-D4SnTCjo.js";var Fe=D({name:`box`,size:24,node:[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]}),Ie=D({name:`columns-3`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]],aliases:[`panels-left-right`]}),Le=D({name:`contact`,size:24,node:[[`path`,{d:`M16 2v2`,key:`scm5qe`}],[`path`,{d:`M7 21v-2a2 2 0 012-2h6a2 2 0 012 2v2`,key:`k82dct`}],[`path`,{d:`M8 2v2`,key:`pbkmx`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]}),Re=D({name:`gallery-horizontal-end`,size:24,node:[[`path`,{d:`M2 7v10`,key:`a2pl2d`}],[`path`,{d:`M6 5v14`,key:`1kq3d7`}],[`rect`,{width:`12`,height:`18`,x:`10`,y:`3`,rx:`2`,key:`13i7bc`}]]}),ze=D({name:`list-collapse`,size:24,node:[[`path`,{d:`M10 5h11`,key:`1hkqpe`}],[`path`,{d:`M10 12h11`,key:`6m4ad9`}],[`path`,{d:`M10 19h11`,key:`14g2nv`}],[`path`,{d:`m3 10 3-3-3-3`,key:`i7pm08`}],[`path`,{d:`m3 20 3-3-3-3`,key:`20gx1n`}]]}),Be=D({name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]}),Ve=D({name:`move-vertical`,size:24,node:[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`m8 18 4 4 4-4`,key:`bh5tu3`}],[`path`,{d:`m8 6 4-4 4 4`,key:`ybng9g`}]]}),He=D({name:`panel-top`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]}),Ue=D({name:`square-dashed`,size:24,node:[[`path`,{d:`M5 3a2 2 0 0 0-2 2`,key:`y57alp`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`18rm91`}],[`path`,{d:`M21 19a2 2 0 0 1-2 2`,key:`1j7049`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2`,key:`sbafld`}],[`path`,{d:`M9 3h1`,key:`1yesri`}],[`path`,{d:`M9 21h1`,key:`15o7lz`}],[`path`,{d:`M14 3h1`,key:`1ec4yj`}],[`path`,{d:`M14 21h1`,key:`v9vybs`}],[`path`,{d:`M3 9v1`,key:`1r0deq`}],[`path`,{d:`M21 9v1`,key:`mxsmne`}],[`path`,{d:`M3 14v1`,key:`vnatye`}],[`path`,{d:`M21 14v1`,key:`169vum`}]],aliases:[`box-select`]}),We=D({name:`table`,size:24,node:[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]}),Ge=D({name:`tablet`,size:24,node:[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]}),Ke={"square-dashed":Ue,"columns-3":Ie,"panel-top":He,"list-collapse":ze,"message-square-warning":z,heading:ce,text:F,quote:Ne,"mouse-pointer-click":Be,"list-checks":me,table:We,minus:B,"move-vertical":Ve,image:Y,images:q,play:U,panorama:Re,contact:Le,"file-down":J,"folder-tree":se,newspaper:Z,"calendar-days":ye,"clipboard-list":ve,cake:be};function qe(e){return Ke[e]??Fe}function $(){return Math.random().toString(36).slice(2,8)+Date.now().toString(36).slice(-6)}function Je(e){return JSON.parse(JSON.stringify(e))}function Ye(e,t){return e.container?e.key===`columns`?(t.layout??`1-1`).split(`-`).length:e.key===`tabs`?2:e.key===`accordion`?3:e.container.min:0}function Xe(e){let t=Je(e.defaults??{}),n={id:$(),type:e.key,data:t};return e.container&&(n.items=Array.from({length:Ye(e,t)},(t,n)=>({id:$(),title:e.container.titled?`${e.container.label} ${n+1}`:void 0,blocks:[]}))),n}function Ze(e){let t=Je(e),n=e=>{e.id=$(),(e.items??[]).forEach(e=>{e.id=$(),e.blocks.forEach(n)})};return n(t),t}function Qe(e,t,n=null){for(let r=0;r<e.length;r++){let i=e[r];if(i.id===t)return{block:i,list:e,index:r,parent:n};for(let e of i.items??[]){let n=Qe(e.blocks,t,i);if(n)return n}}return null}function $e(e,t){for(let n of e)t(n),(n.items??[]).forEach(e=>$e(e.blocks,t))}function et(e){let t=(e.data.layout??`1-1`).split(`-`).length;for(;e.items.length<t;)e.items.push({id:$(),blocks:[]});if(e.items.length>t){let n=e.items.splice(t).flatMap(e=>e.blocks);e.items[t-1].blocks.push(...n)}}var tt={class:`grid gap-4`},nt={class:`mb-2 text-xs font-semibold tracking-wide text-muted-foreground uppercase`},rt=[`title`,`disabled`,`onClick`],it={class:`truncate`},at={__name:`BlockPalette`,props:{compact:{type:Boolean,default:!1}},emits:[`pick`],setup(e,{emit:n}){let r=n,i=a(`pagebuilder:editor`),s=p(()=>Object.entries(i.groups).map(([e,t])=>({key:e,label:t,types:Object.values(i.types).filter(t=>t.group===e)})).filter(e=>e.types.length));return(n,a)=>(h(),d(`div`,tt,[(h(!0),d(g,null,f(s.value,n=>(h(),d(`section`,{key:n.key},[u(`h3`,nt,v(n.label),1),t(o(I),{"model-value":n.types,group:{name:`pagebuilder`,pull:`clone`,put:!1},clone:e=>o(Xe)(e),sort:!1,disabled:e.compact||o(i).readOnly.value,class:`grid grid-cols-2 gap-2`},{default:_(()=>[(h(!0),d(g,null,f(n.types,t=>(h(),d(`button`,{key:t.key,type:`button`,class:l([`flex items-center gap-2 rounded-md border bg-card px-2.5 py-2 text-left text-[13px] font-medium transition-colors hover:border-brand-300 hover:bg-brand-soft/60`,e.compact?``:`cursor-grab active:cursor-grabbing`]),title:t.description||t.label,disabled:o(i).readOnly.value,onClick:e=>r(`pick`,t)},[(h(),b(S(o(qe)(t.icon)),{class:`size-4 shrink-0 text-brand-text`})),u(`span`,it,v(t.label),1)],10,rt))),128))]),_:2},1032,[`model-value`,`clone`,`disabled`])]))),128))]))}},ot={class:`grid gap-1.5`},st=[`for`],ct=[`for`],lt={key:8,class:`grid gap-2`},ut={class:`grid max-h-56 grid-cols-6 gap-1.5 overflow-y-auto`},dt=[`title`,`aria-pressed`,`onClick`],ft={key:0,class:`col-span-6 py-2 text-center text-xs text-muted-foreground`},pt={key:0,class:`relative overflow-hidden rounded-md border bg-muted`},mt=[`src`],ht=[`disabled`],gt=[`disabled`],_t={key:10,class:`grid gap-2`},vt={key:0,class:`grid gap-1`},yt={class:`min-w-0 flex-1 truncate text-[13px]`},bt=[`onClick`],xt=[`onClick`],St={class:`relative`},Ct={key:0,class:`absolute inset-x-0 top-full z-30 mt-1 max-h-60 overflow-y-auto rounded-md border bg-popover p-1 shadow-md`},wt=[`onClick`],Tt={class:`min-w-0`},Et={class:`block truncate font-medium`},Dt={class:`block truncate text-xs text-muted-foreground`},Ot={key:11,class:`grid gap-2`},kt={class:`overflow-x-auto rounded-md border`},At={class:`w-full text-[13px]`},jt=[`value`,`aria-label`,`onInput`],Mt={class:`w-7 p-0 text-center`},Nt=[`onClick`],Pt=[`onClick`],Ft={class:`flex gap-2`},It={key:12,class:`grid gap-2`},Lt=[`open`],Rt={class:`flex cursor-pointer list-none items-center gap-2 px-3 py-2 text-[13px] font-medium`},zt={class:`min-w-0 flex-1 truncate`},Bt=[`onClick`],Vt=[`onClick`],Ht=[`onClick`],Ut={class:`grid gap-3 border-t px-3 py-3`},Wt={key:0,class:`grid gap-2`},Gt={key:13,class:`grid gap-2`},Kt={key:0,class:`grid gap-1`},qt={class:`min-w-0 flex-1 truncate`},Jt={key:0,class:`shrink-0 text-xs text-muted-foreground`},Yt=[`onClick`],Xt=[`onClick`],Zt=[`disabled`],Qt={key:14,class:`text-xs text-muted-foreground`},$t={__name:`FieldInput`,props:e({field:{type:Object,required:!0},id:{type:String,required:!0}},{modelValue:{default:null},modelModifiers:{}}),emits:e([`image-uploaded`,`image-picked`],[`update:modelValue`]),setup(e,{emit:c}){let m=e,_=r(e,`modelValue`),y=a(`pagebuilder:editor`),S=c,w=x(!1),E=x(null),D=x(!1);async function k(e){if(e){w.value=!0;try{let t=await y.uploadImage(e);_.value=t.path,S(`image-uploaded`,t)}catch(e){K.error(e.fieldErrors?.image??e.message)}finally{w.value=!1}}}function te(e){let t=e.target.files?.[0];e.target.value=``,k(t)}function ne(e){D.value=!1,k([...e.dataTransfer?.files??[]].find(e=>e.type.startsWith(`image/`)))}async function re(){let e=await y.pickMedia({multiple:!1});e?.length&&(_.value=e[0].path,S(`image-picked`,e[0]))}let ie=p(()=>m.field.type===`repeater`?m.field.fields.find(e=>e.type===`image`):null);async function ae(){let e=await y.pickMedia({multiple:!0,title:`${m.field.label} aus der Mediathek hinzufügen`});if(!e?.length)return;let t=Math.max(0,m.field.max-(_.value??[]).length),n=e.slice(0,t).map(e=>{let t=ce();return t[ie.value.name]=e.path,`alt`in t&&(t.alt=e.alt??``),`caption`in t&&(t.caption=e.caption??``),t});_.value=[..._.value??[],...n],e.length>t&&K.warning(`Nur ${t} von ${e.length} Bildern übernommen – höchstens ${m.field.max} möglich.`)}function oe(e,t){`alt`in e&&!e.alt&&t.alt&&(e.alt=t.alt),`caption`in e&&!e.caption&&t.caption&&(e.caption=t.caption)}let A=x(``),j=x([]),M=y.peopleCache,N;if(i(A,e=>{if(clearTimeout(N),e.trim().length<2){j.value=[];return}N=setTimeout(async()=>{let t=await _e.get(`/personen/suche?q=${encodeURIComponent(e.trim())}`);t.people.forEach(e=>M[e.id]=e),j.value=t.people.filter(e=>!(_.value??[]).includes(e.id))},250)}),m.field.type===`people`&&(_.value??[]).some(e=>!M[e])){let e=_.value.filter(e=>!M[e]);_e.get(`/personen/suche?${e.map(e=>`ids[]=${e}`).join(`&`)}`).then(e=>e.people.forEach(e=>M[e.id]=e))}function se(e){_.value=[..._.value??[],e.id],A.value=``,j.value=[]}function P(e,t,n){let r=t+n;if(r<0||r>=e.length)return;let i=[...e];[i[t],i[r]]=[i[r],i[t]],_.value=i}function F(e){_.value=_.value.filter((t,n)=>n!==e)}function ce(){return Object.fromEntries(m.field.fields.map(e=>[e.name,structuredClone(e.default??(e.type===`toggle`?!1:e.type===`repeater`?[]:``))]))}function I(){_.value=[..._.value??[],ce()]}let L=p(()=>_.value??[[``]]);function z(e,t,n){let r=L.value.map(e=>[...e]);r[e][t]=n,_.value=r}function B(){_.value=[...L.value,Array(L.value[0]?.length??1).fill(``)]}function V(){_.value=L.value.map(e=>[...e,``])}function le(e){L.value.length>1&&(_.value=L.value.filter((t,n)=>n!==e))}function H(e){(L.value[0]?.length??1)>1&&(_.value=L.value.map(t=>t.filter((t,n)=>n!==e)))}let U=x(null),ue=p(()=>Object.fromEntries(y.files.value.map(e=>[e.id,e])));async function me(e){let t=[...e.target.files??[]];e.target.value=``,w.value=!0;try{for(let e of t){let t=await y.uploadFile(e);_.value=[..._.value??[],t.id]}}catch(e){K.error(e.fieldErrors?.file??e.message)}finally{w.value=!1}}let Y=p(()=>y.files.value.filter(e=>!(_.value??[]).includes(e.id))),X=e=>e>1048576?`${(e/1024/1024).toFixed(1).replace(`.`,`,`)} MB`:`${Math.max(1,Math.round(e/1024))} KB`,Z=x(``),ve=p(()=>{let e=Z.value.trim().toLowerCase(),t=(m.field.choices??[]).map(e=>({value:e.value,label:e.label}));if(!e)return _.value&&!t.some(e=>e.value===_.value)?[{value:_.value,label:_.value},...t]:t;let n=t.filter(t=>t.label.toLowerCase().includes(e)||t.value.includes(e)),r=Te.value?Object.keys(Te.value.icons).filter(t=>t.includes(e)&&!n.some(e=>e.value===t)):[];return[...n,...r.map(e=>({value:e,label:e}))].slice(0,60)});return i(Z,e=>e.trim()&&pe()),(r,i)=>{let a=s(`FieldInput`,!0);return h(),d(`div`,ot,[e.field.type===`toggle`?C(``,!0):(h(),d(`label`,{key:0,for:e.id,class:`text-[13px] font-medium`},v(e.field.label),9,st)),e.field.type===`text`?(h(),b(o(Q),{key:1,id:e.id,modelValue:_.value,"onUpdate:modelValue":i[0]||=e=>_.value=e,maxlength:e.field.max,placeholder:e.field.placeholder??``},null,8,[`id`,`modelValue`,`maxlength`,`placeholder`])):e.field.type===`url`?(h(),b(o(Q),{key:2,id:e.id,modelValue:_.value,"onUpdate:modelValue":i[1]||=e=>_.value=e,type:`text`,inputmode:`url`,placeholder:`https://… oder /seiten/…`},null,8,[`id`,`modelValue`])):e.field.type===`textarea`?(h(),b(o(Ce),{key:3,id:e.id,modelValue:_.value,"onUpdate:modelValue":i[2]||=e=>_.value=e,maxlength:e.field.max,rows:`3`},null,8,[`id`,`modelValue`,`maxlength`])):e.field.type===`html`?(h(),b(je,{key:4,modelValue:_.value,"onUpdate:modelValue":i[3]||=e=>_.value=e,bordered:``,"min-height":`[&_.tiptap]:min-h-24`},null,8,[`modelValue`])):e.field.type===`number`?(h(),b(o(Q),{key:5,id:e.id,modelValue:_.value,"onUpdate:modelValue":i[4]||=e=>_.value=e,modelModifiers:{number:!0},type:`number`,min:e.field.min,max:e.field.max},null,8,[`id`,`modelValue`,`min`,`max`])):e.field.type===`select`?(h(),b(Me,{key:6,id:e.id,modelValue:_.value,"onUpdate:modelValue":i[5]||=e=>_.value=e,options:e.field.choices},null,8,[`id`,`modelValue`,`options`])):e.field.type===`toggle`?(h(),d(`label`,{key:7,for:e.id,class:`flex items-center justify-between gap-3 py-0.5 text-[13px] font-medium`},[n(v(e.field.label)+` `,1),t(o(Ee),{id:e.id,modelValue:_.value,"onUpdate:modelValue":i[6]||=e=>_.value=e},null,8,[`id`,`modelValue`])],8,ct)):e.field.type===`icon`?(h(),d(`div`,lt,[t(o(Q),{modelValue:Z.value,"onUpdate:modelValue":i[7]||=e=>Z.value=e,type:`search`,placeholder:`Alle Symbole durchsuchen (englisch, z. B. calendar)`,class:`h-8 text-[13px]`},null,8,[`modelValue`]),u(`div`,ut,[(h(!0),d(g,null,f(ve.value,e=>(h(),d(`button`,{key:e.value,type:`button`,class:l([`grid aspect-square place-items-center rounded-md border transition-colors`,_.value===e.value?`border-brand-400 bg-brand-soft text-brand-soft-foreground`:`text-muted-foreground hover:bg-accent`]),title:e.label,"aria-pressed":_.value===e.value,onClick:t=>_.value=e.value},[t(ge,{name:e.value,class:`size-4`},null,8,[`name`])],10,dt))),128)),Z.value&&!ve.value.length?(h(),d(`p`,ft,`Kein Symbol gefunden.`)):C(``,!0)])])):e.field.type===`image`?(h(),d(`div`,{key:9,class:l([`grid gap-2 rounded-md`,D.value&&`ring-2 ring-brand-400 ring-offset-2 ring-offset-card`]),onDragover:i[10]||=T(e=>D.value=!0,[`prevent`]),onDragleave:i[11]||=e=>D.value=!1,onDrop:T(ne,[`prevent`])},[_.value?(h(),d(`div`,pt,[u(`img`,{src:o(y).imageUrl(_.value),alt:``,class:`aspect-video w-full object-cover`},null,8,mt),u(`button`,{type:`button`,class:`absolute top-1.5 right-1.5 grid size-7 place-items-center rounded-md bg-card/90 shadow-sm hover:bg-card`,title:`Bild entfernen`,onClick:i[8]||=e=>_.value=null},[t(o(G),{class:`size-4`})])])):C(``,!0),u(`div`,{class:l([`grid gap-2`,o(y).pickMedia?`grid-cols-2`:``])},[u(`button`,{type:`button`,class:`flex h-9 items-center justify-center gap-1.5 rounded-md border border-dashed px-2 text-[13px] font-medium text-muted-foreground hover:border-brand-300 hover:text-foreground`,disabled:w.value,title:`Bild hochladen – oder eine Datei hierher ziehen`,onClick:i[9]||=e=>E.value?.click()},[w.value?(h(),b(o(R),{key:0,class:`size-4 animate-spin`})):(h(),b(o(he),{key:1,class:`size-4`})),n(` `+v(o(y).pickMedia?`Hochladen`:_.value?`Anderes Bild wählen`:`Bild hochladen`),1)],8,ht),o(y).pickMedia?(h(),d(`button`,{key:0,type:`button`,class:`flex h-9 items-center justify-center gap-1.5 rounded-md border px-2 text-[13px] font-medium text-muted-foreground hover:border-brand-300 hover:text-foreground`,disabled:w.value,onClick:re},[t(o(q),{class:`size-4`}),i[15]||=n(` Aus Mediathek `,-1)],8,gt)):C(``,!0)],2),u(`input`,{ref_key:`imageInput`,ref:E,type:`file`,accept:`image/jpeg,image/png,image/webp,image/gif`,class:`hidden`,onChange:te},null,544)],34)):e.field.type===`people`?(h(),d(`div`,_t,[(_.value??[]).length?(h(),d(`ul`,vt,[(h(!0),d(g,null,f(_.value,(e,n)=>(h(),d(`li`,{key:e,class:`flex items-center gap-2 rounded-md border bg-card px-2 py-1.5`},[o(M)[e]?(h(),b(we,{key:0,person:o(M)[e],class:`size-7 text-[10px]`},null,8,[`person`])):C(``,!0),u(`span`,yt,v(o(M)[e]?.name??`…`),1),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded hover:bg-accent`,title:`Nach oben`,onClick:e=>P(_.value,n,-1)},[t(o(O),{class:`size-3.5`})],8,bt),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded hover:bg-accent`,title:`Entfernen`,onClick:e=>F(n)},[t(o(G),{class:`size-3.5`})],8,xt)]))),128))])):C(``,!0),u(`div`,St,[t(o(xe),{class:`pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),t(o(Q),{id:e.id,modelValue:A.value,"onUpdate:modelValue":i[12]||=e=>A.value=e,class:`pl-8`,placeholder:`Person suchen …`,autocomplete:`off`},null,8,[`id`,`modelValue`]),j.value.length?(h(),d(`ul`,Ct,[(h(!0),d(g,null,f(j.value,e=>(h(),d(`li`,{key:e.id},[u(`button`,{type:`button`,class:`flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-[13px] hover:bg-accent`,onClick:t=>se(e)},[t(we,{person:e,class:`size-7 text-[10px]`},null,8,[`person`]),u(`span`,Tt,[u(`span`,Et,v(e.name),1),u(`span`,Dt,v(e.job_title),1)])],8,wt)]))),128))])):C(``,!0)])])):e.field.type===`table`?(h(),d(`div`,Ot,[u(`div`,kt,[u(`table`,At,[u(`tbody`,null,[(h(!0),d(g,null,f(L.value,(e,n)=>(h(),d(`tr`,{key:n,class:`border-b last:border-0`},[(h(!0),d(g,null,f(e,(e,t)=>(h(),d(`td`,{key:t,class:`border-r p-0 last:border-r-0`},[u(`input`,{value:e,class:`h-8 w-full min-w-20 bg-transparent px-2 focus:bg-brand-soft/50 focus:outline-none`,"aria-label":`Zeile ${n+1}, Spalte ${t+1}`,onInput:e=>z(n,t,e.target.value)},null,40,jt)]))),128)),u(`td`,Mt,[u(`button`,{type:`button`,class:`grid size-7 place-items-center text-muted-foreground hover:text-destructive`,title:`Zeile entfernen`,onClick:e=>le(n)},[t(o(G),{class:`size-3.5`})],8,Nt)])]))),128)),u(`tr`,null,[(h(!0),d(g,null,f(L.value[0],(e,n)=>(h(),d(`td`,{key:n,class:`p-0 text-center`},[u(`button`,{type:`button`,class:`mx-auto grid size-7 place-items-center text-muted-foreground hover:text-destructive`,title:`Spalte entfernen`,onClick:e=>H(n)},[t(o(G),{class:`size-3.5`})],8,Pt)]))),128)),i[16]||=u(`td`,null,null,-1)])])])]),u(`div`,Ft,[u(`button`,{type:`button`,class:`inline-flex items-center gap-1 text-[13px] font-medium text-brand-text hover:underline`,onClick:B},[t(o(W),{class:`size-3.5`}),i[17]||=n(` Zeile`,-1)]),u(`button`,{type:`button`,class:`inline-flex items-center gap-1 text-[13px] font-medium text-brand-text hover:underline`,onClick:V},[t(o(W),{class:`size-3.5`}),i[18]||=n(` Spalte`,-1)])])])):e.field.type===`repeater`?(h(),d(`div`,It,[(h(!0),d(g,null,f(_.value??[],(n,r)=>(h(),d(`details`,{key:r,class:`group rounded-md border bg-card`,open:r===(_.value??[]).length-1},[u(`summary`,Rt,[u(`span`,zt,v(n.label||n.title||n.alt||`${e.field.itemLabel} ${r+1}`),1),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded hover:bg-accent`,title:`Nach oben`,onClick:T(e=>P(_.value,r,-1),[`prevent`])},[t(o(O),{class:`size-3.5`})],8,Bt),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded hover:bg-accent`,title:`Nach unten`,onClick:T(e=>P(_.value,r,1),[`prevent`])},[t(o(ee),{class:`size-3.5`})],8,Vt),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded text-destructive hover:bg-destructive/10`,title:`Entfernen`,onClick:T(e=>F(r),[`prevent`])},[t(o(de),{class:`size-3.5`})],8,Ht)]),u(`div`,Ut,[(h(!0),d(g,null,f(e.field.fields,t=>(h(),b(a,{id:`${e.id}-${r}-${t.name}`,key:t.name,modelValue:n[t.name],"onUpdate:modelValue":e=>n[t.name]=e,field:t,onImagePicked:e=>oe(n,e)},null,8,[`id`,`modelValue`,`onUpdate:modelValue`,`field`,`onImagePicked`]))),128))])],8,Lt))),128)),(_.value??[]).length<e.field.max?(h(),d(`div`,Wt,[u(`button`,{type:`button`,class:`flex h-8 items-center justify-center gap-1.5 rounded-md border border-dashed px-2 text-[13px] font-medium text-muted-foreground hover:border-brand-300 hover:text-foreground`,onClick:I},[t(o(W),{class:`size-3.5`}),n(` `+v(e.field.itemLabel)+` hinzufügen `,1)]),ie.value&&o(y).pickMedia?(h(),d(`button`,{key:0,type:`button`,class:`flex h-8 items-center justify-center gap-1.5 rounded-md border px-2 text-[13px] font-medium text-muted-foreground hover:border-brand-300 hover:text-foreground`,onClick:ae},[t(o(q),{class:`size-3.5`}),i[19]||=n(` Mehrere aus der Mediathek hinzufügen `,-1)])):C(``,!0)])):C(``,!0)])):e.field.type===`ids`&&e.field.kind===`page-file`?(h(),d(`div`,Gt,[(_.value??[]).length?(h(),d(`ul`,Kt,[(h(!0),d(g,null,f(_.value,(e,n)=>(h(),d(`li`,{key:e,class:`flex items-center gap-2 rounded-md border bg-card px-2 py-1.5 text-[13px]`},[t(o(J),{class:`size-4 shrink-0 text-muted-foreground`}),u(`span`,qt,v(ue.value[e]?.name??`Datei nicht mehr vorhanden`),1),ue.value[e]?(h(),d(`span`,Jt,v(X(ue.value[e].size)),1)):C(``,!0),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded hover:bg-accent`,title:`Nach oben`,onClick:e=>P(_.value,n,-1)},[t(o(O),{class:`size-3.5`})],8,Yt),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded hover:bg-accent`,title:`Entfernen`,onClick:e=>F(n)},[t(o(G),{class:`size-3.5`})],8,Xt)]))),128))])):C(``,!0),u(`button`,{type:`button`,class:`flex h-9 items-center justify-center gap-2 rounded-md border border-dashed text-[13px] font-medium text-muted-foreground hover:border-brand-300 hover:text-foreground`,disabled:w.value,onClick:i[13]||=e=>U.value?.click()},[w.value?(h(),b(o(R),{key:0,class:`size-4 animate-spin`})):(h(),b(o(fe),{key:1,class:`size-4`})),i[20]||=n(` Dateien hochladen `,-1)],8,Zt),u(`input`,{ref_key:`fileInput`,ref:U,type:`file`,multiple:``,class:`hidden`,onChange:me},null,544),Y.value.length?(h(),b(Me,{key:1,"model-value":null,options:Y.value.map(e=>({value:e.id,label:e.name})),placeholder:`Bereits hochgeladene Datei wählen …`,"onUpdate:modelValue":i[14]||=e=>e&&(_.value=[..._.value??[],e])},null,8,[`options`])):C(``,!0)])):C(``,!0),e.field.help?(h(),d(`p`,Qt,v(e.field.help),1)):C(``,!0)])}}},en={key:0,class:`grid gap-5`},tn={class:`flex items-start gap-3`},nn={class:`grid size-9 shrink-0 place-items-center rounded-md bg-brand-soft text-brand-text`},rn={class:`min-w-0`},an={class:`font-semibold`},on={key:0,class:`text-xs text-muted-foreground`},sn={key:0,class:`rounded-md bg-muted px-3 py-2 text-xs text-muted-foreground`},cn={key:1,class:`grid gap-2`},ln={class:`text-[13px] font-medium`},un={key:1,class:`flex-1 text-[13px]`},dn=[`onClick`],fn=[`onClick`],pn=[`disabled`,`onClick`],mn=[`open`],hn={class:`flex cursor-pointer items-center gap-2 px-3 py-2 text-[13px] font-medium`},gn={key:0,class:`ml-auto rounded bg-amber-100 px-1.5 py-0.5 text-[11px] text-amber-800 dark:bg-amber-900/50 dark:text-amber-200`},_n={class:`grid gap-3 border-t px-3 py-3`},vn={class:`mb-1 text-xs font-semibold text-muted-foreground`},yn={key:0,class:`-mt-1 mb-1 text-[11px] text-muted-foreground`},bn={class:`grid max-h-36 gap-0.5 overflow-y-auto`},xn=[`checked`,`onChange`],Sn={__name:`BlockSettings`,props:{block:{type:Object,required:!0}},setup(e){let r=e,s=a(`pagebuilder:editor`),c=p(()=>s.types[r.block.type]),l=p(()=>(c.value?.fields??[]).filter(e=>e.type!==`html`));i(()=>r.block.data.layout,()=>{r.block.type===`columns`&&et(r.block)});function m(e){let t=r.block.data;`alt`in t&&!t.alt&&e.alt&&(t.alt=e.alt),`caption`in t&&!t.caption&&e.caption&&(t.caption=e.caption)}function _(){r.block.items.push({id:$(),title:`${c.value.container.label} ${r.block.items.length+1}`,blocks:[]})}function y(e,t){let n=r.block.items,i=e+t;i>=0&&i<n.length&&([n[e],n[i]]=[n[i],n[e]])}function x(e){let t=r.block.items[e];(!t.blocks.length||window.confirm(`„${t.title||c.value.container.label}“ enthält Inhalte. Trotzdem entfernen?`))&&r.block.items.splice(e,1)}let w=p(()=>r.block.visibility??{}),T=p(()=>Object.values(w.value).some(e=>e?.length));function E(e,t){let n=new Set(w.value[e]??[]);n.has(t)?n.delete(t):n.add(t),r.block.visibility={...w.value,[e]:[...n]}}let D=p(()=>[{key:`role`,label:`Rollen`,options:s.audienceOptions.role},{key:`department`,label:`Abteilungen`,options:s.audienceOptions.department.map(e=>({value:e,label:e}))},{key:`location`,label:`Standorte`,options:s.audienceOptions.location.map(e=>({value:e,label:e}))},{key:`exclude_role`,label:`Ausgeschlossene Rollen`,hint:`Sehen den Block nie – auch wenn oben etwas passt.`,options:s.audienceOptions.role}].filter(e=>e.options.length));return(r,i)=>c.value?(h(),d(`div`,en,[u(`header`,tn,[u(`span`,nn,[(h(),b(S(o(qe)(c.value.icon)),{class:`size-4.5`}))]),u(`div`,rn,[u(`h2`,an,v(c.value.label),1),c.value.description?(h(),d(`p`,on,v(c.value.description),1)):C(``,!0)])]),c.value.fields.some(e=>e.type===`html`)?(h(),d(`p`,sn,` Den Text bearbeiten Sie direkt im Block. Markieren Sie Text für Fettdruck, Links und Listen. `)):C(``,!0),(h(!0),d(g,null,f(l.value,t=>(h(),b($t,{id:`field-${e.block.id}-${t.name}`,key:`${e.block.id}-${t.name}`,modelValue:e.block.data[t.name],"onUpdate:modelValue":n=>e.block.data[t.name]=n,field:t,onImagePicked:m},null,8,[`id`,`modelValue`,`onUpdate:modelValue`,`field`]))),128)),c.value.container&&c.value.container.max>1&&c.value.key!==`columns`?(h(),d(`section`,cn,[u(`h3`,ln,v(c.value.container.label)+`s`,1),(h(!0),d(g,null,f(e.block.items,(n,r)=>(h(),d(`div`,{key:n.id,class:`flex items-center gap-1`},[c.value.container.titled?(h(),b(o(Q),{key:0,modelValue:n.title,"onUpdate:modelValue":e=>n.title=e,class:`h-8`,"aria-label":`Titel ${r+1}`,maxlength:`120`},null,8,[`modelValue`,`onUpdate:modelValue`,`aria-label`])):(h(),d(`span`,un,v(c.value.container.label)+` `+v(r+1),1)),u(`button`,{type:`button`,class:`grid size-7 shrink-0 place-items-center rounded hover:bg-accent`,title:`Nach oben`,onClick:e=>y(r,-1)},[t(o(O),{class:`size-3.5`})],8,dn),u(`button`,{type:`button`,class:`grid size-7 shrink-0 place-items-center rounded hover:bg-accent`,title:`Nach unten`,onClick:e=>y(r,1)},[t(o(ee),{class:`size-3.5`})],8,fn),u(`button`,{type:`button`,class:`grid size-7 shrink-0 place-items-center rounded text-destructive hover:bg-destructive/10 disabled:opacity-30`,title:`Entfernen`,disabled:e.block.items.length<=c.value.container.min,onClick:e=>x(r)},[t(o(de),{class:`size-3.5`})],8,pn)]))),128)),e.block.items.length<c.value.container.max?(h(),d(`button`,{key:0,type:`button`,class:`flex h-8 items-center justify-center gap-1.5 rounded-md border border-dashed text-[13px] font-medium text-muted-foreground hover:border-brand-300 hover:text-foreground`,onClick:_},[t(o(W),{class:`size-3.5`}),n(` `+v(c.value.container.label)+` hinzufügen `,1)])):C(``,!0)])):C(``,!0),D.value.length?(h(),d(`details`,{key:2,class:`rounded-md border`,open:T.value},[u(`summary`,hn,[t(o(N),{class:`size-4 text-muted-foreground`}),i[0]||=n(` Sichtbarkeit `,-1),T.value?(h(),d(`span`,gn,`eingeschränkt`)):C(``,!0)]),u(`div`,_n,[i[1]||=u(`p`,{class:`text-xs text-muted-foreground`},`Leer = für alle, die die Seite sehen. Sonst nur für Personen, die mindestens eine Angabe erfüllen.`,-1),(h(!0),d(g,null,f(D.value,e=>(h(),d(`fieldset`,{key:e.key,class:`grid gap-1`},[u(`legend`,vn,v(e.label),1),e.hint?(h(),d(`p`,yn,v(e.hint),1)):C(``,!0),u(`div`,bn,[(h(!0),d(g,null,f(e.options,t=>(h(),d(`label`,{key:t.value,class:`flex items-center gap-2 rounded px-1 py-0.5 text-[13px] hover:bg-accent`},[u(`input`,{type:`checkbox`,class:`size-4 accent-[var(--brand)]`,checked:(w.value[e.key]??[]).includes(t.value),onChange:n=>E(e.key,t.value)},null,40,xn),n(` `+v(t.label),1)]))),128))])]))),128))])],8,mn)):C(``,!0)])):C(``,!0)}},Cn=[`data-block-id`],wn={class:`pb-handle flex cursor-grab items-center gap-1 rounded px-1 py-0.5 font-medium text-muted-foreground active:cursor-grabbing`,title:`Ziehen zum Verschieben`},Tn={key:2,class:`rounded-md border border-dashed p-4 text-sm text-muted-foreground`},En={__name:`EditorBlock`,props:{block:{type:Object,required:!0}},setup(e){let r=e,i=a(`pagebuilder:editor`),s=p(()=>i.types[r.block.type]),c=p(()=>i.selectedId.value===r.block.id),f=p(()=>i.hoveredId.value===r.block.id),m=p(()=>Object.values(r.block.visibility??{}).some(e=>e?.length)),g=p(()=>({...r.block,props:i.previews[r.block.id]??r.block.props}));return(r,a)=>(h(),d(`div`,{class:l([`relative rounded-md outline-offset-4 transition-[outline-color]`,[c.value?`outline-2 outline-brand-500`:f.value?`outline-1 outline-brand-300`:`outline-1 outline-transparent`,s.value?``:`opacity-60`]]),"data-block-id":e.block.id,onClick:a[5]||=T(t=>o(i).select(e.block.id),[`stop`]),onMouseover:a[6]||=T(t=>o(i).hoveredId.value=e.block.id,[`stop`]),onMouseleave:a[7]||=t=>o(i).hoveredId.value===e.block.id&&(o(i).hoveredId.value=null)},[(c.value||f.value)&&!o(i).readOnly.value?(h(),d(`div`,{key:0,class:`absolute -top-3.5 right-2 z-20 flex items-center gap-0.5 rounded-md border bg-card px-1 py-0.5 text-xs shadow-sm`,onClick:a[4]||=T(()=>{},[`stop`])},[u(`span`,wn,[t(o(P),{class:`size-3.5`}),(h(),b(S(o(qe)(s.value?.icon)),{class:`size-3.5`})),n(` `+v(s.value?.label??e.block.type),1)]),m.value?(h(),b(o(N),{key:0,class:`mx-1 size-3.5 text-amber-600`,title:`Nur für bestimmte Personen sichtbar`})):C(``,!0),a[8]||=u(`span`,{class:`mx-0.5 h-4 w-px bg-border`},null,-1),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded hover:bg-accent`,title:`Nach oben`,onClick:a[0]||=t=>o(i).move(e.block.id,-1)},[t(o(k),{class:`size-3.5`})]),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded hover:bg-accent`,title:`Nach unten`,onClick:a[1]||=t=>o(i).move(e.block.id,1)},[t(o(X),{class:`size-3.5`})]),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded hover:bg-accent`,title:`Duplizieren`,onClick:a[2]||=t=>o(i).duplicate(e.block.id)},[t(o(j),{class:`size-3.5`})]),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded text-destructive hover:bg-destructive/10`,title:`Entfernen`,onClick:a[3]||=t=>o(i).remove(e.block.id)},[t(o(de),{class:`size-3.5`})])])):C(``,!0),s.value&&o(Pe)(s.value.component)?(h(),b(S(o(Pe)(s.value.component)),{key:1,block:g.value},null,8,[`block`])):(h(),d(`div`,Tn,` Dieser Block (`+v(e.block.type)+`) ist nicht verfügbar – vermutlich ist das zugehörige Plugin deaktiviert. Er wird nicht angezeigt. `,1))],42,Cn))}},Dn={key:0,class:`pointer-events-none text-center text-xs text-muted-foreground`},On={__name:`EditorBlockList`,props:{item:{type:Object,required:!0},root:{type:Boolean,default:!1}},setup(e){let r=e,i=a(`pagebuilder:editor`),s=p(()=>r.root||i.containsActive(r.item));return(r,a)=>(h(),d(`div`,{class:l([`grid`,e.root?`gap-6`:`gap-4`])},[t(o(I),{modelValue:e.item.blocks,"onUpdate:modelValue":a[0]||=t=>e.item.blocks=t,group:{name:`pagebuilder`},handle:`.pb-handle`,animation:150,disabled:o(i).readOnly.value,"ghost-class":`pb-ghost`,class:l([`grid min-h-6`,[e.root?`gap-6`:`gap-4`,e.item.blocks.length?``:`rounded-md border border-dashed border-border bg-muted/40 p-3`]]),onAdd:a[1]||=t=>o(i).select(e.item.blocks[t.newIndex]?.id)},{default:_(()=>[(h(!0),d(g,null,f(e.item.blocks,e=>(h(),b(En,{key:e.id,block:e},null,8,[`block`]))),128)),e.item.blocks.length?C(``,!0):(h(),d(`p`,Dn,v(e.root?`Noch keine Inhalte. Blöcke aus der rechten Spalte hierher ziehen oder hinzufügen.`:`Blöcke hierher ziehen`),1))]),_:1},8,[`modelValue`,`disabled`,`class`]),!o(i).readOnly.value&&(s.value||!e.item.blocks.length)?(h(),b(o(le),{key:0},{default:_(()=>[t(o(H),{class:`flex h-8 items-center justify-center gap-1.5 rounded-md border border-dashed text-xs font-medium text-muted-foreground transition-colors hover:border-brand-300 hover:bg-brand-soft hover:text-brand-soft-foreground`,onClick:a[2]||=T(()=>{},[`stop`])},{default:_(()=>[t(o(W),{class:`size-3.5`}),a[5]||=n(` Block hinzufügen `,-1)]),_:1}),t(o(V),{class:`max-h-[70vh] w-[22rem] overflow-y-auto p-3`,align:`center`,onClick:a[4]||=T(()=>{},[`stop`])},{default:_(()=>[t(at,{compact:``,onPick:a[3]||=t=>o(i).insert(e.item.blocks,e.item.blocks.length,t)})]),_:1})]),_:1})):C(``,!0)],2))}},kn={class:`flex flex-wrap items-center gap-x-6 gap-y-2 border-b px-5 pt-4 pr-12`},An={class:`pb-3`},jn={class:`-mb-px flex gap-1 self-end`,role:`tablist`},Mn=[`aria-selected`,`onClick`],Nn={class:`min-h-0 flex-1 overflow-y-auto p-5`},Pn={class:`flex min-h-0 flex-1`},Fn={class:`flex min-w-0 flex-1 flex-col`},In={class:`flex flex-wrap items-center gap-2 border-b px-4 py-2.5`},Ln={class:`relative min-w-48 flex-1`},Rn={class:`flex flex-wrap gap-1`},zn=[`aria-pressed`,`onClick`],Bn={key:0,class:`grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4`},Vn={key:1,class:`grid place-items-center px-6 py-16 text-center`},Hn={class:`mt-3 text-sm font-medium`},Un={class:`hidden w-72 shrink-0 overflow-y-auto border-l bg-muted/30 p-4 md:block`},Wn={key:0,class:`grid gap-3`},Gn={class:`grid place-items-center overflow-hidden rounded-md border bg-card`},Kn=[`src`,`alt`],qn={class:`text-[13px]`},Jn={class:`font-medium break-all`},Yn={class:`text-muted-foreground`},Xn={class:`grid gap-1`},Zn={class:`flex items-center justify-between text-[13px] font-medium`},Qn={class:`text-[13px]`},$n={key:0,class:`mb-1 font-medium text-brand-text`},er={key:1,class:`text-muted-foreground`},tr=[`href`],nr={key:1,class:`text-[13px] text-muted-foreground`},rr={class:`flex flex-wrap items-center gap-3 border-t bg-card px-5 py-3`},ir={class:`flex min-w-0 flex-1 items-center gap-2`},ar={class:`flex -space-x-2`},or=[`src`],sr={class:`text-[13px] font-medium`},cr={key:1,class:`text-[13px] text-muted-foreground`},lr={__name:`MediaPicker`,props:{open:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},contextPaths:{type:Array,default:()=>[]},contextLabel:{type:String,default:`Hier verwendet`},upload:{type:Function,default:null},title:{type:String,default:``}},emits:[`update:open`,`select`],setup(e,{emit:r}){let a=e,s=r,m=x(`library`),T=x(`all`),D=x(``),ee=p(()=>({q:D.value,sortierung:T.value===`recent`?`verwendet`:`neu`,status:T.value===`unused`?`unbenutzt`:T.value===`recent`?`verwendet`:``,pfade:T.value===`here`?a.contextPaths.slice(0,500):void 0})),{items:O,total:k,loading:j,nextPage:N,load:se,observe:P,replaceItem:F,prepend:ce}=oe(ee),I=x(null),z=x(null),B=x([]),V=x(null),le=p(()=>new Set(a.contextPaths)),H=p(()=>O.value.find(e=>e.id===V.value)??B.value.find(e=>e.id===V.value)??null);i(()=>a.open,async e=>{e&&(B.value=[],V.value=null,D.value=``,T.value=`all`,m.value=`library`,await se(!0),await y(),P(I.value,z.value))},{immediate:!0}),i(m,async e=>{e===`library`&&(await y(),P(I.value,z.value))});let U=e=>B.value.some(t=>t.id===e.id);function W(e){if(!e.missing){if(V.value=e.id,!a.multiple){B.value=[e];return}B.value=U(e)?B.value.filter(t=>t.id!==e.id):[...B.value,e]}}function de(e,t){if(!a.multiple&&t?.detail===2&&!e.missing){B.value=[e],Z();return}W(e)}async function pe(e,t){let n=a.upload?await a.upload(e,t):await te.upload(e,t);return n?.media??n}function me(e){let t=e.map(e=>({...e,usage_count:e.usage_count??0}));T.value=`all`,ce(t),B.value=a.multiple?[...B.value,...t.filter(e=>!U(e))]:[t[t.length-1]],V.value=t[t.length-1].id,m.value=`library`}let J=x(``),Y=x(!1),X=x(null);i(H,(e,t)=>{e?.id!==t?.id&&(J.value=e?.alt??``,X.value=null)});async function he(){let e=H.value;if(e&&J.value.trim()!==(e.alt??``)){Y.value=!0;try{let t=await te.update(e.id,{alt:J.value.trim()});F(t.media),B.value=B.value.map(n=>n.id===e.id?{...n,alt:t.media.alt}:n)}catch(e){K.error(e.message)}finally{Y.value=!1}}}async function ge(){try{X.value=(await te.show(H.value.id)).usages}catch(e){K.error(e.message)}}async function Z(){await he(),s(`select`,B.value.map(e=>A(O.value.find(t=>t.id===e.id)??e))),s(`update:open`,!1)}let _e=p(()=>[{key:`all`,label:`Alle`},{key:`recent`,label:`Zuletzt verwendet`},...a.contextPaths.length?[{key:`here`,label:a.contextLabel}]:[],{key:`unused`,label:`Nicht verwendet`}]);return(r,i)=>(h(),b(o(Ae),{open:e.open,"onUpdate:open":i[6]||=e=>s(`update:open`,e)},{default:_(()=>[t(o(ke),{class:`flex h-[min(88vh,820px)] max-w-6xl flex-col gap-0 overflow-hidden p-0 sm:max-w-6xl`},{default:_(()=>[u(`header`,kn,[u(`div`,An,[t(o(Oe),{class:`text-base`},{default:_(()=>[n(v(e.title||(e.multiple?`Bilder auswählen`:`Bild auswählen`)),1)]),_:1}),t(o(Se),{class:`text-[13px]`},{default:_(()=>[n(v(e.multiple?`Mehrere Bilder anklicken – die Reihenfolge der Auswahl bleibt erhalten.`:`Ein Bild anklicken, mit Doppelklick direkt übernehmen.`),1)]),_:1})]),u(`nav`,jn,[(h(!0),d(g,null,f([{key:`upload`,label:`Hochladen`,icon:o(fe)},{key:`library`,label:`Mediathek`,icon:o(q)}],e=>(h(),d(`button`,{key:e.key,type:`button`,role:`tab`,"aria-selected":m.value===e.key,class:l([`inline-flex items-center gap-1.5 border-b-2 px-3 pb-2.5 text-sm font-medium transition-colors`,m.value===e.key?`border-brand text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`]),onClick:t=>m.value=e.key},[(h(),b(S(e.icon),{class:`size-4`})),n(` `+v(e.label),1)],10,Mn))),128))])]),c(u(`div`,Nn,[e.open?(h(),b(ie,{key:0,upload:pe,paste:m.value===`upload`,onDone:me},null,8,[`paste`])):C(``,!0),i[7]||=u(`p`,{class:`mt-4 text-[13px] text-muted-foreground`},`Hochgeladene Bilder landen in der Mediathek und sind danach ausgewählt. Große Fotos werden automatisch verkleinert.`,-1)],512),[[w,m.value===`upload`]]),c(u(`div`,Pn,[u(`div`,Fn,[u(`div`,In,[u(`label`,Ln,[i[8]||=u(`span`,{class:`sr-only`},`Suchen`,-1),t(o(xe),{class:`pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),c(u(`input`,{"onUpdate:modelValue":i[0]||=e=>D.value=e,type:`search`,placeholder:`Suchen: Name, Alternativtext, Schlagwort …`,class:`h-8 w-full rounded-md border border-input bg-card pr-3 pl-8 text-sm placeholder:text-muted-foreground focus-visible:border-brand-400 focus-visible:ring-3 focus-visible:ring-ring/30 focus-visible:outline-none`},null,512),[[E,D.value]])]),u(`div`,Rn,[(h(!0),d(g,null,f(_e.value,e=>(h(),d(`button`,{key:e.key,type:`button`,class:l([`h-8 rounded-md px-2.5 text-[13px] font-medium transition-colors`,T.value===e.key?`bg-brand-soft text-brand-soft-foreground`:`text-muted-foreground hover:bg-accent hover:text-foreground`]),"aria-pressed":T.value===e.key,onClick:t=>T.value=e.key},v(e.label),11,zn))),128))])]),u(`div`,{ref_key:`scroller`,ref:z,class:`min-h-0 flex-1 overflow-y-auto p-4`},[o(O).length?(h(),d(`ul`,Bn,[(h(!0),d(g,null,f(o(O),n=>(h(),d(`li`,{key:n.id},[t(ne,{item:n,selected:U(n),checkable:e.multiple,here:le.value.has(n.path),onOpen:de,onToggle:W},null,8,[`item`,`selected`,`checkable`,`here`])]))),128))])):o(j)?C(``,!0):(h(),d(`div`,Vn,[(h(),b(S(D.value||T.value!==`all`?o(ue):o(q)),{class:`size-8 text-muted-foreground`,"stroke-width":1.5})),u(`p`,Hn,v(D.value||T.value!==`all`?`Keine Bilder gefunden`:`Die Mediathek ist noch leer`),1),t(o(De),{variant:`outline`,size:`sm`,class:`mt-3`,onClick:i[1]||=e=>m.value=`upload`},{default:_(()=>[t(o(fe)),i[9]||=n(` Bilder hochladen`,-1)]),_:1})])),u(`div`,{ref_key:`sentinel`,ref:I,class:`grid h-12 place-items-center`},[o(j)?(h(),b(o(R),{key:0,class:`size-5 animate-spin text-muted-foreground`})):o(N)&&o(O).length?(h(),b(o(De),{key:1,variant:`ghost`,size:`sm`,onClick:i[2]||=e=>o(se)()},{default:_(()=>[...i[10]||=[n(`Weitere laden`,-1)]]),_:1})):C(``,!0)],512)],512)]),u(`aside`,Un,[H.value?(h(),d(`div`,Wn,[u(`div`,Gn,[H.value.thumb_url||H.value.url?(h(),d(`img`,{key:0,src:H.value.url||H.value.thumb_url,alt:H.value.alt,class:`max-h-44 w-auto object-contain`},null,8,Kn)):(h(),b(o(L),{key:1,class:`my-10 size-6 text-muted-foreground`}))]),u(`div`,qn,[u(`p`,Jn,v(H.value.name),1),u(`p`,Yn,[H.value.width?(h(),d(g,{key:0},[n(v(H.value.width)+` × `+v(H.value.height)+` · `,1)],64)):C(``,!0),n(v(o(ae)(H.value.size)),1)])]),u(`label`,Xn,[u(`span`,Zn,[i[11]||=n(` Alternativtext `,-1),Y.value?(h(),b(o(R),{key:0,class:`size-3.5 animate-spin text-muted-foreground`})):C(``,!0)]),c(u(`textarea`,{"onUpdate:modelValue":i[3]||=e=>J.value=e,rows:`3`,maxlength:`300`,placeholder:`Was ist auf dem Bild zu sehen?`,class:`w-full resize-none rounded-md border border-input bg-card px-2.5 py-1.5 text-[13px] focus-visible:border-brand-400 focus-visible:ring-3 focus-visible:ring-ring/30 focus-visible:outline-none`,onBlur:he},null,544),[[E,J.value]]),i[12]||=u(`span`,{class:`text-[11px] text-muted-foreground`},`Wird in der Mediathek gespeichert und beim Einfügen übernommen.`,-1)]),u(`div`,Qn,[le.value.has(H.value.path)?(h(),d(`p`,$n,v(e.contextLabel),1)):C(``,!0),H.value.usage_count?(h(),d(g,{key:2},[X.value?(h(),b(re,{key:1,usages:X.value},null,8,[`usages`])):(h(),d(`button`,{key:0,type:`button`,class:`font-medium text-brand-text hover:underline`,onClick:ge},` In `+v(H.value.usage_count)+` `+v(H.value.usage_count===1?`Inhalt`:`Inhalten`)+` verwendet `,1))],64)):(h(),d(`p`,er,`Noch nirgends verwendet.`))]),u(`a`,{href:`/redaktion/mediathek?q=${encodeURIComponent(H.value.name)}`,target:`_blank`,class:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground hover:underline`},[i[13]||=n(` In der Mediathek öffnen `,-1),t(o(M),{class:`size-3`})],8,tr)])):(h(),d(`p`,nr,`Bild anklicken, um Details zu sehen und den Alternativtext zu ergänzen.`))])],512),[[w,m.value===`library`]]),u(`footer`,rr,[u(`div`,ir,[B.value.length?(h(),d(g,{key:0},[u(`div`,ar,[(h(!0),d(g,null,f(B.value.slice(-5),e=>(h(),d(`img`,{key:e.id,src:e.thumb_url,alt:``,class:`size-8 rounded border-2 border-card object-cover`},null,8,or))),128))]),u(`span`,sr,v(B.value.length===1?`1 Bild ausgewählt`:`${B.value.length} Bilder ausgewählt`),1),e.multiple?(h(),d(`button`,{key:0,type:`button`,class:`inline-flex items-center gap-0.5 text-xs text-muted-foreground hover:text-foreground`,onClick:i[4]||=e=>B.value=[]},[t(o(G),{class:`size-3`}),i[14]||=n(` Auswahl leeren`,-1)])):C(``,!0)],64)):o(k)!==null&&m.value===`library`?(h(),d(`span`,cr,v(o(k).toLocaleString(`de-DE`))+` `+v(o(k)===1?`Bild`:`Bilder`),1)):C(``,!0)]),t(o(De),{variant:`outline`,onClick:i[5]||=e=>s(`update:open`,!1)},{default:_(()=>[...i[15]||=[n(`Abbrechen`,-1)]]),_:1}),t(o(De),{disabled:!B.value.length,onClick:Z},{default:_(()=>[n(v(e.multiple&&B.value.length>1?`${B.value.length} Bilder übernehmen`:`Übernehmen`),1)]),_:1},8,[`disabled`])])]),_:1})]),_:1},8,[`open`]))}},ur={__name:`MediaPickerHost`,props:{picker:{type:Object,required:!0}},setup(e){return(t,n)=>(h(),b(lr,{open:e.picker.state.open,multiple:e.picker.state.multiple,title:e.picker.state.title,"context-paths":e.picker.state.contextPaths,"context-label":e.picker.state.contextLabel,upload:e.picker.state.upload,onSelect:n[0]||=t=>e.picker.finish(t),"onUpdate:open":n[1]||=t=>!t&&e.picker.finish(null)},null,8,[`open`,`multiple`,`title`,`context-paths`,`context-label`,`upload`]))}};function dr(e={}){let t=m({open:!1,multiple:!1,title:``,contextPaths:[],contextLabel:e.contextLabel??`Hier verwendet`,upload:e.upload??null,resolve:null});function n(n={}){return t.resolve?.(null),new Promise(r=>{Object.assign(t,{multiple:!!n.multiple,title:n.title??``,contextPaths:n.contextPaths??e.contextPaths?.()??[],resolve:r,open:!0})})}function r(e){let n=t.resolve;t.resolve=null,t.open=!1,n?.(e)}return{state:t,pick:n,finish:r}}export{at as a,Ze as c,Ge as d,Sn as i,Qe as l,ur as n,Je as o,On as r,Xe as s,dr as t,$e as u};