@oktis-works/admin 0.23.2 → 0.23.3
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/client/_astro/{ActivityWidget.Dzoi-bq3.js → ActivityWidget.C8vh6xAH.js} +1 -1
- package/dist/client/_astro/{AdminBar.eT1ch_B6.js → AdminBar.D4zIDpRx.js} +1 -1
- package/dist/client/_astro/{ApiKeysManager.kbTE1CPk.js → ApiKeysManager.Bkuipo9h.js} +1 -1
- package/dist/client/_astro/{AtGlanceWidget.w23IIv06.js → AtGlanceWidget.BwnpX_nn.js} +1 -1
- package/dist/client/_astro/{CommentsManager.BN7i1RHa.js → CommentsManager.B7eut49M.js} +1 -1
- package/dist/client/_astro/ContentEditor.CTopdn_8.js +1 -0
- package/dist/client/_astro/ContentTypeWorkspace.xXST4b7L.js +1 -0
- package/dist/client/_astro/{DashboardHome.DXzu_IXZ.js → DashboardHome.DD8QG8ZW.js} +1 -1
- package/dist/client/_astro/{DashboardLayout.astro_astro_type_script_index_0_lang.DmNSzErX.js → DashboardLayout.astro_astro_type_script_index_0_lang.DPDlXZ5o.js} +1 -1
- package/dist/client/_astro/{FieldGroupEditor.DsqphEgt.js → FieldGroupEditor.BBEN5r2U.js} +3 -3
- package/dist/client/_astro/{FieldGroupList.pW2Um9om.js → FieldGroupList.BatiQHnf.js} +1 -1
- package/dist/client/_astro/FieldRenderer.BeF5CSJf.js +3 -0
- package/dist/client/_astro/{Footer.5Lcn2VXz.js → Footer.BdwB3qmM.js} +1 -1
- package/dist/client/_astro/{GeneralSettings.B-H8Rzy7.js → GeneralSettings.BCfrxm6Z.js} +1 -1
- package/dist/client/_astro/{LogsManager.Crd8q2te.js → LogsManager.Bs5CSVoj.js} +1 -1
- package/dist/client/_astro/{MediaLibrary.Cv6Ry3u9.js → MediaLibrary.CHn5f4-T.js} +1 -1
- package/dist/client/_astro/{MenuManager.D25ika09.js → MenuManager.C6SrDqdC.js} +1 -1
- package/dist/client/_astro/{Modal.572hmVvb.js → Modal.DdoTYkUe.js} +1 -1
- package/dist/client/_astro/PluginManager.BLpO1lc5.js +112 -0
- package/dist/client/_astro/PluginPageHost.CuXn-tn7.js +1 -0
- package/dist/client/_astro/{PostTypesManager.C3RbmOZT.js → PostTypesManager.B6XdeNQH.js} +1 -1
- package/dist/client/_astro/{QuickDraftWidget.BtSGzhKq.js → QuickDraftWidget.COnmqwEP.js} +1 -1
- package/dist/client/_astro/{ReadingSettings.ZFDaeo5U.js → ReadingSettings.dAD5fTqQ.js} +1 -1
- package/dist/client/_astro/{ResourceHubs.Cx9fbCv1.js → ResourceHubs.B6txFjmO.js} +1 -1
- package/dist/client/_astro/{TaxonomiesManager.BLsvmjaL.js → TaxonomiesManager.CUiXA1--.js} +1 -1
- package/dist/client/_astro/{TaxonomyTermsManager.C_xEh8Ab.js → TaxonomyTermsManager.egxIFsFi.js} +1 -1
- package/dist/client/_astro/{ThemeCustomizer.BrDHVXLk.js → ThemeCustomizer.Bh3Gj0ud.js} +1 -1
- package/dist/client/_astro/{ThemeManager.BpS3m7Qc.js → ThemeManager.UG7ieOYF.js} +1 -1
- package/dist/client/_astro/{UserCreateForm.BYwgAqKk.js → UserCreateForm.CTbVVXjg.js} +1 -1
- package/dist/client/_astro/{UsersManager.DODMr48D.js → UsersManager.Dk2kJsYG.js} +1 -1
- package/dist/client/_astro/{WebhooksManager.DmWIW272.js → WebhooksManager.DTMl6Bm7.js} +1 -1
- package/dist/client/_astro/{api.53l1ob4Z.js → api.fpBzBw4U.js} +1 -1
- package/dist/client/_astro/extensions.DZ7iomLj.js +1 -0
- package/dist/client/_astro/i18n.DQYU1D_P.js +1 -0
- package/dist/client/_astro/{login.astro_astro_type_script_index_0_lang.BLf2Iun3.js → login.astro_astro_type_script_index_0_lang.DA827d72.js} +1 -1
- package/dist/client/_astro/{pt-BR.zZcF2v3X.js → pt-BR.C041vzOT.js} +1 -1
- package/dist/client/_astro/slots.CSARb9TW.js +1 -0
- package/dist/client/_astro/store.CjNcmZUB.js +1 -0
- package/dist/server/chunks/{404_BAOD9OCa.mjs → 404_vQwudBEj.mjs} +1 -1
- package/dist/server/chunks/{BaseLayout_BE8O-LS4.mjs → BaseLayout_CJGULIpb.mjs} +3 -3
- package/dist/server/chunks/{ContentEditor_DPy3I4HM.mjs → ContentEditor_D3hp0Gyo.mjs} +49 -11
- package/dist/server/chunks/{DashboardLayout_D6zphdT0.mjs → DashboardLayout_DvfGK5S9.mjs} +20 -17
- package/dist/server/chunks/{FieldRenderer_D4dcZjgt.mjs → FieldRenderer_hN7BJpMp.mjs} +6 -6
- package/dist/server/chunks/{MediaLibrary_DGmYSSZH.mjs → MediaLibrary_BP42MRyJ.mjs} +2 -2
- package/dist/server/chunks/{Modal_BmuvdwoB.mjs → Modal_Ch2TxBxO.mjs} +1 -1
- package/dist/server/chunks/_.._DuD24v6o.mjs +76 -0
- package/dist/server/chunks/{_id__XEnJ5nS2.mjs → _id__DK_jXL1Q.mjs} +4 -4
- package/dist/server/chunks/{access_B5npG273.mjs → access_pGLFLBaE.mjs} +3 -3
- package/dist/server/chunks/{api-keys_Bs6zIXYm.mjs → api-keys_BPiWCywt.mjs} +3 -3
- package/dist/server/chunks/{comments_zJrnFEjl.mjs → comments_HtxLK4Vu.mjs} +2 -2
- package/dist/server/chunks/{custom-fields_C5EBkR02.mjs → custom-fields_CLqVsj2N.mjs} +2 -2
- package/dist/server/chunks/{customize_CKqMX14y.mjs → customize_C8xbYnPi.mjs} +3 -3
- package/dist/server/chunks/{edit_QKBYgFkJ.mjs → edit_CHln4Kd_.mjs} +2 -2
- package/dist/server/chunks/{i18n_C-sgJSi1.mjs → i18n_BlAR9yiz.mjs} +23 -2
- package/dist/server/chunks/{index_BM_-WBYo.mjs → index_BiKJEUK6.mjs} +2 -2
- package/dist/server/chunks/{index_BletZ9T6.mjs → index_CNk9hfS_.mjs} +3 -3
- package/dist/server/chunks/{index_CDwohy44.mjs → index_COr5MHJ7.mjs} +2 -2
- package/dist/server/chunks/{index_DenKi4a3.mjs → index_DK_fTf2_.mjs} +2 -2
- package/dist/server/chunks/{index_Btvmuytk.mjs → index_T7SwCQJ9.mjs} +2 -2
- package/dist/server/chunks/{login_CtIWLqC2.mjs → login_4_AiN3uA.mjs} +1 -1
- package/dist/server/chunks/{logs_DlTldv5b.mjs → logs_BnmhxL0Y.mjs} +2 -2
- package/dist/server/chunks/{menus_z2d_K44p.mjs → menus_CnlArgBT.mjs} +2 -2
- package/dist/server/chunks/{new_CYvLScge.mjs → new_BLx19-Ni.mjs} +2 -2
- package/dist/server/chunks/{new_Cxp8Mdw4.mjs → new_CtlziJrk.mjs} +2 -2
- package/dist/server/chunks/{plugins_4g6EEkCb.mjs → plugins_CgMxXTGS.mjs} +13 -5
- package/dist/server/chunks/{post-types_7cW4BLBV.mjs → post-types_cQc2Msvm.mjs} +2 -2
- package/dist/server/chunks/{pt-BR_AVNE88MZ.mjs → pt-BR_B8bZo1Id.mjs} +7 -1
- package/dist/server/chunks/{reading_2DqfBhj_.mjs → reading_0A4laJFd.mjs} +2 -2
- package/dist/server/chunks/{taxonomies_D7mMKpNX.mjs → taxonomies_CiAk4uQu.mjs} +2 -2
- package/dist/server/chunks/{taxonomy_64ggDTF9.mjs → taxonomy_C1yrRsga.mjs} +3 -3
- package/dist/server/chunks/{themes_Dscq-5uk.mjs → themes_C8eP1zzS.mjs} +2 -2
- package/dist/server/chunks/{upload_B-DdqpaQ.mjs → upload_BNO83SEC.mjs} +2 -2
- package/dist/server/chunks/{webhooks_D05B4_Rs.mjs → webhooks_BQe0fs4j.mjs} +2 -2
- package/dist/server/entry.mjs +43 -43
- package/dist/server/virtual_astro_middleware.mjs +1 -1
- package/package.json +3 -3
- package/dist/client/_astro/ContentEditor.BlsJ2bwD.js +0 -1
- package/dist/client/_astro/ContentTypeWorkspace.BPVuQgzA.js +0 -1
- package/dist/client/_astro/FieldRenderer.AYtSBfHZ.js +0 -3
- package/dist/client/_astro/PluginManager.DLfgQFPF.js +0 -112
- package/dist/client/_astro/extensions.DzQcQsO9.js +0 -1
- package/dist/client/_astro/i18n.A82w5XQu.js +0 -1
- package/dist/client/_astro/preload-helper.oCYlU9a4.js +0 -1
- package/dist/client/_astro/store.DLCqLxBR.js +0 -1
- package/dist/server/chunks/_slug__BkXrukGe.mjs +0 -34
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,a as t,f as n,h as r,l as i,p as a,r as o}from"./solid.Ck4Vtfe4.js";import{_ as s,a as c,f as l,l as u,m as d,o as f,p,s as m,u as h}from"./web.DD6VKaIp.js";import{n as g}from"./i18n.
|
|
1
|
+
import{S as e,a as t,f as n,h as r,l as i,p as a,r as o}from"./solid.Ck4Vtfe4.js";import{_ as s,a as c,f as l,l as u,m as d,o as f,p,s as m,u as h}from"./web.DD6VKaIp.js";import{n as g}from"./i18n.DQYU1D_P.js";import{n as _}from"./api.fpBzBw4U.js";import{t as v}from"./FbIcon.Bn4e_qFb.js";var y=s(`<div class="notice notice--error">`),b=s(`<div class=fb-list__toolbar><label class=fb-list__filter><span></span><select class=input><option value></option><!$><!/></select></label><input class="input fb-list__search"type=search>`),x=s(`<div class=fb-groups-table__head><span></span><span></span><span></span><span></span><span></span><span>`),S=s(`<section class="card fb-groups-table">`),ee=s(`<p class="muted fb-import-hint">`),te=s(`<div class=fb-modal-backdrop><div class=fb-modal><div class=fb-modal__header><h3></h3><button type=button class=fb-modal__close></button></div><div class=fb-modal__body><p class=muted></p><label class=fb-import-dropzone><input id=import-file-input type=file accept=.json hidden><!$><!/><span></span></label><!$><!/></div><div class=fb-modal__footer><button type=button class="btn btn-secondary"></button><button type=button class="btn btn-primary">`),C=s(`<div class=fb-list><!$><!/><div class=fb-list__header><div><span class=fb-eyebrow></span><h2></h2><p class=muted></p></div><div class=fb-list__header-actions><label class=fb-import-btn><input type=file accept=.json hidden><button type=button class="btn btn-secondary"><!$><!/> <!$><!/></button></label><a class="btn btn-primary"href=/settings/custom-fields/new>+ <!$><!/></a></div></div><!$><!/><!$><!/>`),w=s(`<p class=muted>`),T=s(`<option><!$><!/> (<!$><!/>)`),E=s(`<div class=fb-empty-groups><!$><!/><h4></h4><p class=muted></p><a class="btn btn-primary"href=/settings/custom-fields/new>`),D=s(`<div class=fb-groups-table__row role=button tabindex=0><div class=fb-groups-table__title><strong></strong><code></code></div><span class="fb-groups-table__desc muted"></span><span class=fb-groups-table__location></span><span class=fb-groups-table__count></span><span><span class=badge></span></span><div class=fb-groups-table__actions><button type=button class=fb-row-action></button><button type=button class=fb-row-action></button><button type=button class=fb-row-action></button><button type=button class=fb-row-action></button><button type=button class="fb-row-action is-danger">`);function O(){let{t:s}=g(),[c,O]=r([]),[k,A]=r([]),[j,M]=r(``),[N,ne]=r(``),[P,F]=r(!0),[I,L]=r(``);e(async()=>{try{let[e,t]=await Promise.all([_.getContentTypes(),_.getFieldGroups()]);A(e),O(t),e[0]&&M(e[0].slug)}catch(e){L(e instanceof Error?e.message:String(e))}finally{F(!1)}});let R=e=>[...new Set((e.locationRules??[]).flat().filter(e=>e.param===`content_type`&&e.operator===`eq`&&e.value).map(e=>e.value))],re=e=>{let t=R(e);return t.length===0?s(`settings.customFields.groups.allContentTypes`):t.map(e=>k().find(t=>t.slug===e)?.pluralLabel??e).join(`, `)},z=n(()=>{let e=N().trim().toLowerCase();return c().filter(e=>!e.key.startsWith(`core-fields-`)).filter(t=>{let n=R(t);return(!j()||n.length===0||n.includes(j()))&&(!e||t.title.toLowerCase().includes(e)||t.key.toLowerCase().includes(e))})}),B=e=>{window.location.href=`/settings/custom-fields/${e}`},V=async e=>{try{let t=await _.getFieldGroup(e.id);await _.createFieldGroup({...t,id:void 0,key:`${t.key}-copy-${Date.now().toString(36)}`,title:`${t.title} ${s(`settings.customFields.form.copySuffix`)}`}),await H()}catch(e){L(e instanceof Error?e.message:String(e))}},ie=async e=>{try{let t=await _.getFieldGroup(e.id);await _.updateFieldGroup(e.id,{...t,active:!e.active}),await H()}catch(e){L(e instanceof Error?e.message:String(e))}},ae=async e=>{if(window.confirm(s(`settings.customFields.actions.confirmDelete`)))try{await _.deleteFieldGroup(e.id),await H()}catch(e){L(e instanceof Error?e.message:String(e))}},H=async()=>{let e=await _.getFieldGroups();O(e)},[oe,U]=r(!1),[W,G]=r(null),[K,q]=r(!1),se=async e=>{try{let t=await _.exportFieldGroup(e.id),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${e.key}.json`,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)}catch(e){L(e instanceof Error?e.message:String(e))}},J=e=>{let t=e.currentTarget;t.files&&t.files[0]&&G(t.files[0])},ce=async()=>{let e=W();if(e){q(!0);try{let t=await e.text(),n=JSON.parse(t),r=(await _.importFieldGroups(n)).results.filter(e=>!e.success);r.length>0?L(r.map(e=>`${e.key}: ${e.error}`).join(`; `)):L(``),U(!1),G(null),await H()}catch(e){L(e instanceof Error?e.message:String(e))}finally{q(!1)}}},Y=e=>s(`settings.customFields.actions.${e}`),X=e=>s(`settings.customFields.groups.${e}`);return(()=>{var e=f(C),n=e.firstChild,[r,c]=m(n.nextSibling),g=r.nextSibling,_=g.firstChild,O=_.firstChild,A=O.nextSibling,F=A.nextSibling,L=_.nextSibling.firstChild,R=L.firstChild,H=R.nextSibling,q=H.firstChild,[Z,le]=m(q.nextSibling),ue=Z.nextSibling.nextSibling,[de,fe]=m(ue.nextSibling),Q=L.nextSibling,pe=Q.firstChild.nextSibling,[me,he]=m(pe.nextSibling),ge=g.nextSibling,[$,_e]=m(ge.nextSibling),ve=$.nextSibling,[ye,be]=m(ve.nextSibling);return u(e,i(t,{get when(){return I()},get children(){var e=f(y);return u(e,I),e}}),r,c),u(O,()=>s(`settings.customFields.listEyebrow`)),u(A,()=>X(`title`)),u(F,()=>s(`settings.customFields.description`)),R.addEventListener(`change`,J),H.$$click=()=>U(!0),u(H,i(v,{name:`upload`,class:`fb-btn-icon`}),Z,le),u(H,()=>Y(`import`),de,fe),u(Q,()=>X(`new`),me,he),u(e,i(t,{get when(){return!P()},get fallback(){return(()=>{var e=f(w);return u(e,()=>s(`settings.customFields.loading`)),e})()},get children(){return[(()=>{var e=f(b),t=e.firstChild,n=t.firstChild,r=n.nextSibling,c=r.firstChild,h=c.nextSibling,[g,_]=m(h.nextSibling),v=t.nextSibling;return u(n,()=>s(`settings.customFields.contentType`)),r.addEventListener(`change`,e=>M(e.currentTarget.value)),u(c,()=>X(`allContentTypes`)),u(r,i(o,{get each(){return k()},children:e=>(()=>{var t=f(T),n=t.firstChild,[r,i]=m(n.nextSibling),o=r.nextSibling.nextSibling,[s,c]=m(o.nextSibling);return s.nextSibling,u(t,()=>e.pluralLabel,r,i),u(t,()=>e.slug,s,c),a(()=>d(t,`value`,e.slug)),t})()}),g,_),v.$$input=e=>ne(e.currentTarget.value),a(()=>p(v,`placeholder`,X(`search`))),a(()=>d(r,`value`,j())),a(()=>d(v,`value`,N())),l(),e})(),(()=>{var e=f(S);return u(e,i(t,{get when(){return z().length>0},get fallback(){return(()=>{var e=f(E),t=e.firstChild,[n,r]=m(t.nextSibling),a=n.nextSibling,o=a.nextSibling,s=o.nextSibling;return u(e,i(v,{name:`columns-3`,class:`fb-empty-icon`}),n,r),u(a,()=>X(`empty`)),u(o,()=>X(`emptyHint`)),u(s,()=>X(`new`)),e})()},get children(){return[(()=>{var e=f(x),t=e.firstChild,n=t.nextSibling,r=n.nextSibling,i=r.nextSibling,a=i.nextSibling;return u(t,()=>X(`groupName`)),u(n,()=>s(`settings.customFields.form.description`)),u(r,()=>X(`appliesTo`)),u(i,()=>X(`fields`)),u(a,()=>X(`status`)),e})(),i(o,{get each(){return z()},children:e=>(()=>{var t=f(D),n=t.firstChild,r=n.firstChild,i=r.nextSibling,o=n.nextSibling,s=o.nextSibling,c=s.nextSibling,d=c.nextSibling,p=d.firstChild,m=d.nextSibling,g=m.firstChild,_=g.nextSibling,v=_.nextSibling,y=v.nextSibling,b=y.nextSibling;return t.$$keydown=t=>{t.key===`Enter`&&B(e.id)},t.$$click=()=>B(e.id),u(r,()=>e.title),u(i,()=>e.key),u(o,()=>String(e.metadata?.description??`—`)),u(s,()=>re(e)),u(c,()=>e.fieldCount),u(p,(()=>{var t=h(()=>!!e.active);return()=>t()?X(`active`):X(`inactive`)})()),m.$$click=e=>e.stopPropagation(),g.$$click=()=>B(e.id),u(g,()=>Y(`edit`)),_.$$click=()=>void se(e),u(_,()=>Y(`export`)),v.$$click=()=>void V(e),u(v,()=>Y(`duplicate`)),y.$$click=()=>void ie(e),u(y,(()=>{var t=h(()=>!!e.active);return()=>t()?Y(`deactivate`):Y(`activate`)})()),b.$$click=()=>void ae(e),u(b,()=>Y(`delete`)),a(t=>{var n=!!e.active,r=!e.active;return n!==t.e&&p.classList.toggle(`badge-success`,t.e=n),r!==t.t&&p.classList.toggle(`badge-secondary`,t.t=r),t},{e:void 0,t:void 0}),l(),t})()})]}})),e})()]}}),$,_e),u(e,i(t,{get when(){return oe()},get children(){var e=f(te),n=e.firstChild,r=n.firstChild,o=r.firstChild,c=o.nextSibling,g=r.nextSibling,_=g.firstChild,y=_.nextSibling,b=y.firstChild,x=b.nextSibling,[S,C]=m(x.nextSibling),w=S.nextSibling,T=y.nextSibling,[E,D]=m(T.nextSibling),O=g.nextSibling.firstChild,k=O.nextSibling;return e.$$click=()=>{U(!1),G(null)},n.$$click=e=>e.stopPropagation(),u(o,()=>Y(`import`)),c.$$click=()=>{U(!1),G(null)},u(c,i(v,{name:`x`})),u(_,()=>s(`settings.customFields.import.description`)),y.$$click=()=>document.getElementById(`import-file-input`)?.click(),b.addEventListener(`change`,J),u(y,i(v,{name:`upload`,class:`fb-dropzone-icon`}),S,C),u(w,(()=>{var e=h(()=>!!W());return()=>e()?W().name:s(`settings.customFields.import.dropzone`)})()),u(g,i(t,{get when(){return W()},get children(){var e=f(ee);return u(e,()=>s(`settings.customFields.import.hint`)),e}}),E,D),O.$$click=()=>{U(!1),G(null)},u(O,()=>s(`common.cancel`)),k.$$click=ce,u(k,(()=>{var e=h(()=>!!K());return()=>e()?s(`common.loading`):Y(`import`)})()),a(e=>{var t=s(`common.close`),n=!W()||K();return t!==e.e&&p(c,`aria-label`,e.e=t),n!==e.t&&d(k,`disabled`,e.t=n),e},{e:void 0,t:void 0}),l(),e}}),ye,be),l(),e})()}c([`click`,`input`,`keydown`]);export{O as FieldGroupList};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{S as e,a as t,f as n,h as r,i,l as a,p as o,r as s,s as c}from"./solid.Ck4Vtfe4.js";import{_ as l,a as u,f as d,l as f,m as p,o as m,p as h,s as g,t as _,u as v}from"./web.DD6VKaIp.js";import{n as y}from"./api.fpBzBw4U.js";import"./src.CYKGYEyR.js";import{s as b}from"./slots.CSARb9TW.js";function x(e){return e==null?!0:typeof e==`string`?e.trim()===``:Array.isArray(e)?e.length===0:!1}function S(e,t,n,r){return!t||!x(e)||(r.push({field:n,code:`REQUIRED`,message:`${n} é obrigatório`}),!1)}function C(e,t,n,r){if(x(e))return;let i=String(e),a=t.minLength??t.minimum,o=t.characterLimit??t.maxLength;a!==void 0&&i.length<a&&r.push({field:n,code:`MIN_LENGTH`,message:`${n} deve ter pelo menos ${a} caracteres`}),o!==void 0&&i.length>o&&r.push({field:n,code:`CHARACTER_LIMIT`,message:`${n} excede o limite de ${o} caracteres`})}function w(e,t,n){x(e)||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(e))||n.push({field:t,code:`INVALID_EMAIL`,message:`${t} não é um e-mail válido`})}function T(e,t,n){if(!x(e))try{let t=new URL(String(e));if(![`http:`,`https:`].includes(t.protocol))throw Error(`protocol`)}catch{n.push({field:t,code:`INVALID_URL`,message:`${t} não é uma URL válida (http/https)`})}}function E(e,t,n,r){if(x(e))return;let i=Number(e);if(Number.isNaN(i)){r.push({field:n,code:`NOT_A_NUMBER`,message:`${n} deve ser um número`});return}let a=t.minValue??t.min,o=t.maxValue??t.max,s=t.step;if(a!==void 0&&i<a&&r.push({field:n,code:`MIN_VALUE`,message:`${n} deve ser maior ou igual a ${a}`}),o!==void 0&&i>o&&r.push({field:n,code:`MAX_VALUE`,message:`${n} deve ser menor ou igual a ${o}`}),s!==void 0&&s>0){let e=a??0;Math.abs((i-e)/s-Math.round((i-e)/s))>1e-9&&r.push({field:n,code:`STEP_MISMATCH`,message:`${n} deve seguir o incremento de ${s}`})}}function D(e){let t=e.choices??[];return new Set(t.map(e=>String(e.value)))}function O(e,t,n,r,i){n||t.has(String(e))||i.push({field:r,code:`INVALID_CHOICE`,message:`${r} contém um valor fora das opções permitidas`})}function k(e,t,n,r){let i=t.minSelections,a=t.maxSelections;i!==void 0&&e.length<i&&r.push({field:n,code:`MIN_SELECTIONS`,message:`${n} requer no mínimo ${i} seleção(ões)`}),a!==void 0&&e.length>a&&r.push({field:n,code:`MAX_SELECTIONS`,message:`${n} permite no máximo ${a} seleção(ões)`})}function A(e,t,n,r){if(x(e))return;let i=!!t.multiple,a=!!(t.allowCustom??!1),o=D(t);if(i){if(!Array.isArray(e)){r.push({field:n,code:`NOT_ARRAY`,message:`${n} deve ser uma lista`});return}if(!a)for(let t of e)O(t,o,!1,n,r);k(e,t,n,r);return}O(e,o,a,n,r),Array.isArray(e)&&r.push({field:n,code:`SINGLE_ONLY`,message:`${n} aceita apenas um valor`})}function j(e,t,n,r){if(x(e))return;if(!Array.isArray(e)){r.push({field:n,code:`NOT_ARRAY`,message:`${n} deve ser uma lista de valores`});return}let i=D(t);for(let t of e)O(t,i,!0,n,r);k(e,t,n,r)}function ee(e,t,n,r){x(e)||O(e,D(t),!!t.allowCustom,n,r)}function te(e,t,n){e!=null&&typeof e!=`boolean`&&e!==0&&e!==1&&e!==`0`&&e!==`1`&&n.push({field:t,code:`NOT_BOOLEAN`,message:`${t} deve ser verdadeiro ou falso`})}function M(e,t,n,r){if(typeof e!=`object`||!e||Array.isArray(e)){r.push({field:n,code:`INVALID_MEDIA`,message:`${n} deve referenciar uma mídia válida`});return}let i=e,a=t.mimeTypes??[];a.length>0&&i.mimeType&&(a.map(e=>e.toLowerCase()).includes(i.mimeType.toLowerCase())||r.push({field:n,code:`INVALID_MIME`,message:`${n} não aceita arquivos do tipo ${i.mimeType}`}));let o=t.maxSize,s=t.minSize;if(i.size!==void 0&&(o!==void 0&&i.size>o&&r.push({field:n,code:`FILE_TOO_LARGE`,message:`${n} excede o tamanho máximo de ${Math.round(o/1024)}KB`}),s!==void 0&&i.size<s&&r.push({field:n,code:`FILE_TOO_SMALL`,message:`${n} está abaixo do tamanho mínimo de ${Math.round(s/1024)}KB`})),i.width!==void 0&&i.height!==void 0){let e=t.minWidth,a=t.maxWidth,o=t.minHeight,s=t.maxHeight;e!==void 0&&i.width<e&&r.push({field:n,code:`MIN_WIDTH`,message:`${n} requer largura mínima de ${e}px`}),a!==void 0&&i.width>a&&r.push({field:n,code:`MAX_WIDTH`,message:`${n} permite largura máxima de ${a}px`}),o!==void 0&&i.height<o&&r.push({field:n,code:`MIN_HEIGHT`,message:`${n} requer altura mínima de ${o}px`}),s!==void 0&&i.height>s&&r.push({field:n,code:`MAX_HEIGHT`,message:`${n} permite altura máxima de ${s}px`})}}function N(e,t,n,r){x(e)||M(e,t,n,r)}function P(e,t,n,r){x(e)||M(e,t,n,r)}function ne(e,t,n,r){if(e==null)return;if(!Array.isArray(e)){r.push({field:n,code:`NOT_ARRAY`,message:`${n} deve ser uma lista de imagens`});return}let i=t.minSelections!==void 0||t.maxSelections!==void 0;if(e.length===0&&!i)return;let a=t.minSelections,o=t.maxSelections;a!==void 0&&e.length<a&&r.push({field:n,code:`MIN_SELECTIONS`,message:`${n} requer no mínimo ${a} imagem(ns)`}),o!==void 0&&e.length>o&&r.push({field:n,code:`MAX_SELECTIONS`,message:`${n} permite no máximo ${o} imagem(ns)`});for(let i of e)M(i,t,n,r)}function re(e,t,n,r){if(x(e))return;let i=t.multiple!==!1,a=t.minSelections,o=t.maxSelections,s=Array.isArray(e)?e:[e];for(let e of s)if(typeof e!=`string`&&typeof e!=`number`){r.push({field:n,code:`INVALID_ID`,message:`${n} contém um identificador inválido`});return}i?(o!==void 0&&s.length>o&&r.push({field:n,code:`MAX_SELECTIONS`,message:`${n} permite no máximo ${o} seleção(ões)`}),a!==void 0&&s.length<a&&r.push({field:n,code:`MIN_SELECTIONS`,message:`${n} requer no mínimo ${a} seleção(ões)`})):s.length>1&&r.push({field:n,code:`SINGLE_ONLY`,message:`${n} aceita apenas um valor`})}function ie(e,t,n){if(x(e))return;if(typeof e!=`object`||!e){n.push({field:t,code:`INVALID_LINK`,message:`${t} deve ser um objeto de link`});return}let r=e;if(!r.url||typeof r.url!=`string`){n.push({field:t,code:`LINK_URL_REQUIRED`,message:`${t} requer uma URL`});return}try{let e=new URL(r.url);if(![`http:`,`https:`,`mailto:`,`tel:`].includes(e.protocol)&&!r.url.startsWith(`#`)&&!r.url.startsWith(`/`))throw Error(`protocol`)}catch{!r.url.startsWith(`#`)&&!r.url.startsWith(`/`)&&!r.url.startsWith(`?`)&&n.push({field:t,code:`INVALID_URL`,message:`${t} contém uma URL inválida`})}r.target!==void 0&&![`_self`,`_blank`].includes(String(r.target))&&n.push({field:t,code:`INVALID_TARGET`,message:`${t} aceita apenas _self ou _blank`})}function ae(e,t,n){if(x(e))return;if(typeof e!=`object`||!e){n.push({field:t,code:`INVALID_MAP`,message:`${t} deve conter endereço e coordenadas`});return}let r=e;x(r.address)&&n.push({field:t,code:`ADDRESS_REQUIRED`,message:`${t} requer um endereço`});let i=Number(r.lat),a=Number(r.lng);(!Number.isFinite(i)||i<-90||i>90)&&n.push({field:t,code:`INVALID_LATITUDE`,message:`${t} contém latitude inválida (-90 a 90)`}),(!Number.isFinite(a)||a<-180||a>180)&&n.push({field:t,code:`INVALID_LONGITUDE`,message:`${t} contém longitude inválida (-180 a 180)`})}var oe=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function se(e,t,n,r){if(x(e))return;let i=String(e),a=i.startsWith(`rgba(`);if(a&&!t.enableOpacity){r.push({field:n,code:`OPACITY_DISABLED`,message:`${n} não permite transparência`});return}if(!a&&!oe.test(i)){r.push({field:n,code:`INVALID_COLOR`,message:`${n} deve ser uma cor em formato hexadecimal válido`});return}let o=t.palette??[];o.length>0&&(o.map(e=>e.toLowerCase()).includes(i.toLowerCase())||r.push({field:n,code:`NOT_IN_PALETTE`,message:`${n} deve usar uma cor da paleta definida`}))}function ce(e,t){if(e.type===`clone`||e.type===`repeater`||e.type===`group`||e.type===`flexible_content`)return null;let n=e.config??{},r=[];switch(S(t,e.required,e.label,r),e.type){case`text`:case`textarea`:case`password`:C(t,n,e.label,r);break;case`slug`:C(t,n,e.label,r),!x(t)&&!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(String(t))&&r.push({field:e.label,code:`INVALID_SLUG`,message:`${e.label} deve ser um slug válido (a-z, 0-9 e hífens)`});break;case`email`:w(t,e.label,r);break;case`url`:case`oembed`:T(t,e.label,r);break;case`number`:case`range`:E(t,n,e.label,r);break;case`wysiwyg`:C(t,n,e.label,r);break;case`select`:A(t,n,e.label,r);break;case`checkbox`:j(t,n,e.label,r);break;case`radio`:ee(t,n,e.label,r);break;case`true_false`:te(t,e.label,r);break;case`image`:N(t,n,e.label,r);break;case`file`:P(t,n,e.label,r);break;case`gallery`:ne(t,n,e.label,r);break;case`link`:ie(t,e.label,r);break;case`page_link`:case`post_object`:case`relationship`:case`taxonomy`:case`user`:re(t,n,e.label,r);break;case`google_map`:ae(t,e.label,r);break;case`color_picker`:se(t,n,e.label,r)}return r[0]?.message??null}var le=new Set(`a.abbr.b.blockquote.br.code.dd.div.dl.dt.em.figcaption.figure.h1.h2.h3.h4.h5.h6.hr.i.img.li.ol.p.pre.q.s.span.strong.sub.sup.u.ul`.split(`.`)),ue=new Set([`br`,`hr`,`img`]),de=new Set([`script`,`style`,`iframe`,`object`,`embed`,`svg`,`math`,`textarea`,`title`,`noscript`,`template`]),fe=new Set([`class`,`title`,`alt`,`width`,`height`,`href`,`src`,`target`,`rel`]),pe=new Set([`http`,`https`,`mailto`,`tel`]),me=new Set([`http`,`https`]),F={amp:`&`,lt:`<`,gt:`>`,quot:`"`,apos:`'`,colon:`:`,tab:` `,newline:`
|
|
2
|
+
`,sol:`/`,lpar:`(`,rpar:`)`,num:`#`,period:`.`,excl:`!`,comma:`,`};function I(e){return e.replace(/&#x([0-9a-fA-F]+);?/g,(e,t)=>L(parseInt(t,16))).replace(/&#(\d+);?/g,(e,t)=>L(parseInt(t,10))).replace(/&([a-zA-Z][a-zA-Z0-9]{1,30});?/g,(e,t)=>F[t in F?t:t.toLowerCase()]??e)}function L(e){if(!Number.isFinite(e)||e<0||e>1114111)return``;try{return String.fromCodePoint(e)}catch{return``}}function R(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}function z(e){return e.replace(/&(?![a-zA-Z][a-zA-Z0-9]{1,30};|#[0-9]{1,7};|#[xX][0-9a-fA-F]{1,6};)|[<>]/g,e=>e===`&`?`&`:e===`<`?`<`:`>`)}function B(e,t){let n=I(e).replace(/[\t\n\r]/g,``).trim(),r=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(n);return!r||t.has(r[1].toLowerCase())}function V(e){return R(I(e))}function he(e){let t=[],n=e.length,r=0,i=e=>e===` `||e===` `||e===`
|
|
3
|
+
`||e===`\r`||e===`\f`;for(;r<n;){for(;r<n&&(i(e.charAt(r))||e.charAt(r)===`/`);)r++;if(r>=n)break;let a=``;for(;r<n&&!i(e.charAt(r))&&e.charAt(r)!==`=`&&e.charAt(r)!==`>`&&e.charAt(r)!==`/`&&e.charAt(r)!==`<`;)a+=e.charAt(r),r++;if(!a){r++;continue}let o=``,s=r;for(;s<n&&i(e.charAt(s));)s++;if(s<n&&e.charAt(s)===`=`){for(s++;s<n&&i(e.charAt(s));)s++;if(s<n&&(e.charAt(s)===`"`||e.charAt(s)===`'`)){let t=e.charAt(s);s++;let r=s;for(;s<n&&e.charAt(s)!==t;)s++;o=e.slice(r,s),s++}else{let t=s;for(;s<n&&!i(e.charAt(s))&&e.charAt(s)!==`>`;)s++;o=e.slice(t,s)}r=s}t.push([a.toLowerCase(),o])}return t}function ge(e,t){let n=[],r=new Set,i=!1;for(let[e,a]of t)if(fe.has(e)&&!r.has(e)&&(e!==`href`||B(a,pe))&&(e!==`src`||B(a,me))){if(e===`target`){if(V(a)!==`_blank`)continue;i=!0;continue}e!==`rel`&&(r.add(e),n.push(`${e}="${V(a)}"`))}return e===`a`&&i&&(n.push(`target="_blank"`),n.push(`rel="noopener noreferrer"`)),n.length>0?` ${n.join(` `)}`:``}function H(e){if(typeof e!=`string`||e.length===0)return``;let t=e.toLowerCase(),n=e.length,r=[],i=``,a=0;for(;a<n;){let o=e.indexOf(`<`,a);if(o===-1){i+=z(e.slice(a));break}if(o>a&&(i+=z(e.slice(a,o))),e.startsWith(`<!--`,o)){let t=e.indexOf(`-->`,o+4);a=t===-1?n:t+3;continue}if(e.charAt(o+1)===`!`||e.charAt(o+1)===`?`){let t=e.indexOf(`>`,o+2);a=t===-1?n:t+1;continue}let s=/^<(\/?)([a-zA-Z][a-zA-Z0-9]*)(?=[\s/>])/.exec(e.slice(o,Math.min(o+64,n)));if(!s){i+=`<`,a=o+1;continue}let c=s[1]===`/`,l=s[2].toLowerCase(),u=o+s[0].length,d=``;for(;u<n;){let t=e[u];if(d)t===d&&(d=``);else if(t===`"`||t===`'`)d=t;else if(t===`>`)break;u++}if(u>=n)break;let f=e.slice(o+s[0].length,u);if(a=u+1,!c&&de.has(l)){let r=t.indexOf(`</${l}`,a);if(r===-1)break;let i=e.indexOf(`>`,r);a=i===-1?n:i+1;continue}if(c){let e=r.lastIndexOf(l);if(e!==-1){for(let t=r.length-1;t>=e;t--)i+=`</${r[t]}>`;r.length=e}continue}if(!le.has(l))continue;let p=ge(l,he(f));ue.has(l)?i+=`<${l}${p} />`:(i+=`<${l}${p}>`,r.push(l))}for(let e=r.length-1;e>=0;e--)i+=`</${r[e]}>`;return i}var _e=l(`<ul class=relationship-picker__selection>`),ve=l(`<li class=relationship-picker__empty>Buscando...`),ye=l(`<li class=relationship-picker__empty>Nenhum resultado`),be=l(`<ul class=relationship-picker__results><!$><!/><!$><!/><!$><!/>`),xe=l(`<div class=relationship-picker><!$><!/><input type=search class=input><!$><!/>`),Se=l(`<li><!$><!/><button type=button aria-label=Remover>×`),Ce=l(`<li><button type=button><!$><!/><span class=relationship-picker__type>`);function we(e){let[i,c]=r(``),[l,u]=r([]),[_,b]=r([]),[x,S]=r(!1),[C,w]=r(!1),T=n(()=>{let t=e.value;return Array.isArray(t)?t.map(String):t?[String(t)]:[]}),E=async()=>{S(!0);try{let t=await y.getContent({type:e.postType,status:`PUBLISHED`,search:i()||void 0,limit:10});u(t.data.filter(e=>!T().includes(e.id)).map(e=>({id:e.id,title:e.title,type:e.type}))),w(!0)}catch{u([])}finally{S(!1)}},D=t=>{b(e=>[...e,t]),e.multiple?e.onChange([...T(),t.id]):(e.onChange(t.id),c(``)),u([]),w(!1)},O=t=>{b(e=>e.filter(e=>e.id!==t));let n=T().filter(e=>e!==t);e.onChange(e.multiple?n:n[0]??null)},k=async()=>{C()||await E()};return(()=>{var n=m(xe),r=n.firstChild,[u,y]=g(r.nextSibling),b=u.nextSibling,S=b.nextSibling,[A,j]=g(S.nextSibling);return f(n,a(t,{get when(){return _().length>0||T().length>0},get children(){var e=m(_e);return f(e,a(s,{get each(){return _()},children:e=>(()=>{var t=m(Se),n=t.firstChild,[r,i]=g(n.nextSibling),a=r.nextSibling;return f(t,()=>e.title,r,i),a.$$click=()=>O(e.id),d(),t})()})),e}}),u,y),b.addEventListener(`blur`,()=>setTimeout(()=>w(!1),150)),b.$$input=e=>{c(e.currentTarget.value),E()},b.addEventListener(`focus`,()=>void k()),f(n,a(t,{get when(){return v(()=>!!C())()&&(x()||l().length>0)},get children(){var e=m(be),n=e.firstChild,[r,i]=g(n.nextSibling),o=r.nextSibling,[c,u]=g(o.nextSibling),p=c.nextSibling,[h,_]=g(p.nextSibling);return f(e,a(t,{get when(){return x()},get children(){return m(ve)}}),r,i),f(e,a(s,{get each(){return l()},children:e=>(()=>{var t=m(Ce),n=t.firstChild,r=n.firstChild,[i,a]=g(r.nextSibling),o=i.nextSibling;return n.$$click=()=>D(e),n.$$mousedown=e=>e.preventDefault(),f(n,()=>e.title,i,a),f(o,()=>e.type),d(),t})()}),c,u),f(e,a(t,{get when(){return v(()=>!x())()&&l().length===0},get children(){return m(ye)}}),h,_),e}}),A,j),o(()=>h(b,`placeholder`,e.placeholder??`Buscar conteúdo...`)),o(()=>p(b,`value`,i())),d(),n})()}u([`input`,`click`,`mousedown`]);var Te=l(`<div class="fb-plugin-field-renderer fb-plugin-field-renderer--loading"><div class=fb-spinner aria-hidden=true></div><span>Carregando editor...`),Ee=l(`<div class=fb-renderer-error><i data-lucide=alert-circle aria-hidden=true></i><span>`),De=l(`<div class="fb-plugin-field-renderer fb-plugin-field-renderer--fallback"><!$><!/><!$><!/>`),Oe=l(`<div class=fb-plugin-field-renderer>`),ke=l(`<textarea class="input fb-plugin-fallback-textarea">`),Ae=l(`<input type=number class=input>`),je=l(`<input type=text class=input>`);function Me(n){let[o,s]=r(null),[l,u]=r(null),[d,p]=r(!0),[h,v]=r(!1);e(async()=>{let e=[n.adminRendererPath,n.adminComponentPath].filter(Boolean);for(let t of e)try{let e=await b(t),n=e.default||e.PluginFieldRenderer||e.PluginFieldConfig;if(n){s(n),p(!1);return}}catch(e){console.debug(`[PluginFieldRenderer] Failed to load ${t}:`,e)}n.adminRendererPath&&!h()&&v(!0),u(`Componente de renderização não encontrado`),p(!1)});let y=e=>{n.onChange(e)};return a(c,{get children(){return[a(i,{get when(){return d()},get children(){return m(Te)}}),a(i,{get when(){return l()||!o()},get children(){var e=m(De),r=e.firstChild,[i,o]=g(r.nextSibling),s=i.nextSibling,[c,u]=g(s.nextSibling);return f(e,a(t,{get when(){return l()},get children(){var e=m(Ee),t=e.firstChild.nextSibling;return f(t,l),e}}),i,o),f(e,a(Ne,{get field(){return n.field},get value(){return n.value},onChange:y,get disabled(){return n.disabled},get t(){return n._t}}),c,u),e}}),a(i,{when:!0,get children(){var e=m(Oe);return f(e,a(_,{get component(){return o()},get field(){return n.field},get value(){return n.value},onChange:y,get disabled(){return n.disabled},get t(){return n._t}})),e}})]}})}function Ne(e){let{field:t,value:n,onChange:r,disabled:i}=e,a=t.config?.inputType||`textarea`,o=t.config?.placeholder||``,s=t.config?.rows||4;return a===`textarea`||a===`code`||a===`markdown`?(()=>{var e=m(ke);return e.$$input=e=>r(e.currentTarget.value),p(e,`value`,n),h(e,`placeholder`,o),h(e,`rows`,s),p(e,`disabled`,i),h(e,`spellcheck`,!1),d(),e})():a===`number`?(()=>{var e=m(Ae);return e.$$input=e=>{let t=e.currentTarget.value;if(t===``)r(``);else{let e=Number(t);r(Number.isFinite(e)?e:t)}},p(e,`value`,n),h(e,`placeholder`,o),p(e,`disabled`,i),d(),e})():(()=>{var e=m(je);return e.$$input=e=>r(e.currentTarget.value),p(e,`value`,n),h(e,`placeholder`,o),p(e,`disabled`,i),d(),e})()}u([`input`]);var Pe=l(`<span class=field-renderer__required>*`),Fe=l(`<p class=field-renderer__instructions>`),Ie=l(`<p class=field-renderer__error role=alert>`),Le=l(`<div class=field-renderer><label class=field-renderer__label><!$><!/><!$><!/></label><!$><!/><!$><!/><!$><!/>`),U=l(`<input type=text class=input>`),Re=l(`<textarea class=input>`),ze=l(`<div class=field-renderer__wysiwyg><div class=field-renderer__wysiwyg-toolbar role=toolbar><select class=input value><option value></option><option value="<h1>"></option><option value="<h2>"></option><option value="<h3>"></option><option value="<h4>"></option><option value="<blockquote>"></option><option value="<pre>"></option></select><span class=field-renderer__wysiwyg-divider></span><button type=button><strong></strong></button><button type=button><em></em></button><button type=button><u></u></button><span class=field-renderer__wysiwyg-divider></span><button type=button></button><button type=button></button><button type=button></button></div><div class="field-renderer__wysiwyg-body input"role=textbox aria-multiline=true>`),Be=l(`<input type=number class=input>`),Ve=l(`<input type=email class=input>`),He=l(`<input type=url class=input placeholder=https://>`),Ue=l(`<input type=password class=input>`),We=l(`<input type=checkbox>`),W=l(`<select class=input>`),G=l(`<option>`),K=l(`<div class=field-renderer__choices>`),Ge=l(`<label><input type=radio> <!$><!/>`),Ke=l(`<label><input type=checkbox> <!$><!/>`),qe=l(`<input type=date class=input>`),Je=l(`<input type=datetime-local class=input>`),Ye=l(`<input type=time class=input>`),Xe=l(`<input type=color class=input>`),Ze=l(`<div class=field-renderer__map><input type=text class=input placeholder=Endereço><input type=number class=input placeholder="Latitude (-90 a 90)"step=any min=-90 max=90><input type=number class=input placeholder="Longitude (-180 a 180)"step=any min=-180 max=180>`),Qe=l(`<div class=field-renderer__link><input type=url class=input placeholder="https:// ou /caminho"><select class=input><option value=_self>Mesma janela</option><option value=_blank>Nova janela`),$e=l(`<div class=field-renderer__rows><!$><!/><button type=button class=btn>+ Adicionar linha`),et=l(`<div class=field-renderer__rows><!$><!/><select class=input value><option value>+ Adicionar layout...</option><!$><!/>`),q=l(`<div class=field-renderer__row><div class=field-renderer__row-header><span><!$><!/> <!$><!/></span><button type=button class=btn>↑</button><button type=button class=btn>↓</button><button type=button class="btn btn-danger">Remover</button></div><!$><!/>`),tt=l(`<p class=field-renderer__instructions>Layout "<!$><!/>" não encontrado.`),nt=l(`<fieldset class=field-renderer__group>`),rt=l(`<div class=field-renderer__row><div class=field-renderer__row-header><span>Linha <!$><!/></span><button type=button class="btn btn-danger">Remover</button></div><!$><!/>`),it=l(`<input type=file class=input>`);function J(e){return e==null||e===``||Array.isArray(e)&&e.length===0||typeof e==`boolean`&&!e}function Y(e){return e.toLowerCase().normalize(`NFD`).replace(/[̀-ͯ]/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/(^-|-$)/g,``)}function X(e,t){if(typeof t==`boolean`)return!!e===t;let n=Number(e),r=Number(t);return e===t||!Number.isNaN(n)&&!Number.isNaN(r)&&n===r}function Z(e,t){let n=e.conditionalLogic;return!n?.groups||n.groups.length===0||n.groups.map(e=>{let n=e.rules??[];if(n.length===0)return!0;let r=n.map(e=>{let n=t[e.field];switch(e.operator){case`eq`:return X(n,e.value);case`neq`:return!X(n,e.value);case`gt`:return Number(n)>Number(e.value);case`lt`:return Number(n)<Number(e.value);case`contains`:return Array.isArray(n)?n.includes(e.value):String(n??``).includes(String(e.value));case`pattern_matches`:try{return new RegExp(String(e.value)).test(String(n??``))}catch{return!1}case`has_any_value`:return!J(n);case`has_no_value`:return J(n);default:return!1}});return e.match===`ANY`?r.some(Boolean):r.every(Boolean)}).some(Boolean)}var at=new Set([`message`,`tab`,`accordion`]);function Q(e){let i=()=>Z(e.field,e.values),[s,c]=r(!1),l=()=>e.values[e.field.name],u=n(()=>s()?ce(e.field,e.values[e.field.name]):null),d=t=>{c(!0),e.onChange(e.field.name,t)};return a(t,{get when(){return v(()=>!!i())()&&!at.has(e.field.type)},get children(){var n=m(Le),r=n.firstChild,i=r.firstChild,[s,c]=g(i.nextSibling),p=s.nextSibling,[_,v]=g(p.nextSibling),y=r.nextSibling,[b,x]=g(y.nextSibling),S=b.nextSibling,[C,w]=g(S.nextSibling),T=C.nextSibling,[E,D]=g(T.nextSibling);return f(r,()=>e.field.label,s,c),f(r,a(t,{get when(){return e.field.required},get children(){return m(Pe)}}),_,v),f(n,a(t,{get when(){return e.field.instructions},get children(){var t=m(Fe);return f(t,()=>e.field.instructions),t}}),b,x),f(n,a(ot,{get field(){return e.field},get value(){return l()},onChange:d,get values(){return e.values},get t(){return e.t}}),C,w),f(n,a(t,{get when(){return u()},get children(){var e=m(Ie);return f(e,u),e}}),E,D),o(()=>h(n,`data-field-type`,e.field.type)),n}})}function ot(e){let n=()=>e.field.config??{},r=e=>{if(!e)return;document.execCommand(`formatBlock`,!1,e);let t=document.querySelector(`.field-renderer__wysiwyg-body[contenteditable="true"]:focus`);t&&t.dispatchEvent(new Event(`input`,{bubbles:!0}))},i=e=>{document.execCommand(e,!1);let t=document.querySelector(`.field-renderer__wysiwyg-body[contenteditable="true"]:focus`);t&&t.dispatchEvent(new Event(`input`,{bubbles:!0}))},c=()=>{let t=window.prompt(e.t(`content.editor.linkPrompt`)||``);if(t){document.execCommand(`createLink`,!1,t);let e=document.querySelector(`.field-renderer__wysiwyg-body[contenteditable="true"]:focus`);e&&e.dispatchEvent(new Event(`input`,{bubbles:!0}))}};switch(e.field.type){case`text`:return(()=>{var t=m(U);return t.addEventListener(`blur`,t=>e.onChange(t.currentTarget.value.trim())),t.$$input=t=>e.onChange(t.currentTarget.value),o(e=>{var r=n().placeholder,i=n().maxLength??n().characterLimit;return r!==e.e&&h(t,`placeholder`,e.e=r),i!==e.t&&h(t,`maxlength`,e.t=i),e},{e:void 0,t:void 0}),o(()=>p(t,`value`,e.value??n().defaultValue??``)),d(),t})();case`textarea`:return(()=>{var t=m(Re);return t.$$input=t=>e.onChange(t.currentTarget.value),o(e=>{var r=n().rows??4,i=n().placeholder,a=n().maxLength??n().characterLimit;return r!==e.e&&h(t,`rows`,e.e=r),i!==e.t&&h(t,`placeholder`,e.t=i),a!==e.a&&h(t,`maxlength`,e.a=a),e},{e:void 0,t:void 0,a:void 0}),o(()=>p(t,`value`,e.value??n().defaultValue??``)),d(),t})();case`wysiwyg`:return(()=>{var t=m(ze),a=t.firstChild,s=a.firstChild,l=s.firstChild,u=l.nextSibling,g=u.nextSibling,_=g.nextSibling,v=_.nextSibling,y=v.nextSibling,b=y.nextSibling,x=s.nextSibling.nextSibling,S=x.firstChild,C=x.nextSibling,w=C.firstChild,T=C.nextSibling,E=T.firstChild,D=T.nextSibling.nextSibling,O=D.nextSibling,k=O.nextSibling,A=a.nextSibling;return s.addEventListener(`change`,e=>r(e.currentTarget.value)),f(l,()=>e.t(`content.editor.formatParagraph`)),f(u,()=>e.t(`content.editor.formatH1`)),f(g,()=>e.t(`content.editor.formatH2`)),f(_,()=>e.t(`content.editor.formatH3`)),f(v,()=>e.t(`content.editor.formatH4`)),f(y,()=>e.t(`content.editor.formatBlockquote`)),f(b,()=>e.t(`content.editor.formatCode`)),x.$$click=()=>i(`bold`),f(S,()=>e.t(`content.editor.bold`)),C.$$click=()=>i(`italic`),f(w,()=>e.t(`content.editor.italic`)),T.$$click=()=>i(`underline`),f(E,()=>e.t(`content.editor.underline`)),D.$$click=()=>i(`insertUnorderedList`),f(D,()=>e.t(`content.editor.bulletList`)),O.$$click=()=>i(`insertOrderedList`),f(O,()=>e.t(`content.editor.numberedList`)),k.$$click=()=>c(),f(k,()=>e.t(`content.editor.link`)),A.addEventListener(`blur`,t=>{let n=H(t.currentTarget.innerHTML);n!==t.currentTarget.innerHTML&&(t.currentTarget.innerHTML=n,e.onChange(n))}),A.$$input=t=>{let n=t.currentTarget.innerHTML;e.onChange(n)},h(A,`contenteditable`,!0),o(t=>{var r=e.t(`content.editor.toolbar`),i=e.t(`content.editor.format`),o=n().placeholder,c=e.value??n().defaultValue??``;return r!==t.e&&h(a,`aria-label`,t.e=r),i!==t.t&&h(s,`aria-label`,t.t=i),o!==t.a&&h(A,`data-placeholder`,t.a=o),c!==t.o&&p(A,`innerHTML`,t.o=c),t},{e:void 0,t:void 0,a:void 0,o:void 0}),d(),t})();case`number`:case`range`:return(()=>{var t=m(Be);return t.$$input=t=>e.onChange(t.currentTarget.value===``?void 0:Number(t.currentTarget.value)),o(e=>{var r=n().min??n().minValue,i=n().max??n().maxValue,a=n().step;return r!==e.e&&h(t,`min`,e.e=r),i!==e.t&&h(t,`max`,e.t=i),a!==e.a&&h(t,`step`,e.a=a),e},{e:void 0,t:void 0,a:void 0}),o(()=>p(t,`value`,e.value??n().defaultValue??``)),d(),t})();case`email`:return(()=>{var t=m(Ve);return t.$$input=t=>e.onChange(t.currentTarget.value),o(()=>p(t,`value`,e.value??n().defaultValue??``)),d(),t})();case`url`:return(()=>{var t=m(He);return t.$$input=t=>e.onChange(t.currentTarget.value),o(()=>p(t,`value`,e.value??n().defaultValue??``)),d(),t})();case`password`:return(()=>{var t=m(Ue);return t.$$input=t=>e.onChange(t.currentTarget.value),o(()=>p(t,`value`,e.value??n().defaultValue??``)),d(),t})();case`slug`:return(()=>{var t=m(U);return t.addEventListener(`blur`,t=>e.onChange(Y(t.currentTarget.value.trim()))),t.$$input=t=>e.onChange(Y(t.currentTarget.value)),o(()=>h(t,`placeholder`,n().placeholder)),o(()=>p(t,`value`,e.value??n().defaultValue??``)),d(),t})();case`true_false`:return(()=>{var t=m(We);return t.addEventListener(`change`,t=>e.onChange(t.currentTarget.checked)),o(()=>p(t,`checked`,!!e.value)),t})();case`select`:return(()=>{var t=m(W);return t.addEventListener(`change`,t=>e.onChange(t.currentTarget.multiple?Array.from(t.currentTarget.selectedOptions).map(e=>e.value):t.currentTarget.value)),f(t,a(s,{get each(){return n().choices??[]},children:e=>(()=>{var t=m(G);return f(t,()=>e.label),o(()=>p(t,`value`,e.value)),t})()})),o(()=>p(t,`multiple`,n().multiple===!0)),o(()=>p(t,`value`,n().multiple===!0?Array.isArray(e.value)?e.value:[]:e.value??n().defaultValue??``)),t})();case`radio`:return(()=>{var t=m(K);return f(t,a(s,{get each(){return n().choices??[]},children:t=>(()=>{var n=m(Ge),r=n.firstChild,i=r.nextSibling.nextSibling,[a,s]=g(i.nextSibling);return r.addEventListener(`change`,()=>e.onChange(t.value)),f(n,()=>t.label,a,s),o(()=>h(r,`name`,e.field.name)),o(()=>p(r,`checked`,e.value===t.value)),n})()})),t})();case`checkbox`:return(()=>{var t=m(K);return f(t,a(s,{get each(){return n().choices??[]},children:t=>{let n=()=>Array.isArray(e.value)&&e.value.includes(t.value);return(()=>{var r=m(Ke),i=r.firstChild,a=i.nextSibling.nextSibling,[s,c]=g(a.nextSibling);return i.addEventListener(`change`,n=>{let r=Array.isArray(e.value)?[...e.value]:[];e.onChange(n.currentTarget.checked?[...r,t.value]:r.filter(e=>e!==t.value))}),f(r,()=>t.label,s,c),o(()=>p(i,`checked`,n())),r})()}})),t})();case`date_picker`:return(()=>{var t=m(qe);return t.$$input=t=>e.onChange(t.currentTarget.value),o(()=>p(t,`value`,e.value??n().defaultValue??``)),d(),t})();case`date_time_picker`:return(()=>{var t=m(Je);return t.$$input=t=>e.onChange(t.currentTarget.value),o(()=>p(t,`value`,e.value??n().defaultValue??``)),d(),t})();case`time_picker`:return(()=>{var t=m(Ye);return t.$$input=t=>e.onChange(t.currentTarget.value),o(()=>p(t,`value`,e.value??n().defaultValue??``)),d(),t})();case`color_picker`:return(()=>{var t=m(Xe);return t.addEventListener(`change`,t=>e.onChange(t.currentTarget.value)),o(()=>p(t,`value`,e.value??n().defaultValue??``)),t})();case`image`:case`file`:return a($,{multiple:!1,get onChange(){return e.onChange},get accept(){return e.field.type===`image`?`image/*`:void 0}});case`gallery`:return a($,{multiple:!0,get onChange(){return e.onChange},accept:`image/*`});case`google_map`:return(()=>{var t=m(Ze),n=t.firstChild,r=n.nextSibling,i=r.nextSibling;return n.$$input=t=>{let n=e.value??{};e.onChange({...n,address:t.currentTarget.value})},r.$$input=t=>{let n=e.value??{};e.onChange({...n,lat:Number(t.currentTarget.value)})},i.$$input=t=>{let n=e.value??{};e.onChange({...n,lng:Number(t.currentTarget.value)})},o(()=>p(n,`value`,e.value?.address??``)),o(()=>p(r,`value`,e.value?.lat??``)),o(()=>p(i,`value`,e.value?.lng??``)),d(),t})();case`link`:return(()=>{var t=m(Qe),n=t.firstChild,r=n.nextSibling;return n.$$input=t=>{let n=e.value??{};e.onChange({...n,url:t.currentTarget.value})},r.addEventListener(`change`,t=>{let n=e.value??{};e.onChange({...n,target:t.currentTarget.value})}),o(()=>p(n,`value`,e.value?.url??``)),o(()=>p(r,`value`,e.value?.target??`_self`)),d(),t})();case`relationship`:case`post_object`:return a(we,{get postType(){return n().postType},get multiple(){return n().multiple!==!1},get value(){return e.value},get onChange(){return e.onChange}});case`taxonomy`:case`user`:return a(ct,{get field(){return e.field},get value(){return e.value},get onChange(){return e.onChange},get multiple(){return n().multiple!==!1}});case`repeater`:{let t=()=>Array.isArray(e.value)?e.value:[];return(()=>{var n=m($e),r=n.firstChild,[i,o]=g(r.nextSibling),c=i.nextSibling;return f(n,a(s,{get each(){return t()},children:(n,r)=>a(st,{get field(){return e.field},row:n,get index(){return r()},get t(){return e.t},onUpdate:n=>{let i=[...t()];i[r()]=n,e.onChange(i)},onRemove:()=>{e.onChange(t().filter((e,t)=>t!==r()))}})}),i,o),c.$$click=()=>e.onChange([...t(),{}]),d(),n})()}case`flexible_content`:{let r=()=>e.field.layouts.length>0?e.field.layouts:n().layouts??[],i=()=>(Array.isArray(e.value)?e.value:[]).map(e=>({fc_layout:String(e.fc_layout??``),data:e}));return(()=>{var n=m(et),c=n.firstChild,[l,u]=g(c.nextSibling),h=l.nextSibling,_=h.firstChild.nextSibling,[v,y]=g(_.nextSibling);return f(n,a(s,{get each(){return i()},children:(n,c)=>{let l=()=>r().find(e=>e.name===n.fc_layout),u=()=>{let{fc_layout:e,...t}=n.data;return t};return(()=>{var r=m(q),h=r.firstChild,_=h.firstChild,v=_.firstChild,[y,b]=g(v.nextSibling),x=y.nextSibling.nextSibling,[S,C]=g(x.nextSibling),w=_.nextSibling,T=w.nextSibling,E=T.nextSibling,D=h.nextSibling,[O,k]=g(D.nextSibling);return f(_,()=>l()?.label||n.fc_layout||`Linha`,y,b),f(_,()=>c()+1,S,C),w.$$click=()=>{let t=[...Array.isArray(e.value)?e.value:[]];[t[c()-1],t[c()]]=[t[c()],t[c()-1]],e.onChange(t)},T.$$click=()=>{let t=[...Array.isArray(e.value)?e.value:[]];[t[c()],t[c()+1]]=[t[c()+1],t[c()]],e.onChange(t)},E.$$click=()=>e.onChange((Array.isArray(e.value)?e.value:[]).filter((e,t)=>t!==c())),f(r,a(t,{get when(){return l()},get fallback(){return(()=>{var e=m(tt),t=e.firstChild.nextSibling,[r,i]=g(t.nextSibling);return r.nextSibling,f(e,()=>n.fc_layout,r,i),e})()},get children(){return a(s,{get each(){return l().subFields??[]},children:t=>a(Q,{field:t,get values(){return u()},get t(){return e.t},onChange:(t,n)=>{let r=[...Array.isArray(e.value)?e.value:[]];r[c()]={...r[c()],[t]:n},e.onChange(r)}})})}}),O,k),o(e=>{var t=c()===0,n=c()===i().length-1;return t!==e.e&&p(w,`disabled`,e.e=t),n!==e.t&&p(T,`disabled`,e.t=n),e},{e:void 0,t:void 0}),d(),r})()}}),l,u),h.addEventListener(`change`,t=>{t.currentTarget.value&&(e.onChange([...Array.isArray(e.value)?e.value:[],{fc_layout:t.currentTarget.value}]),t.currentTarget.value=``)}),f(h,a(s,{get each(){return r()},children:e=>(()=>{var t=m(G);return f(t,()=>e.label??e.name),o(()=>p(t,`value`,e.name)),t})()}),v,y),n})()}case`group`:return(()=>{var t=m(nt);return f(t,a(s,{get each(){return e.field.subFields??[]},children:t=>a(Q,{field:t,get values(){return e.value??{}},get t(){return e.t},onChange:(t,n)=>e.onChange({...e.value??{},[t]:n})})})),t})();default:return e.field.isPluginType&&(e.field.adminRendererPath||e.field.adminComponentPath)?a(Me,{get field(){return e.field},get value(){return e.value},get onChange(){return e.onChange},get adminRendererPath(){return e.field.adminRendererPath},get adminComponentPath(){return e.field.adminComponentPath},get _t(){return e.t}}):(()=>{var t=m(U);return t.$$input=t=>e.onChange(t.currentTarget.value),d(),t})()}}function st(e){return(()=>{var t=m(rt),n=t.firstChild,r=n.firstChild,i=r.firstChild.nextSibling,[o,c]=g(i.nextSibling),l=r.nextSibling,u=n.nextSibling,[p,h]=g(u.nextSibling);return f(r,()=>e.index+1,o,c),l.$$click=()=>e.onRemove(),f(t,a(s,{get each(){return e.field.subFields??[]},children:t=>a(Q,{field:t,get values(){return e.row},get t(){return e.t},onChange:(t,n)=>e.onUpdate({...e.row,[t]:n})})}),p,h),d(),t})()}function $(e){return(()=>{var t=m(it);return t.addEventListener(`change`,t=>{let n=Array.from(t.currentTarget.files??[]);e.onChange(e.multiple?n:n[0])}),o(n=>{var r=e.multiple,i=e.accept;return r!==n.e&&p(t,`multiple`,n.e=r),i!==n.t&&h(t,`accept`,n.t=i),n},{e:void 0,t:void 0}),t})()}function ct(e){let t=()=>Array.isArray(e.value)?e.value:e.value?[e.value]:[];return(()=>{var n=m(W);return n.addEventListener(`change`,t=>{let n=Array.from(t.currentTarget.selectedOptions).map(e=>e.value);e.onChange(e.multiple?n:n[0])}),f(n,a(s,{get each(){return e.field.config?.choices??[]},children:e=>(()=>{var n=m(G);return f(n,()=>e.label),o(()=>p(n,`selected`,t().includes(e.value))),o(()=>p(n,`value`,e.value)),n})()})),o(t=>{var r=e.multiple,i=Math.min(6,Math.max(3,(e.field.config?.choices??[]).length||3));return r!==t.e&&p(n,`multiple`,t.e=r),i!==t.t&&h(n,`size`,t.t=i),t},{e:void 0,t:void 0}),n})()}u([`input`,`click`]);export{Z as n,H as r,Q as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p as e}from"./solid.Ck4Vtfe4.js";import{_ as t,l as n,o as r,p as i}from"./web.DD6VKaIp.js";import{n as a}from"./i18n.
|
|
1
|
+
import{p as e}from"./solid.Ck4Vtfe4.js";import{_ as t,l as n,o as r,p as i}from"./web.DD6VKaIp.js";import{n as a}from"./i18n.DQYU1D_P.js";var o=t(`<footer class=admin-footer role=contentinfo><div class=footer-content><div class=footer-left><p class=footer-version><span class=product-name>OkCMS</span></p></div><nav class=footer-links><a href=https://oktisworks.com target=_blank rel="noopener noreferrer"></a><a href=https://github.com/oktis-works/cms target=_blank rel="noopener noreferrer"></a><a href=https://docs.oktisworks.com target=_blank rel="noopener noreferrer"></a><a href=https://oktisworks.com/community target=_blank rel="noopener noreferrer"></a></nav><div class=footer-right><p class=footer-powered></p></div></div><style>
|
|
2
2
|
.admin-footer {
|
|
3
3
|
position: static;
|
|
4
4
|
width: 100%;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,a as t,f as n,h as r,l as i}from"./solid.Ck4Vtfe4.js";import{_ as a,l as o,o as s,s as c,u as l}from"./web.DD6VKaIp.js";import{a as u,i as d,n as f,o as p,r as m,s as h}from"./i18n.
|
|
1
|
+
import{S as e,a as t,f as n,h as r,l as i}from"./solid.Ck4Vtfe4.js";import{_ as a,l as o,o as s,s as c,u as l}from"./web.DD6VKaIp.js";import{a as u,i as d,n as f,o as p,r as m,s as h}from"./i18n.DQYU1D_P.js";import{n as g}from"./api.fpBzBw4U.js";import{i as _,n as v,r as y,s as b}from"./src.CYKGYEyR.js";import{t as x}from"./TimezoneSelect.DDwsrzLo.js";var S=a(`<div class="notice notice--error">`),C=a(`<div class=notice>`),w=a(`<form><div class=form-grid></div><div class=media-details__actions>`),T=a(`<div class=general-settings><!$><!/><!$><!/><!$><!/>`),E=a(`<p class=muted>`),D=a(`<label class=general-settings__tz><!$><!/><!$><!/>`);function O(){let{t:a}=f(),[O,k]=r({}),[A,j]=r(``),[M,N]=r(!1),[P,F]=r(``),[I,L]=r(``),[R,z]=r(!1),B=n(()=>p.map(e=>({value:e,label:`${d[e]} ${u[e]}`}))),V=n(()=>[{key:`siteTitle`,label:a(`settings.general.fields.siteTitle`),type:`text`,placeholder:a(`settings.general.fields.siteTitlePlaceholder`)},{key:`siteDescription`,label:a(`settings.general.fields.siteDescription`),type:`text`,placeholder:a(`settings.general.fields.siteDescriptionPlaceholder`)},{key:`language`,label:a(`settings.general.fields.language`),type:`select`,options:B()}]);e(async()=>{try{let e=await g.getSettings(`general`),t={};for(let n of e)t[n.key]=typeof n.value==`string`?n.value:JSON.stringify(n.value??``);for(let e of V())t[e.key]===void 0&&(t[e.key]=``);j(t.language??``),k(t),N(!0)}catch(e){F(e instanceof Error?e.message:String(e))}});let H=async e=>{e.preventDefault(),F(``),L(``),z(!0);try{let e=await g.getSettings(`general`),t=new Map(e.map(e=>[e.key,e]));await g.updateSettings(V().map(e=>{let n=t.get(e.key);return{key:e.key,value:O()[e.key]??``,group:n?.group??`general`,type:n?.type??`string`}}));let n=O().language??``;if(h(n)&&n!==A()){m(n),window.location.reload();return}L(a(`settings.general.saved`))}catch(e){F(e instanceof Error?e.message:String(e))}finally{z(!1)}};return(()=>{var e=s(T),n=e.firstChild,[r,u]=c(n.nextSibling),d=r.nextSibling,[f,p]=c(d.nextSibling),m=f.nextSibling,[h,g]=c(m.nextSibling);return o(e,i(t,{get when(){return P()},get children(){var e=s(S);return o(e,P),e}}),r,u),o(e,i(t,{get when(){return I()},get children(){var e=s(C);return o(e,I),e}}),f,p),o(e,i(t,{get when(){return M()},get fallback(){return(()=>{var e=s(E);return o(e,()=>a(`settings.general.loading`)),e})()},get children(){return i(y,{get children(){var e=s(w),t=e.firstChild,n=t.nextSibling;return e.addEventListener(`submit`,H),o(t,()=>V().map(e=>e.type===`select`?i(b,{get name(){return e.key},get label(){return e.label},get value(){return O()[e.key]??``},get options(){return e.options??[]},onChange:t=>k({...O(),[e.key]:t})}):e.type===`timezone`?(()=>{var t=s(D),n=t.firstChild,[r,a]=c(n.nextSibling),l=r.nextSibling,[u,d]=c(l.nextSibling);return o(t,()=>e.label,r,a),o(t,i(x,{get value(){return O()[e.key]??``},get placeholder(){return e.placeholder??``},get searchPlaceholder(){return e.placeholder??``},onChange:t=>k({...O(),[e.key]:t})}),u,d),t})():i(_,{get name(){return e.key},get label(){return e.label},get placeholder(){return l(()=>`placeholder`in e)()?e.placeholder:``},get value(){return O()[e.key]??``},onInput:t=>k({...O(),[e.key]:t})}))),o(n,i(v,{variant:`primary`,type:`submit`,get disabled(){return R()},get loading(){return R()},get children(){return a(`settings.general.save`)}})),e}})}}),h,g),e})()}export{O as GeneralSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,a as t,h as n,l as r,p as i,r as a}from"./solid.Ck4Vtfe4.js";import{_ as o,a as s,f as c,l,m as u,o as d,p as f,s as p,u as m}from"./web.DD6VKaIp.js";import{n as h}from"./i18n.
|
|
1
|
+
import{S as e,a as t,h as n,l as r,p as i,r as a}from"./solid.Ck4Vtfe4.js";import{_ as o,a as s,f as c,l,m as u,o as d,p as f,s as p,u as m}from"./web.DD6VKaIp.js";import{n as h}from"./i18n.DQYU1D_P.js";import{n as g}from"./api.fpBzBw4U.js";var _=o(`<div class="notice notice--error">`),v=o(`<div class="notice notice--success">`),y=o(`<div class=table-scroll><table class=table><thead><tr><th></th><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody>`),b=o(`<div class="resource-hub logs-manager"><!$><!/><!$><!/><section class=card><div class=card-header-row><div><h3></h3><p></p></div></div><form class="resource-form logs-retention-form"><label><!$><!/><input class=input type=number min=1 max=3650 required></label><button class="btn btn-primary"type=submit></button></form></section><section class=card><div class=card-header-row><h3></h3><button class=btn type=button></button></div><div class=logs-filters><input class=input><input class=input><button class=btn type=button></button></div><!$><!/>`),x=o(`<p>`),S=o(`<tr><td></td><td><code></code></td><td><!$><!/><!$><!/></td><td></td><td></td><td>`);function C(){let{t:o}=h(),[s,C]=n([]),[w,T]=n(90),[E,D]=n(``),[O,k]=n(``),[A,j]=n(``),[M,N]=n(``),[P,F]=n(!0),I=async()=>{F(!0),j(``);try{let[e,t]=await Promise.all([g.getAuditLogConfig(),g.listAuditLogs({limit:500,action:E()||void 0,resourceType:O()||void 0})]);T(e.retentionDays),C(t.data)}catch(e){j(e instanceof Error?e.message:String(e))}finally{F(!1)}};e(I);let L=async e=>{e.preventDefault();try{let e=await g.updateAuditLogConfig(w());T(e.retentionDays),N(o(`logs.retentionSaved`)),await I()}catch(e){j(e instanceof Error?e.message:String(e))}};return(()=>{var e=d(b),n=e.firstChild,[h,g]=p(n.nextSibling),C=h.nextSibling,[j,N]=p(C.nextSibling),F=j.nextSibling,R=F.firstChild,z=R.firstChild.firstChild,B=z.nextSibling,V=R.nextSibling,H=V.firstChild,U=H.firstChild,[W,ee]=p(U.nextSibling),G=W.nextSibling,te=H.nextSibling,K=F.nextSibling,q=K.firstChild,J=q.firstChild,Y=J.nextSibling,X=q.nextSibling,Z=X.firstChild,Q=Z.nextSibling,$=Q.nextSibling,ne=X.nextSibling,[re,ie]=p(ne.nextSibling);return l(e,r(t,{get when(){return A()},get children(){var e=d(_);return l(e,A),e}}),h,g),l(e,r(t,{get when(){return M()},get children(){var e=d(v);return l(e,M),e}}),j,N),l(z,()=>o(`logs.retentionTitle`)),l(B,()=>o(`logs.retentionDescription`)),V.addEventListener(`submit`,L),l(H,()=>o(`logs.retentionDays`),W,ee),G.$$input=e=>T(Number(e.currentTarget.value)),l(te,()=>o(`common.save`)),l(J,()=>o(`logs.historyTitle`)),Y.$$click=()=>void I(),l(Y,()=>o(`common.refresh`)),Z.$$input=e=>D(e.currentTarget.value),Q.$$input=e=>k(e.currentTarget.value),$.$$click=()=>void I(),l($,()=>o(`common.filter`)),l(K,r(t,{get when(){return!P()},get fallback(){return(()=>{var e=d(x);return l(e,()=>o(`logs.loading`)),e})()},get children(){return r(t,{get when(){return s().length>0},get fallback(){return(()=>{var e=d(x);return l(e,()=>o(`logs.empty`)),e})()},get children(){var e=d(y),t=e.firstChild.firstChild,n=t.firstChild.firstChild,i=n.nextSibling,c=i.nextSibling,u=c.nextSibling,f=u.nextSibling,h=f.nextSibling,g=t.nextSibling;return l(n,()=>o(`logs.columns.date`)),l(i,()=>o(`logs.columns.action`)),l(c,()=>o(`logs.columns.resource`)),l(u,()=>o(`logs.columns.user`)),l(f,()=>o(`logs.columns.status`)),l(h,()=>o(`logs.columns.ip`)),l(g,r(a,{get each(){return s()},children:e=>(()=>{var t=d(S),n=t.firstChild,r=n.nextSibling,i=r.firstChild,a=r.nextSibling,s=a.firstChild,[c,u]=p(s.nextSibling),f=c.nextSibling,[h,g]=p(f.nextSibling),_=a.nextSibling,v=_.nextSibling,y=v.nextSibling;return l(n,(()=>{var t=m(()=>!!e.created_at);return()=>t()?new Date(e.created_at).toLocaleString():`—`})()),l(i,()=>e.action),l(a,()=>e.resourceType,c,u),l(a,(()=>{var t=m(()=>!!e.resourceId);return()=>t()?`:${e.resourceId}`:``})(),h,g),l(_,()=>e.userId??o(`logs.system`)),l(v,()=>String(e.changes?.status??`—`)),l(y,()=>e.ipAddress??`—`),t})()})),e}})}}),re,ie),i(e=>{var t=o(`logs.actionFilter`),n=o(`logs.resourceFilter`);return t!==e.e&&f(Z,`placeholder`,e.e=t),n!==e.t&&f(Q,`placeholder`,e.t=n),e},{e:void 0,t:void 0}),i(()=>u(G,`value`,w())),i(()=>u(Z,`value`,E())),i(()=>u(Q,`value`,O())),c(),e})()}s([`input`,`click`]);export{C as LogsManager};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,a as t,h as n,l as r,p as i,r as a}from"./solid.Ck4Vtfe4.js";import{_ as o,a as s,f as ee,l as c,m as l,o as u,p as d,s as f,u as p}from"./web.DD6VKaIp.js";import{n as m}from"./i18n.A82w5XQu.js";import{n as h}from"./api.53l1ob4Z.js";import{a as g,i as _,n as v,o as y,s as te}from"./src.CYKGYEyR.js";var ne=o(`<div class="notice notice--error">`),re=o(`<div class=notice>`),ie=o(`<div class=media-grid>`),ae=o(`<div class=media-library><!$><!/><!$><!/><div class=upload-zone><p><strong></strong> ou</p><label class="btn btn-primary"style=cursor:pointer><!$><!/><input type=file multiple style=display:none></label><p class=muted></p></div><div class=toolbar><!$><!/><!$><!/><!$><!/></div><!$><!/><!$><!/><!$><!/>`),oe=o(`<p class=muted>`),se=o(`<img loading=lazy>`,!0,!1,!1),ce=o(`<button type=button class=media-card><div class=media-card__preview></div><div class=media-card__meta><span class=media-card__name></span><span class=muted><!$><!/> · <!$><!/>`),le=o(`<span class=media-card__ext>`),ue=o(`<img>`),de=o(`<video controls>`),fe=o(`<audio controls>`),pe=o(`<iframe>`),me=o(`<div class="media-card__ext media-modal__file-icon">`),he=o(`<dt>`),ge=o(`<dd>`),_e=o(`<div class=media-modal><div class=media-modal__preview><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/></div><div class=media-modal__layout><div class=media-modal__fields><!$><!/><!$><!/><!$><!/><label class=field__label><!$><!/><textarea class="input media-modal__textarea"name=media-description></textarea></label></div><dl class="media-details__list media-modal__facts"><dt></dt><dd></dd><dt></dt><dd></dd><dt></dt><dd></dd><!$><!/><dt></dt><dd></dd><dt></dt><dd class=media-details__url><code></code><button class="btn btn-secondary btn-sm"type=button></button></dd></dl></div><div class=media-modal__replace><label class="btn btn-secondary"style=cursor:pointer><!$><!/><input type=file style=display:none></label><span class=muted></span></div><div class=media-details__actions><!$><!/><!$><!/><!$><!/>`);function ve(e){return Number.isFinite(e)?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`:`—`}function b(e){return e.mime_type.startsWith(`image/`)}function ye(e){return e.mime_type.startsWith(`video/`)}function be(e){return e.mime_type.startsWith(`audio/`)}function xe(e){return e.mime_type===`application/pdf`}function x(e){return e.title?.trim()||e.filename}function Se(e){let t=e.metadata,n=Number(t?.width),r=Number(t?.height);return n>0&&r>0?`${n} × ${r} px`:null}function S(e){return{title:e.title??e.filename,alt:e.alt??``,caption:e.caption??``,description:e.description??``}}function C(o){let{t:s}=m(),[C,w]=n([]),[Ce,T]=n(0),[E,D]=n(1),[O,we]=n(``),[k,A]=n(``),[j,M]=n(``),[Te,N]=n(``),[Ee,P]=n(!1),[F,I]=n(null),[L,R]=n({title:``,alt:``,caption:``,description:``}),[De,z]=n(!1),[Oe,B]=n(!1),[ke,V]=n(!1),H=e=>h.mediaUrl(e.url),U=async()=>{try{let e=await h.listMedia({page:E(),limit:24,search:O()||void 0,mimeType:k()||void 0});w(e.data??[]),T(e.total??0)}catch(e){M(e instanceof Error?e.message:String(e))}};e(U);let W=async()=>{D(1),await U()},Ae=e=>{I(e),R(S(e)),M(``)},G=async e=>{if(e.length===0)return;P(!0),M(``),N(``);let t=0;for(let n of Array.from(e))try{await h.uploadMedia(n,{alt:``}),t+=1}catch(e){M(`${n.name}: ${e instanceof Error?e.message:String(e)}`)}P(!1),t>0&&(N(s(`media.toasts.uploaded`,{count:t})),D(1),await U())},je=async e=>{if(confirm(s(`media.details.confirmDelete`,{filename:e.filename})))try{await h.deleteMedia(e.id),F()?.id===e.id&&I(null),await U()}catch(e){M(e instanceof Error?e.message:String(e))}},Me=async()=>{let e=F();if(e){B(!0),M(``);try{let t=await h.updateMedia(e.id,L()),n={...e,...t};I(n),R(S(n)),N(s(`media.details.saved`)),await U()}catch(e){M(e instanceof Error?e.message:String(e))}finally{B(!1)}}},Ne=async e=>{let t=F();if(t){V(!0),M(``);try{let n=await h.replaceMediaFile(t.id,e),r={...t,...n};I(r),R(S(r)),N(s(`media.details.replaced`)),await U()}catch(e){M(e instanceof Error?e.message:String(e))}finally{V(!1)}}},Pe=async e=>{try{await navigator.clipboard.writeText(e),N(s(`media.details.copied`))}catch{M(s(`media.details.copyError`))}};return(()=>{var e=u(ae),n=e.firstChild,[m,h]=f(n.nextSibling),S=m.nextSibling,[w,T]=f(S.nextSibling),M=w.nextSibling,N=M.firstChild,P=N.firstChild,B=N.nextSibling,V=B.firstChild,[Fe,Ie]=f(V.nextSibling),K=Fe.nextSibling,Le=B.nextSibling,q=M.nextSibling,Re=q.firstChild,[J,Y]=f(Re.nextSibling),ze=J.nextSibling,[X,Be]=f(ze.nextSibling),Ve=X.nextSibling,[He,Z]=f(Ve.nextSibling),Ue=q.nextSibling,[Q,We]=f(Ue.nextSibling),Ge=Q.nextSibling,[$,Ke]=f(Ge.nextSibling),qe=$.nextSibling,[Je,Ye]=f(qe.nextSibling);return c(e,r(t,{get when(){return j()},get children(){var e=u(ne);return c(e,j),e}}),m,h),c(e,r(t,{get when(){return Te()},get children(){var e=u(re);return c(e,Te),e}}),w,T),M.addEventListener(`drop`,e=>{e.preventDefault(),z(!1),e.dataTransfer&&G(e.dataTransfer.files)}),M.addEventListener(`dragleave`,()=>z(!1)),M.addEventListener(`dragover`,e=>{e.preventDefault(),z(!0)}),c(P,()=>s(`media.upload.dropzone`)),c(B,(()=>{var e=p(()=>!!Ee());return()=>e()?s(`media.upload.uploading`):s(`media.upload.select`)})(),Fe,Ie),K.addEventListener(`change`,e=>{e.currentTarget.files&&G(e.currentTarget.files),e.currentTarget.value=``}),c(Le,()=>s(`media.upload.hint`)),c(q,r(_,{name:`media-search`,get placeholder(){return s(`media.toolbar.search`)},get value(){return O()},onInput:e=>{we(e),W()}}),J,Y),c(q,r(te,{name:`media-mime`,get placeholder(){return s(`media.toolbar.allTypes`)},get value(){return k()},get options(){return[{value:`image/png`,label:s(`media.mimeTypes.png`)},{value:`image/jpeg`,label:s(`media.mimeTypes.jpeg`)},{value:`image/gif`,label:s(`media.mimeTypes.gif`)},{value:`image/webp`,label:s(`media.mimeTypes.webp`)},{value:`image/svg+xml`,label:s(`media.mimeTypes.svg`)},{value:`application/pdf`,label:s(`media.mimeTypes.pdf`)},{value:`video/mp4`,label:s(`media.mimeTypes.mp4`)},{value:`audio/mpeg`,label:s(`media.mimeTypes.mp3`)}]},onChange:e=>{A(e),W()}}),X,Be),c(q,r(v,{variant:`secondary`,onClick:()=>void W(),get children(){return s(`media.toolbar.searchBtn`)}}),He,Z),c(e,r(t,{get when(){return C().length>0},get fallback(){return(()=>{var e=u(oe);return c(e,()=>s(`media.empty`)),e})()},get children(){var e=u(ie);return c(e,r(a,{get each(){return C()},children:e=>(()=>{var n=u(ce),a=n.firstChild,o=a.nextSibling.firstChild,s=o.nextSibling,l=s.firstChild,[p,m]=f(l.nextSibling),h=p.nextSibling.nextSibling,[g,_]=f(h.nextSibling);return n.$$click=()=>Ae(e),c(a,r(t,{get when(){return b(e)},get fallback(){return(()=>{var t=u(le);return c(t,()=>e.mime_type.split(`/`)[1]?.toUpperCase()??`FILE`),t})()},get children(){var t=u(se);return i(n=>{var r=H(e),i=e.alt??x(e);return r!==n.e&&d(t,`src`,n.e=r),i!==n.t&&d(t,`alt`,n.t=i),n},{e:void 0,t:void 0}),t}})),c(o,()=>x(e)),c(s,()=>e.filename,p,m),c(s,()=>ve(e.size),g,_),i(t=>{var r=F()?.id===e.id,i=x(e);return r!==t.e&&n.classList.toggle(`media-card--selected`,t.e=r),i!==t.t&&d(o,`title`,t.t=i),t},{e:void 0,t:void 0}),ee(),n})()})),e}}),Q,We),c(e,r(y,{get page(){return E()},limit:24,get total(){return Ce()},onPageChange:e=>{D(e),U()}}),$,Ke),c(e,r(g,{get open(){return!!F()},get title(){return p(()=>!!F())()?x(F()):s(`media.details.title`)},onClose:()=>I(null),get children(){return r(t,{get when(){return F()},children:e=>(()=>{var n=u(_e),a=n.firstChild,o=a.firstChild,[m,h]=f(o.nextSibling),g=m.nextSibling,[y,te]=f(g.nextSibling),ne=y.nextSibling,[re,ie]=f(ne.nextSibling),ae=re.nextSibling,[oe,se]=f(ae.nextSibling),ce=oe.nextSibling,[le,S]=f(ce.nextSibling),C=a.nextSibling,w=C.firstChild,Ce=w.firstChild,[T,E]=f(Ce.nextSibling),D=T.nextSibling,[O,we]=f(D.nextSibling),k=O.nextSibling,[A,j]=f(k.nextSibling),M=A.nextSibling,Te=M.firstChild,[N,Ee]=f(Te.nextSibling),P=N.nextSibling,F=w.nextSibling,De=F.firstChild,z=De.nextSibling,B=z.nextSibling,V=B.nextSibling,U=V.nextSibling,W=U.nextSibling,Ae=W.nextSibling,[G,Fe]=f(Ae.nextSibling),Ie=G.nextSibling,K=Ie.nextSibling,Le=K.nextSibling,q=Le.nextSibling.firstChild,Re=q.nextSibling,J=C.nextSibling,Y=J.firstChild,ze=Y.firstChild,[X,Be]=f(ze.nextSibling),Ve=X.nextSibling,He=Y.nextSibling,Z=J.nextSibling,Ue=Z.firstChild,[Q,We]=f(Ue.nextSibling),Ge=Q.nextSibling,[$,Ke]=f(Ge.nextSibling),qe=$.nextSibling,[Je,Ye]=f(qe.nextSibling);return c(a,r(t,{get when(){return b(e())},get children(){var t=u(ue);return i(n=>{var r=H(e()),i=L().alt||x(e());return r!==n.e&&d(t,`src`,n.e=r),i!==n.t&&d(t,`alt`,n.t=i),n},{e:void 0,t:void 0}),t}}),m,h),c(a,r(t,{get when(){return ye(e())},get children(){var t=u(de);return i(()=>d(t,`src`,H(e()))),t}}),y,te),c(a,r(t,{get when(){return be(e())},get children(){var t=u(fe);return i(()=>d(t,`src`,H(e()))),t}}),re,ie),c(a,r(t,{get when(){return xe(e())},get children(){var t=u(pe);return i(n=>{var r=x(e()),i=H(e());return r!==n.e&&d(t,`title`,n.e=r),i!==n.t&&d(t,`src`,n.t=i),n},{e:void 0,t:void 0}),t}}),oe,se),c(a,r(t,{get when(){return p(()=>!(b(e())||ye(e())||be(e())))()&&!xe(e())},get children(){var t=u(me);return c(t,()=>e().mime_type.split(`/`)[1]?.toUpperCase()??`FILE`),t}}),le,S),c(w,r(_,{name:`media-title`,get label(){return s(`media.details.titleField`)},get value(){return L().title},onInput:e=>R({...L(),title:e})}),T,E),c(w,r(_,{name:`media-alt`,get label(){return s(`media.details.alt`)},get value(){return L().alt},onInput:e=>R({...L(),alt:e})}),O,we),c(w,r(_,{name:`media-caption`,get label(){return s(`media.details.caption`)},get value(){return L().caption},onInput:e=>R({...L(),caption:e})}),A,j),c(M,()=>s(`media.details.description`),N,Ee),P.$$input=e=>R({...L(),description:e.currentTarget.value}),c(De,()=>s(`media.details.file`)),c(z,()=>e().filename),c(B,()=>s(`media.details.type`)),c(V,()=>e().mime_type),c(U,()=>s(`media.details.size`)),c(W,()=>ve(e().size)),c(F,r(t,{get when(){return Se(e())},get children(){return[(()=>{var e=u(he);return c(e,()=>s(`media.details.dimensions`)),e})(),(()=>{var t=u(ge);return c(t,()=>Se(e())),t})()]}}),G,Fe),c(Ie,()=>s(`media.details.uploaded`)),c(K,(()=>{var t=p(()=>!!e().created_at);return()=>t()?new Date(e().created_at).toLocaleString():`—`})()),c(Le,()=>s(`media.details.url`)),c(q,()=>H(e())),Re.$$click=()=>void Pe(H(e())),c(Re,()=>s(`media.details.copy`)),c(Y,(()=>{var e=p(()=>!!ke());return()=>e()?s(`media.details.replacing`):s(`media.details.replace`)})(),X,Be),Ve.addEventListener(`change`,e=>{let t=e.currentTarget.files?.[0];t&&Ne(t),e.currentTarget.value=``}),c(He,()=>s(`media.details.replaceHint`)),c(Z,r(v,{variant:`primary`,get disabled(){return Oe()},get loading(){return Oe()},onClick:()=>void Me(),get children(){return s(`media.details.save`)}}),Q,We),c(Z,r(v,{variant:`danger`,onClick:()=>void je(e()),get children(){return s(`media.details.delete`)}}),$,Ke),c(Z,r(v,{variant:`secondary`,onClick:()=>I(null),get children(){return s(`media.details.close`)}}),Je,Ye),i(()=>l(Ve,`disabled`,ke())),i(()=>l(P,`value`,L().description)),ee(),n})()})}}),Je,Ye),i(e=>{var t=!!(De()||o.focusUpload),n=Ee();return t!==e.e&&M.classList.toggle(`upload-zone--active`,e.e=t),n!==e.t&&l(K,`disabled`,e.t=n),e},{e:void 0,t:void 0}),e})()}s([`click`,`input`]);export{C as MediaLibrary};
|
|
1
|
+
import{S as e,a as t,h as n,l as r,p as i,r as a}from"./solid.Ck4Vtfe4.js";import{_ as o,a as s,f as ee,l as c,m as l,o as u,p as d,s as f,u as p}from"./web.DD6VKaIp.js";import{n as m}from"./i18n.DQYU1D_P.js";import{n as h}from"./api.fpBzBw4U.js";import{a as g,i as _,n as v,o as y,s as te}from"./src.CYKGYEyR.js";var ne=o(`<div class="notice notice--error">`),re=o(`<div class=notice>`),ie=o(`<div class=media-grid>`),ae=o(`<div class=media-library><!$><!/><!$><!/><div class=upload-zone><p><strong></strong> ou</p><label class="btn btn-primary"style=cursor:pointer><!$><!/><input type=file multiple style=display:none></label><p class=muted></p></div><div class=toolbar><!$><!/><!$><!/><!$><!/></div><!$><!/><!$><!/><!$><!/>`),oe=o(`<p class=muted>`),se=o(`<img loading=lazy>`,!0,!1,!1),ce=o(`<button type=button class=media-card><div class=media-card__preview></div><div class=media-card__meta><span class=media-card__name></span><span class=muted><!$><!/> · <!$><!/>`),le=o(`<span class=media-card__ext>`),ue=o(`<img>`),de=o(`<video controls>`),fe=o(`<audio controls>`),pe=o(`<iframe>`),me=o(`<div class="media-card__ext media-modal__file-icon">`),he=o(`<dt>`),ge=o(`<dd>`),_e=o(`<div class=media-modal><div class=media-modal__preview><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/></div><div class=media-modal__layout><div class=media-modal__fields><!$><!/><!$><!/><!$><!/><label class=field__label><!$><!/><textarea class="input media-modal__textarea"name=media-description></textarea></label></div><dl class="media-details__list media-modal__facts"><dt></dt><dd></dd><dt></dt><dd></dd><dt></dt><dd></dd><!$><!/><dt></dt><dd></dd><dt></dt><dd class=media-details__url><code></code><button class="btn btn-secondary btn-sm"type=button></button></dd></dl></div><div class=media-modal__replace><label class="btn btn-secondary"style=cursor:pointer><!$><!/><input type=file style=display:none></label><span class=muted></span></div><div class=media-details__actions><!$><!/><!$><!/><!$><!/>`);function ve(e){return Number.isFinite(e)?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`:`—`}function b(e){return e.mime_type.startsWith(`image/`)}function ye(e){return e.mime_type.startsWith(`video/`)}function be(e){return e.mime_type.startsWith(`audio/`)}function xe(e){return e.mime_type===`application/pdf`}function x(e){return e.title?.trim()||e.filename}function Se(e){let t=e.metadata,n=Number(t?.width),r=Number(t?.height);return n>0&&r>0?`${n} × ${r} px`:null}function S(e){return{title:e.title??e.filename,alt:e.alt??``,caption:e.caption??``,description:e.description??``}}function C(o){let{t:s}=m(),[C,w]=n([]),[Ce,T]=n(0),[E,D]=n(1),[O,we]=n(``),[k,A]=n(``),[j,M]=n(``),[Te,N]=n(``),[Ee,P]=n(!1),[F,I]=n(null),[L,R]=n({title:``,alt:``,caption:``,description:``}),[De,z]=n(!1),[Oe,B]=n(!1),[ke,V]=n(!1),H=e=>h.mediaUrl(e.url),U=async()=>{try{let e=await h.listMedia({page:E(),limit:24,search:O()||void 0,mimeType:k()||void 0});w(e.data??[]),T(e.total??0)}catch(e){M(e instanceof Error?e.message:String(e))}};e(U);let W=async()=>{D(1),await U()},Ae=e=>{I(e),R(S(e)),M(``)},G=async e=>{if(e.length===0)return;P(!0),M(``),N(``);let t=0;for(let n of Array.from(e))try{await h.uploadMedia(n,{alt:``}),t+=1}catch(e){M(`${n.name}: ${e instanceof Error?e.message:String(e)}`)}P(!1),t>0&&(N(s(`media.toasts.uploaded`,{count:t})),D(1),await U())},je=async e=>{if(confirm(s(`media.details.confirmDelete`,{filename:e.filename})))try{await h.deleteMedia(e.id),F()?.id===e.id&&I(null),await U()}catch(e){M(e instanceof Error?e.message:String(e))}},Me=async()=>{let e=F();if(e){B(!0),M(``);try{let t=await h.updateMedia(e.id,L()),n={...e,...t};I(n),R(S(n)),N(s(`media.details.saved`)),await U()}catch(e){M(e instanceof Error?e.message:String(e))}finally{B(!1)}}},Ne=async e=>{let t=F();if(t){V(!0),M(``);try{let n=await h.replaceMediaFile(t.id,e),r={...t,...n};I(r),R(S(r)),N(s(`media.details.replaced`)),await U()}catch(e){M(e instanceof Error?e.message:String(e))}finally{V(!1)}}},Pe=async e=>{try{await navigator.clipboard.writeText(e),N(s(`media.details.copied`))}catch{M(s(`media.details.copyError`))}};return(()=>{var e=u(ae),n=e.firstChild,[m,h]=f(n.nextSibling),S=m.nextSibling,[w,T]=f(S.nextSibling),M=w.nextSibling,N=M.firstChild,P=N.firstChild,B=N.nextSibling,V=B.firstChild,[Fe,Ie]=f(V.nextSibling),K=Fe.nextSibling,Le=B.nextSibling,q=M.nextSibling,Re=q.firstChild,[J,Y]=f(Re.nextSibling),ze=J.nextSibling,[X,Be]=f(ze.nextSibling),Ve=X.nextSibling,[He,Z]=f(Ve.nextSibling),Ue=q.nextSibling,[Q,We]=f(Ue.nextSibling),Ge=Q.nextSibling,[$,Ke]=f(Ge.nextSibling),qe=$.nextSibling,[Je,Ye]=f(qe.nextSibling);return c(e,r(t,{get when(){return j()},get children(){var e=u(ne);return c(e,j),e}}),m,h),c(e,r(t,{get when(){return Te()},get children(){var e=u(re);return c(e,Te),e}}),w,T),M.addEventListener(`drop`,e=>{e.preventDefault(),z(!1),e.dataTransfer&&G(e.dataTransfer.files)}),M.addEventListener(`dragleave`,()=>z(!1)),M.addEventListener(`dragover`,e=>{e.preventDefault(),z(!0)}),c(P,()=>s(`media.upload.dropzone`)),c(B,(()=>{var e=p(()=>!!Ee());return()=>e()?s(`media.upload.uploading`):s(`media.upload.select`)})(),Fe,Ie),K.addEventListener(`change`,e=>{e.currentTarget.files&&G(e.currentTarget.files),e.currentTarget.value=``}),c(Le,()=>s(`media.upload.hint`)),c(q,r(_,{name:`media-search`,get placeholder(){return s(`media.toolbar.search`)},get value(){return O()},onInput:e=>{we(e),W()}}),J,Y),c(q,r(te,{name:`media-mime`,get placeholder(){return s(`media.toolbar.allTypes`)},get value(){return k()},get options(){return[{value:`image/png`,label:s(`media.mimeTypes.png`)},{value:`image/jpeg`,label:s(`media.mimeTypes.jpeg`)},{value:`image/gif`,label:s(`media.mimeTypes.gif`)},{value:`image/webp`,label:s(`media.mimeTypes.webp`)},{value:`image/svg+xml`,label:s(`media.mimeTypes.svg`)},{value:`application/pdf`,label:s(`media.mimeTypes.pdf`)},{value:`video/mp4`,label:s(`media.mimeTypes.mp4`)},{value:`audio/mpeg`,label:s(`media.mimeTypes.mp3`)}]},onChange:e=>{A(e),W()}}),X,Be),c(q,r(v,{variant:`secondary`,onClick:()=>void W(),get children(){return s(`media.toolbar.searchBtn`)}}),He,Z),c(e,r(t,{get when(){return C().length>0},get fallback(){return(()=>{var e=u(oe);return c(e,()=>s(`media.empty`)),e})()},get children(){var e=u(ie);return c(e,r(a,{get each(){return C()},children:e=>(()=>{var n=u(ce),a=n.firstChild,o=a.nextSibling.firstChild,s=o.nextSibling,l=s.firstChild,[p,m]=f(l.nextSibling),h=p.nextSibling.nextSibling,[g,_]=f(h.nextSibling);return n.$$click=()=>Ae(e),c(a,r(t,{get when(){return b(e)},get fallback(){return(()=>{var t=u(le);return c(t,()=>e.mime_type.split(`/`)[1]?.toUpperCase()??`FILE`),t})()},get children(){var t=u(se);return i(n=>{var r=H(e),i=e.alt??x(e);return r!==n.e&&d(t,`src`,n.e=r),i!==n.t&&d(t,`alt`,n.t=i),n},{e:void 0,t:void 0}),t}})),c(o,()=>x(e)),c(s,()=>e.filename,p,m),c(s,()=>ve(e.size),g,_),i(t=>{var r=F()?.id===e.id,i=x(e);return r!==t.e&&n.classList.toggle(`media-card--selected`,t.e=r),i!==t.t&&d(o,`title`,t.t=i),t},{e:void 0,t:void 0}),ee(),n})()})),e}}),Q,We),c(e,r(y,{get page(){return E()},limit:24,get total(){return Ce()},onPageChange:e=>{D(e),U()}}),$,Ke),c(e,r(g,{get open(){return!!F()},get title(){return p(()=>!!F())()?x(F()):s(`media.details.title`)},onClose:()=>I(null),get children(){return r(t,{get when(){return F()},children:e=>(()=>{var n=u(_e),a=n.firstChild,o=a.firstChild,[m,h]=f(o.nextSibling),g=m.nextSibling,[y,te]=f(g.nextSibling),ne=y.nextSibling,[re,ie]=f(ne.nextSibling),ae=re.nextSibling,[oe,se]=f(ae.nextSibling),ce=oe.nextSibling,[le,S]=f(ce.nextSibling),C=a.nextSibling,w=C.firstChild,Ce=w.firstChild,[T,E]=f(Ce.nextSibling),D=T.nextSibling,[O,we]=f(D.nextSibling),k=O.nextSibling,[A,j]=f(k.nextSibling),M=A.nextSibling,Te=M.firstChild,[N,Ee]=f(Te.nextSibling),P=N.nextSibling,F=w.nextSibling,De=F.firstChild,z=De.nextSibling,B=z.nextSibling,V=B.nextSibling,U=V.nextSibling,W=U.nextSibling,Ae=W.nextSibling,[G,Fe]=f(Ae.nextSibling),Ie=G.nextSibling,K=Ie.nextSibling,Le=K.nextSibling,q=Le.nextSibling.firstChild,Re=q.nextSibling,J=C.nextSibling,Y=J.firstChild,ze=Y.firstChild,[X,Be]=f(ze.nextSibling),Ve=X.nextSibling,He=Y.nextSibling,Z=J.nextSibling,Ue=Z.firstChild,[Q,We]=f(Ue.nextSibling),Ge=Q.nextSibling,[$,Ke]=f(Ge.nextSibling),qe=$.nextSibling,[Je,Ye]=f(qe.nextSibling);return c(a,r(t,{get when(){return b(e())},get children(){var t=u(ue);return i(n=>{var r=H(e()),i=L().alt||x(e());return r!==n.e&&d(t,`src`,n.e=r),i!==n.t&&d(t,`alt`,n.t=i),n},{e:void 0,t:void 0}),t}}),m,h),c(a,r(t,{get when(){return ye(e())},get children(){var t=u(de);return i(()=>d(t,`src`,H(e()))),t}}),y,te),c(a,r(t,{get when(){return be(e())},get children(){var t=u(fe);return i(()=>d(t,`src`,H(e()))),t}}),re,ie),c(a,r(t,{get when(){return xe(e())},get children(){var t=u(pe);return i(n=>{var r=x(e()),i=H(e());return r!==n.e&&d(t,`title`,n.e=r),i!==n.t&&d(t,`src`,n.t=i),n},{e:void 0,t:void 0}),t}}),oe,se),c(a,r(t,{get when(){return p(()=>!(b(e())||ye(e())||be(e())))()&&!xe(e())},get children(){var t=u(me);return c(t,()=>e().mime_type.split(`/`)[1]?.toUpperCase()??`FILE`),t}}),le,S),c(w,r(_,{name:`media-title`,get label(){return s(`media.details.titleField`)},get value(){return L().title},onInput:e=>R({...L(),title:e})}),T,E),c(w,r(_,{name:`media-alt`,get label(){return s(`media.details.alt`)},get value(){return L().alt},onInput:e=>R({...L(),alt:e})}),O,we),c(w,r(_,{name:`media-caption`,get label(){return s(`media.details.caption`)},get value(){return L().caption},onInput:e=>R({...L(),caption:e})}),A,j),c(M,()=>s(`media.details.description`),N,Ee),P.$$input=e=>R({...L(),description:e.currentTarget.value}),c(De,()=>s(`media.details.file`)),c(z,()=>e().filename),c(B,()=>s(`media.details.type`)),c(V,()=>e().mime_type),c(U,()=>s(`media.details.size`)),c(W,()=>ve(e().size)),c(F,r(t,{get when(){return Se(e())},get children(){return[(()=>{var e=u(he);return c(e,()=>s(`media.details.dimensions`)),e})(),(()=>{var t=u(ge);return c(t,()=>Se(e())),t})()]}}),G,Fe),c(Ie,()=>s(`media.details.uploaded`)),c(K,(()=>{var t=p(()=>!!e().created_at);return()=>t()?new Date(e().created_at).toLocaleString():`—`})()),c(Le,()=>s(`media.details.url`)),c(q,()=>H(e())),Re.$$click=()=>void Pe(H(e())),c(Re,()=>s(`media.details.copy`)),c(Y,(()=>{var e=p(()=>!!ke());return()=>e()?s(`media.details.replacing`):s(`media.details.replace`)})(),X,Be),Ve.addEventListener(`change`,e=>{let t=e.currentTarget.files?.[0];t&&Ne(t),e.currentTarget.value=``}),c(He,()=>s(`media.details.replaceHint`)),c(Z,r(v,{variant:`primary`,get disabled(){return Oe()},get loading(){return Oe()},onClick:()=>void Me(),get children(){return s(`media.details.save`)}}),Q,We),c(Z,r(v,{variant:`danger`,onClick:()=>void je(e()),get children(){return s(`media.details.delete`)}}),$,Ke),c(Z,r(v,{variant:`secondary`,onClick:()=>I(null),get children(){return s(`media.details.close`)}}),Je,Ye),i(()=>l(Ve,`disabled`,ke())),i(()=>l(P,`value`,L().description)),ee(),n})()})}}),Je,Ye),i(e=>{var t=!!(De()||o.focusUpload),n=Ee();return t!==e.e&&M.classList.toggle(`upload-zone--active`,e.e=t),n!==e.t&&l(K,`disabled`,e.t=n),e},{e:void 0,t:void 0}),e})()}s([`click`,`input`]);export{C as MediaLibrary};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,a as t,f as n,h as r,l as i,p as a,r as o}from"./solid.Ck4Vtfe4.js";import{_ as s,a as c,f as l,l as u,m as d,o as f,p,s as m,u as h}from"./web.DD6VKaIp.js";import{n as g}from"./i18n.A82w5XQu.js";import{n as _}from"./api.53l1ob4Z.js";var v=s(`<div class=wp-menu-empty-level>`),y=s(`<div class=wp-menu-tree><!$><!/><!$><!/>`),b=s(`<article class=wp-menu-item><div class=wp-menu-item__header><span class=wp-menu-drag draggable=true>⠿⠿⠿</span><span class=wp-menu-item__label><strong></strong><small></small></span><div class=wp-menu-item__actions><button type=button class="btn btn-sm">↑</button><button type=button class="btn btn-sm">↓</button><button type=button class="btn btn-sm">→</button><button type=button class="btn btn-sm">←</button></div></div><details class=wp-menu-item__details><summary></summary><div class=wp-menu-item__fields><label><!$><!/><input class=input></label><label><!$><!/><input class=input></label><label><!$><!/><input class=input></label><label><!$><!/><input class=input></label><label><!$><!/><select class=input><option value=_self></option><option value=_blank></option></select></label><label><!$><!/><input class=input></label><label class=wp-menu-item__wide><!$><!/><textarea class=input rows=2></textarea></label><button type=button class="btn btn-danger btn-sm"></button></div></details><!$><!/>`),x=s(`<p class=muted>`),S=s(`<details class=wp-menu-box><summary></summary><div class=wp-menu-box__body><!$><!/><!$><!/>`),C=s(`<div class="notice notice--error">`),w=s(`<div class=notice>`),T=s(`<div class="menus-manager wp-menus-manager"><!$><!/><!$><!/><!$><!/><style>.wp-menu-editor__top,.wp-structure-heading,.wp-menu-editor__identity,.wp-menu-item__header,.wp-menu-item__actions,.form-actions{display:flex;align-items:center;gap:.7rem}.wp-menu-editor__top,.wp-structure-heading{justify-content:space-between}.wp-menu-editor__top{margin-bottom:1rem}.wp-menu-editor__top h3{margin:.25rem 0 0}.wp-eyebrow{display:block;margin-top:.7rem;font-size:.72rem;text-transform:uppercase;letter-spacing:.08em;color:var(--color-muted)}.wp-menu-editor__identity{margin-bottom:1rem;align-items:end}.wp-menu-editor__identity label{display:grid;gap:.35rem;flex:1}.wp-menu-editor__columns{display:grid;grid-template-columns:330px minmax(0,1fr);gap:1.2rem;align-items:start}.wp-menu-sources,.wp-menu-structure{min-width:0}.wp-menu-sources>h4,.wp-structure-heading h4{margin:0}.wp-menu-box{background:var(--color-surface,#fff);border:1px solid var(--color-border,#ddd);margin-bottom:.7rem}.wp-menu-box summary{cursor:pointer;padding:.8rem;font-weight:600}.wp-menu-box__body{padding:0 .8rem .8rem;display:grid;gap:.6rem}.wp-menu-box__body p{margin:0}.wp-source-list{display:grid;gap:.35rem;max-height:220px;overflow:auto;border:1px solid var(--color-border,#ddd);padding:.45rem}.wp-source-row{display:flex!important;align-items:start;gap:.45rem!important;padding:.3rem}.wp-source-row span,.wp-source-link{display:grid;gap:.12rem;text-align:left}.wp-source-row small,.wp-source-link small,.wp-menu-item__label small{color:var(--color-muted);font-size:.75rem}.wp-source-link{border:0;background:none;color:inherit;padding:.35rem;width:100%;cursor:pointer}.wp-source-link:hover{background:var(--color-surface-muted,#f5f5f5)}.wp-taxonomy-source{display:grid;gap:.2rem;border-top:1px solid var(--color-border,#ddd);padding-top:.5rem}.wp-taxonomy-source:first-child{border-top:0;padding-top:0}.wp-menu-structure{background:var(--color-surface-muted,#f7f7f7);padding:1rem}.wp-menu-structure .wp-structure-heading{margin-bottom:1rem}.wp-menu-tree{display:grid;gap:.55rem}.wp-menu-tree[data-depth="1"]{margin:.55rem 0 0 2rem}.wp-menu-item{background:var(--color-surface,#fff);border:1px solid var(--color-border,#dcdcde);box-shadow:0 1px 1px rgba(0,0,0,.04)}.wp-menu-item__header{padding:.55rem .7rem}.wp-menu-drag{cursor:grab;letter-spacing:-.2rem;width:1.4rem;color:var(--color-muted);user-select:none}.wp-menu-item__label{display:grid;gap:.15rem;flex:1;min-width:0}.wp-menu-item__label small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-menu-item__actions{margin-left:auto}.wp-menu-item__details{border-top:1px solid var(--color-border,#ddd)}.wp-menu-item__details summary{padding:.5rem .7rem;cursor:pointer;color:var(--color-muted);font-size:.85rem}.wp-menu-item__fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.7rem;padding:.7rem;border-top:1px solid var(--color-border,#ddd)}.wp-menu-item__fields label{display:grid;gap:.3rem}.wp-menu-item__wide{grid-column:1/-1}.wp-menu-empty,.wp-menu-empty-level{text-align:center;padding:2rem;color:var(--color-muted)}.wp-menu-empty-level{border:1px dashed var(--color-border,#ccc);padding:1rem}.wp-menu-settings{margin-top:1rem}.wp-menu-settings h4{margin-top:0}.wp-menu-settings p{margin-bottom:0}.wp-menus-manager .menu-actions{white-space:nowrap;text-align:right}@media(max-width:850px){.wp-menu-editor__columns{grid-template-columns:1fr}.wp-menu-sources{order:2}.wp-menu-structure{order:1}.wp-menu-editor__identity,.wp-menu-editor__top{align-items:stretch;display:grid}.wp-menu-item__fields{grid-template-columns:1fr}.wp-menu-item__wide{grid-column:auto}}`),E=s(`<div class=skeleton>`),ee=s(`<div class=manager-toolbar><p class=muted></p><button class="btn btn-primary"type=button>+ <!$><!/>`),D=s(`<table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody>`),te=s(`<section class=card>`),O=s(`<p class="muted empty-state">`),k=s(`<tr><td><strong></strong></td><td><code></code></td><td></td><td class=menu-actions><button class="btn btn-secondary btn-sm"type=button></button> <button class="btn btn-danger btn-sm"type=button>`),ne=s(`<input class=input>`),A=s(`<div class=wp-source-list>`),j=s(`<button type=button class="btn btn-secondary btn-sm">`),re=s(`<label><!$><!/><input class=input placeholder=https://>`),ie=s(`<label><!$><!/><input class=input>`),ae=s(`<form class=wp-menu-editor><div class=wp-menu-editor__top><div><button type=button class="btn btn-secondary btn-sm">← <!$><!/></button><span class=wp-eyebrow></span><h3></h3></div><div class=form-actions><button class="btn btn-secondary"type=button></button><button class="btn btn-primary"type=submit></button></div></div><div class="wp-menu-editor__identity card"><label><!$><!/><input class=input required></label><label><!$><!/><input class=input></label></div><div class=wp-menu-editor__columns><aside class=wp-menu-sources><h4></h4><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/></aside><main class=wp-menu-structure><div class=wp-structure-heading><div><h4></h4><p class=muted></p></div><span class=badge><!$><!/> <!$><!/></span></div><!$><!/><section class="card wp-menu-settings"><h4></h4><label class=checkbox-label><input type=checkbox> <!$><!/></label><p class=muted>`),oe=s(`<label class=wp-source-row><input type=checkbox><span><!$><!/><small>/<!$><!/>`),se=s(`<label class=wp-source-row><input type=checkbox><span><!$><!/><small>/post/<!$><!/>`),M=s(`<div class=wp-taxonomy-source><strong></strong><!$><!/>`),N=s(`<button type=button class=wp-source-link><!$><!/><small>/<!$><!/>/<!$><!/>`),ce=s(`<button type=button class=wp-source-link><!$><!/><small>/<!$><!/>`),le=s(`<div class="wp-menu-empty card">`);function P(e){return`${e}_${typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():Math.random().toString(36).slice(2)}`}function F(e){return e.toLowerCase().normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/(^-|-$)/g,``)}function I(e,t=null){let n=e.id||P(`item`);return{...e,id:n,clientId:n,parentId:t??e.parentId??null,children:[]}}function ue(e){let t=(Array.isArray(e)?e:[]).map(e=>I(e)),n=new Map(t.map(e=>[e.id,e])),r=[];for(let e of t){let t=e.parentId?n.get(e.parentId):void 0;t&&t.id!==e.id?t.children.push(e):r.push(e)}let i=e=>(e.sort((e,t)=>(e.order??0)-(t.order??0)),e.forEach(e=>i(e.children)),e);return i(r)}function L(e,t=null){let n=[];return e.forEach((e,r)=>{let{clientId:i,children:a,...o}=e;n.push({...o,id:e.id,parentId:t,order:r}),n.push(...L(a,e.id))}),n}function R(e){return e.map(e=>({...e,children:R(e.children)}))}function z(e,t){return e.id===t||e.children.some(e=>z(e,t))}function B(e,t){let n=e.findIndex(e=>e.id===t);if(n>=0){let t=[...e],[r]=t.splice(n,1);return{items:t,removed:r}}for(let n=0;n<e.length;n+=1){let r=B(e[n].children,t);if(r.removed){let t=[...e];return t[n]={...t[n],children:r.items},{items:t,removed:r.removed}}}return{items:e}}function V(e,t,n){let r=e.findIndex(e=>e.id===t);if(r>=0){let t=[...e];return t.splice(r,0,n),{items:t,inserted:!0}}for(let r=0;r<e.length;r+=1){let i=V(e[r].children,t,n);if(i.inserted){let t=[...e];return t[r]={...t[r],children:i.items},{items:t,inserted:!0}}}return{items:e,inserted:!1}}function H(e,t,n){for(let r=0;r<e.length;r+=1){let i=e[r];if(i.id===t){let t=[...e];return t[r]={...i,children:[...i.children,n]},{items:t,inserted:!0}}let a=H(i.children,t,n);if(a.inserted){let t=[...e];return t[r]={...i,children:a.items},{items:t,inserted:!0}}}return{items:e,inserted:!1}}function U(e,t,n){return e.map(e=>e.id===t?{...e,...n}:{...e,children:U(e.children,t,n)})}function de(e,t){return B(e,t).items}function fe(e,t,n){if(t===n||e.some(e=>e.id===t&&z(e,n)))return e;let r=B(e,t);if(!r.removed)return e;let i=V(r.items,n,r.removed);return i.inserted?i.items:e}function pe(e,t,n){if(t===n||e.some(e=>e.id===t&&z(e,n)))return e;let r=B(e,t);if(!r.removed)return e;let i=H(r.items,n,r.removed);return i.inserted?i.items:e}function W(e,t,n){let r=e.findIndex(e=>e.id===t);if(r>=0)return{siblings:e,index:r,parent:n};for(let n of e){let e=W(n.children,t,n);if(e)return e}return null}function me(e,t,n){let r=R(e),i=W(r,t);if(!i)return e;let a=i.index+n;return a<0||a>=i.siblings.length?e:([i.siblings[i.index],i.siblings[a]]=[i.siblings[a],i.siblings[i.index]],r)}function he(e,t){let n=R(e),r=W(n,t);return!r||r.index===0?e:pe(n,t,r.siblings[r.index-1].id)}function ge(e,t){let n=R(e),r=W(n,t);return r?.parent?fe(n,t,r.parent.id):e}function _e(e){let t=P(`item`);return{id:t,clientId:t,type:e.type,label:e.label,url:e.url,objectId:e.objectId,objectType:e.objectType,parentId:null,order:0,target:`_self`,children:[]}}function ve(e){let[n,s]=r(null);return(()=>{var r=f(y),c=r.firstChild,[h,g]=m(c.nextSibling),_=h.nextSibling,[x,S]=m(_.nextSibling);return u(r,i(o,{get each(){return e.items},children:r=>(()=>{var o=f(b),c=o.firstChild,h=c.firstChild,g=h.nextSibling,_=g.firstChild,v=_.nextSibling,y=g.nextSibling.firstChild,x=y.nextSibling,S=x.nextSibling,C=S.nextSibling,w=c.nextSibling,T=w.firstChild,E=T.nextSibling.firstChild,ee=E.firstChild,[D,te]=m(ee.nextSibling),O=D.nextSibling,k=E.nextSibling,ne=k.firstChild,[A,j]=m(ne.nextSibling),re=A.nextSibling,ie=k.nextSibling,ae=ie.firstChild,[oe,se]=m(ae.nextSibling),M=oe.nextSibling,N=ie.nextSibling,ce=N.firstChild,[le,P]=m(ce.nextSibling),F=le.nextSibling,I=N.nextSibling,ue=I.firstChild,[L,R]=m(ue.nextSibling),z=L.nextSibling,B=z.firstChild,V=B.nextSibling,H=I.nextSibling,pe=H.firstChild,[W,_e]=m(pe.nextSibling),G=W.nextSibling,K=H.nextSibling,q=K.firstChild,[J,ye]=m(q.nextSibling),Y=J.nextSibling,be=K.nextSibling,xe=w.nextSibling,[Se,Ce]=m(xe.nextSibling);return o.addEventListener(`drop`,t=>{t.preventDefault();let i=n()??t.dataTransfer?.getData(`text/plain`);i&&e.onChange(fe(e.items,i,r.id)),s(null)}),o.addEventListener(`dragover`,e=>e.preventDefault()),h.addEventListener(`dragend`,()=>s(null)),h.addEventListener(`dragstart`,e=>{s(r.id),e.dataTransfer?.setData(`text/plain`,r.id)}),u(_,()=>r.label||e.t(`menus.editor.untitled`)),u(v,()=>r.url||e.t(`menus.editor.noUrl`)),y.$$click=()=>e.onChange(me(e.items,r.id,-1)),x.$$click=()=>e.onChange(me(e.items,r.id,1)),S.$$click=()=>e.onChange(he(e.items,r.id)),C.$$click=()=>e.onChange(ge(e.items,r.id)),u(T,()=>e.t(`menus.editor.itemSettings`)),u(E,()=>e.t(`menus.editor.navigationLabel`),D,te),O.$$input=t=>e.onChange(U(e.items,r.id,{label:t.currentTarget.value})),u(k,()=>e.t(`menus.editor.url`),A,j),re.$$input=t=>e.onChange(U(e.items,r.id,{url:t.currentTarget.value})),u(ie,()=>e.t(`menus.editor.titleAttribute`),oe,se),M.$$input=t=>e.onChange(U(e.items,r.id,{attrTitle:t.currentTarget.value})),u(N,()=>e.t(`menus.editor.cssClasses`),le,P),F.$$input=t=>e.onChange(U(e.items,r.id,{cssClasses:t.currentTarget.value})),u(I,()=>e.t(`menus.editor.target`),L,R),z.addEventListener(`change`,t=>e.onChange(U(e.items,r.id,{target:t.currentTarget.value}))),u(B,()=>e.t(`menus.editor.sameWindow`)),u(V,()=>e.t(`menus.editor.newWindow`)),u(H,()=>e.t(`menus.editor.xfn`),W,_e),G.$$input=t=>e.onChange(U(e.items,r.id,{xfn:t.currentTarget.value})),u(K,()=>e.t(`menus.editor.description`),J,ye),Y.$$input=t=>e.onChange(U(e.items,r.id,{description:t.currentTarget.value})),be.$$click=()=>e.onChange(de(e.items,r.id)),u(be,()=>e.t(`menus.editor.remove`)),u(o,i(t,{get when(){return r.children.length>0},get children(){return i(ve,{get items(){return r.children},get depth(){return(e.depth??0)+1},get t(){return e.t},onChange:t=>e.onChange(U(e.items,r.id,{children:t}))})}}),Se,Ce),a(t=>{var n=e.t(`menus.editor.drag`),r=e.t(`menus.editor.up`),i=e.t(`menus.editor.down`),a=e.t(`menus.editor.indent`),o=e.t(`menus.editor.outdent`);return n!==t.e&&p(h,`title`,t.e=n),r!==t.t&&p(y,`title`,t.t=r),i!==t.a&&p(x,`title`,t.a=i),a!==t.o&&p(S,`title`,t.o=a),o!==t.i&&p(C,`title`,t.i=o),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),a(()=>d(O,`value`,r.label)),a(()=>d(re,`value`,r.url??``)),a(()=>d(M,`value`,r.attrTitle??``)),a(()=>d(F,`value`,r.cssClasses??``)),a(()=>d(z,`value`,r.target??`_self`)),a(()=>d(G,`value`,r.xfn??``)),a(()=>d(Y,`value`,r.description??``)),l(),o})()}),h,g),u(r,i(t,{get when(){return e.items.length===0},get children(){var t=f(v);return u(t,()=>e.t(`menus.editor.emptyLevel`)),t}}),x,S),a(()=>p(r,`data-depth`,e.depth??0)),r})()}function G(e){return(()=>{var n=f(S),r=n.firstChild,o=r.nextSibling,s=o.firstChild,[c,l]=m(s.nextSibling),p=c.nextSibling,[h,g]=m(p.nextSibling);return u(r,()=>e.title),u(o,i(t,{get when(){return e.description},get children(){var t=f(x);return u(t,()=>e.description),t}}),c,l),u(o,()=>e.children,h,g),a(()=>d(n,`open`,e.open)),n})()}function K(){let{t:s}=g(),[c,v]=r([]),[y,b]=r(null),[x,S]=r([]),[I,R]=r([]),[z,B]=r({}),[V,H]=r([]),[U,de]=r([]),[fe,pe]=r({}),[W,me]=r(``),[he,ge]=r(``),[K,q]=r([]),[J,ye]=r(``),[Y,be]=r(``),[xe,Se]=r(!0),[Ce,we]=r(!1),[Te,X]=r(``),[Ee,Z]=r(``),De=async()=>{Se(!0),X(``);try{let[e,t,n,r,i]=await Promise.all([_.getMenus(),_.getContent({type:`page`,status:`PUBLISHED`,limit:100}),_.getContent({type:`post`,status:`PUBLISHED`,limit:100}),_.getContentTypes(),_.getTaxonomies()]);v(e),S(t.data),R(n.data),H(r),de(i);let a=await Promise.all(r.filter(e=>e.slug!==`page`&&e.slug!==`post`&&!e.singleton).map(async e=>[e.slug,(await _.getContent({type:e.slug,status:`PUBLISHED`,limit:100})).data]));B(Object.fromEntries(a));let o=await Promise.all(i.map(async e=>[e.slug,await _.getTaxonomyTerms(e.slug)]));pe(Object.fromEntries(o))}catch(e){X(e instanceof Error?e.message:String(e))}finally{Se(!1)}};e(De);let Oe=e=>{b({id:e?.id,name:e?.name??``,slug:e?.slug??``,items:ue(e?.items),settings:{...e?.settings??{}}}),q([]),X(``),Z(``)},Q=e=>{let t=y();t&&b({...t,...e})},$=e=>{let t=y();t&&Q({items:[...t.items,_e(e)]})},ke=e=>{let t=new Set(K()),n=y();n&&(Q({items:[...n.items,...e.filter(e=>t.has(e.id)).map(_e)]}),q([]))},Ae=()=>{J().trim()&&Y().trim()&&($({id:P(`custom`),type:`custom`,label:Y().trim(),url:J().trim()}),ye(``),be(``))},je=async e=>{e.preventDefault();let t=y();if(t){if(!t.name.trim()){X(s(`menus.nameRequired`));return}we(!0),X(``);try{let e={name:t.name.trim(),slug:t.slug.trim()||F(t.name),items:L(t.items),settings:t.settings};t.id?await _.updateMenu(t.id,e):await _.createMenu(e),b(null),Z(s(`menus.saved`)),await De()}catch(e){X(e instanceof Error?e.message:String(e))}finally{we(!1)}}},Me=async e=>{if(e.id&&confirm(s(`menus.confirmDelete`,{name:e.name})))try{await _.deleteMenu(e.id),Z(s(`menus.deleted`)),await De()}catch(e){X(e instanceof Error?e.message:String(e))}},Ne=n(()=>x().filter(e=>!W()||`${e.title} ${e.slug}`.toLowerCase().includes(W().toLowerCase()))),Pe=n(()=>I().filter(e=>!he()||`${e.title} ${e.slug}`.toLowerCase().includes(he().toLowerCase()))),Fe=e=>({id:`page:${e.id}`,type:`page`,label:e.title,url:`/${e.slug}`,objectId:e.id,objectType:`page`}),Ie=e=>({id:`post:${e.id}`,type:`post`,label:e.title,url:`/post/${e.slug}`,objectId:e.id,objectType:`post`}),Le=e=>({id:`content:${e.type}:${e.id}`,type:`content`,label:e.title,url:`/${e.type}/${e.slug}`,objectId:e.id,objectType:e.type});return(()=>{var e=f(T),n=e.firstChild,[r,g]=m(n.nextSibling),_=r.nextSibling,[v,x]=m(_.nextSibling),S=v.nextSibling,[P,I]=m(S.nextSibling);return P.nextSibling,u(e,i(t,{get when(){return Te()},get children(){var e=f(C);return u(e,Te),e}}),r,g),u(e,i(t,{get when(){return Ee()},get children(){var e=f(w);return u(e,Ee),e}}),v,x),u(e,i(t,{get when(){return!xe()},get fallback(){return(()=>{var e=f(E);return u(e,()=>s(`common.loading`)),e})()},get children(){return i(t,{get when(){return y()},get fallback(){return[(()=>{var e=f(ee),t=e.firstChild,n=t.nextSibling,r=n.firstChild.nextSibling,[i,a]=m(r.nextSibling);return u(t,()=>s(`menus.hint`)),n.$$click=()=>Oe(),u(n,()=>s(`menus.new`),i,a),l(),e})(),(()=>{var e=f(te);return u(e,i(t,{get when(){return c().length>0},get fallback(){return(()=>{var e=f(O);return u(e,()=>s(`menus.empty`)),e})()},get children(){var e=f(D),t=e.firstChild,n=t.firstChild.firstChild,r=n.nextSibling,a=r.nextSibling,d=t.nextSibling;return u(n,()=>s(`menus.name`)),u(r,()=>s(`menus.slug`)),u(a,()=>s(`menus.items`)),u(d,i(o,{get each(){return c()},children:e=>(()=>{var t=f(k),n=t.firstChild,r=n.firstChild,i=n.nextSibling,a=i.firstChild,o=i.nextSibling,c=o.nextSibling.firstChild,d=c.nextSibling.nextSibling;return u(r,()=>e.name),u(a,()=>e.slug),u(o,()=>e.items?.length??0),c.$$click=()=>Oe(e),u(c,()=>s(`common.edit`)),d.$$click=()=>void Me(e),u(d,()=>s(`common.delete`)),l(),t})()})),e}})),e})()]},children:e=>(()=>{var n=f(ae),r=n.firstChild,c=r.firstChild,g=c.firstChild,_=g.firstChild.nextSibling,[v,y]=m(_.nextSibling),x=g.nextSibling,S=x.nextSibling,C=c.nextSibling.firstChild,w=C.nextSibling,T=r.nextSibling,E=T.firstChild,ee=E.firstChild,[D,te]=m(ee.nextSibling),O=D.nextSibling,k=E.nextSibling,P=k.firstChild,[I,ue]=m(P.nextSibling),L=I.nextSibling,R=T.nextSibling.firstChild,B=R.firstChild,H=B.nextSibling,[de,pe]=m(H.nextSibling),_e=de.nextSibling,[xe,Se]=m(_e.nextSibling),we=xe.nextSibling,[Te,X]=m(we.nextSibling),Ee=Te.nextSibling,[Z,De]=m(Ee.nextSibling),Oe=Z.nextSibling,[Me,Re]=m(Oe.nextSibling),ze=Me.nextSibling,[Be,Ve]=m(ze.nextSibling),He=Be.nextSibling,[Ue,We]=m(He.nextSibling),Ge=R.nextSibling,Ke=Ge.firstChild,qe=Ke.firstChild,Je=qe.firstChild,Ye=Je.nextSibling,Xe=qe.nextSibling,Ze=Xe.firstChild,[Qe,$e]=m(Ze.nextSibling),et=Qe.nextSibling.nextSibling,[tt,nt]=m(et.nextSibling),rt=Ke.nextSibling,[it,at]=m(rt.nextSibling),ot=it.nextSibling.firstChild,st=ot.nextSibling,ct=st.firstChild,lt=ct.nextSibling.nextSibling,[ut,dt]=m(lt.nextSibling),ft=st.nextSibling;return n.addEventListener(`submit`,je),g.$$click=()=>b(null),u(g,()=>s(`menus.back`),v,y),u(x,()=>s(`menus.editor.eyebrow`)),u(S,(()=>{var t=h(()=>!!e().id);return()=>t()?s(`menus.edit`):s(`menus.create`)})()),C.$$click=()=>b(null),u(C,()=>s(`common.cancel`)),u(w,(()=>{var e=h(()=>!!Ce());return()=>e()?s(`common.loading`):s(`common.save`)})()),u(E,()=>s(`menus.name`),D,te),O.$$input=e=>Q({name:e.currentTarget.value}),u(k,()=>s(`menus.slug`),I,ue),L.$$input=e=>Q({slug:e.currentTarget.value}),u(B,()=>s(`menus.editor.addItems`)),u(R,i(G,{get title(){return s(`menus.sources.pages`)},open:!0,get children(){return[(()=>{var e=f(ne);return e.$$input=e=>me(e.currentTarget.value),a(()=>p(e,`placeholder`,s(`menus.editor.search`))),a(()=>d(e,`value`,W())),l(),e})(),(()=>{var e=f(A);return u(e,i(o,{get each(){return Ne()},children:e=>(()=>{var t=f(oe),n=t.firstChild,r=n.nextSibling,i=r.firstChild,[o,s]=m(i.nextSibling),c=o.nextSibling,l=c.firstChild.nextSibling,[p,h]=m(l.nextSibling);return n.addEventListener(`change`,t=>q(t.currentTarget.checked?[...K(),`page:${e.id}`]:K().filter(t=>t!==`page:${e.id}`))),u(r,()=>e.title,o,s),u(c,()=>e.slug,p,h),a(()=>d(n,`checked`,K().includes(`page:${e.id}`))),t})()})),e})(),(()=>{var e=f(j);return e.$$click=()=>ke(Ne().map(Fe)),u(e,()=>s(`menus.editor.addSelected`)),l(),e})()]}}),de,pe),u(R,i(G,{get title(){return s(`menus.sources.posts`)},get children(){return[(()=>{var e=f(ne);return e.$$input=e=>ge(e.currentTarget.value),a(()=>p(e,`placeholder`,s(`menus.editor.search`))),a(()=>d(e,`value`,he())),l(),e})(),(()=>{var e=f(A);return u(e,i(o,{get each(){return Pe()},children:e=>(()=>{var t=f(se),n=t.firstChild,r=n.nextSibling,i=r.firstChild,[o,s]=m(i.nextSibling),c=o.nextSibling,l=c.firstChild.nextSibling,[p,h]=m(l.nextSibling);return n.addEventListener(`change`,t=>q(t.currentTarget.checked?[...K(),`post:${e.id}`]:K().filter(t=>t!==`post:${e.id}`))),u(r,()=>e.title,o,s),u(c,()=>e.slug,p,h),a(()=>d(n,`checked`,K().includes(`post:${e.id}`))),t})()})),e})(),(()=>{var e=f(j);return e.$$click=()=>ke(Pe().map(Ie)),u(e,()=>s(`menus.editor.addSelected`)),l(),e})()]}}),xe,Se),u(R,i(G,{get title(){return s(`menus.sources.contentTypes`)},get children(){return i(o,{get each(){return V().filter(e=>e.slug!==`page`&&e.slug!==`post`&&!e.singleton)},children:e=>(()=>{var t=f(M),n=t.firstChild,r=n.nextSibling,[a,s]=m(r.nextSibling);return u(n,()=>e.pluralLabel),u(t,i(o,{get each(){return z()[e.slug]??[]},children:t=>(()=>{var n=f(N),r=n.firstChild,[i,a]=m(r.nextSibling),o=i.nextSibling,s=o.firstChild.nextSibling,[c,d]=m(s.nextSibling),p=c.nextSibling.nextSibling,[h,g]=m(p.nextSibling);return n.$$click=()=>$(Le(t)),u(n,()=>t.title,i,a),u(o,()=>e.slug,c,d),u(o,()=>t.slug,h,g),l(),n})()}),a,s),t})()})}}),Te,X),u(R,i(G,{get title(){return s(`menus.sources.custom`)},get description(){return s(`menus.sources.customHint`)},get children(){return[(()=>{var e=f(re),t=e.firstChild,[n,r]=m(t.nextSibling),i=n.nextSibling;return u(e,()=>s(`menus.editor.url`),n,r),i.$$input=e=>ye(e.currentTarget.value),a(()=>d(i,`value`,J())),l(),e})(),(()=>{var e=f(ie),t=e.firstChild,[n,r]=m(t.nextSibling),i=n.nextSibling;return u(e,()=>s(`menus.editor.navigationLabel`),n,r),i.$$input=e=>be(e.currentTarget.value),a(()=>d(i,`value`,Y())),l(),e})(),(()=>{var e=f(j);return e.$$click=Ae,u(e,()=>s(`menus.editor.addToMenu`)),l(),e})()]}}),Z,De),u(R,i(G,{get title(){return s(`menus.sources.home`)},get children(){var e=f(j);return e.$$click=()=>$({id:`home`,type:`home`,label:s(`menus.sources.home`),url:`/`}),u(e,()=>s(`menus.editor.addToMenu`)),l(),e}}),Me,Re),u(R,i(G,{get title(){return s(`menus.sources.archives`)},get children(){var e=f(A);return u(e,i(o,{get each(){return V().filter(e=>e.hasArchive)},children:e=>(()=>{var t=f(ce),n=t.firstChild,[r,i]=m(n.nextSibling),a=r.nextSibling,o=a.firstChild.nextSibling,[s,c]=m(o.nextSibling);return t.$$click=()=>$({id:`archive:${e.slug}`,type:`archive`,label:e.pluralLabel,url:`/${e.slug}`,objectType:e.slug}),u(t,()=>e.pluralLabel,r,i),u(a,()=>e.slug,s,c),l(),t})()})),e}}),Be,Ve),u(R,i(G,{get title(){return s(`menus.sources.taxonomies`)},get children(){return i(o,{get each(){return U()},children:e=>(()=>{var t=f(M),n=t.firstChild,r=n.nextSibling,[a,s]=m(r.nextSibling);return u(n,()=>e.name),u(t,i(o,{get each(){return fe()[e.slug]??[]},children:t=>(()=>{var n=f(N),r=n.firstChild,[i,a]=m(r.nextSibling),o=i.nextSibling,s=o.firstChild.nextSibling,[c,d]=m(s.nextSibling),p=c.nextSibling.nextSibling,[h,g]=m(p.nextSibling);return n.$$click=()=>$({id:`term:${e.slug}:${t.slug}`,type:`taxonomy`,label:t.name,url:`/${e.slug}/${t.slug}`,objectId:t.id,objectType:e.slug}),u(n,()=>t.name,i,a),u(o,()=>e.slug,c,d),u(o,()=>t.slug,h,g),l(),n})()}),a,s),t})()})}}),Ue,We),u(Je,()=>s(`menus.editor.structure`)),u(Ye,()=>s(`menus.editor.structureHint`)),u(Xe,()=>e().items.length,Qe,$e),u(Xe,()=>s(`menus.items`),tt,nt),u(Ge,i(t,{get when(){return e().items.length>0},get fallback(){return(()=>{var e=f(le);return u(e,()=>s(`menus.editor.empty`)),e})()},get children(){return i(ve,{get items(){return e().items},t:s,onChange:e=>Q({items:e})})}}),it,at),u(ot,()=>s(`menus.editor.settings`)),ct.addEventListener(`change`,t=>Q({settings:{...e().settings,autoAddNewPages:t.currentTarget.checked}})),u(st,()=>s(`menus.editor.autoAddPages`),ut,dt),u(ft,()=>s(`menus.editor.autoAddPagesHint`)),a(t=>{var n=Ce(),r=F(e().name);return n!==t.e&&d(w,`disabled`,t.e=n),r!==t.t&&p(L,`placeholder`,t.t=r),t},{e:void 0,t:void 0}),a(()=>d(O,`value`,e().name)),a(()=>d(L,`value`,e().slug)),a(()=>d(ct,`checked`,e().settings.autoAddNewPages===!0)),l(),n})()})}}),P,I),e})()}c([`click`,`input`]);export{K as MenuManager};
|
|
1
|
+
import{S as e,a as t,f as n,h as r,l as i,p as a,r as o}from"./solid.Ck4Vtfe4.js";import{_ as s,a as c,f as l,l as u,m as d,o as f,p,s as m,u as h}from"./web.DD6VKaIp.js";import{n as g}from"./i18n.DQYU1D_P.js";import{n as _}from"./api.fpBzBw4U.js";var v=s(`<div class=wp-menu-empty-level>`),y=s(`<div class=wp-menu-tree><!$><!/><!$><!/>`),b=s(`<article class=wp-menu-item><div class=wp-menu-item__header><span class=wp-menu-drag draggable=true>⠿⠿⠿</span><span class=wp-menu-item__label><strong></strong><small></small></span><div class=wp-menu-item__actions><button type=button class="btn btn-sm">↑</button><button type=button class="btn btn-sm">↓</button><button type=button class="btn btn-sm">→</button><button type=button class="btn btn-sm">←</button></div></div><details class=wp-menu-item__details><summary></summary><div class=wp-menu-item__fields><label><!$><!/><input class=input></label><label><!$><!/><input class=input></label><label><!$><!/><input class=input></label><label><!$><!/><input class=input></label><label><!$><!/><select class=input><option value=_self></option><option value=_blank></option></select></label><label><!$><!/><input class=input></label><label class=wp-menu-item__wide><!$><!/><textarea class=input rows=2></textarea></label><button type=button class="btn btn-danger btn-sm"></button></div></details><!$><!/>`),x=s(`<p class=muted>`),S=s(`<details class=wp-menu-box><summary></summary><div class=wp-menu-box__body><!$><!/><!$><!/>`),C=s(`<div class="notice notice--error">`),w=s(`<div class=notice>`),T=s(`<div class="menus-manager wp-menus-manager"><!$><!/><!$><!/><!$><!/><style>.wp-menu-editor__top,.wp-structure-heading,.wp-menu-editor__identity,.wp-menu-item__header,.wp-menu-item__actions,.form-actions{display:flex;align-items:center;gap:.7rem}.wp-menu-editor__top,.wp-structure-heading{justify-content:space-between}.wp-menu-editor__top{margin-bottom:1rem}.wp-menu-editor__top h3{margin:.25rem 0 0}.wp-eyebrow{display:block;margin-top:.7rem;font-size:.72rem;text-transform:uppercase;letter-spacing:.08em;color:var(--color-muted)}.wp-menu-editor__identity{margin-bottom:1rem;align-items:end}.wp-menu-editor__identity label{display:grid;gap:.35rem;flex:1}.wp-menu-editor__columns{display:grid;grid-template-columns:330px minmax(0,1fr);gap:1.2rem;align-items:start}.wp-menu-sources,.wp-menu-structure{min-width:0}.wp-menu-sources>h4,.wp-structure-heading h4{margin:0}.wp-menu-box{background:var(--color-surface,#fff);border:1px solid var(--color-border,#ddd);margin-bottom:.7rem}.wp-menu-box summary{cursor:pointer;padding:.8rem;font-weight:600}.wp-menu-box__body{padding:0 .8rem .8rem;display:grid;gap:.6rem}.wp-menu-box__body p{margin:0}.wp-source-list{display:grid;gap:.35rem;max-height:220px;overflow:auto;border:1px solid var(--color-border,#ddd);padding:.45rem}.wp-source-row{display:flex!important;align-items:start;gap:.45rem!important;padding:.3rem}.wp-source-row span,.wp-source-link{display:grid;gap:.12rem;text-align:left}.wp-source-row small,.wp-source-link small,.wp-menu-item__label small{color:var(--color-muted);font-size:.75rem}.wp-source-link{border:0;background:none;color:inherit;padding:.35rem;width:100%;cursor:pointer}.wp-source-link:hover{background:var(--color-surface-muted,#f5f5f5)}.wp-taxonomy-source{display:grid;gap:.2rem;border-top:1px solid var(--color-border,#ddd);padding-top:.5rem}.wp-taxonomy-source:first-child{border-top:0;padding-top:0}.wp-menu-structure{background:var(--color-surface-muted,#f7f7f7);padding:1rem}.wp-menu-structure .wp-structure-heading{margin-bottom:1rem}.wp-menu-tree{display:grid;gap:.55rem}.wp-menu-tree[data-depth="1"]{margin:.55rem 0 0 2rem}.wp-menu-item{background:var(--color-surface,#fff);border:1px solid var(--color-border,#dcdcde);box-shadow:0 1px 1px rgba(0,0,0,.04)}.wp-menu-item__header{padding:.55rem .7rem}.wp-menu-drag{cursor:grab;letter-spacing:-.2rem;width:1.4rem;color:var(--color-muted);user-select:none}.wp-menu-item__label{display:grid;gap:.15rem;flex:1;min-width:0}.wp-menu-item__label small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-menu-item__actions{margin-left:auto}.wp-menu-item__details{border-top:1px solid var(--color-border,#ddd)}.wp-menu-item__details summary{padding:.5rem .7rem;cursor:pointer;color:var(--color-muted);font-size:.85rem}.wp-menu-item__fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.7rem;padding:.7rem;border-top:1px solid var(--color-border,#ddd)}.wp-menu-item__fields label{display:grid;gap:.3rem}.wp-menu-item__wide{grid-column:1/-1}.wp-menu-empty,.wp-menu-empty-level{text-align:center;padding:2rem;color:var(--color-muted)}.wp-menu-empty-level{border:1px dashed var(--color-border,#ccc);padding:1rem}.wp-menu-settings{margin-top:1rem}.wp-menu-settings h4{margin-top:0}.wp-menu-settings p{margin-bottom:0}.wp-menus-manager .menu-actions{white-space:nowrap;text-align:right}@media(max-width:850px){.wp-menu-editor__columns{grid-template-columns:1fr}.wp-menu-sources{order:2}.wp-menu-structure{order:1}.wp-menu-editor__identity,.wp-menu-editor__top{align-items:stretch;display:grid}.wp-menu-item__fields{grid-template-columns:1fr}.wp-menu-item__wide{grid-column:auto}}`),E=s(`<div class=skeleton>`),ee=s(`<div class=manager-toolbar><p class=muted></p><button class="btn btn-primary"type=button>+ <!$><!/>`),D=s(`<table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody>`),te=s(`<section class=card>`),O=s(`<p class="muted empty-state">`),k=s(`<tr><td><strong></strong></td><td><code></code></td><td></td><td class=menu-actions><button class="btn btn-secondary btn-sm"type=button></button> <button class="btn btn-danger btn-sm"type=button>`),ne=s(`<input class=input>`),A=s(`<div class=wp-source-list>`),j=s(`<button type=button class="btn btn-secondary btn-sm">`),re=s(`<label><!$><!/><input class=input placeholder=https://>`),ie=s(`<label><!$><!/><input class=input>`),ae=s(`<form class=wp-menu-editor><div class=wp-menu-editor__top><div><button type=button class="btn btn-secondary btn-sm">← <!$><!/></button><span class=wp-eyebrow></span><h3></h3></div><div class=form-actions><button class="btn btn-secondary"type=button></button><button class="btn btn-primary"type=submit></button></div></div><div class="wp-menu-editor__identity card"><label><!$><!/><input class=input required></label><label><!$><!/><input class=input></label></div><div class=wp-menu-editor__columns><aside class=wp-menu-sources><h4></h4><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/></aside><main class=wp-menu-structure><div class=wp-structure-heading><div><h4></h4><p class=muted></p></div><span class=badge><!$><!/> <!$><!/></span></div><!$><!/><section class="card wp-menu-settings"><h4></h4><label class=checkbox-label><input type=checkbox> <!$><!/></label><p class=muted>`),oe=s(`<label class=wp-source-row><input type=checkbox><span><!$><!/><small>/<!$><!/>`),se=s(`<label class=wp-source-row><input type=checkbox><span><!$><!/><small>/post/<!$><!/>`),M=s(`<div class=wp-taxonomy-source><strong></strong><!$><!/>`),N=s(`<button type=button class=wp-source-link><!$><!/><small>/<!$><!/>/<!$><!/>`),ce=s(`<button type=button class=wp-source-link><!$><!/><small>/<!$><!/>`),le=s(`<div class="wp-menu-empty card">`);function P(e){return`${e}_${typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():Math.random().toString(36).slice(2)}`}function F(e){return e.toLowerCase().normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/(^-|-$)/g,``)}function I(e,t=null){let n=e.id||P(`item`);return{...e,id:n,clientId:n,parentId:t??e.parentId??null,children:[]}}function ue(e){let t=(Array.isArray(e)?e:[]).map(e=>I(e)),n=new Map(t.map(e=>[e.id,e])),r=[];for(let e of t){let t=e.parentId?n.get(e.parentId):void 0;t&&t.id!==e.id?t.children.push(e):r.push(e)}let i=e=>(e.sort((e,t)=>(e.order??0)-(t.order??0)),e.forEach(e=>i(e.children)),e);return i(r)}function L(e,t=null){let n=[];return e.forEach((e,r)=>{let{clientId:i,children:a,...o}=e;n.push({...o,id:e.id,parentId:t,order:r}),n.push(...L(a,e.id))}),n}function R(e){return e.map(e=>({...e,children:R(e.children)}))}function z(e,t){return e.id===t||e.children.some(e=>z(e,t))}function B(e,t){let n=e.findIndex(e=>e.id===t);if(n>=0){let t=[...e],[r]=t.splice(n,1);return{items:t,removed:r}}for(let n=0;n<e.length;n+=1){let r=B(e[n].children,t);if(r.removed){let t=[...e];return t[n]={...t[n],children:r.items},{items:t,removed:r.removed}}}return{items:e}}function V(e,t,n){let r=e.findIndex(e=>e.id===t);if(r>=0){let t=[...e];return t.splice(r,0,n),{items:t,inserted:!0}}for(let r=0;r<e.length;r+=1){let i=V(e[r].children,t,n);if(i.inserted){let t=[...e];return t[r]={...t[r],children:i.items},{items:t,inserted:!0}}}return{items:e,inserted:!1}}function H(e,t,n){for(let r=0;r<e.length;r+=1){let i=e[r];if(i.id===t){let t=[...e];return t[r]={...i,children:[...i.children,n]},{items:t,inserted:!0}}let a=H(i.children,t,n);if(a.inserted){let t=[...e];return t[r]={...i,children:a.items},{items:t,inserted:!0}}}return{items:e,inserted:!1}}function U(e,t,n){return e.map(e=>e.id===t?{...e,...n}:{...e,children:U(e.children,t,n)})}function de(e,t){return B(e,t).items}function fe(e,t,n){if(t===n||e.some(e=>e.id===t&&z(e,n)))return e;let r=B(e,t);if(!r.removed)return e;let i=V(r.items,n,r.removed);return i.inserted?i.items:e}function pe(e,t,n){if(t===n||e.some(e=>e.id===t&&z(e,n)))return e;let r=B(e,t);if(!r.removed)return e;let i=H(r.items,n,r.removed);return i.inserted?i.items:e}function W(e,t,n){let r=e.findIndex(e=>e.id===t);if(r>=0)return{siblings:e,index:r,parent:n};for(let n of e){let e=W(n.children,t,n);if(e)return e}return null}function me(e,t,n){let r=R(e),i=W(r,t);if(!i)return e;let a=i.index+n;return a<0||a>=i.siblings.length?e:([i.siblings[i.index],i.siblings[a]]=[i.siblings[a],i.siblings[i.index]],r)}function he(e,t){let n=R(e),r=W(n,t);return!r||r.index===0?e:pe(n,t,r.siblings[r.index-1].id)}function ge(e,t){let n=R(e),r=W(n,t);return r?.parent?fe(n,t,r.parent.id):e}function _e(e){let t=P(`item`);return{id:t,clientId:t,type:e.type,label:e.label,url:e.url,objectId:e.objectId,objectType:e.objectType,parentId:null,order:0,target:`_self`,children:[]}}function ve(e){let[n,s]=r(null);return(()=>{var r=f(y),c=r.firstChild,[h,g]=m(c.nextSibling),_=h.nextSibling,[x,S]=m(_.nextSibling);return u(r,i(o,{get each(){return e.items},children:r=>(()=>{var o=f(b),c=o.firstChild,h=c.firstChild,g=h.nextSibling,_=g.firstChild,v=_.nextSibling,y=g.nextSibling.firstChild,x=y.nextSibling,S=x.nextSibling,C=S.nextSibling,w=c.nextSibling,T=w.firstChild,E=T.nextSibling.firstChild,ee=E.firstChild,[D,te]=m(ee.nextSibling),O=D.nextSibling,k=E.nextSibling,ne=k.firstChild,[A,j]=m(ne.nextSibling),re=A.nextSibling,ie=k.nextSibling,ae=ie.firstChild,[oe,se]=m(ae.nextSibling),M=oe.nextSibling,N=ie.nextSibling,ce=N.firstChild,[le,P]=m(ce.nextSibling),F=le.nextSibling,I=N.nextSibling,ue=I.firstChild,[L,R]=m(ue.nextSibling),z=L.nextSibling,B=z.firstChild,V=B.nextSibling,H=I.nextSibling,pe=H.firstChild,[W,_e]=m(pe.nextSibling),G=W.nextSibling,K=H.nextSibling,q=K.firstChild,[J,ye]=m(q.nextSibling),Y=J.nextSibling,be=K.nextSibling,xe=w.nextSibling,[Se,Ce]=m(xe.nextSibling);return o.addEventListener(`drop`,t=>{t.preventDefault();let i=n()??t.dataTransfer?.getData(`text/plain`);i&&e.onChange(fe(e.items,i,r.id)),s(null)}),o.addEventListener(`dragover`,e=>e.preventDefault()),h.addEventListener(`dragend`,()=>s(null)),h.addEventListener(`dragstart`,e=>{s(r.id),e.dataTransfer?.setData(`text/plain`,r.id)}),u(_,()=>r.label||e.t(`menus.editor.untitled`)),u(v,()=>r.url||e.t(`menus.editor.noUrl`)),y.$$click=()=>e.onChange(me(e.items,r.id,-1)),x.$$click=()=>e.onChange(me(e.items,r.id,1)),S.$$click=()=>e.onChange(he(e.items,r.id)),C.$$click=()=>e.onChange(ge(e.items,r.id)),u(T,()=>e.t(`menus.editor.itemSettings`)),u(E,()=>e.t(`menus.editor.navigationLabel`),D,te),O.$$input=t=>e.onChange(U(e.items,r.id,{label:t.currentTarget.value})),u(k,()=>e.t(`menus.editor.url`),A,j),re.$$input=t=>e.onChange(U(e.items,r.id,{url:t.currentTarget.value})),u(ie,()=>e.t(`menus.editor.titleAttribute`),oe,se),M.$$input=t=>e.onChange(U(e.items,r.id,{attrTitle:t.currentTarget.value})),u(N,()=>e.t(`menus.editor.cssClasses`),le,P),F.$$input=t=>e.onChange(U(e.items,r.id,{cssClasses:t.currentTarget.value})),u(I,()=>e.t(`menus.editor.target`),L,R),z.addEventListener(`change`,t=>e.onChange(U(e.items,r.id,{target:t.currentTarget.value}))),u(B,()=>e.t(`menus.editor.sameWindow`)),u(V,()=>e.t(`menus.editor.newWindow`)),u(H,()=>e.t(`menus.editor.xfn`),W,_e),G.$$input=t=>e.onChange(U(e.items,r.id,{xfn:t.currentTarget.value})),u(K,()=>e.t(`menus.editor.description`),J,ye),Y.$$input=t=>e.onChange(U(e.items,r.id,{description:t.currentTarget.value})),be.$$click=()=>e.onChange(de(e.items,r.id)),u(be,()=>e.t(`menus.editor.remove`)),u(o,i(t,{get when(){return r.children.length>0},get children(){return i(ve,{get items(){return r.children},get depth(){return(e.depth??0)+1},get t(){return e.t},onChange:t=>e.onChange(U(e.items,r.id,{children:t}))})}}),Se,Ce),a(t=>{var n=e.t(`menus.editor.drag`),r=e.t(`menus.editor.up`),i=e.t(`menus.editor.down`),a=e.t(`menus.editor.indent`),o=e.t(`menus.editor.outdent`);return n!==t.e&&p(h,`title`,t.e=n),r!==t.t&&p(y,`title`,t.t=r),i!==t.a&&p(x,`title`,t.a=i),a!==t.o&&p(S,`title`,t.o=a),o!==t.i&&p(C,`title`,t.i=o),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),a(()=>d(O,`value`,r.label)),a(()=>d(re,`value`,r.url??``)),a(()=>d(M,`value`,r.attrTitle??``)),a(()=>d(F,`value`,r.cssClasses??``)),a(()=>d(z,`value`,r.target??`_self`)),a(()=>d(G,`value`,r.xfn??``)),a(()=>d(Y,`value`,r.description??``)),l(),o})()}),h,g),u(r,i(t,{get when(){return e.items.length===0},get children(){var t=f(v);return u(t,()=>e.t(`menus.editor.emptyLevel`)),t}}),x,S),a(()=>p(r,`data-depth`,e.depth??0)),r})()}function G(e){return(()=>{var n=f(S),r=n.firstChild,o=r.nextSibling,s=o.firstChild,[c,l]=m(s.nextSibling),p=c.nextSibling,[h,g]=m(p.nextSibling);return u(r,()=>e.title),u(o,i(t,{get when(){return e.description},get children(){var t=f(x);return u(t,()=>e.description),t}}),c,l),u(o,()=>e.children,h,g),a(()=>d(n,`open`,e.open)),n})()}function K(){let{t:s}=g(),[c,v]=r([]),[y,b]=r(null),[x,S]=r([]),[I,R]=r([]),[z,B]=r({}),[V,H]=r([]),[U,de]=r([]),[fe,pe]=r({}),[W,me]=r(``),[he,ge]=r(``),[K,q]=r([]),[J,ye]=r(``),[Y,be]=r(``),[xe,Se]=r(!0),[Ce,we]=r(!1),[Te,X]=r(``),[Ee,Z]=r(``),De=async()=>{Se(!0),X(``);try{let[e,t,n,r,i]=await Promise.all([_.getMenus(),_.getContent({type:`page`,status:`PUBLISHED`,limit:100}),_.getContent({type:`post`,status:`PUBLISHED`,limit:100}),_.getContentTypes(),_.getTaxonomies()]);v(e),S(t.data),R(n.data),H(r),de(i);let a=await Promise.all(r.filter(e=>e.slug!==`page`&&e.slug!==`post`&&!e.singleton).map(async e=>[e.slug,(await _.getContent({type:e.slug,status:`PUBLISHED`,limit:100})).data]));B(Object.fromEntries(a));let o=await Promise.all(i.map(async e=>[e.slug,await _.getTaxonomyTerms(e.slug)]));pe(Object.fromEntries(o))}catch(e){X(e instanceof Error?e.message:String(e))}finally{Se(!1)}};e(De);let Oe=e=>{b({id:e?.id,name:e?.name??``,slug:e?.slug??``,items:ue(e?.items),settings:{...e?.settings??{}}}),q([]),X(``),Z(``)},Q=e=>{let t=y();t&&b({...t,...e})},$=e=>{let t=y();t&&Q({items:[...t.items,_e(e)]})},ke=e=>{let t=new Set(K()),n=y();n&&(Q({items:[...n.items,...e.filter(e=>t.has(e.id)).map(_e)]}),q([]))},Ae=()=>{J().trim()&&Y().trim()&&($({id:P(`custom`),type:`custom`,label:Y().trim(),url:J().trim()}),ye(``),be(``))},je=async e=>{e.preventDefault();let t=y();if(t){if(!t.name.trim()){X(s(`menus.nameRequired`));return}we(!0),X(``);try{let e={name:t.name.trim(),slug:t.slug.trim()||F(t.name),items:L(t.items),settings:t.settings};t.id?await _.updateMenu(t.id,e):await _.createMenu(e),b(null),Z(s(`menus.saved`)),await De()}catch(e){X(e instanceof Error?e.message:String(e))}finally{we(!1)}}},Me=async e=>{if(e.id&&confirm(s(`menus.confirmDelete`,{name:e.name})))try{await _.deleteMenu(e.id),Z(s(`menus.deleted`)),await De()}catch(e){X(e instanceof Error?e.message:String(e))}},Ne=n(()=>x().filter(e=>!W()||`${e.title} ${e.slug}`.toLowerCase().includes(W().toLowerCase()))),Pe=n(()=>I().filter(e=>!he()||`${e.title} ${e.slug}`.toLowerCase().includes(he().toLowerCase()))),Fe=e=>({id:`page:${e.id}`,type:`page`,label:e.title,url:`/${e.slug}`,objectId:e.id,objectType:`page`}),Ie=e=>({id:`post:${e.id}`,type:`post`,label:e.title,url:`/post/${e.slug}`,objectId:e.id,objectType:`post`}),Le=e=>({id:`content:${e.type}:${e.id}`,type:`content`,label:e.title,url:`/${e.type}/${e.slug}`,objectId:e.id,objectType:e.type});return(()=>{var e=f(T),n=e.firstChild,[r,g]=m(n.nextSibling),_=r.nextSibling,[v,x]=m(_.nextSibling),S=v.nextSibling,[P,I]=m(S.nextSibling);return P.nextSibling,u(e,i(t,{get when(){return Te()},get children(){var e=f(C);return u(e,Te),e}}),r,g),u(e,i(t,{get when(){return Ee()},get children(){var e=f(w);return u(e,Ee),e}}),v,x),u(e,i(t,{get when(){return!xe()},get fallback(){return(()=>{var e=f(E);return u(e,()=>s(`common.loading`)),e})()},get children(){return i(t,{get when(){return y()},get fallback(){return[(()=>{var e=f(ee),t=e.firstChild,n=t.nextSibling,r=n.firstChild.nextSibling,[i,a]=m(r.nextSibling);return u(t,()=>s(`menus.hint`)),n.$$click=()=>Oe(),u(n,()=>s(`menus.new`),i,a),l(),e})(),(()=>{var e=f(te);return u(e,i(t,{get when(){return c().length>0},get fallback(){return(()=>{var e=f(O);return u(e,()=>s(`menus.empty`)),e})()},get children(){var e=f(D),t=e.firstChild,n=t.firstChild.firstChild,r=n.nextSibling,a=r.nextSibling,d=t.nextSibling;return u(n,()=>s(`menus.name`)),u(r,()=>s(`menus.slug`)),u(a,()=>s(`menus.items`)),u(d,i(o,{get each(){return c()},children:e=>(()=>{var t=f(k),n=t.firstChild,r=n.firstChild,i=n.nextSibling,a=i.firstChild,o=i.nextSibling,c=o.nextSibling.firstChild,d=c.nextSibling.nextSibling;return u(r,()=>e.name),u(a,()=>e.slug),u(o,()=>e.items?.length??0),c.$$click=()=>Oe(e),u(c,()=>s(`common.edit`)),d.$$click=()=>void Me(e),u(d,()=>s(`common.delete`)),l(),t})()})),e}})),e})()]},children:e=>(()=>{var n=f(ae),r=n.firstChild,c=r.firstChild,g=c.firstChild,_=g.firstChild.nextSibling,[v,y]=m(_.nextSibling),x=g.nextSibling,S=x.nextSibling,C=c.nextSibling.firstChild,w=C.nextSibling,T=r.nextSibling,E=T.firstChild,ee=E.firstChild,[D,te]=m(ee.nextSibling),O=D.nextSibling,k=E.nextSibling,P=k.firstChild,[I,ue]=m(P.nextSibling),L=I.nextSibling,R=T.nextSibling.firstChild,B=R.firstChild,H=B.nextSibling,[de,pe]=m(H.nextSibling),_e=de.nextSibling,[xe,Se]=m(_e.nextSibling),we=xe.nextSibling,[Te,X]=m(we.nextSibling),Ee=Te.nextSibling,[Z,De]=m(Ee.nextSibling),Oe=Z.nextSibling,[Me,Re]=m(Oe.nextSibling),ze=Me.nextSibling,[Be,Ve]=m(ze.nextSibling),He=Be.nextSibling,[Ue,We]=m(He.nextSibling),Ge=R.nextSibling,Ke=Ge.firstChild,qe=Ke.firstChild,Je=qe.firstChild,Ye=Je.nextSibling,Xe=qe.nextSibling,Ze=Xe.firstChild,[Qe,$e]=m(Ze.nextSibling),et=Qe.nextSibling.nextSibling,[tt,nt]=m(et.nextSibling),rt=Ke.nextSibling,[it,at]=m(rt.nextSibling),ot=it.nextSibling.firstChild,st=ot.nextSibling,ct=st.firstChild,lt=ct.nextSibling.nextSibling,[ut,dt]=m(lt.nextSibling),ft=st.nextSibling;return n.addEventListener(`submit`,je),g.$$click=()=>b(null),u(g,()=>s(`menus.back`),v,y),u(x,()=>s(`menus.editor.eyebrow`)),u(S,(()=>{var t=h(()=>!!e().id);return()=>t()?s(`menus.edit`):s(`menus.create`)})()),C.$$click=()=>b(null),u(C,()=>s(`common.cancel`)),u(w,(()=>{var e=h(()=>!!Ce());return()=>e()?s(`common.loading`):s(`common.save`)})()),u(E,()=>s(`menus.name`),D,te),O.$$input=e=>Q({name:e.currentTarget.value}),u(k,()=>s(`menus.slug`),I,ue),L.$$input=e=>Q({slug:e.currentTarget.value}),u(B,()=>s(`menus.editor.addItems`)),u(R,i(G,{get title(){return s(`menus.sources.pages`)},open:!0,get children(){return[(()=>{var e=f(ne);return e.$$input=e=>me(e.currentTarget.value),a(()=>p(e,`placeholder`,s(`menus.editor.search`))),a(()=>d(e,`value`,W())),l(),e})(),(()=>{var e=f(A);return u(e,i(o,{get each(){return Ne()},children:e=>(()=>{var t=f(oe),n=t.firstChild,r=n.nextSibling,i=r.firstChild,[o,s]=m(i.nextSibling),c=o.nextSibling,l=c.firstChild.nextSibling,[p,h]=m(l.nextSibling);return n.addEventListener(`change`,t=>q(t.currentTarget.checked?[...K(),`page:${e.id}`]:K().filter(t=>t!==`page:${e.id}`))),u(r,()=>e.title,o,s),u(c,()=>e.slug,p,h),a(()=>d(n,`checked`,K().includes(`page:${e.id}`))),t})()})),e})(),(()=>{var e=f(j);return e.$$click=()=>ke(Ne().map(Fe)),u(e,()=>s(`menus.editor.addSelected`)),l(),e})()]}}),de,pe),u(R,i(G,{get title(){return s(`menus.sources.posts`)},get children(){return[(()=>{var e=f(ne);return e.$$input=e=>ge(e.currentTarget.value),a(()=>p(e,`placeholder`,s(`menus.editor.search`))),a(()=>d(e,`value`,he())),l(),e})(),(()=>{var e=f(A);return u(e,i(o,{get each(){return Pe()},children:e=>(()=>{var t=f(se),n=t.firstChild,r=n.nextSibling,i=r.firstChild,[o,s]=m(i.nextSibling),c=o.nextSibling,l=c.firstChild.nextSibling,[p,h]=m(l.nextSibling);return n.addEventListener(`change`,t=>q(t.currentTarget.checked?[...K(),`post:${e.id}`]:K().filter(t=>t!==`post:${e.id}`))),u(r,()=>e.title,o,s),u(c,()=>e.slug,p,h),a(()=>d(n,`checked`,K().includes(`post:${e.id}`))),t})()})),e})(),(()=>{var e=f(j);return e.$$click=()=>ke(Pe().map(Ie)),u(e,()=>s(`menus.editor.addSelected`)),l(),e})()]}}),xe,Se),u(R,i(G,{get title(){return s(`menus.sources.contentTypes`)},get children(){return i(o,{get each(){return V().filter(e=>e.slug!==`page`&&e.slug!==`post`&&!e.singleton)},children:e=>(()=>{var t=f(M),n=t.firstChild,r=n.nextSibling,[a,s]=m(r.nextSibling);return u(n,()=>e.pluralLabel),u(t,i(o,{get each(){return z()[e.slug]??[]},children:t=>(()=>{var n=f(N),r=n.firstChild,[i,a]=m(r.nextSibling),o=i.nextSibling,s=o.firstChild.nextSibling,[c,d]=m(s.nextSibling),p=c.nextSibling.nextSibling,[h,g]=m(p.nextSibling);return n.$$click=()=>$(Le(t)),u(n,()=>t.title,i,a),u(o,()=>e.slug,c,d),u(o,()=>t.slug,h,g),l(),n})()}),a,s),t})()})}}),Te,X),u(R,i(G,{get title(){return s(`menus.sources.custom`)},get description(){return s(`menus.sources.customHint`)},get children(){return[(()=>{var e=f(re),t=e.firstChild,[n,r]=m(t.nextSibling),i=n.nextSibling;return u(e,()=>s(`menus.editor.url`),n,r),i.$$input=e=>ye(e.currentTarget.value),a(()=>d(i,`value`,J())),l(),e})(),(()=>{var e=f(ie),t=e.firstChild,[n,r]=m(t.nextSibling),i=n.nextSibling;return u(e,()=>s(`menus.editor.navigationLabel`),n,r),i.$$input=e=>be(e.currentTarget.value),a(()=>d(i,`value`,Y())),l(),e})(),(()=>{var e=f(j);return e.$$click=Ae,u(e,()=>s(`menus.editor.addToMenu`)),l(),e})()]}}),Z,De),u(R,i(G,{get title(){return s(`menus.sources.home`)},get children(){var e=f(j);return e.$$click=()=>$({id:`home`,type:`home`,label:s(`menus.sources.home`),url:`/`}),u(e,()=>s(`menus.editor.addToMenu`)),l(),e}}),Me,Re),u(R,i(G,{get title(){return s(`menus.sources.archives`)},get children(){var e=f(A);return u(e,i(o,{get each(){return V().filter(e=>e.hasArchive)},children:e=>(()=>{var t=f(ce),n=t.firstChild,[r,i]=m(n.nextSibling),a=r.nextSibling,o=a.firstChild.nextSibling,[s,c]=m(o.nextSibling);return t.$$click=()=>$({id:`archive:${e.slug}`,type:`archive`,label:e.pluralLabel,url:`/${e.slug}`,objectType:e.slug}),u(t,()=>e.pluralLabel,r,i),u(a,()=>e.slug,s,c),l(),t})()})),e}}),Be,Ve),u(R,i(G,{get title(){return s(`menus.sources.taxonomies`)},get children(){return i(o,{get each(){return U()},children:e=>(()=>{var t=f(M),n=t.firstChild,r=n.nextSibling,[a,s]=m(r.nextSibling);return u(n,()=>e.name),u(t,i(o,{get each(){return fe()[e.slug]??[]},children:t=>(()=>{var n=f(N),r=n.firstChild,[i,a]=m(r.nextSibling),o=i.nextSibling,s=o.firstChild.nextSibling,[c,d]=m(s.nextSibling),p=c.nextSibling.nextSibling,[h,g]=m(p.nextSibling);return n.$$click=()=>$({id:`term:${e.slug}:${t.slug}`,type:`taxonomy`,label:t.name,url:`/${e.slug}/${t.slug}`,objectId:t.id,objectType:e.slug}),u(n,()=>t.name,i,a),u(o,()=>e.slug,c,d),u(o,()=>t.slug,h,g),l(),n})()}),a,s),t})()})}}),Ue,We),u(Je,()=>s(`menus.editor.structure`)),u(Ye,()=>s(`menus.editor.structureHint`)),u(Xe,()=>e().items.length,Qe,$e),u(Xe,()=>s(`menus.items`),tt,nt),u(Ge,i(t,{get when(){return e().items.length>0},get fallback(){return(()=>{var e=f(le);return u(e,()=>s(`menus.editor.empty`)),e})()},get children(){return i(ve,{get items(){return e().items},t:s,onChange:e=>Q({items:e})})}}),it,at),u(ot,()=>s(`menus.editor.settings`)),ct.addEventListener(`change`,t=>Q({settings:{...e().settings,autoAddNewPages:t.currentTarget.checked}})),u(st,()=>s(`menus.editor.autoAddPages`),ut,dt),u(ft,()=>s(`menus.editor.autoAddPagesHint`)),a(t=>{var n=Ce(),r=F(e().name);return n!==t.e&&d(w,`disabled`,t.e=n),r!==t.t&&p(L,`placeholder`,t.t=r),t},{e:void 0,t:void 0}),a(()=>d(O,`value`,e().name)),a(()=>d(L,`value`,e().slug)),a(()=>d(ct,`checked`,e().settings.autoAddNewPages===!0)),l(),n})()})}}),P,I),e})()}c([`click`,`input`]);export{K as MenuManager};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,d as t,l as n,p as r,x as i}from"./solid.Ck4Vtfe4.js";import{_ as a,a as o,f as s,l as c,o as l,p as u,s as d}from"./web.DD6VKaIp.js";import{n as f}from"./i18n.
|
|
1
|
+
import{a as e,d as t,l as n,p as r,x as i}from"./solid.Ck4Vtfe4.js";import{_ as a,a as o,f as s,l as c,o as l,p as u,s as d}from"./web.DD6VKaIp.js";import{n as f}from"./i18n.DQYU1D_P.js";var p=a(`<div class=modal-overlay role=presentation><section class=modal role=dialog aria-modal=true><header class=modal-header><h3></h3><button type=button class=modal-close>×</button></header><!$><!/>`);function m(a){let{t:o}=f();return t(()=>{if(!a.open)return;let e=e=>{e.key===`Escape`&&a.onClose()};document.addEventListener(`keydown`,e),i(()=>document.removeEventListener(`keydown`,e))}),n(e,{get when(){return a.open},get children(){var e=l(p),t=e.firstChild,n=t.firstChild,i=n.firstChild,f=i.nextSibling,m=n.nextSibling,[h,g]=d(m.nextSibling);return e.$$mousedown=e=>{e.target===e.currentTarget&&a.onClose()},c(i,()=>a.title),f.$$click=()=>a.onClose(),c(t,()=>a.children,h,g),r(e=>{var n=a.title,r=o(`common.close`);return n!==e.e&&u(t,`aria-label`,e.e=n),r!==e.t&&u(f,`aria-label`,e.t=r),e},{e:void 0,t:void 0}),s(),e}})}o([`mousedown`,`click`]);export{m as t};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import{S as e,h as t,l as n,p as r,r as i}from"./solid.Ck4Vtfe4.js";import{_ as a,a as o,f as s,i as c,l,o as u,s as d,u as f}from"./web.DD6VKaIp.js";import{n as p}from"./i18n.DQYU1D_P.js";import{n as m}from"./api.fpBzBw4U.js";var h=a(`<div class=plugin-manager><p class=page-hint></p><!$><!/><!$><!/><!$><!/><style>
|
|
2
|
+
.page-hint {
|
|
3
|
+
margin: 0 0 1.25rem;
|
|
4
|
+
color: var(--color-muted);
|
|
5
|
+
font-size: 0.8125rem;
|
|
6
|
+
}
|
|
7
|
+
.badge-enabled {
|
|
8
|
+
display: inline-block;
|
|
9
|
+
margin-left: 0.5rem;
|
|
10
|
+
padding: 0.125rem 0.375rem;
|
|
11
|
+
font-size: 0.625rem;
|
|
12
|
+
font-weight: 600;
|
|
13
|
+
text-transform: uppercase;
|
|
14
|
+
background: var(--color-success-soft);
|
|
15
|
+
color: var(--color-success);
|
|
16
|
+
border-radius: var(--radius-full);
|
|
17
|
+
}
|
|
18
|
+
.enabled-badge {
|
|
19
|
+
color: var(--color-success);
|
|
20
|
+
font-weight: 500;
|
|
21
|
+
}
|
|
22
|
+
.disabled-badge {
|
|
23
|
+
color: var(--color-muted);
|
|
24
|
+
font-weight: 500;
|
|
25
|
+
}
|
|
26
|
+
.plugins-table-container {
|
|
27
|
+
overflow-x: auto;
|
|
28
|
+
}
|
|
29
|
+
.table {
|
|
30
|
+
width: 100%;
|
|
31
|
+
border-collapse: collapse;
|
|
32
|
+
}
|
|
33
|
+
.table th,
|
|
34
|
+
.table td {
|
|
35
|
+
padding: 0.75rem 1rem;
|
|
36
|
+
text-align: left;
|
|
37
|
+
border-bottom: 1px solid var(--color-border);
|
|
38
|
+
}
|
|
39
|
+
.table th {
|
|
40
|
+
font-weight: 600;
|
|
41
|
+
color: var(--color-text);
|
|
42
|
+
background: var(--color-surface);
|
|
43
|
+
}
|
|
44
|
+
.plugin-row:hover {
|
|
45
|
+
background: var(--color-background);
|
|
46
|
+
}
|
|
47
|
+
.plugin-name {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
gap: 0.25rem;
|
|
51
|
+
}
|
|
52
|
+
.plugin-name strong {
|
|
53
|
+
font-weight: 500;
|
|
54
|
+
}
|
|
55
|
+
.plugin-description {
|
|
56
|
+
font-size: 0.75rem;
|
|
57
|
+
color: var(--color-muted);
|
|
58
|
+
}
|
|
59
|
+
.status-badge {
|
|
60
|
+
display: inline-flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
padding: 0.25rem 0.5rem;
|
|
63
|
+
border-radius: var(--radius-full);
|
|
64
|
+
font-size: 0.6875rem;
|
|
65
|
+
font-weight: 600;
|
|
66
|
+
text-transform: uppercase;
|
|
67
|
+
}
|
|
68
|
+
.status-active {
|
|
69
|
+
background: var(--color-success-soft);
|
|
70
|
+
color: var(--color-success);
|
|
71
|
+
}
|
|
72
|
+
.status-installed {
|
|
73
|
+
background: var(--color-primary-soft);
|
|
74
|
+
color: var(--color-primary);
|
|
75
|
+
}
|
|
76
|
+
.status-inactive {
|
|
77
|
+
background: var(--color-muted-soft);
|
|
78
|
+
color: var(--color-muted);
|
|
79
|
+
}
|
|
80
|
+
.status-quarantined {
|
|
81
|
+
background: var(--color-warning-soft);
|
|
82
|
+
color: var(--color-warning);
|
|
83
|
+
}
|
|
84
|
+
.status-missing {
|
|
85
|
+
background: var(--color-error-soft);
|
|
86
|
+
color: var(--color-error);
|
|
87
|
+
}
|
|
88
|
+
.status-load-failed {
|
|
89
|
+
background: var(--color-error-soft);
|
|
90
|
+
color: var(--color-error);
|
|
91
|
+
}
|
|
92
|
+
.empty-state {
|
|
93
|
+
padding: 2rem;
|
|
94
|
+
text-align: center;
|
|
95
|
+
color: var(--color-muted);
|
|
96
|
+
}
|
|
97
|
+
.alert {
|
|
98
|
+
padding: 0.75rem 1rem;
|
|
99
|
+
border-radius: var(--radius-md);
|
|
100
|
+
margin-bottom: 1rem;
|
|
101
|
+
}
|
|
102
|
+
.alert-error {
|
|
103
|
+
background: var(--color-error-soft);
|
|
104
|
+
color: var(--color-error);
|
|
105
|
+
border: 1px solid var(--color-error);
|
|
106
|
+
}
|
|
107
|
+
.skeleton {
|
|
108
|
+
padding: 2rem;
|
|
109
|
+
text-align: center;
|
|
110
|
+
color: var(--color-muted);
|
|
111
|
+
}
|
|
112
|
+
`),g=a(`<div class="alert alert-error">`),_=a(`<div class=skeleton>Loading...`),v=a(`<div class=plugins-table-container><table class=table><thead><tr><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody></tbody></table><!$><!/>`),y=a(`<tr class=plugin-row><td class=plugin-name><strong></strong><!$><!/><!$><!/></td><td></td><td><span></span></td><td><button type=button></button></td><td>`),b=a(`<span class=plugin-description>`),x=a(`<span class=badge-enabled>`),S=a(`<span class=enabled-badge>`),C=a(`<span class=disabled-badge>`),w=a(`<div class=empty-state>`);function T(){let{t:a}=p(),[o,T]=t([]),[E,D]=t(!0),[O,k]=t(null),[A,j]=t(null);e(async()=>{try{j((await m.getMe()).tenantId??null)}catch{j(null)}await M()});async function M(){try{D(!0);let e=await m.getPlugins();T(e)}catch{k(a(`plugins.loadError`))}finally{D(!1)}}async function N(e){let t=A();if(t)try{e.enabled?await m.deactivatePlugin(e.id,t):await m.activatePlugin(e.id,t),await M()}catch{k(a(`plugins.actionError`))}}let P=e=>{switch(e){case`ACTIVE`:case`ACTIVATED`:return a(`plugins.status.active`);case`INSTALLED`:return a(`plugins.status.installed`);case`INACTIVE`:case`DEACTIVATED`:return a(`plugins.status.inactive`);case`QUARANTINED`:return a(`plugins.status.quarantined`);case`MISSING`:return a(`plugins.status.missing`);case`LOAD_FAILED`:return a(`plugins.status.loadFailed`);default:return e}},F=e=>{switch(e){case`ACTIVE`:case`ACTIVATED`:return`status-active`;case`INSTALLED`:return`status-installed`;case`INACTIVE`:case`DEACTIVATED`:return`status-inactive`;case`QUARANTINED`:return`status-quarantined`;case`MISSING`:return`status-missing`;case`LOAD_FAILED`:return`status-load-failed`;default:return``}};return(()=>{var e=u(h),t=e.firstChild,p=t.nextSibling,[m,T]=d(p.nextSibling),D=m.nextSibling,[k,A]=d(D.nextSibling),j=k.nextSibling,[M,I]=d(j.nextSibling);return M.nextSibling,l(t,()=>a(`plugins.directoryHint`)),l(e,(()=>{var e=f(()=>!!O());return()=>e()&&(()=>{var e=u(g);return l(e,O),e})()})(),m,T),l(e,(()=>{var e=f(()=>!!E());return()=>e()&&u(_)})(),k,A),l(e,(()=>{var e=f(()=>!(E()||O()));return()=>e()&&(()=>{var e=u(v),t=e.firstChild,p=t.firstChild,m=p.firstChild.firstChild,h=m.nextSibling,g=h.nextSibling,_=g.nextSibling,T=_.nextSibling,E=p.nextSibling,D=t.nextSibling,[O,k]=d(D.nextSibling);return l(m,()=>a(`plugins.columns.name`)),l(h,()=>a(`plugins.columns.version`)),l(g,()=>a(`plugins.columns.status`)),l(_,()=>a(`plugins.columns.enabled`)),l(T,()=>a(`plugins.columns.actions`)),l(E,n(i,{get each(){return o()},children:e=>(()=>{var t=u(y),n=t.firstChild,i=n.firstChild,o=i.nextSibling,[p,m]=d(o.nextSibling),h=p.nextSibling,[g,_]=d(h.nextSibling),v=n.nextSibling,w=v.nextSibling,T=w.firstChild,E=w.nextSibling,D=E.firstChild,O=E.nextSibling;return l(i,()=>e.name),l(n,(()=>{var t=f(()=>!!e.manifest?.description);return()=>t()&&(()=>{var t=u(b);return l(t,()=>e.manifest.description),t})()})(),p,m),l(n,(()=>{var t=f(()=>!!e.enabled);return()=>t()&&(()=>{var e=u(x);return l(e,()=>a(`plugins.enabledForTenant`)),e})()})(),g,_),l(v,()=>e.version),l(T,()=>P(e.status)),D.$$click=()=>void N(e),l(D,(()=>{var t=f(()=>!!e.enabled);return()=>t()?a(`plugins.actions.deactivate`):a(`plugins.actions.activate`)})()),l(O,(()=>{var t=f(()=>!!e.enabled);return()=>t()?(()=>{var e=u(S);return l(e,()=>a(`plugins.enabledYes`)),e})():(()=>{var e=u(C);return l(e,()=>a(`plugins.enabledNo`)),e})()})()),r(()=>c(T,`status-badge ${F(e.status)}`)),s(),t})()})),l(e,(()=>{var e=f(()=>o().length===0);return()=>e()&&(()=>{var e=u(w);return l(e,()=>a(`plugins.empty`)),e})()})(),O,k),e})()})(),M,I),e})()}o([`click`]);export{T as PluginManager};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S as e,a as t,h as n,l as r,p as i}from"./solid.Ck4Vtfe4.js";import{_ as a,l as o,o as s,p as c}from"./web.DD6VKaIp.js";import{o as l}from"./slots.CSARb9TW.js";import{n as u}from"./store.CjNcmZUB.js";var d=a(`<span class=muted>`);function f(a){let[f,p]=n(null),[m,h]=n(null);return e(async()=>{let e=await u(),t=e.menuPages.find(e=>e.slug===a.slug),n=e.submenuPages.find(e=>e.slug===a.slug),r=t?.componentId??n?.componentId;r?p(r):h(`No component is registered for plugin page "${a.slug}"`)}),r(t,{get when(){return f()},get fallback(){return(()=>{var e=s(d);return o(e,()=>m()??`Loading plugin page…`),i(()=>c(e,`data-plugin-component-error`,a.slug)),e})()},get children(){return r(l,{get componentId(){return f()}})}})}export{f as PluginPageHost};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,a as t,d as n,f as r,h as i,l as a,p as o,r as s,x as c}from"./solid.Ck4Vtfe4.js";import{_ as l,a as u,f as d,h as f,l as p,m,o as h,p as g,s as _,u as v,v as y}from"./web.DD6VKaIp.js";import{n as b}from"./i18n.A82w5XQu.js";import{n as x}from"./api.53l1ob4Z.js";import{t as S}from"./FloatingPanel.BetdW5N2.js";import{t as C}from"./iconsAndAliases.ujTnkhnl.js";var w=l(`<input type=search class="input icon-picker__search">`),T=l(`<div class=icon-picker__viewport><div class=icon-picker__grid role=listbox>`),E=l(`<p class=icon-picker__count>`),D=l(`<div class=icon-picker><button type=button class="input icon-picker__trigger"aria-haspopup=dialog><span class=icon-picker__value><span class=icon-picker__preview aria-hidden=true></span><span class=icon-picker__name></span></span><span class=icon-picker__caret aria-hidden=true></span></button><!$><!/>`),O=l(`<p class=icon-picker__empty>`),k=l(`<button type=button role=option class=icon-picker__cell style=height:56px>`),A=56,j=60,M=300,ee=2,N=Math.ceil(M/j)+4,P=e=>e.replace(/(^|[-_])(\w)/g,(e,t,n)=>n.toUpperCase()),F=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/([A-Z])([A-Z][a-z])/g,`$1-$2`).toLowerCase(),I=`xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"`,L=e=>Object.entries(e).map(([e,t])=>`${e}="${String(t).replace(/"/g,`"`)}"`).join(` `),R=null,z=()=>(R||=[...new Set(Object.keys(C).map(F))].sort(),R),B=new Map;function te(e){let t=B.get(e);if(t!==void 0)return t;let n=C[P(e)],r=``;return Array.isArray(n)&&(r=`<svg ${I}>${n.map(([e,t])=>`<${e} ${L(t)} />`).join(``)}</svg>`),B.set(e,r),r}var V=e=>e.toLowerCase().replace(/[-_\s]+/g,` `).trim();function H(l){let[u,b]=i(!1),[x,C]=i(``),[P,F]=i(-1),[I,L]=i(0),[R,B]=i(6),[H,ne]=i(void 0),[re,ie]=i(void 0),U,W,ae,G,K=r(()=>{let e=V(x()).split(` `).filter(Boolean),t=z();return e.length===0?t:t.filter(t=>{let n=V(t);return e.every(e=>n.includes(e))})}),q=r(()=>{let e=Math.max(1,R());return K().map((t,n)=>({name:t,index:n,row:Math.floor(n/e),col:n%e}))}),oe=r(()=>Math.max(0,Math.floor(I()/j)-ee)*R()),J=r(()=>{let e=oe();return q().slice(e,e+N*R())}),Y=r(()=>Math.ceil(q().length/Math.max(1,R()))),X=e=>{let t=e?.clientWidth??0;if(t<=0)return;let n=Math.max(3,Math.floor(t/A));B(e=>e===n?e:n)},Z=(e,t=`nearest`)=>{let n=W;if(!n||e<0)return;let r=Math.max(1,R()),i=Math.floor(e/r)*j,a=i+j,o=n.scrollTop;t===`center`?o=i-M/2+j/2:i<n.scrollTop?o=i:a>n.scrollTop+M&&(o=a-M);let s=Math.max(0,Y()*j-M);o=Math.min(Math.max(0,o),s),n.scrollTop=o,L(o)},se=e=>{l.onChange(e),b(!1),C(``)},Q=e=>{let t=K();if(t.length===0)return;let n=P(),r=n<0?e>0?-1:t.length:n,i=Math.min(Math.max(0,r+e),t.length-1);F(i),Z(i)},$=e=>{let t=Math.max(1,R());switch(e.key){case`ArrowDown`:e.preventDefault(),Q(t);break;case`ArrowUp`:e.preventDefault(),Q(-t);break;case`ArrowRight`:e.preventDefault(),Q(1);break;case`ArrowLeft`:e.preventDefault(),Q(-1);break;case`Home`:e.preventDefault(),F(0),Z(0);break;case`End`:e.preventDefault(),F(K().length-1),Z(K().length-1);break;case`Enter`:{e.preventDefault();let t=K()[P()];t&&se(t);break}}};return e(()=>{typeof ResizeObserver<`u`&&(G=new ResizeObserver(e=>{X(e[0]?.target)})),X(H()),c(()=>G?.disconnect())}),n(()=>{let e=H();e&&(X(e),G?.observe(e))}),n(()=>{u()&&(F(-1),queueMicrotask(()=>{let e=K().indexOf(l.value);e>=0&&Z(e,`center`),ae?.focus()}))}),n(()=>{x(),F(-1),W&&(W.scrollTop=0),L(0)}),(()=>{var e=h(D),n=e.firstChild,r=n.firstChild,i=r.firstChild,c=i.nextSibling,A=r.nextSibling,M=n.nextSibling,[ee,N]=_(M.nextSibling),F=U;return typeof F==`function`?y(F,e):U=e,n.$$click=()=>b(!u()),y(ie,n),p(c,()=>l.value||`box`),p(A,()=>u()?`▴`:`▾`),p(e,a(S,{get open(){return u()},get trigger(){return re()},onClose:()=>b(!1),class:`icon-picker__panel`,role:`dialog`,get"aria-label"(){return l.label},minWidth:360,onKeyDown:$,get children(){return[(()=>{var e=h(w);return y(e=>ae=e,e),e.$$input=e=>C(e.currentTarget.value),o(()=>g(e,`placeholder`,l.searchPlaceholder)),o(()=>m(e,`value`,x())),d(),e})(),a(t,{get when(){return K().length>0},get fallback(){return(()=>{var e=h(O);return p(e,()=>l.emptyLabel??`—`),e})()},get children(){var e=h(T),t=e.firstChild;return e.addEventListener(`scroll`,e=>L(e.currentTarget.scrollTop)),y(e=>W=e,e),y(ne,t),p(t,a(s,{get each(){return J()},children:e=>(()=>{var t=h(k);return t.$$click=()=>se(e.name),o(n=>{var r=e.name,i=e.name,a=l.value===e.name,o=l.value===e.name,s=P()===e.index,c=`${e.row*j}px`,u=`${e.col*(100/Math.max(1,R()))}%`,d=`${100/Math.max(1,R())}%`,p=te(e.name);return r!==n.e&&g(t,`title`,n.e=r),i!==n.t&&g(t,`aria-label`,n.t=i),a!==n.a&&g(t,`aria-selected`,n.a=a),o!==n.o&&t.classList.toggle(`is-selected`,n.o=o),s!==n.i&&t.classList.toggle(`is-active`,n.i=s),c!==n.n&&f(t,`top`,n.n=c),u!==n.s&&f(t,`left`,n.s=u),d!==n.h&&f(t,`width`,n.h=d),p!==n.r&&m(t,`innerHTML`,n.r=p),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0}),d(),t})()})),o(e=>{var n=l.label,r=`${Y()*j}px`;return n!==e.e&&g(t,`aria-label`,e.e=n),r!==e.t&&f(t,`height`,e.t=r),e},{e:void 0,t:void 0}),e}}),a(t,{get when(){return v(()=>!!l.countLabel)()&&K().length>0},get children(){var e=h(E);return p(e,()=>l.countLabel?.(K().length)),e}})]}}),ee,N),o(e=>{var t=u(),r=te(l.value||`box`);return t!==e.e&&g(n,`aria-expanded`,e.e=t),r!==e.t&&m(i,`innerHTML`,e.t=r),e},{e:void 0,t:void 0}),d(),e})()}u([`click`,`input`]);var ne=l(`<div class="notice notice--error">`),re=l(`<button type=button class="btn btn-secondary">`),ie=l(`<div class=post-types-manager><!$><!/><form class=card><h3></h3><div class=form-grid><label><!$><!/><input class=input required pattern=[a-z0-9_]+></label><label><!$><!/><input class=input required></label><label><!$><!/><input class=input required></label><label class=post-types-manager__icon-field><!$><!/><!$><!/><small class=muted></small></label></div><fieldset class=supports><legend></legend><!$><!/><label><input type=checkbox> <!$><!/></label><label><input type=checkbox> <!$><!/></label></fieldset><button type=submit class="btn btn-primary"></button><!$><!/></form><div class="card settings-table-card"><table class=table><thead><tr><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody>`),U=l(`<label><input type=checkbox> <!$><!/>`),W=l(`<button type=button class="btn btn-danger">`),ae=l(`<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td><span class=post-types-manager__icon><span class=post-types-manager__icon-preview aria-hidden=true></span><!$><!/></span></td><td><button type=button class="btn btn-secondary"></button> <!$><!/>`);function G(){let{t:n}=b(),[c,l]=i([]),[u,f]=i(``),[y,S]=i(!1),[C,w]=i(null),T=r(()=>[{value:`title`,label:n(`settings.postTypes.form.supportsOptions.title`)},{value:`editor`,label:n(`settings.postTypes.form.supportsOptions.editor`)},{value:`thumbnail`,label:n(`settings.postTypes.form.supportsOptions.thumbnail`)},{value:`excerpt`,label:n(`settings.postTypes.form.supportsOptions.excerpt`)},{value:`revisions`,label:n(`settings.postTypes.form.supportsOptions.revisions`)}]),[E,D]=i({name:``,slug:``,singularLabel:``,pluralLabel:``,hasArchive:!1,singleton:!1,menuIcon:`box`,supports:[`title`,`editor`]}),O=()=>{w(null),D({name:``,slug:``,singularLabel:``,pluralLabel:``,hasArchive:!1,singleton:!1,menuIcon:`box`,supports:[`title`,`editor`]})},k=async()=>{try{l(await x.getContentTypes())}catch(e){f(e instanceof Error?e.message:String(e))}};e(k);let A=async e=>{e.preventDefault(),f(``),S(!0);try{let e={name:E().name||E().slug,slug:E().slug,singularLabel:E().singularLabel,pluralLabel:E().pluralLabel,hasArchive:E().hasArchive,singleton:E().singleton,menuIcon:E().menuIcon||`box`,supports:E().supports};C()?await x.updateContentType(C(),e):await x.createContentType(e),O(),await k(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){f(e instanceof Error?e.message:String(e))}finally{S(!1)}},j=e=>{w(e.slug),D({name:e.name,slug:e.slug,singularLabel:e.singularLabel,pluralLabel:e.pluralLabel,hasArchive:e.hasArchive??!1,singleton:e.singleton??!1,menuIcon:e.menuIcon??`box`,supports:[...e.supports??[`title`,`editor`]]})},M=async e=>{try{await x.deleteContentType(e),await k(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){f(e instanceof Error?e.message:String(e))}};return(()=>{var e=h(ie),r=e.firstChild,[i,l]=_(r.nextSibling),f=i.nextSibling,b=f.firstChild,x=b.nextSibling,S=x.firstChild,w=S.firstChild,[k,ee]=_(w.nextSibling),N=k.nextSibling,P=S.nextSibling,F=P.firstChild,[I,L]=_(F.nextSibling),R=I.nextSibling,z=P.nextSibling,B=z.firstChild,[V,G]=_(B.nextSibling),K=V.nextSibling,q=z.nextSibling,oe=q.firstChild,[J,Y]=_(oe.nextSibling),X=J.nextSibling,[Z,se]=_(X.nextSibling),Q=Z.nextSibling,$=x.nextSibling,ce=$.firstChild,le=ce.nextSibling,[ue,de]=_(le.nextSibling),fe=ue.nextSibling,pe=fe.firstChild,me=pe.nextSibling.nextSibling,[he,ge]=_(me.nextSibling),_e=fe.nextSibling,ve=_e.firstChild,ye=ve.nextSibling.nextSibling,[be,xe]=_(ye.nextSibling),Se=$.nextSibling,Ce=Se.nextSibling,[we,Te]=_(Ce.nextSibling),Ee=f.nextSibling.firstChild.firstChild,De=Ee.firstChild.firstChild,Oe=De.nextSibling,ke=Oe.nextSibling,Ae=ke.nextSibling,je=Ae.nextSibling,Me=je.nextSibling,Ne=Me.nextSibling,Pe=Ne.nextSibling,Fe=Ee.nextSibling;return p(e,a(t,{get when(){return u()},get children(){var e=h(ne);return p(e,u),e}}),i,l),f.addEventListener(`submit`,A),p(b,(()=>{var e=v(()=>!!C());return()=>e()?n(`settings.postTypes.form.editTitle`):n(`settings.postTypes.form.title`)})()),p(S,()=>n(`settings.postTypes.form.slug`),k,ee),N.$$input=e=>D({...E(),slug:e.currentTarget.value}),p(P,()=>n(`settings.postTypes.form.singular`),I,L),R.$$input=e=>D({...E(),singularLabel:e.currentTarget.value}),p(z,()=>n(`settings.postTypes.form.plural`),V,G),K.$$input=e=>D({...E(),pluralLabel:e.currentTarget.value}),p(q,()=>n(`settings.postTypes.form.icon`),J,Y),p(q,a(H,{get value(){return E().menuIcon},onChange:e=>D({...E(),menuIcon:e}),get searchPlaceholder(){return n(`settings.postTypes.form.iconSearchPlaceholder`)},get emptyLabel(){return n(`settings.postTypes.form.iconEmpty`)},countLabel:e=>n(`settings.postTypes.form.iconCount`,{count:e}),get label(){return n(`settings.postTypes.form.icon`)}}),Z,se),p(Q,()=>n(`settings.postTypes.form.iconHint`)),p(ce,()=>n(`settings.postTypes.form.supports`)),p($,a(s,{get each(){return T()},children:e=>(()=>{var t=h(U),n=t.firstChild,r=n.nextSibling.nextSibling,[i,a]=_(r.nextSibling);return n.addEventListener(`change`,t=>D({...E(),supports:t.currentTarget.checked?[...E().supports,e.value]:E().supports.filter(t=>t!==e.value)})),p(t,()=>e.label,i,a),o(()=>m(n,`checked`,E().supports.includes(e.value))),t})()}),ue,de),pe.addEventListener(`change`,e=>D({...E(),hasArchive:e.currentTarget.checked})),p(fe,()=>n(`settings.postTypes.form.hasArchive`),he,ge),ve.addEventListener(`change`,e=>D({...E(),singleton:e.currentTarget.checked})),p(_e,()=>n(`settings.postTypes.form.singleton`),be,xe),p(Se,(()=>{var e=v(()=>!!C());return()=>e()?n(`settings.postTypes.form.update`):n(`settings.postTypes.form.create`)})()),p(f,a(t,{get when(){return C()},get children(){var e=h(re);return e.$$click=O,p(e,()=>n(`settings.postTypes.form.cancel`)),d(),e}}),we,Te),p(De,()=>n(`settings.postTypes.table.slug`)),p(Oe,()=>n(`settings.postTypes.table.singular`)),p(ke,()=>n(`settings.postTypes.table.plural`)),p(Ae,()=>n(`settings.postTypes.table.source`)),p(je,()=>n(`settings.postTypes.table.supports`)),p(Me,()=>n(`settings.postTypes.table.archive`)),p(Ne,()=>n(`settings.postTypes.table.mode`)),p(Pe,()=>n(`settings.postTypes.table.icon`)),p(Fe,a(s,{get each(){return c()},children:e=>(()=>{var r=h(ae),i=r.firstChild,s=i.nextSibling,c=s.nextSibling,l=c.nextSibling,u=l.nextSibling,f=u.nextSibling,g=f.nextSibling,y=g.nextSibling,b=y.firstChild,x=b.firstChild,S=x.nextSibling,[C,w]=_(S.nextSibling),T=y.nextSibling,E=T.firstChild,D=E.nextSibling.nextSibling,[O,k]=_(D.nextSibling);return p(i,()=>e.slug),p(s,()=>e.singularLabel),p(c,()=>e.pluralLabel),p(l,()=>e.source??n(`settings.postTypes.sources.admin`)),p(u,()=>(e.supports??[]).join(`, `)),p(f,(()=>{var t=v(()=>!!e.hasArchive);return()=>t()?n(`common.yes`):n(`common.no`)})()),p(g,(()=>{var t=v(()=>!!e.singleton);return()=>t()?n(`settings.postTypes.table.singleton`):n(`settings.postTypes.table.collection`)})()),p(b,()=>e.menuIcon??`box`,C,w),E.$$click=()=>j(e),p(E,()=>n(`settings.postTypes.table.actions.edit`)),p(T,a(t,{get when(){return e.source!==`CORE`},get children(){var t=h(W);return t.$$click=()=>M(e.slug),p(t,()=>n(`settings.postTypes.table.actions.remove`)),d(),t}}),O,k),o(()=>m(x,`innerHTML`,te(e.menuIcon??`box`))),d(),r})()})),o(e=>{var t=n(`settings.postTypes.form.slugHint`),r=y();return t!==e.e&&g(N,`title`,e.e=t),r!==e.t&&m(Se,`disabled`,e.t=r),e},{e:void 0,t:void 0}),o(()=>m(N,`value`,E().slug)),o(()=>m(R,`value`,E().singularLabel)),o(()=>m(K,`value`,E().pluralLabel)),o(()=>m(pe,`checked`,E().hasArchive)),o(()=>m(ve,`checked`,E().singleton)),d(),e})()}u([`input`,`click`]);export{G as PostTypesManager};
|
|
1
|
+
import{S as e,a as t,d as n,f as r,h as i,l as a,p as o,r as s,x as c}from"./solid.Ck4Vtfe4.js";import{_ as l,a as u,f as d,h as f,l as p,m,o as h,p as g,s as _,u as v,v as y}from"./web.DD6VKaIp.js";import{n as b}from"./i18n.DQYU1D_P.js";import{n as x}from"./api.fpBzBw4U.js";import{t as S}from"./FloatingPanel.BetdW5N2.js";import{t as C}from"./iconsAndAliases.ujTnkhnl.js";var w=l(`<input type=search class="input icon-picker__search">`),T=l(`<div class=icon-picker__viewport><div class=icon-picker__grid role=listbox>`),E=l(`<p class=icon-picker__count>`),D=l(`<div class=icon-picker><button type=button class="input icon-picker__trigger"aria-haspopup=dialog><span class=icon-picker__value><span class=icon-picker__preview aria-hidden=true></span><span class=icon-picker__name></span></span><span class=icon-picker__caret aria-hidden=true></span></button><!$><!/>`),O=l(`<p class=icon-picker__empty>`),k=l(`<button type=button role=option class=icon-picker__cell style=height:56px>`),A=56,j=60,M=300,ee=2,N=Math.ceil(M/j)+4,P=e=>e.replace(/(^|[-_])(\w)/g,(e,t,n)=>n.toUpperCase()),F=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/([A-Z])([A-Z][a-z])/g,`$1-$2`).toLowerCase(),I=`xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"`,L=e=>Object.entries(e).map(([e,t])=>`${e}="${String(t).replace(/"/g,`"`)}"`).join(` `),R=null,z=()=>(R||=[...new Set(Object.keys(C).map(F))].sort(),R),B=new Map;function te(e){let t=B.get(e);if(t!==void 0)return t;let n=C[P(e)],r=``;return Array.isArray(n)&&(r=`<svg ${I}>${n.map(([e,t])=>`<${e} ${L(t)} />`).join(``)}</svg>`),B.set(e,r),r}var V=e=>e.toLowerCase().replace(/[-_\s]+/g,` `).trim();function H(l){let[u,b]=i(!1),[x,C]=i(``),[P,F]=i(-1),[I,L]=i(0),[R,B]=i(6),[H,ne]=i(void 0),[re,ie]=i(void 0),U,W,ae,G,K=r(()=>{let e=V(x()).split(` `).filter(Boolean),t=z();return e.length===0?t:t.filter(t=>{let n=V(t);return e.every(e=>n.includes(e))})}),q=r(()=>{let e=Math.max(1,R());return K().map((t,n)=>({name:t,index:n,row:Math.floor(n/e),col:n%e}))}),oe=r(()=>Math.max(0,Math.floor(I()/j)-ee)*R()),J=r(()=>{let e=oe();return q().slice(e,e+N*R())}),Y=r(()=>Math.ceil(q().length/Math.max(1,R()))),X=e=>{let t=e?.clientWidth??0;if(t<=0)return;let n=Math.max(3,Math.floor(t/A));B(e=>e===n?e:n)},Z=(e,t=`nearest`)=>{let n=W;if(!n||e<0)return;let r=Math.max(1,R()),i=Math.floor(e/r)*j,a=i+j,o=n.scrollTop;t===`center`?o=i-M/2+j/2:i<n.scrollTop?o=i:a>n.scrollTop+M&&(o=a-M);let s=Math.max(0,Y()*j-M);o=Math.min(Math.max(0,o),s),n.scrollTop=o,L(o)},se=e=>{l.onChange(e),b(!1),C(``)},Q=e=>{let t=K();if(t.length===0)return;let n=P(),r=n<0?e>0?-1:t.length:n,i=Math.min(Math.max(0,r+e),t.length-1);F(i),Z(i)},$=e=>{let t=Math.max(1,R());switch(e.key){case`ArrowDown`:e.preventDefault(),Q(t);break;case`ArrowUp`:e.preventDefault(),Q(-t);break;case`ArrowRight`:e.preventDefault(),Q(1);break;case`ArrowLeft`:e.preventDefault(),Q(-1);break;case`Home`:e.preventDefault(),F(0),Z(0);break;case`End`:e.preventDefault(),F(K().length-1),Z(K().length-1);break;case`Enter`:{e.preventDefault();let t=K()[P()];t&&se(t);break}}};return e(()=>{typeof ResizeObserver<`u`&&(G=new ResizeObserver(e=>{X(e[0]?.target)})),X(H()),c(()=>G?.disconnect())}),n(()=>{let e=H();e&&(X(e),G?.observe(e))}),n(()=>{u()&&(F(-1),queueMicrotask(()=>{let e=K().indexOf(l.value);e>=0&&Z(e,`center`),ae?.focus()}))}),n(()=>{x(),F(-1),W&&(W.scrollTop=0),L(0)}),(()=>{var e=h(D),n=e.firstChild,r=n.firstChild,i=r.firstChild,c=i.nextSibling,A=r.nextSibling,M=n.nextSibling,[ee,N]=_(M.nextSibling),F=U;return typeof F==`function`?y(F,e):U=e,n.$$click=()=>b(!u()),y(ie,n),p(c,()=>l.value||`box`),p(A,()=>u()?`▴`:`▾`),p(e,a(S,{get open(){return u()},get trigger(){return re()},onClose:()=>b(!1),class:`icon-picker__panel`,role:`dialog`,get"aria-label"(){return l.label},minWidth:360,onKeyDown:$,get children(){return[(()=>{var e=h(w);return y(e=>ae=e,e),e.$$input=e=>C(e.currentTarget.value),o(()=>g(e,`placeholder`,l.searchPlaceholder)),o(()=>m(e,`value`,x())),d(),e})(),a(t,{get when(){return K().length>0},get fallback(){return(()=>{var e=h(O);return p(e,()=>l.emptyLabel??`—`),e})()},get children(){var e=h(T),t=e.firstChild;return e.addEventListener(`scroll`,e=>L(e.currentTarget.scrollTop)),y(e=>W=e,e),y(ne,t),p(t,a(s,{get each(){return J()},children:e=>(()=>{var t=h(k);return t.$$click=()=>se(e.name),o(n=>{var r=e.name,i=e.name,a=l.value===e.name,o=l.value===e.name,s=P()===e.index,c=`${e.row*j}px`,u=`${e.col*(100/Math.max(1,R()))}%`,d=`${100/Math.max(1,R())}%`,p=te(e.name);return r!==n.e&&g(t,`title`,n.e=r),i!==n.t&&g(t,`aria-label`,n.t=i),a!==n.a&&g(t,`aria-selected`,n.a=a),o!==n.o&&t.classList.toggle(`is-selected`,n.o=o),s!==n.i&&t.classList.toggle(`is-active`,n.i=s),c!==n.n&&f(t,`top`,n.n=c),u!==n.s&&f(t,`left`,n.s=u),d!==n.h&&f(t,`width`,n.h=d),p!==n.r&&m(t,`innerHTML`,n.r=p),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0}),d(),t})()})),o(e=>{var n=l.label,r=`${Y()*j}px`;return n!==e.e&&g(t,`aria-label`,e.e=n),r!==e.t&&f(t,`height`,e.t=r),e},{e:void 0,t:void 0}),e}}),a(t,{get when(){return v(()=>!!l.countLabel)()&&K().length>0},get children(){var e=h(E);return p(e,()=>l.countLabel?.(K().length)),e}})]}}),ee,N),o(e=>{var t=u(),r=te(l.value||`box`);return t!==e.e&&g(n,`aria-expanded`,e.e=t),r!==e.t&&m(i,`innerHTML`,e.t=r),e},{e:void 0,t:void 0}),d(),e})()}u([`click`,`input`]);var ne=l(`<div class="notice notice--error">`),re=l(`<button type=button class="btn btn-secondary">`),ie=l(`<div class=post-types-manager><!$><!/><form class=card><h3></h3><div class=form-grid><label><!$><!/><input class=input required pattern=[a-z0-9_]+></label><label><!$><!/><input class=input required></label><label><!$><!/><input class=input required></label><label class=post-types-manager__icon-field><!$><!/><!$><!/><small class=muted></small></label></div><fieldset class=supports><legend></legend><!$><!/><label><input type=checkbox> <!$><!/></label><label><input type=checkbox> <!$><!/></label></fieldset><button type=submit class="btn btn-primary"></button><!$><!/></form><div class="card settings-table-card"><table class=table><thead><tr><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody>`),U=l(`<label><input type=checkbox> <!$><!/>`),W=l(`<button type=button class="btn btn-danger">`),ae=l(`<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td><span class=post-types-manager__icon><span class=post-types-manager__icon-preview aria-hidden=true></span><!$><!/></span></td><td><button type=button class="btn btn-secondary"></button> <!$><!/>`);function G(){let{t:n}=b(),[c,l]=i([]),[u,f]=i(``),[y,S]=i(!1),[C,w]=i(null),T=r(()=>[{value:`title`,label:n(`settings.postTypes.form.supportsOptions.title`)},{value:`editor`,label:n(`settings.postTypes.form.supportsOptions.editor`)},{value:`thumbnail`,label:n(`settings.postTypes.form.supportsOptions.thumbnail`)},{value:`excerpt`,label:n(`settings.postTypes.form.supportsOptions.excerpt`)},{value:`revisions`,label:n(`settings.postTypes.form.supportsOptions.revisions`)}]),[E,D]=i({name:``,slug:``,singularLabel:``,pluralLabel:``,hasArchive:!1,singleton:!1,menuIcon:`box`,supports:[`title`,`editor`]}),O=()=>{w(null),D({name:``,slug:``,singularLabel:``,pluralLabel:``,hasArchive:!1,singleton:!1,menuIcon:`box`,supports:[`title`,`editor`]})},k=async()=>{try{l(await x.getContentTypes())}catch(e){f(e instanceof Error?e.message:String(e))}};e(k);let A=async e=>{e.preventDefault(),f(``),S(!0);try{let e={name:E().name||E().slug,slug:E().slug,singularLabel:E().singularLabel,pluralLabel:E().pluralLabel,hasArchive:E().hasArchive,singleton:E().singleton,menuIcon:E().menuIcon||`box`,supports:E().supports};C()?await x.updateContentType(C(),e):await x.createContentType(e),O(),await k(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){f(e instanceof Error?e.message:String(e))}finally{S(!1)}},j=e=>{w(e.slug),D({name:e.name,slug:e.slug,singularLabel:e.singularLabel,pluralLabel:e.pluralLabel,hasArchive:e.hasArchive??!1,singleton:e.singleton??!1,menuIcon:e.menuIcon??`box`,supports:[...e.supports??[`title`,`editor`]]})},M=async e=>{try{await x.deleteContentType(e),await k(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){f(e instanceof Error?e.message:String(e))}};return(()=>{var e=h(ie),r=e.firstChild,[i,l]=_(r.nextSibling),f=i.nextSibling,b=f.firstChild,x=b.nextSibling,S=x.firstChild,w=S.firstChild,[k,ee]=_(w.nextSibling),N=k.nextSibling,P=S.nextSibling,F=P.firstChild,[I,L]=_(F.nextSibling),R=I.nextSibling,z=P.nextSibling,B=z.firstChild,[V,G]=_(B.nextSibling),K=V.nextSibling,q=z.nextSibling,oe=q.firstChild,[J,Y]=_(oe.nextSibling),X=J.nextSibling,[Z,se]=_(X.nextSibling),Q=Z.nextSibling,$=x.nextSibling,ce=$.firstChild,le=ce.nextSibling,[ue,de]=_(le.nextSibling),fe=ue.nextSibling,pe=fe.firstChild,me=pe.nextSibling.nextSibling,[he,ge]=_(me.nextSibling),_e=fe.nextSibling,ve=_e.firstChild,ye=ve.nextSibling.nextSibling,[be,xe]=_(ye.nextSibling),Se=$.nextSibling,Ce=Se.nextSibling,[we,Te]=_(Ce.nextSibling),Ee=f.nextSibling.firstChild.firstChild,De=Ee.firstChild.firstChild,Oe=De.nextSibling,ke=Oe.nextSibling,Ae=ke.nextSibling,je=Ae.nextSibling,Me=je.nextSibling,Ne=Me.nextSibling,Pe=Ne.nextSibling,Fe=Ee.nextSibling;return p(e,a(t,{get when(){return u()},get children(){var e=h(ne);return p(e,u),e}}),i,l),f.addEventListener(`submit`,A),p(b,(()=>{var e=v(()=>!!C());return()=>e()?n(`settings.postTypes.form.editTitle`):n(`settings.postTypes.form.title`)})()),p(S,()=>n(`settings.postTypes.form.slug`),k,ee),N.$$input=e=>D({...E(),slug:e.currentTarget.value}),p(P,()=>n(`settings.postTypes.form.singular`),I,L),R.$$input=e=>D({...E(),singularLabel:e.currentTarget.value}),p(z,()=>n(`settings.postTypes.form.plural`),V,G),K.$$input=e=>D({...E(),pluralLabel:e.currentTarget.value}),p(q,()=>n(`settings.postTypes.form.icon`),J,Y),p(q,a(H,{get value(){return E().menuIcon},onChange:e=>D({...E(),menuIcon:e}),get searchPlaceholder(){return n(`settings.postTypes.form.iconSearchPlaceholder`)},get emptyLabel(){return n(`settings.postTypes.form.iconEmpty`)},countLabel:e=>n(`settings.postTypes.form.iconCount`,{count:e}),get label(){return n(`settings.postTypes.form.icon`)}}),Z,se),p(Q,()=>n(`settings.postTypes.form.iconHint`)),p(ce,()=>n(`settings.postTypes.form.supports`)),p($,a(s,{get each(){return T()},children:e=>(()=>{var t=h(U),n=t.firstChild,r=n.nextSibling.nextSibling,[i,a]=_(r.nextSibling);return n.addEventListener(`change`,t=>D({...E(),supports:t.currentTarget.checked?[...E().supports,e.value]:E().supports.filter(t=>t!==e.value)})),p(t,()=>e.label,i,a),o(()=>m(n,`checked`,E().supports.includes(e.value))),t})()}),ue,de),pe.addEventListener(`change`,e=>D({...E(),hasArchive:e.currentTarget.checked})),p(fe,()=>n(`settings.postTypes.form.hasArchive`),he,ge),ve.addEventListener(`change`,e=>D({...E(),singleton:e.currentTarget.checked})),p(_e,()=>n(`settings.postTypes.form.singleton`),be,xe),p(Se,(()=>{var e=v(()=>!!C());return()=>e()?n(`settings.postTypes.form.update`):n(`settings.postTypes.form.create`)})()),p(f,a(t,{get when(){return C()},get children(){var e=h(re);return e.$$click=O,p(e,()=>n(`settings.postTypes.form.cancel`)),d(),e}}),we,Te),p(De,()=>n(`settings.postTypes.table.slug`)),p(Oe,()=>n(`settings.postTypes.table.singular`)),p(ke,()=>n(`settings.postTypes.table.plural`)),p(Ae,()=>n(`settings.postTypes.table.source`)),p(je,()=>n(`settings.postTypes.table.supports`)),p(Me,()=>n(`settings.postTypes.table.archive`)),p(Ne,()=>n(`settings.postTypes.table.mode`)),p(Pe,()=>n(`settings.postTypes.table.icon`)),p(Fe,a(s,{get each(){return c()},children:e=>(()=>{var r=h(ae),i=r.firstChild,s=i.nextSibling,c=s.nextSibling,l=c.nextSibling,u=l.nextSibling,f=u.nextSibling,g=f.nextSibling,y=g.nextSibling,b=y.firstChild,x=b.firstChild,S=x.nextSibling,[C,w]=_(S.nextSibling),T=y.nextSibling,E=T.firstChild,D=E.nextSibling.nextSibling,[O,k]=_(D.nextSibling);return p(i,()=>e.slug),p(s,()=>e.singularLabel),p(c,()=>e.pluralLabel),p(l,()=>e.source??n(`settings.postTypes.sources.admin`)),p(u,()=>(e.supports??[]).join(`, `)),p(f,(()=>{var t=v(()=>!!e.hasArchive);return()=>t()?n(`common.yes`):n(`common.no`)})()),p(g,(()=>{var t=v(()=>!!e.singleton);return()=>t()?n(`settings.postTypes.table.singleton`):n(`settings.postTypes.table.collection`)})()),p(b,()=>e.menuIcon??`box`,C,w),E.$$click=()=>j(e),p(E,()=>n(`settings.postTypes.table.actions.edit`)),p(T,a(t,{get when(){return e.source!==`CORE`},get children(){var t=h(W);return t.$$click=()=>M(e.slug),p(t,()=>n(`settings.postTypes.table.actions.remove`)),d(),t}}),O,k),o(()=>m(x,`innerHTML`,te(e.menuIcon??`box`))),d(),r})()})),o(e=>{var t=n(`settings.postTypes.form.slugHint`),r=y();return t!==e.e&&g(N,`title`,e.e=t),r!==e.t&&m(Se,`disabled`,e.t=r),e},{e:void 0,t:void 0}),o(()=>m(N,`value`,E().slug)),o(()=>m(R,`value`,E().singularLabel)),o(()=>m(K,`value`,E().pluralLabel)),o(()=>m(pe,`checked`,E().hasArchive)),o(()=>m(ve,`checked`,E().singleton)),d(),e})()}u([`input`,`click`]);export{G as PostTypesManager};
|