@oktis-works/admin 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/client/_astro/{ActivityWidget.ChzmikZu.js → ActivityWidget.DNyiLPyM.js} +1 -1
  2. package/dist/client/_astro/{AdminBar.BJWCyHKH.js → AdminBar.D2QGhaa-.js} +1 -1
  3. package/dist/client/_astro/{ApiKeysManager.BhT6maqs.js → ApiKeysManager.BmxmytW6.js} +1 -1
  4. package/dist/client/_astro/{AtGlanceWidget.DxzCpOV6.js → AtGlanceWidget.CgdOZ4NX.js} +1 -1
  5. package/dist/client/_astro/{CommentsManager.ENdf74ep.js → CommentsManager.BpgRvhqq.js} +1 -1
  6. package/dist/client/_astro/{ContentEditor.D5ceM2cx.js → ContentEditor.Cvcc9jyB.js} +1 -1
  7. package/dist/client/_astro/ContentEditor.Dlr6S8c9.js +1 -0
  8. package/dist/client/_astro/{ContentTypeWorkspace.Pt26MjgI.js → ContentTypeWorkspace.B-QD-s14.js} +1 -1
  9. package/dist/client/_astro/{DashboardHome.CFRpf5gq.js → DashboardHome.DcWndv88.js} +1 -1
  10. package/dist/client/_astro/{DashboardLayout.astro_astro_type_script_index_0_lang.K2BlxaxN.js → DashboardLayout.astro_astro_type_script_index_0_lang.BxVql8ej.js} +1 -1
  11. package/dist/client/_astro/{FieldGroupEditor.CJrN1zwx.js → FieldGroupEditor.DobVrLT3.js} +1 -1
  12. package/dist/client/_astro/{FieldGroupList.BwV0WQKr.js → FieldGroupList.DgWHlojw.js} +1 -1
  13. package/dist/client/_astro/{Footer.GKAEli7Z.js → Footer.B_gXuAcf.js} +1 -1
  14. package/dist/client/_astro/GeneralSettings.aMI_-diu.js +1 -0
  15. package/dist/client/_astro/{LogsManager.CFLnd9ZB.js → LogsManager.eIRgbNTh.js} +1 -1
  16. package/dist/client/_astro/{MediaLibrary.7dkXH_rK.js → MediaLibrary.BW_tESC1.js} +1 -1
  17. package/dist/client/_astro/{MenuManager.DR4WuUgm.js → MenuManager.B47dpGK5.js} +1 -1
  18. package/dist/client/_astro/{Modal.C6l3xeBc.js → Modal.okwDNaJA.js} +1 -1
  19. package/dist/client/_astro/{PluginManager.DGS7ULAQ.js → PluginManager.hd7fdKOg.js} +1 -1
  20. package/dist/client/_astro/{PostTypesManager.CFYtUiMC.js → PostTypesManager.BnhcBQeu.js} +1 -1
  21. package/dist/client/_astro/{QuickDraftWidget.6BO0a_eK.js → QuickDraftWidget.BWETQ9qA.js} +1 -1
  22. package/dist/client/_astro/ReadingSettings.BqL8YJzx.js +1 -0
  23. package/dist/client/_astro/{ResourceHubs.BkQbEmJj.js → ResourceHubs.JyJ8ldXA.js} +1 -1
  24. package/dist/client/_astro/{TaxonomiesManager.C_5zrayU.js → TaxonomiesManager.BwQxlWDW.js} +1 -1
  25. package/dist/client/_astro/TaxonomyTermsManager.CpdAkio2.js +1 -0
  26. package/dist/client/_astro/{ThemeCustomizer.CA-V4vrP.js → ThemeCustomizer.Dvep4d4M.js} +1 -1
  27. package/dist/client/_astro/{ThemeManager.BRbihPtF.js → ThemeManager.719jEleT.js} +1 -1
  28. package/dist/client/_astro/TimezoneSelect.DDwsrzLo.js +1 -0
  29. package/dist/client/_astro/{UserCreateForm.Zz8aGR3k.js → UserCreateForm.DV9A1IF9.js} +1 -1
  30. package/dist/client/_astro/{UsersManager.BrtySwDC.js → UsersManager.DzsGmnQL.js} +1 -1
  31. package/dist/client/_astro/{WebhooksManager.UOfDFaV5.js → WebhooksManager.BMIbWri8.js} +1 -1
  32. package/dist/client/_astro/{i18n.DeOz3HxE.js → i18n.fOaTPvDv.js} +1 -1
  33. package/dist/client/_astro/{pt-BR.C-EQC0-7.js → pt-BR.DcDswrQc.js} +1 -1
  34. package/dist/server/chunks/{404_DSq1z3nq.mjs → 404_D1pHvc7z.mjs} +1 -1
  35. package/dist/server/chunks/{BaseLayout_BfJCf1zO.mjs → BaseLayout_CJflf8jJ.mjs} +1 -1
  36. package/dist/server/chunks/{ContentEditor_Bm8Txfp0.mjs → ContentEditor_6sIvZ3uy.mjs} +3 -3
  37. package/dist/server/chunks/{DashboardLayout_Bgig4Bzt.mjs → DashboardLayout_DtK3Anmh.mjs} +8 -3
  38. package/dist/server/chunks/{FieldRenderer_CDx8Zaxh.mjs → FieldRenderer_B6tKYaE6.mjs} +2 -2
  39. package/dist/server/chunks/{MediaLibrary_D5Q4ofCd.mjs → MediaLibrary_8WB0Ye_E.mjs} +2 -2
  40. package/dist/server/chunks/{Modal_B8BarHWg.mjs → Modal_VCbAKO9c.mjs} +1 -1
  41. package/dist/server/chunks/TimezoneSelect_Cj-oxeeA.mjs +119 -0
  42. package/dist/server/chunks/{_id__BlTMZrdv.mjs → _id__BRgx0Qhs.mjs} +2 -2
  43. package/dist/server/chunks/{_slug__Dj-IRSFr.mjs → _slug__BbwMz5xa.mjs} +1 -1
  44. package/dist/server/chunks/{access_CNiloHkT.mjs → access_DwKf8961.mjs} +3 -3
  45. package/dist/server/chunks/{api-keys_GqT5bD0q.mjs → api-keys_CTxaGDZE.mjs} +3 -3
  46. package/dist/server/chunks/{comments_BXNvPafa.mjs → comments_BNk3Hrx4.mjs} +2 -2
  47. package/dist/server/chunks/{custom-fields_CO1IKHOz.mjs → custom-fields_BjWRZLRj.mjs} +2 -2
  48. package/dist/server/chunks/{customize_Byc8itgW.mjs → customize_B0Y29Bes.mjs} +2 -2
  49. package/dist/server/chunks/{edit_D0rn3HA1.mjs → edit_D6dFB1SQ.mjs} +2 -2
  50. package/dist/server/chunks/{general_B0fNmZbu.mjs → general_BfSXZMQp.mjs} +13 -129
  51. package/dist/server/chunks/{i18n_ie92fcXF.mjs → i18n_CU8HvleS.mjs} +2 -2
  52. package/dist/server/chunks/{index_CV9dE_yu.mjs → index_BmxZa69w.mjs} +2 -2
  53. package/dist/server/chunks/{index_i8ebBGvR.mjs → index_CVQR_qrN.mjs} +2 -2
  54. package/dist/server/chunks/{index_7b0VyAS9.mjs → index_ColI234p.mjs} +1 -1
  55. package/dist/server/chunks/{index_DhgdylFA.mjs → index_DRSrVG7Y.mjs} +2 -2
  56. package/dist/server/chunks/{index_M4NDX1QC.mjs → index_LgsQrGNm.mjs} +3 -3
  57. package/dist/server/chunks/{login_D50phFgs.mjs → login_CiCfEf74.mjs} +1 -1
  58. package/dist/server/chunks/{logs_BRNxhbeo.mjs → logs_C2EbDtQZ.mjs} +2 -2
  59. package/dist/server/chunks/{menus_B-GjEx8-.mjs → menus_B5OYxxGA.mjs} +2 -2
  60. package/dist/server/chunks/{new_CK6-d0l3.mjs → new_BUCIK3MO.mjs} +2 -2
  61. package/dist/server/chunks/{new_Bi2kaUnl.mjs → new_Cnpne1UT.mjs} +2 -2
  62. package/dist/server/chunks/{plugins_D7EHhXUJ.mjs → plugins_CHpdN1dL.mjs} +2 -2
  63. package/dist/server/chunks/{post-types_BBn7Tk48.mjs → post-types_BiT9-dJV.mjs} +2 -2
  64. package/dist/server/chunks/{pt-BR_CQWainBO.mjs → pt-BR_BoYPF9Bk.mjs} +1 -1
  65. package/dist/server/chunks/{reading_BGq2c5HM.mjs → reading_5d6bNfqR.mjs} +44 -6
  66. package/dist/server/chunks/{taxonomies_D5-WJMXM.mjs → taxonomies_DsIVJXrK.mjs} +2 -2
  67. package/dist/server/chunks/{taxonomy__yis5-wJ.mjs → taxonomy_CLDWhvlz.mjs} +25 -29
  68. package/dist/server/chunks/{themes_Dpg-ee2S.mjs → themes_DXVdbmMO.mjs} +2 -2
  69. package/dist/server/chunks/{upload_BPY5ZFIb.mjs → upload_BnM80kT5.mjs} +2 -2
  70. package/dist/server/chunks/{webhooks_DFrRhSdU.mjs → webhooks_DFHVjsid.mjs} +2 -2
  71. package/dist/server/entry.mjs +29 -29
  72. package/dist/server/virtual_astro_middleware.mjs +1 -1
  73. package/package.json +1 -1
  74. package/dist/client/_astro/ContentEditor.D0k_DlIU.js +0 -1
  75. package/dist/client/_astro/GeneralSettings.CVL2OygA.js +0 -1
  76. package/dist/client/_astro/ReadingSettings.DPXWhZzQ.js +0 -1
  77. package/dist/client/_astro/TaxonomyTermsManager.j3RcgMUq.js +0 -1
@@ -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.DeOz3HxE.js";import{n as _}from"./api.B03e8F6d.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.fOaTPvDv.js";import{n as _}from"./api.B03e8F6d.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.DeOz3HxE.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};
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.fOaTPvDv.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};
@@ -1,4 +1,4 @@
1
- import{S as e,h as t,l as n,p as r,r as i}from"./solid.Ck4Vtfe4.js";import{_ as a,i as o,l as s,o as c,s as l,u}from"./web.DD6VKaIp.js";import{n as d}from"./i18n.DeOz3HxE.js";import{n as f}from"./api.B03e8F6d.js";var p=a(`<div class=plugin-manager><p class=page-hint></p><!$><!/><!$><!/><!$><!/><style>
1
+ import{S as e,h as t,l as n,p as r,r as i}from"./solid.Ck4Vtfe4.js";import{_ as a,i as o,l as s,o as c,s as l,u}from"./web.DD6VKaIp.js";import{n as d}from"./i18n.fOaTPvDv.js";import{n as f}from"./api.B03e8F6d.js";var p=a(`<div class=plugin-manager><p class=page-hint></p><!$><!/><!$><!/><!$><!/><style>
2
2
  .page-hint {
3
3
  margin: 0 0 1.25rem;
4
4
  color: var(--color-muted);
@@ -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.DeOz3HxE.js";import{n as x}from"./api.B03e8F6d.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,`&quot;`)}"`).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.fOaTPvDv.js";import{n as x}from"./api.B03e8F6d.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,`&quot;`)}"`).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,4 +1,4 @@
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,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.DeOz3HxE.js";import{n as h}from"./api.B03e8F6d.js";import{DashboardWidget as g}from"./AtGlanceWidget.DxzCpOV6.js";var _=a(`<div class=quick-draft-wrapper><div class=quick-draft-content-wrapper>`),v=a(`<style>
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,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.fOaTPvDv.js";import{n as h}from"./api.B03e8F6d.js";import{DashboardWidget as g}from"./AtGlanceWidget.CgdOZ4NX.js";var _=a(`<div class=quick-draft-wrapper><div class=quick-draft-content-wrapper>`),v=a(`<style>
2
2
  .quick-draft-form { display: flex; flex-direction: column; gap: 1rem; }
3
3
  .form-group textarea { min-height: 100px; resize: vertical; font-family: inherit; }
4
4
  .drafts-list h4 { margin-bottom: 1rem; }
@@ -0,0 +1 @@
1
+ import{S as e,a as t,h as n,l as r}from"./solid.Ck4Vtfe4.js";import{_ as i,l as a,o,s}from"./web.DD6VKaIp.js";import{n as c}from"./i18n.fOaTPvDv.js";import{n as l}from"./api.B03e8F6d.js";import{i as u,n as d,r as f,s as p}from"./src.CYKGYEyR.js";import{t as m}from"./TimezoneSelect.DDwsrzLo.js";var h=i(`<p class=muted>`),g=i(`<div class="notice notice--error">`),_=i(`<div class=notice>`),v=i(`<div class=form-field><label></label><!$><!/>`),y=i(`<form><div class=form-grid><div class=form-field><label></label><!$><!/></div><!$><!/><div class=form-field><label></label><!$><!/><p class=form-hint></p></div><div class=form-field><label></label><!$><!/><p class=form-hint></p></div></div><div class=media-details__actions>`),b=i(`<div class=reading-settings><!$><!/><!$><!/><!$><!/>`);function x(){let{t:i}=c(),[x,S]=n({frontPageDisplays:`static`,frontPage:``,postsPage:``,timezone_string:``,gmt_offset:``}),[C,w]=n([]),[T,E]=n(!0),[D,O]=n(!1),[k,A]=n(``),[j,M]=n(``);e(async()=>{try{let e=(await l.getContent({type:`page`,status:`PUBLISHED`,limit:100})).data.map(e=>({value:e.id,label:e.title||e.slug}));w(e);let t=await l.getSettings(`reading`),n={};for(let e of t)n[e.key]=typeof e.value==`string`?e.value:JSON.stringify(e.value??``);n.frontPageDisplays||=`static`,S({frontPageDisplays:n.frontPageDisplays??`static`,frontPage:n.frontPage??``,postsPage:n.postsPage??``,timezone_string:n.timezone_string??``,gmt_offset:n.gmt_offset??``})}catch(e){A(e instanceof Error?e.message:String(e))}finally{E(!1)}});let N=async e=>{e.preventDefault(),A(``),M(``),O(!0);try{let e=x(),t=[{key:`frontPageDisplays`,value:e.frontPageDisplays,group:`reading`,type:`string`},{key:`frontPage`,value:e.frontPage,group:`reading`,type:`string`},{key:`postsPage`,value:e.postsPage,group:`reading`,type:`string`}];await l.updateSettings(t),M(i(`settings.reading.saved`))}catch(e){A(e instanceof Error?e.message:String(e))}finally{O(!1)}};return T()?(()=>{var e=o(h);return a(e,()=>i(`settings.reading.loading`)),e})():(()=>{var e=o(b),n=e.firstChild,[c,l]=s(n.nextSibling),h=c.nextSibling,[w,T]=s(h.nextSibling),E=w.nextSibling,[O,A]=s(E.nextSibling);return a(e,r(t,{get when(){return k()},get children(){var e=o(g);return a(e,k),e}}),c,l),a(e,r(t,{get when(){return j()},get children(){var e=o(_);return a(e,j),e}}),w,T),a(e,r(f,{get children(){var e=o(y),n=e.firstChild,c=n.firstChild,l=c.firstChild,f=l.nextSibling,[h,g]=s(f.nextSibling),_=c.nextSibling,[b,w]=s(_.nextSibling),T=b.nextSibling,E=T.firstChild,O=E.nextSibling,[k,A]=s(O.nextSibling),j=k.nextSibling,M=T.nextSibling,P=M.firstChild,F=P.nextSibling,[I,L]=s(F.nextSibling),R=I.nextSibling,z=n.nextSibling;return e.addEventListener(`submit`,N),a(l,()=>i(`settings.reading.frontPageDisplays`)),a(c,r(p,{name:`frontPageDisplays`,get value(){return x().frontPageDisplays},get options(){return[{value:`latest`,label:i(`settings.reading.frontPageDisplaysOptions.latest`)},{value:`static`,label:i(`settings.reading.frontPageDisplaysOptions.static`)}]},onChange:e=>S({...x(),frontPageDisplays:e})}),h,g),a(n,r(t,{get when(){return x().frontPageDisplays===`static`},get children(){return[(()=>{var e=o(v),t=e.firstChild,n=t.nextSibling,[c,l]=s(n.nextSibling);return a(t,()=>i(`settings.reading.frontPage`)),a(e,r(p,{name:`frontPage`,get value(){return x().frontPage},get options(){return[{value:``,label:i(`settings.reading.selectPage`)},...C()]},onChange:e=>S({...x(),frontPage:e})}),c,l),e})(),(()=>{var e=o(v),t=e.firstChild,n=t.nextSibling,[c,l]=s(n.nextSibling);return a(t,()=>i(`settings.reading.postsPage`)),a(e,r(p,{name:`postsPage`,get value(){return x().postsPage},get options(){return[{value:``,label:i(`settings.reading.selectPage`)},...C()]},onChange:e=>S({...x(),postsPage:e})}),c,l),e})()]}}),b,w),a(E,()=>i(`settings.reading.timezoneString`)),a(T,r(m,{get value(){return x().timezone_string??``},get placeholder(){return i(`settings.reading.timezoneStringPlaceholder`)},get searchPlaceholder(){return i(`settings.reading.timezoneStringPlaceholder`)},onChange:e=>S({...x(),timezone_string:e})}),k,A),a(j,()=>i(`settings.reading.timezoneDescription`)),a(P,()=>i(`settings.reading.gmtOffset`)),a(M,r(u,{name:`gmt_offset`,type:`number`,get value(){return x().gmt_offset??``},get placeholder(){return i(`settings.reading.gmtOffsetPlaceholder`)},onInput:e=>S({...x(),gmt_offset:e})}),I,L),a(R,()=>i(`settings.reading.gmtOffsetDescription`)),a(z,r(d,{variant:`primary`,type:`submit`,get disabled(){return D()},get loading(){return D()},get children(){return i(`settings.reading.save`)}})),e}}),O,A),e})()}export{x as ReadingSettings};
@@ -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,v as g}from"./web.DD6VKaIp.js";import{n as _}from"./i18n.DeOz3HxE.js";import{n as v}from"./api.B03e8F6d.js";import{t as y}from"./Modal.C6l3xeBc.js";import{t as b}from"./FloatingPanel.BetdW5N2.js";var x=s(`<input type=search class="input permission-picker__search">`),S=s(`<div class=permission-picker__matrix role=presentation><div class="permission-picker__row permission-picker__row--head"role=presentation><span class=permission-picker__resource></span><!$><!/><!$><!/></div><!$><!/>`),C=s(`<div class=permission-picker__custom><p class=permission-picker__custom-label></p><div class=permission-picker__chips><!$><!/><form class=permission-picker__custom-form><input class="input permission-picker__custom-input"><button class="btn btn-secondary btn-sm"type=submit>`),w=s(`<p class=icon-picker__count>`),T=s(`<div class=permission-picker><button type=button class="input permission-picker__trigger"aria-haspopup=dialog><span class=permission-picker__value></span><span class=icon-picker__caret aria-hidden=true></span></button><!$><!/>`),E=s(`<span class=permission-picker__action-label>`),D=s(`<p class=permission-picker__empty>`),O=s(`<div class=permission-picker__row><span class=permission-picker__resource></span><!$><!/>`),k=s(`<label class=permission-picker__cell><input type=checkbox><span aria-hidden=true>✓`),A=s(`<span class="permission-picker__cell permission-picker__cell--empty">`),ee=s(`<span class=permission-picker__chip><code></code><button type=button>×`),j=[`read`,`create`,`update`,`delete`],M=[`content`,`media`,`category`,`tag`,`menu`,`user`,`roles`,`theme`,`plugin`,`setting`,`webhook`,`tenants`,`audit`,`build`,`system`],N={media:[`upload`]},P=(e,t)=>`${e}:${t}`,F=e=>{let[t,n]=e.split(`:`);return!t||!n?!1:j.includes(t)&&M.includes(n)};function I(e){let{t:s}=_(),[c,h]=r(!1),[v,y]=r(``),[I,L]=r(``),[R,z]=r(void 0),B=n(()=>new Set(e.value)),V=n(()=>e.value.filter(e=>!F(e))),H=n(()=>{let e=v().trim().toLowerCase();return e?M.filter(t=>t.includes(e)||s(`access.resources.${t}`).toLowerCase().includes(e)):M}),U=n(()=>{let e=new Set;for(let t of H())for(let n of N[t]??[])e.add(n);return[...e]}),W=(e,t)=>j.includes(e)||(N[t]??[]).includes(e),G=(t,n)=>{let r=P(t,n);e.onChange(B().has(r)?e.value.filter(e=>e!==r):[...e.value,r])},K=t=>{e.onChange(e.value.filter(e=>e!==t))},q=()=>{let t=I().trim().toLowerCase().replace(/\s+/g,`-`);t&&!B().has(t)&&e.onChange([...e.value,t]),L(``)},J=()=>{let t=e.value.length;if(t===0)return e.placeholder??s(`access.permissionsPlaceholder`);let n=new Set(e.value.map(e=>e.split(`:`)[1]??e));return s(`access.permissionsSummary`,{resources:n.size,count:t})};return(()=>{var n=f(T),r=n.firstChild,_=r.firstChild,M=_.nextSibling,N=r.nextSibling,[F,Y]=m(N.nextSibling);return r.$$click=()=>h(!c()),g(z,r),u(_,J),u(M,()=>c()?`▴`:`▾`),u(n,i(b,{get open(){return c()},get trigger(){return R()},onClose:()=>h(!1),class:`permission-picker__panel`,role:`dialog`,get"aria-label"(){return s(`access.permissions`)},minWidth:440,get children(){return[(()=>{var t=f(x);return t.$$input=e=>y(e.currentTarget.value),a(()=>p(t,`placeholder`,e.searchPlaceholder??s(`access.permissionSearch`))),a(()=>d(t,`value`,v())),l(),t})(),(()=>{var e=f(S),t=e.firstChild,n=t.firstChild.nextSibling,[r,c]=m(n.nextSibling),l=r.nextSibling,[h,g]=m(l.nextSibling),_=t.nextSibling,[v,y]=m(_.nextSibling);return u(t,i(o,{each:j,children:e=>(()=>{var t=f(E);return u(t,e),t})()}),r,c),u(t,i(o,{get each(){return U()},children:e=>(()=>{var t=f(E);return u(t,e),t})()}),h,g),u(e,i(o,{get each(){return H()},get fallback(){return(()=>{var e=f(D);return u(e,()=>s(`access.permissionNoMatches`)),e})()},children:e=>(()=>{var t=f(O),n=t.firstChild,r=n.nextSibling,[c,l]=m(r.nextSibling);return p(n,`title`,e),u(n,()=>s(`access.resources.${e}`)),u(t,i(o,{get each(){return[...j,...U()]},children:t=>W(t,e)?(()=>{var n=f(k),r=n.firstChild;return p(n,`title`,`${t}:${e}`),r.addEventListener(`change`,()=>G(t,e)),a(()=>n.classList.toggle(`is-checked`,!!B().has(P(t,e)))),a(()=>d(r,`checked`,B().has(P(t,e)))),n})():f(A)}),c,l),t})()}),v,y),e})(),(()=>{var e=f(C),t=e.firstChild,n=t.nextSibling,r=n.firstChild,[c,h]=m(r.nextSibling),g=c.nextSibling,_=g.firstChild,v=_.nextSibling;return u(t,()=>s(`access.customPermissions`)),u(n,i(o,{get each(){return V()},children:e=>(()=>{var t=f(ee),n=t.firstChild,r=n.nextSibling;return u(n,e),r.$$click=()=>K(e),a(()=>p(r,`aria-label`,`${s(`common.remove`)}: ${e}`)),l(),t})()}),c,h),g.addEventListener(`submit`,e=>{e.preventDefault(),q()}),_.$$input=e=>L(e.currentTarget.value),u(v,()=>s(`common.add`)),a(()=>p(_,`placeholder`,s(`access.customPermission`))),a(()=>d(_,`value`,I())),l(),e})(),i(t,{get when(){return e.value.length>0},get children(){var t=f(w);return u(t,()=>s(`access.permissionsSelected`,{count:e.value.length})),t}})]}}),F,Y),a(t=>{var n=c(),i=e.value.length===0;return n!==t.e&&p(r,`aria-expanded`,t.e=n),i!==t.t&&_.classList.toggle(`is-empty`,t.t=i),t},{e:void 0,t:void 0}),l(),n})()}c([`click`,`input`]);var L=s(`<div class="notice notice--error">`),R=s(`<div class=resource-hub><!$><!/><div class=access-grid><section class=card><div class=card-header-row><h3></h3><button class="btn btn-primary"type=button>+ <!$><!/></button></div><table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody></tbody></table><!$><!/></section><section class=card><div class=card-header-row><h3></h3><button class="btn btn-primary"type=button>+ <!$><!/></button></div><table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody></tbody></table><!$><!/>`),z=s(`<button class="btn btn-danger btn-sm"type=button>`),B=s(`<tr><td></td><td><code></code></td><td class=access-permissions-cell></td><td class=access-actions><button class="btn btn-secondary btn-sm"type=button></button><!$><!/>`),V=s(`<form class=resource-form><label><span class=resource-form__label></span><input class=input required></label><label><span class=resource-form__label></span><input class=input required></label><div class=resource-form__field><span class=resource-form__label></span><!$><!/></div><div class=form-actions><button class="btn btn-secondary"type=button></button><button class="btn btn-primary"type=submit>`),H=s(`<tr><td></td><td><code></code></td><td></td><td class=access-actions><button class="btn btn-secondary btn-sm"type=button></button><button class="btn btn-danger btn-sm"type=button>`),U=s(`<form class=resource-form><label><span class=resource-form__label></span><input class=input required></label><label><span class=resource-form__label></span><input class=input required></label><label><span class=resource-form__label></span><input class=input></label><div class=form-actions><button class="btn btn-secondary"type=button></button><button class="btn btn-primary"type=submit>`);function W(){let{t:n}=_(),[s,c]=r([]),[g,b]=r([]),[x,S]=r(null),[C,w]=r(null),[T,E]=r(!1),[D,O]=r(``),k=async()=>{try{c(await v.listRoles()),b((await v.listTenants({limit:100})).data??[])}catch(e){O(e instanceof Error?e.message:String(e))}};e(k);let A=e=>{e.preventDefault();let t=x();t&&(E(!0),(t.id?v.updateRole(t.id,t):v.createRole(t)).then(()=>(S(null),k())).catch(e=>O(e instanceof Error?e.message:String(e))).finally(()=>E(!1)))},ee=e=>{e.preventDefault();let t=C();t&&(E(!0),(t.id?v.updateTenant(t.id,t):v.createTenant(t)).then(()=>(w(null),k())).catch(e=>O(e instanceof Error?e.message:String(e))).finally(()=>E(!1)))},j=e=>{let t=e.permissions??[];return t.length===0?`—`:t.slice(0,4).join(`, `)+(t.length>4?` +${t.length-4}`:``)};return(()=>{var e=f(R),r=e.firstChild,[c,_]=m(r.nextSibling),b=c.nextSibling.firstChild,E=b.firstChild,O=E.firstChild,M=O.nextSibling,N=M.firstChild.nextSibling,[P,F]=m(N.nextSibling),W=E.nextSibling,G=W.firstChild,K=G.firstChild.firstChild,q=K.nextSibling,J=q.nextSibling,Y=G.nextSibling,te=W.nextSibling,[ne,re]=m(te.nextSibling),X=b.nextSibling,Z=X.firstChild,Q=Z.firstChild,$=Q.nextSibling,ie=$.firstChild.nextSibling,[ae,oe]=m(ie.nextSibling),se=Z.nextSibling,ce=se.firstChild,le=ce.firstChild.firstChild,ue=le.nextSibling,de=ue.nextSibling,fe=ce.nextSibling,pe=se.nextSibling,[me,he]=m(pe.nextSibling);return u(e,i(t,{get when(){return D()},get children(){var e=f(L);return u(e,D),e}}),c,_),u(O,()=>n(`access.roles`)),M.$$click=()=>S({name:``,slug:``,permissions:[]}),u(M,()=>n(`common.create`),P,F),u(K,()=>n(`resources.name`)),u(q,()=>n(`resources.slug`)),u(J,()=>n(`access.permissions`)),u(Y,i(o,{get each(){return s()},children:e=>(()=>{var r=f(B),o=r.firstChild,s=o.nextSibling,c=s.firstChild,d=s.nextSibling,h=d.nextSibling,g=h.firstChild,_=g.nextSibling,[y,b]=m(_.nextSibling);return u(o,()=>e.name),u(c,()=>e.slug),u(d,()=>j(e)),g.$$click=()=>S({...e,permissions:[...e.permissions??[]]}),u(g,()=>n(`common.edit`)),u(h,i(t,{get when(){return!e.is_system},get children(){var t=f(z);return t.$$click=()=>void v.deleteRole(e.id).then(k),u(t,()=>n(`common.delete`)),l(),t}}),y,b),a(()=>p(d,`title`,(e.permissions??[]).join(`, `))),l(),r})()})),u(b,i(y,{get open(){return x()!==null},onClose:()=>S(null),get title(){return h(()=>!!x()?.id)()?n(`access.editRole`):n(`access.newRole`)},get children(){return i(t,{get when(){return x()},children:e=>(()=>{var t=f(V),r=t.firstChild,o=r.firstChild,s=o.nextSibling,c=r.nextSibling,g=c.firstChild,_=g.nextSibling,v=c.nextSibling,y=v.firstChild,b=y.nextSibling,[x,C]=m(b.nextSibling),w=v.nextSibling.firstChild,E=w.nextSibling;return t.addEventListener(`submit`,A),u(o,()=>n(`resources.name`)),s.$$input=t=>S({...e(),name:t.currentTarget.value}),u(g,()=>n(`resources.slug`)),_.$$input=t=>S({...e(),slug:t.currentTarget.value}),u(y,()=>n(`access.permissions`)),u(v,i(I,{get value(){return e().permissions??[]},onChange:t=>S({...e(),permissions:t})}),x,C),w.$$click=()=>S(null),u(w,()=>n(`common.cancel`)),u(E,(()=>{var e=h(()=>!!T());return()=>e()?n(`common.loading`):n(`common.save`)})()),a(e=>{var t=n(`resources.name`),r=n(`resources.slug`),i=T();return t!==e.e&&p(s,`placeholder`,e.e=t),r!==e.t&&p(_,`placeholder`,e.t=r),i!==e.a&&d(E,`disabled`,e.a=i),e},{e:void 0,t:void 0,a:void 0}),a(()=>d(s,`value`,e().name??``)),a(()=>d(_,`value`,e().slug??``)),l(),t})()})}}),ne,re),u(Q,()=>n(`access.tenants`)),$.$$click=()=>w({name:``,slug:``}),u($,()=>n(`common.create`),ae,oe),u(le,()=>n(`resources.name`)),u(ue,()=>n(`resources.slug`)),u(de,()=>n(`common.status`)),u(fe,i(o,{get each(){return g()},children:e=>(()=>{var t=f(H),r=t.firstChild,i=r.nextSibling,a=i.firstChild,o=i.nextSibling,s=o.nextSibling.firstChild,c=s.nextSibling;return u(r,()=>e.name),u(a,()=>e.slug),u(o,()=>e.status),s.$$click=()=>w({...e}),u(s,()=>n(`common.edit`)),c.$$click=()=>e.id&&void v.deleteTenant(e.id).then(k),u(c,()=>n(`common.delete`)),l(),t})()})),u(X,i(y,{get open(){return C()!==null},onClose:()=>w(null),get title(){return h(()=>!!C()?.id)()?n(`access.editTenant`):n(`access.newTenant`)},get children(){return i(t,{get when(){return C()},children:e=>(()=>{var t=f(U),r=t.firstChild,i=r.firstChild,o=i.nextSibling,s=r.nextSibling,c=s.firstChild,m=c.nextSibling,g=s.nextSibling,_=g.firstChild,v=_.nextSibling,y=g.nextSibling.firstChild,b=y.nextSibling;return t.addEventListener(`submit`,ee),u(i,()=>n(`resources.name`)),o.$$input=t=>w({...e(),name:t.currentTarget.value}),u(c,()=>n(`resources.slug`)),m.$$input=t=>w({...e(),slug:t.currentTarget.value}),u(_,()=>n(`access.domain`)),v.$$input=t=>w({...e(),domain:t.currentTarget.value}),y.$$click=()=>w(null),u(y,()=>n(`common.cancel`)),u(b,(()=>{var e=h(()=>!!T());return()=>e()?n(`common.loading`):n(`common.save`)})()),a(e=>{var t=n(`resources.name`),r=n(`resources.slug`),i=n(`access.domain`),a=T();return t!==e.e&&p(o,`placeholder`,e.e=t),r!==e.t&&p(m,`placeholder`,e.t=r),i!==e.a&&p(v,`placeholder`,e.a=i),a!==e.o&&d(b,`disabled`,e.o=a),e},{e:void 0,t:void 0,a:void 0,o:void 0}),a(()=>d(o,`value`,e().name??``)),a(()=>d(m,`value`,e().slug??``)),a(()=>d(v,`value`,e().domain??``)),l(),t})()})}}),me,he),l(),e})()}c([`click`,`input`]);export{W as AccessManager};
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,v as g}from"./web.DD6VKaIp.js";import{n as _}from"./i18n.fOaTPvDv.js";import{n as v}from"./api.B03e8F6d.js";import{t as y}from"./Modal.okwDNaJA.js";import{t as b}from"./FloatingPanel.BetdW5N2.js";var x=s(`<input type=search class="input permission-picker__search">`),S=s(`<div class=permission-picker__matrix role=presentation><div class="permission-picker__row permission-picker__row--head"role=presentation><span class=permission-picker__resource></span><!$><!/><!$><!/></div><!$><!/>`),C=s(`<div class=permission-picker__custom><p class=permission-picker__custom-label></p><div class=permission-picker__chips><!$><!/><form class=permission-picker__custom-form><input class="input permission-picker__custom-input"><button class="btn btn-secondary btn-sm"type=submit>`),w=s(`<p class=icon-picker__count>`),T=s(`<div class=permission-picker><button type=button class="input permission-picker__trigger"aria-haspopup=dialog><span class=permission-picker__value></span><span class=icon-picker__caret aria-hidden=true></span></button><!$><!/>`),E=s(`<span class=permission-picker__action-label>`),D=s(`<p class=permission-picker__empty>`),O=s(`<div class=permission-picker__row><span class=permission-picker__resource></span><!$><!/>`),k=s(`<label class=permission-picker__cell><input type=checkbox><span aria-hidden=true>✓`),A=s(`<span class="permission-picker__cell permission-picker__cell--empty">`),ee=s(`<span class=permission-picker__chip><code></code><button type=button>×`),j=[`read`,`create`,`update`,`delete`],M=[`content`,`media`,`category`,`tag`,`menu`,`user`,`roles`,`theme`,`plugin`,`setting`,`webhook`,`tenants`,`audit`,`build`,`system`],N={media:[`upload`]},P=(e,t)=>`${e}:${t}`,F=e=>{let[t,n]=e.split(`:`);return!t||!n?!1:j.includes(t)&&M.includes(n)};function I(e){let{t:s}=_(),[c,h]=r(!1),[v,y]=r(``),[I,L]=r(``),[R,z]=r(void 0),B=n(()=>new Set(e.value)),V=n(()=>e.value.filter(e=>!F(e))),H=n(()=>{let e=v().trim().toLowerCase();return e?M.filter(t=>t.includes(e)||s(`access.resources.${t}`).toLowerCase().includes(e)):M}),U=n(()=>{let e=new Set;for(let t of H())for(let n of N[t]??[])e.add(n);return[...e]}),W=(e,t)=>j.includes(e)||(N[t]??[]).includes(e),G=(t,n)=>{let r=P(t,n);e.onChange(B().has(r)?e.value.filter(e=>e!==r):[...e.value,r])},K=t=>{e.onChange(e.value.filter(e=>e!==t))},q=()=>{let t=I().trim().toLowerCase().replace(/\s+/g,`-`);t&&!B().has(t)&&e.onChange([...e.value,t]),L(``)},J=()=>{let t=e.value.length;if(t===0)return e.placeholder??s(`access.permissionsPlaceholder`);let n=new Set(e.value.map(e=>e.split(`:`)[1]??e));return s(`access.permissionsSummary`,{resources:n.size,count:t})};return(()=>{var n=f(T),r=n.firstChild,_=r.firstChild,M=_.nextSibling,N=r.nextSibling,[F,Y]=m(N.nextSibling);return r.$$click=()=>h(!c()),g(z,r),u(_,J),u(M,()=>c()?`▴`:`▾`),u(n,i(b,{get open(){return c()},get trigger(){return R()},onClose:()=>h(!1),class:`permission-picker__panel`,role:`dialog`,get"aria-label"(){return s(`access.permissions`)},minWidth:440,get children(){return[(()=>{var t=f(x);return t.$$input=e=>y(e.currentTarget.value),a(()=>p(t,`placeholder`,e.searchPlaceholder??s(`access.permissionSearch`))),a(()=>d(t,`value`,v())),l(),t})(),(()=>{var e=f(S),t=e.firstChild,n=t.firstChild.nextSibling,[r,c]=m(n.nextSibling),l=r.nextSibling,[h,g]=m(l.nextSibling),_=t.nextSibling,[v,y]=m(_.nextSibling);return u(t,i(o,{each:j,children:e=>(()=>{var t=f(E);return u(t,e),t})()}),r,c),u(t,i(o,{get each(){return U()},children:e=>(()=>{var t=f(E);return u(t,e),t})()}),h,g),u(e,i(o,{get each(){return H()},get fallback(){return(()=>{var e=f(D);return u(e,()=>s(`access.permissionNoMatches`)),e})()},children:e=>(()=>{var t=f(O),n=t.firstChild,r=n.nextSibling,[c,l]=m(r.nextSibling);return p(n,`title`,e),u(n,()=>s(`access.resources.${e}`)),u(t,i(o,{get each(){return[...j,...U()]},children:t=>W(t,e)?(()=>{var n=f(k),r=n.firstChild;return p(n,`title`,`${t}:${e}`),r.addEventListener(`change`,()=>G(t,e)),a(()=>n.classList.toggle(`is-checked`,!!B().has(P(t,e)))),a(()=>d(r,`checked`,B().has(P(t,e)))),n})():f(A)}),c,l),t})()}),v,y),e})(),(()=>{var e=f(C),t=e.firstChild,n=t.nextSibling,r=n.firstChild,[c,h]=m(r.nextSibling),g=c.nextSibling,_=g.firstChild,v=_.nextSibling;return u(t,()=>s(`access.customPermissions`)),u(n,i(o,{get each(){return V()},children:e=>(()=>{var t=f(ee),n=t.firstChild,r=n.nextSibling;return u(n,e),r.$$click=()=>K(e),a(()=>p(r,`aria-label`,`${s(`common.remove`)}: ${e}`)),l(),t})()}),c,h),g.addEventListener(`submit`,e=>{e.preventDefault(),q()}),_.$$input=e=>L(e.currentTarget.value),u(v,()=>s(`common.add`)),a(()=>p(_,`placeholder`,s(`access.customPermission`))),a(()=>d(_,`value`,I())),l(),e})(),i(t,{get when(){return e.value.length>0},get children(){var t=f(w);return u(t,()=>s(`access.permissionsSelected`,{count:e.value.length})),t}})]}}),F,Y),a(t=>{var n=c(),i=e.value.length===0;return n!==t.e&&p(r,`aria-expanded`,t.e=n),i!==t.t&&_.classList.toggle(`is-empty`,t.t=i),t},{e:void 0,t:void 0}),l(),n})()}c([`click`,`input`]);var L=s(`<div class="notice notice--error">`),R=s(`<div class=resource-hub><!$><!/><div class=access-grid><section class=card><div class=card-header-row><h3></h3><button class="btn btn-primary"type=button>+ <!$><!/></button></div><table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody></tbody></table><!$><!/></section><section class=card><div class=card-header-row><h3></h3><button class="btn btn-primary"type=button>+ <!$><!/></button></div><table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody></tbody></table><!$><!/>`),z=s(`<button class="btn btn-danger btn-sm"type=button>`),B=s(`<tr><td></td><td><code></code></td><td class=access-permissions-cell></td><td class=access-actions><button class="btn btn-secondary btn-sm"type=button></button><!$><!/>`),V=s(`<form class=resource-form><label><span class=resource-form__label></span><input class=input required></label><label><span class=resource-form__label></span><input class=input required></label><div class=resource-form__field><span class=resource-form__label></span><!$><!/></div><div class=form-actions><button class="btn btn-secondary"type=button></button><button class="btn btn-primary"type=submit>`),H=s(`<tr><td></td><td><code></code></td><td></td><td class=access-actions><button class="btn btn-secondary btn-sm"type=button></button><button class="btn btn-danger btn-sm"type=button>`),U=s(`<form class=resource-form><label><span class=resource-form__label></span><input class=input required></label><label><span class=resource-form__label></span><input class=input required></label><label><span class=resource-form__label></span><input class=input></label><div class=form-actions><button class="btn btn-secondary"type=button></button><button class="btn btn-primary"type=submit>`);function W(){let{t:n}=_(),[s,c]=r([]),[g,b]=r([]),[x,S]=r(null),[C,w]=r(null),[T,E]=r(!1),[D,O]=r(``),k=async()=>{try{c(await v.listRoles()),b((await v.listTenants({limit:100})).data??[])}catch(e){O(e instanceof Error?e.message:String(e))}};e(k);let A=e=>{e.preventDefault();let t=x();t&&(E(!0),(t.id?v.updateRole(t.id,t):v.createRole(t)).then(()=>(S(null),k())).catch(e=>O(e instanceof Error?e.message:String(e))).finally(()=>E(!1)))},ee=e=>{e.preventDefault();let t=C();t&&(E(!0),(t.id?v.updateTenant(t.id,t):v.createTenant(t)).then(()=>(w(null),k())).catch(e=>O(e instanceof Error?e.message:String(e))).finally(()=>E(!1)))},j=e=>{let t=e.permissions??[];return t.length===0?`—`:t.slice(0,4).join(`, `)+(t.length>4?` +${t.length-4}`:``)};return(()=>{var e=f(R),r=e.firstChild,[c,_]=m(r.nextSibling),b=c.nextSibling.firstChild,E=b.firstChild,O=E.firstChild,M=O.nextSibling,N=M.firstChild.nextSibling,[P,F]=m(N.nextSibling),W=E.nextSibling,G=W.firstChild,K=G.firstChild.firstChild,q=K.nextSibling,J=q.nextSibling,Y=G.nextSibling,te=W.nextSibling,[ne,re]=m(te.nextSibling),X=b.nextSibling,Z=X.firstChild,Q=Z.firstChild,$=Q.nextSibling,ie=$.firstChild.nextSibling,[ae,oe]=m(ie.nextSibling),se=Z.nextSibling,ce=se.firstChild,le=ce.firstChild.firstChild,ue=le.nextSibling,de=ue.nextSibling,fe=ce.nextSibling,pe=se.nextSibling,[me,he]=m(pe.nextSibling);return u(e,i(t,{get when(){return D()},get children(){var e=f(L);return u(e,D),e}}),c,_),u(O,()=>n(`access.roles`)),M.$$click=()=>S({name:``,slug:``,permissions:[]}),u(M,()=>n(`common.create`),P,F),u(K,()=>n(`resources.name`)),u(q,()=>n(`resources.slug`)),u(J,()=>n(`access.permissions`)),u(Y,i(o,{get each(){return s()},children:e=>(()=>{var r=f(B),o=r.firstChild,s=o.nextSibling,c=s.firstChild,d=s.nextSibling,h=d.nextSibling,g=h.firstChild,_=g.nextSibling,[y,b]=m(_.nextSibling);return u(o,()=>e.name),u(c,()=>e.slug),u(d,()=>j(e)),g.$$click=()=>S({...e,permissions:[...e.permissions??[]]}),u(g,()=>n(`common.edit`)),u(h,i(t,{get when(){return!e.is_system},get children(){var t=f(z);return t.$$click=()=>void v.deleteRole(e.id).then(k),u(t,()=>n(`common.delete`)),l(),t}}),y,b),a(()=>p(d,`title`,(e.permissions??[]).join(`, `))),l(),r})()})),u(b,i(y,{get open(){return x()!==null},onClose:()=>S(null),get title(){return h(()=>!!x()?.id)()?n(`access.editRole`):n(`access.newRole`)},get children(){return i(t,{get when(){return x()},children:e=>(()=>{var t=f(V),r=t.firstChild,o=r.firstChild,s=o.nextSibling,c=r.nextSibling,g=c.firstChild,_=g.nextSibling,v=c.nextSibling,y=v.firstChild,b=y.nextSibling,[x,C]=m(b.nextSibling),w=v.nextSibling.firstChild,E=w.nextSibling;return t.addEventListener(`submit`,A),u(o,()=>n(`resources.name`)),s.$$input=t=>S({...e(),name:t.currentTarget.value}),u(g,()=>n(`resources.slug`)),_.$$input=t=>S({...e(),slug:t.currentTarget.value}),u(y,()=>n(`access.permissions`)),u(v,i(I,{get value(){return e().permissions??[]},onChange:t=>S({...e(),permissions:t})}),x,C),w.$$click=()=>S(null),u(w,()=>n(`common.cancel`)),u(E,(()=>{var e=h(()=>!!T());return()=>e()?n(`common.loading`):n(`common.save`)})()),a(e=>{var t=n(`resources.name`),r=n(`resources.slug`),i=T();return t!==e.e&&p(s,`placeholder`,e.e=t),r!==e.t&&p(_,`placeholder`,e.t=r),i!==e.a&&d(E,`disabled`,e.a=i),e},{e:void 0,t:void 0,a:void 0}),a(()=>d(s,`value`,e().name??``)),a(()=>d(_,`value`,e().slug??``)),l(),t})()})}}),ne,re),u(Q,()=>n(`access.tenants`)),$.$$click=()=>w({name:``,slug:``}),u($,()=>n(`common.create`),ae,oe),u(le,()=>n(`resources.name`)),u(ue,()=>n(`resources.slug`)),u(de,()=>n(`common.status`)),u(fe,i(o,{get each(){return g()},children:e=>(()=>{var t=f(H),r=t.firstChild,i=r.nextSibling,a=i.firstChild,o=i.nextSibling,s=o.nextSibling.firstChild,c=s.nextSibling;return u(r,()=>e.name),u(a,()=>e.slug),u(o,()=>e.status),s.$$click=()=>w({...e}),u(s,()=>n(`common.edit`)),c.$$click=()=>e.id&&void v.deleteTenant(e.id).then(k),u(c,()=>n(`common.delete`)),l(),t})()})),u(X,i(y,{get open(){return C()!==null},onClose:()=>w(null),get title(){return h(()=>!!C()?.id)()?n(`access.editTenant`):n(`access.newTenant`)},get children(){return i(t,{get when(){return C()},children:e=>(()=>{var t=f(U),r=t.firstChild,i=r.firstChild,o=i.nextSibling,s=r.nextSibling,c=s.firstChild,m=c.nextSibling,g=s.nextSibling,_=g.firstChild,v=_.nextSibling,y=g.nextSibling.firstChild,b=y.nextSibling;return t.addEventListener(`submit`,ee),u(i,()=>n(`resources.name`)),o.$$input=t=>w({...e(),name:t.currentTarget.value}),u(c,()=>n(`resources.slug`)),m.$$input=t=>w({...e(),slug:t.currentTarget.value}),u(_,()=>n(`access.domain`)),v.$$input=t=>w({...e(),domain:t.currentTarget.value}),y.$$click=()=>w(null),u(y,()=>n(`common.cancel`)),u(b,(()=>{var e=h(()=>!!T());return()=>e()?n(`common.loading`):n(`common.save`)})()),a(e=>{var t=n(`resources.name`),r=n(`resources.slug`),i=n(`access.domain`),a=T();return t!==e.e&&p(o,`placeholder`,e.e=t),r!==e.t&&p(m,`placeholder`,e.t=r),i!==e.a&&p(v,`placeholder`,e.a=i),a!==e.o&&d(b,`disabled`,e.o=a),e},{e:void 0,t:void 0,a:void 0,o:void 0}),a(()=>d(o,`value`,e().name??``)),a(()=>d(m,`value`,e().slug??``)),a(()=>d(v,`value`,e().domain??``)),l(),t})()})}}),me,he),l(),e})()}c([`click`,`input`]);export{W as AccessManager};
@@ -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.DeOz3HxE.js";import{n as g}from"./api.B03e8F6d.js";var _=o(`<div class="notice notice--error">`),v=o(`<div class=taxonomies-manager><!$><!/><form class=card><h3></h3><div class=form-grid><label><!$><!/><input class=input required></label><label><!$><!/><input class=input pattern=[a-z0-9_]*></label><label class=checkbox-label><input type=checkbox> <!$><!/></label></div><fieldset><legend></legend><!$><!/></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></tr></thead><tbody>`),y=o(`<label><input type=checkbox> <!$><!/> (<!$><!/>)`),b=o(`<button type=button class="btn btn-danger">`),x=o(`<tr><td><!$><!/> (<!$><!/>)</td><td></td><td></td><td>`),ee=o(`<label style=margin-right:0.75rem><input type=checkbox> <!$><!/>`);function S(){let{t:o}=h(),[s,S]=n([]),[C,w]=n([]),[T,E]=n(``),[D,O]=n(!1),[k,A]=n({name:``,slug:``,hierarchical:!1,attachTo:[]}),j=async()=>{try{let[e,t]=await Promise.all([g.getTaxonomies(),g.getContentTypes()]);S(e),w(t)}catch(e){E(e instanceof Error?e.message:String(e))}};e(j);let M=async e=>{e.preventDefault(),E(``),O(!0);try{await g.createTaxonomy({name:k().name,slug:k().slug||void 0,hierarchical:k().hierarchical,attachTo:k().attachTo,labels:{singular_name:k().name}}),A({name:``,slug:``,hierarchical:!1,attachTo:[]}),await j(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){E(e instanceof Error?e.message:String(e))}finally{O(!1)}},N=async(e,t)=>{let n=e.attachTo?.includes(t);try{n?await g.detachTaxonomy(e.slug,t):await g.attachTaxonomy(e.slug,t),await j(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){E(e instanceof Error?e.message:String(e))}},P=async e=>{try{await g.deleteTaxonomy(e),await j(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){E(e instanceof Error?e.message:String(e))}};return(()=>{var e=d(v),n=e.firstChild,[h,g]=p(n.nextSibling),S=h.nextSibling,w=S.firstChild,E=w.nextSibling,O=E.firstChild,j=O.firstChild,[F,I]=p(j.nextSibling),L=F.nextSibling,R=O.nextSibling,z=R.firstChild,[B,V]=p(z.nextSibling),H=B.nextSibling,U=R.nextSibling,W=U.firstChild,G=W.nextSibling.nextSibling,[K,q]=p(G.nextSibling),J=E.nextSibling,Y=J.firstChild,te=Y.nextSibling,[ne,re]=p(te.nextSibling),X=J.nextSibling,Z=S.nextSibling.firstChild.firstChild,Q=Z.firstChild.firstChild,$=Q.nextSibling,ie=$.nextSibling,ae=Z.nextSibling;return l(e,r(t,{get when(){return T()},get children(){var e=d(_);return l(e,T),e}}),h,g),S.addEventListener(`submit`,M),l(w,()=>o(`settings.taxonomies.form.title`)),l(O,()=>o(`settings.taxonomies.form.name`),F,I),L.$$input=e=>A({...k(),name:e.currentTarget.value}),l(R,()=>o(`settings.taxonomies.form.slug`),B,V),H.$$input=e=>A({...k(),slug:e.currentTarget.value}),W.addEventListener(`change`,e=>A({...k(),hierarchical:e.currentTarget.checked})),l(U,()=>o(`settings.taxonomies.form.hierarchical`),K,q),l(Y,()=>o(`settings.taxonomies.form.attachTo`)),l(J,r(a,{get each(){return C()},children:e=>(()=>{var t=d(y),n=t.firstChild,r=n.nextSibling.nextSibling,[a,o]=p(r.nextSibling),s=a.nextSibling.nextSibling,[c,f]=p(s.nextSibling);return c.nextSibling,n.addEventListener(`change`,t=>A({...k(),attachTo:t.currentTarget.checked?[...k().attachTo,e.slug]:k().attachTo.filter(t=>t!==e.slug)})),l(t,()=>e.pluralLabel,a,o),l(t,()=>e.slug,c,f),i(()=>u(n,`checked`,k().attachTo.includes(e.slug))),t})()}),ne,re),l(X,()=>o(`settings.taxonomies.form.create`)),l(Q,()=>o(`settings.taxonomies.table.taxonomy`)),l($,()=>o(`settings.taxonomies.table.hierarchical`)),l(ie,()=>o(`settings.taxonomies.table.attachedTypes`)),l(ae,r(a,{get each(){return s()},children:e=>(()=>{var n=d(x),s=n.firstChild,f=s.firstChild,[h,g]=p(f.nextSibling),_=h.nextSibling.nextSibling,[v,y]=p(_.nextSibling);v.nextSibling;var S=s.nextSibling,w=S.nextSibling,T=w.nextSibling;return l(s,()=>e.name,h,g),l(s,()=>e.slug,v,y),l(S,(()=>{var t=m(()=>!!e.hierarchical);return()=>t()?o(`common.yes`):o(`common.no`)})()),l(w,r(a,{get each(){return C()},children:t=>(()=>{var n=d(ee),r=n.firstChild,a=r.nextSibling.nextSibling,[o,s]=p(a.nextSibling);return r.addEventListener(`change`,()=>N(e,t.slug)),l(n,()=>t.slug,o,s),i(()=>u(r,`checked`,e.attachTo?.includes(t.slug)??!1)),n})()})),l(T,r(t,{get when(){return e.source!==`CORE`},get children(){var t=d(b);return t.$$click=()=>P(e.slug),l(t,()=>o(`settings.taxonomies.table.actions.remove`)),c(),t}})),n})()})),i(e=>{var t=o(`settings.taxonomies.form.slugHint`),n=D();return t!==e.e&&f(H,`title`,e.e=t),n!==e.t&&u(X,`disabled`,e.t=n),e},{e:void 0,t:void 0}),i(()=>u(L,`value`,k().name)),i(()=>u(H,`value`,k().slug)),i(()=>u(W,`checked`,k().hierarchical)),c(),e})()}s([`input`,`click`]);export{S as TaxonomiesManager};
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.fOaTPvDv.js";import{n as g}from"./api.B03e8F6d.js";var _=o(`<div class="notice notice--error">`),v=o(`<div class=taxonomies-manager><!$><!/><form class=card><h3></h3><div class=form-grid><label><!$><!/><input class=input required></label><label><!$><!/><input class=input pattern=[a-z0-9_]*></label><label class=checkbox-label><input type=checkbox> <!$><!/></label></div><fieldset><legend></legend><!$><!/></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></tr></thead><tbody>`),y=o(`<label><input type=checkbox> <!$><!/> (<!$><!/>)`),b=o(`<button type=button class="btn btn-danger">`),x=o(`<tr><td><!$><!/> (<!$><!/>)</td><td></td><td></td><td>`),ee=o(`<label style=margin-right:0.75rem><input type=checkbox> <!$><!/>`);function S(){let{t:o}=h(),[s,S]=n([]),[C,w]=n([]),[T,E]=n(``),[D,O]=n(!1),[k,A]=n({name:``,slug:``,hierarchical:!1,attachTo:[]}),j=async()=>{try{let[e,t]=await Promise.all([g.getTaxonomies(),g.getContentTypes()]);S(e),w(t)}catch(e){E(e instanceof Error?e.message:String(e))}};e(j);let M=async e=>{e.preventDefault(),E(``),O(!0);try{await g.createTaxonomy({name:k().name,slug:k().slug||void 0,hierarchical:k().hierarchical,attachTo:k().attachTo,labels:{singular_name:k().name}}),A({name:``,slug:``,hierarchical:!1,attachTo:[]}),await j(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){E(e instanceof Error?e.message:String(e))}finally{O(!1)}},N=async(e,t)=>{let n=e.attachTo?.includes(t);try{n?await g.detachTaxonomy(e.slug,t):await g.attachTaxonomy(e.slug,t),await j(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){E(e instanceof Error?e.message:String(e))}},P=async e=>{try{await g.deleteTaxonomy(e),await j(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){E(e instanceof Error?e.message:String(e))}};return(()=>{var e=d(v),n=e.firstChild,[h,g]=p(n.nextSibling),S=h.nextSibling,w=S.firstChild,E=w.nextSibling,O=E.firstChild,j=O.firstChild,[F,I]=p(j.nextSibling),L=F.nextSibling,R=O.nextSibling,z=R.firstChild,[B,V]=p(z.nextSibling),H=B.nextSibling,U=R.nextSibling,W=U.firstChild,G=W.nextSibling.nextSibling,[K,q]=p(G.nextSibling),J=E.nextSibling,Y=J.firstChild,te=Y.nextSibling,[ne,re]=p(te.nextSibling),X=J.nextSibling,Z=S.nextSibling.firstChild.firstChild,Q=Z.firstChild.firstChild,$=Q.nextSibling,ie=$.nextSibling,ae=Z.nextSibling;return l(e,r(t,{get when(){return T()},get children(){var e=d(_);return l(e,T),e}}),h,g),S.addEventListener(`submit`,M),l(w,()=>o(`settings.taxonomies.form.title`)),l(O,()=>o(`settings.taxonomies.form.name`),F,I),L.$$input=e=>A({...k(),name:e.currentTarget.value}),l(R,()=>o(`settings.taxonomies.form.slug`),B,V),H.$$input=e=>A({...k(),slug:e.currentTarget.value}),W.addEventListener(`change`,e=>A({...k(),hierarchical:e.currentTarget.checked})),l(U,()=>o(`settings.taxonomies.form.hierarchical`),K,q),l(Y,()=>o(`settings.taxonomies.form.attachTo`)),l(J,r(a,{get each(){return C()},children:e=>(()=>{var t=d(y),n=t.firstChild,r=n.nextSibling.nextSibling,[a,o]=p(r.nextSibling),s=a.nextSibling.nextSibling,[c,f]=p(s.nextSibling);return c.nextSibling,n.addEventListener(`change`,t=>A({...k(),attachTo:t.currentTarget.checked?[...k().attachTo,e.slug]:k().attachTo.filter(t=>t!==e.slug)})),l(t,()=>e.pluralLabel,a,o),l(t,()=>e.slug,c,f),i(()=>u(n,`checked`,k().attachTo.includes(e.slug))),t})()}),ne,re),l(X,()=>o(`settings.taxonomies.form.create`)),l(Q,()=>o(`settings.taxonomies.table.taxonomy`)),l($,()=>o(`settings.taxonomies.table.hierarchical`)),l(ie,()=>o(`settings.taxonomies.table.attachedTypes`)),l(ae,r(a,{get each(){return s()},children:e=>(()=>{var n=d(x),s=n.firstChild,f=s.firstChild,[h,g]=p(f.nextSibling),_=h.nextSibling.nextSibling,[v,y]=p(_.nextSibling);v.nextSibling;var S=s.nextSibling,w=S.nextSibling,T=w.nextSibling;return l(s,()=>e.name,h,g),l(s,()=>e.slug,v,y),l(S,(()=>{var t=m(()=>!!e.hierarchical);return()=>t()?o(`common.yes`):o(`common.no`)})()),l(w,r(a,{get each(){return C()},children:t=>(()=>{var n=d(ee),r=n.firstChild,a=r.nextSibling.nextSibling,[o,s]=p(a.nextSibling);return r.addEventListener(`change`,()=>N(e,t.slug)),l(n,()=>t.slug,o,s),i(()=>u(r,`checked`,e.attachTo?.includes(t.slug)??!1)),n})()})),l(T,r(t,{get when(){return e.source!==`CORE`},get children(){var t=d(b);return t.$$click=()=>P(e.slug),l(t,()=>o(`settings.taxonomies.table.actions.remove`)),c(),t}})),n})()})),i(e=>{var t=o(`settings.taxonomies.form.slugHint`),n=D();return t!==e.e&&f(H,`title`,e.e=t),n!==e.t&&u(X,`disabled`,e.t=n),e},{e:void 0,t:void 0}),i(()=>u(L,`value`,k().name)),i(()=>u(H,`value`,k().slug)),i(()=>u(W,`checked`,k().hierarchical)),c(),e})()}s([`input`,`click`]);export{S as TaxonomiesManager};
@@ -0,0 +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,s as f,u as p}from"./web.DD6VKaIp.js";import{n as m}from"./i18n.fOaTPvDv.js";import{n as h}from"./api.B03e8F6d.js";import{n as g,t as ee}from"./FieldRenderer.2TxRD88c.js";var _=o(`<div class="notice notice--error">`),te=o(`<div class=term-meta-fields><h4></h4><!$><!/>`),ne=o(`<button class=btn type=button>`),v=o(`<table class=table><thead><tr><th></th><th></th><th></th></tr></thead><tbody>`),y=o(`<div class=taxonomy-manager__layout><div class=taxonomy-manager__form-col><form class="card term-form"><h3></h3><label><!$><!/><input class=input required></label><label><!$><!/><input class=input></label><label><!$><!/><textarea class=input rows=3></textarea></label><!$><!/><div class=form-actions><button class="btn btn-primary"type=submit></button><!$><!/></div></form></div><div class=taxonomy-manager__table-col><div class=card><div class=card-header><div><h3></h3><p class=muted></p></div><span class=badge></span></div><!$><!/>`),b=o(`<div class=taxonomy-manager><!$><!/><!$><!/><!$><!/>`),re=o(`<p class=muted>`),ie=o(`<tr><td></td><td></td><td><button class="btn btn-secondary btn-sm"type=button></button> <button class="btn btn-danger btn-sm"type=button>`);function x(o){let{t:s}=m(),[x,S]=n(null),[C,w]=n([]),[T,E]=n(``),[D,O]=n(``),[k,A]=n(``),[j,M]=n(null),[N,P]=n(``),[ae,F]=n(!1),[I,L]=n([]),[R,z]=n({}),B=async()=>{if(o.taxonomySlug)try{let[e,t]=await Promise.all([h.getTaxonomies(),h.getTaxonomyTerms(o.taxonomySlug)]);S(e.find(e=>e.slug===o.taxonomySlug)??null),w(t)}catch(e){P(e instanceof Error?e.message:String(e))}},V=async()=>{if(o.taxonomySlug)try{let e=await h.getFieldGroups({taxonomy:o.taxonomySlug}),t=await Promise.all(e.filter(e=>e.active).map(async e=>h.getFieldGroup(e.id)));L(g(t.flatMap(e=>e.fields??[])))}catch{L([])}};e(()=>{B(),V()});let H=()=>{M(null),E(``),O(``),A(``),z({})},oe=e=>{M(e.id??null),E(e.name),O(e.slug),A(e.description??``),z({...e.meta??{}}),P(``)},se=async e=>{e.preventDefault(),P(``),F(!0);try{let e=C().find(e=>e.id===j())?.meta??{},t={name:T(),slug:D()||void 0,description:k()||void 0,...I().length>0?{meta:{...e,...R()}}:{}};j()?await h.updateTaxonomyTerm(o.taxonomySlug,j(),t):await h.createTaxonomyTerm(o.taxonomySlug,t),H(),await B()}catch(e){P(e instanceof Error?e.message:String(e))}finally{F(!1)}},ce=async e=>{if(e.id&&confirm(s(`content.taxonomy.confirmDelete`,{name:e.name})))try{await h.deleteTaxonomyTerm(o.taxonomySlug,e.id),await B()}catch(e){P(e instanceof Error?e.message:String(e))}};return(()=>{var e=d(b),n=e.firstChild,[m,h]=f(n.nextSibling),g=m.nextSibling,[S,w]=f(g.nextSibling),M=S.nextSibling,[P,F]=f(M.nextSibling);return l(e,r(t,{get when(){return N()},get children(){var e=d(_);return l(e,N),e}}),m,h),l(e,r(t,{get when(){return p(()=>!x())()&&o.taxonomySlug},get children(){var e=d(_);return l(e,()=>s(`content.taxonomy.notFound`)),e}}),S,w),l(e,r(t,{get when(){return x()},get children(){var e=d(y),n=e.firstChild,m=n.firstChild,h=m.firstChild,g=h.nextSibling,_=g.firstChild,[b,S]=f(_.nextSibling),w=b.nextSibling,M=g.nextSibling,N=M.firstChild,[P,F]=f(N.nextSibling),L=P.nextSibling,B=M.nextSibling,V=B.firstChild,[U,W]=f(V.nextSibling),G=U.nextSibling,le=B.nextSibling,[K,ue]=f(le.nextSibling),q=K.nextSibling,J=q.firstChild,de=J.nextSibling,[fe,Y]=f(de.nextSibling),X=n.nextSibling.firstChild,Z=X.firstChild,Q=Z.firstChild,$=Q.firstChild,pe=$.nextSibling,me=Q.nextSibling,he=Z.nextSibling,[ge,_e]=f(he.nextSibling);return m.addEventListener(`submit`,se),l(h,(()=>{var e=p(()=>!!j());return()=>e()?s(`content.taxonomy.editTerm`):s(`content.taxonomy.addTerm`)})()),l(g,()=>s(`content.taxonomy.name`),b,S),w.$$input=e=>E(e.currentTarget.value),l(M,()=>s(`content.taxonomy.slug`),P,F),L.$$input=e=>O(e.currentTarget.value),l(B,()=>s(`content.taxonomy.description`),U,W),G.$$input=e=>A(e.currentTarget.value),l(m,r(t,{get when(){return I().length>0},get children(){var e=d(te),t=e.firstChild,n=t.nextSibling,[i,o]=f(n.nextSibling);return l(t,()=>s(`content.taxonomy.termFields`)),l(e,r(a,{get each(){return I()},children:e=>r(ee,{field:e,get values(){return R()},onChange:(e,t)=>z({...R(),[e]:t}),t:s})}),i,o),e}}),K,ue),l(J,(()=>{var e=p(()=>!!j());return()=>e()?s(`common.save`):s(`content.taxonomy.add`)})()),l(q,r(t,{get when(){return j()},get children(){var e=d(ne);return e.$$click=H,l(e,()=>s(`common.cancel`)),c(),e}}),fe,Y),l($,()=>x().name),l(pe,(()=>{var e=p(()=>!!o.contentType);return()=>e()?`${s(`content.taxonomy.attachedTo`)}: ${o.contentType}`:s(`content.taxonomy.descriptionHint`)})()),l(me,()=>C().length),l(X,r(t,{get when(){return C().length>0},get fallback(){return(()=>{var e=d(re);return l(e,()=>s(`content.taxonomy.empty`)),e})()},get children(){var e=d(v),t=e.firstChild,n=t.firstChild.firstChild,i=n.nextSibling,o=t.nextSibling;return l(n,()=>s(`content.taxonomy.name`)),l(i,()=>s(`content.taxonomy.slug`)),l(o,r(a,{get each(){return C()},children:e=>(()=>{var t=d(ie),n=t.firstChild,r=n.nextSibling,i=r.nextSibling.firstChild,a=i.nextSibling.nextSibling;return l(n,()=>e.name),l(r,()=>e.slug),i.$$click=()=>oe(e),l(i,()=>s(`common.edit`)),a.$$click=()=>void ce(e),l(a,()=>s(`content.taxonomy.delete`)),c(),t})()})),e}}),ge,_e),i(()=>u(J,`disabled`,ae())),i(()=>u(w,`value`,T())),i(()=>u(L,`value`,D())),i(()=>u(G,`value`,k())),c(),e}}),P,F),e})()}s([`input`,`click`]);export{x as TaxonomyTermsManager};
@@ -1,4 +1,4 @@
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.DeOz3HxE.js";import{n as _}from"./api.B03e8F6d.js";var v=s(`<p class=muted>`),y=s(`<span class=customizer__saved>`),b=s(`<div class="alert alert-error">`),x=s(`<div class=customizer__layout><aside class=customizer__panel><h3><!$><!/> · <!$><!/></h3><!$><!/><!$><!/><div class=customizer__actions><button class="btn btn-primary"></button><button class="btn btn-secondary"></button><button class="btn btn-secondary"></button></div><!$><!/><!$><!/><p class="muted customizer__hint"></p></aside><section class=customizer__preview><div class=customizer__preview-bar><input class=input placeholder=/></div><iframe class=customizer__frame>`),S=s(`<div class=customizer><!$><!/><style>
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.fOaTPvDv.js";import{n as _}from"./api.B03e8F6d.js";var v=s(`<p class=muted>`),y=s(`<span class=customizer__saved>`),b=s(`<div class="alert alert-error">`),x=s(`<div class=customizer__layout><aside class=customizer__panel><h3><!$><!/> · <!$><!/></h3><!$><!/><!$><!/><div class=customizer__actions><button class="btn btn-primary"></button><button class="btn btn-secondary"></button><button class="btn btn-secondary"></button></div><!$><!/><!$><!/><p class="muted customizer__hint"></p></aside><section class=customizer__preview><div class=customizer__preview-bar><input class=input placeholder=/></div><iframe class=customizer__frame>`),S=s(`<div class=customizer><!$><!/><style>
2
2
  .customizer__layout {
3
3
  display: grid;
4
4
  grid-template-columns: minmax(280px, 340px) 1fr;
@@ -1,4 +1,4 @@
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,i 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.DeOz3HxE.js";import{n as _}from"./api.B03e8F6d.js";var v=o(`<div class=theme-manager><div class=theme-toolbar><p class=page-hint></p><button class="btn btn-refresh"></button></div><!$><!/><!$><!/><!$><!/><!$><!/><style>
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,i 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.fOaTPvDv.js";import{n as _}from"./api.B03e8F6d.js";var v=o(`<div class=theme-manager><div class=theme-toolbar><p class=page-hint></p><button class="btn btn-refresh"></button></div><!$><!/><!$><!/><!$><!/><!$><!/><style>
2
2
  .theme-toolbar {
3
3
  display: flex;
4
4
  align-items: flex-start;
@@ -0,0 +1 @@
1
+ import{a as e,f 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,v as m}from"./web.DD6VKaIp.js";import{t as h}from"./FloatingPanel.BetdW5N2.js";var g=o(`<input type=search class="input tz-select__search">`),_=o(`<div class=tz-select__options>`),v=o(`<div class=tz-select><button type=button class="input tz-select__trigger"aria-haspopup=listbox><span class=tz-select__value></span><span aria-hidden=true></span></button><!$><!/>`),y=o(`<p class=tz-select__empty>—`),b=o(`<button type=button role=option class=tz-select__option>`),x=new Map;function S(e){let t=x.get(e);t||(t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}),x.set(e,t));let n=(t.formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??`GMT`).match(/GMT([+-])(\d{2}):(\d{2})/);if(!n)return{label:`UTC+00:00`,minutes:0};let r=(n[1]===`-`?-1:1)*(Number(n[2])*60+Number(n[3]));return{label:`UTC${n[1]}${n[2]}:${n[3]}`,minutes:r}}function C(){let e=Intl,t=(typeof e.supportedValuesOf==`function`?e.supportedValuesOf(`timeZone`):[`UTC`]).map(e=>{let{label:t,minutes:n}=S(e);return{tz:e,label:`(UTC${t.slice(3)}) ${e}`,minutes:n}});return t.sort((e,t)=>e.minutes-t.minutes||e.tz.localeCompare(t.tz)),[{tz:`UTC`,label:`(UTC+00:00) UTC`,minutes:0},...t]}var w=e=>e.toLowerCase().replace(/[/_\-]/g,` `);function T(o){let[s,x]=n(!1),[S,T]=n(``),E,[D,O]=n(void 0),k=t(()=>C()),A=t(()=>k().find(e=>e.tz===o.value)),j=t(()=>{let e=w(S().trim());return e?k().filter(t=>w(t.label).includes(e)):k()});return(()=>{var t=d(v),n=t.firstChild,C=n.firstChild,w=C.nextSibling,k=n.nextSibling,[M,N]=p(k.nextSibling),P=E;return typeof P==`function`?m(P,t):E=t,n.$$click=()=>x(!s()),m(O,n),l(C,()=>A()?.label??o.placeholder??``),l(w,()=>s()?`▴`:`▾`),l(t,r(h,{get open(){return s()},get trigger(){return D()},onClose:()=>{x(!1),T(``)},class:`tz-select__panel`,role:`listbox`,minWidth:320,get children(){return[(()=>{var e=d(g);return m(e=>queueMicrotask(()=>e.focus()),e),e.$$input=e=>T(e.currentTarget.value),i(()=>f(e,`placeholder`,o.searchPlaceholder??o.placeholder??``)),i(()=>u(e,`value`,S())),c(),e})(),(()=>{var t=d(_);return l(t,r(e,{get when(){return j().length>0},get fallback(){return d(y)},get children(){return r(a,{get each(){return j()},children:e=>(()=>{var t=d(b);return t.$$click=()=>{o.onChange(e.tz),x(!1),T(``)},l(t,()=>e.label),i(n=>{var r=o.value===e.tz,i=o.value===e.tz;return r!==n.e&&f(t,`aria-selected`,n.e=r),i!==n.t&&t.classList.toggle(`is-selected`,n.t=i),n},{e:void 0,t:void 0}),c(),t})()})}})),t})()]}}),M,N),i(()=>f(n,`aria-expanded`,s())),c(),t})()}s([`click`,`input`]);export{T as t};
@@ -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,s as f,u as ee}from"./web.DD6VKaIp.js";import{n as p}from"./i18n.DeOz3HxE.js";import{n as m}from"./api.B03e8F6d.js";var h=o(`<div class="notice notice--error">`),te=o(`<div class=user-create><!$><!/><form class=card><h3></h3><div class=form-grid><label><!$><!/><input class=input required></label><label><!$><!/><input class=input type=email required></label><label><!$><!/><span class=muted></span><input class=input type=password required minlength=8></label><label><!$><!/><select class=input><option value></option><!$><!/></select></label></div><p class=muted><!$><!/> <!$><!/> — <!$><!/> <!$><!/>.</p><div class=media-details__actions><button class="btn btn-primary"type=submit></button><a class="btn btn-secondary"href=/users>`),g=o(`<option><!$><!/> (<!$><!/>)`);function _(){let{t:o}=p(),[s,_]=n(``),[v,y]=n(``),[b,ne]=n(``),[x,S]=n(``),[C,w]=n([]),[T,E]=n(``),[D,O]=n(!1);e(async()=>{try{let e=await m.listRoles();w(e),S(e.find(e=>e.slug===`EDITOR`)?.id??e[0]?.id??``)}catch{}});let re=async e=>{if(e.preventDefault(),E(``),b().length<8){E(o(`users.detail.passwordError`));return}O(!0);try{await m.createUser({name:s(),email:v(),password:b(),roleId:x()||void 0}),window.location.href=`/users`}catch(e){E(e instanceof Error?e.message:String(e)),O(!1)}};return(()=>{var e=d(te),n=e.firstChild,[p,m]=f(n.nextSibling),w=p.nextSibling,E=w.firstChild,O=E.nextSibling,k=O.firstChild,ie=k.firstChild,[A,j]=f(ie.nextSibling),M=A.nextSibling,N=k.nextSibling,P=N.firstChild,[F,ae]=f(P.nextSibling),I=F.nextSibling,L=N.nextSibling,oe=L.firstChild,[R,z]=f(oe.nextSibling),B=R.nextSibling,V=B.nextSibling,H=L.nextSibling,U=H.firstChild,[W,G]=f(U.nextSibling),K=W.nextSibling,q=K.firstChild,se=q.nextSibling,[ce,le]=f(se.nextSibling),J=O.nextSibling,ue=J.firstChild,[Y,de]=f(ue.nextSibling),fe=Y.nextSibling.nextSibling,[X,pe]=f(fe.nextSibling),me=X.nextSibling.nextSibling,[Z,he]=f(me.nextSibling),ge=Z.nextSibling.nextSibling,[Q,_e]=f(ge.nextSibling);Q.nextSibling;var $=J.nextSibling.firstChild,ve=$.nextSibling;return l(e,r(t,{get when(){return T()},get children(){var e=d(h);return l(e,T),e}}),p,m),w.addEventListener(`submit`,re),l(E,()=>o(`users.new`)),l(k,()=>o(`users.detail.fields.name`),A,j),M.$$input=e=>_(e.currentTarget.value),l(N,()=>o(`users.detail.fields.email`),F,ae),I.$$input=e=>y(e.currentTarget.value),l(L,()=>o(`users.detail.fields.password`),R,z),l(B,()=>o(`users.detail.passwordPrompt`,{email:``})),V.$$input=e=>ne(e.currentTarget.value),l(H,()=>o(`users.detail.fields.role`),W,G),K.addEventListener(`change`,e=>S(e.currentTarget.value)),l(q,()=>o(`users.detail.rolePlaceholder`)),l(K,r(a,{get each(){return C()},children:e=>(()=>{var t=d(g),n=t.firstChild,[r,a]=f(n.nextSibling),o=r.nextSibling.nextSibling,[s,c]=f(o.nextSibling);return s.nextSibling,l(t,()=>e.name,r,a),l(t,()=>e.slug,s,c),i(()=>u(t,`value`,e.id)),t})()}),ce,le),l(J,()=>o(`common.save`),Y,de),l(J,()=>o(`users.new`).toLowerCase(),X,pe),l(J,()=>o(`users.detail.fields.role`),Z,he),l(J,()=>o(`users.toolbar.newBtn`).toLowerCase(),Q,_e),l($,(()=>{var e=ee(()=>!!D());return()=>e()?o(`common.loading`):o(`common.create`)})()),l(ve,()=>o(`common.back`)),i(()=>u($,`disabled`,D())),i(()=>u(M,`value`,s())),i(()=>u(I,`value`,v())),i(()=>u(V,`value`,b())),i(()=>u(K,`value`,x())),c(),e})()}s([`input`]);export{_ as UserCreateForm};
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,s as f,u as ee}from"./web.DD6VKaIp.js";import{n as p}from"./i18n.fOaTPvDv.js";import{n as m}from"./api.B03e8F6d.js";var h=o(`<div class="notice notice--error">`),te=o(`<div class=user-create><!$><!/><form class=card><h3></h3><div class=form-grid><label><!$><!/><input class=input required></label><label><!$><!/><input class=input type=email required></label><label><!$><!/><span class=muted></span><input class=input type=password required minlength=8></label><label><!$><!/><select class=input><option value></option><!$><!/></select></label></div><p class=muted><!$><!/> <!$><!/> — <!$><!/> <!$><!/>.</p><div class=media-details__actions><button class="btn btn-primary"type=submit></button><a class="btn btn-secondary"href=/users>`),g=o(`<option><!$><!/> (<!$><!/>)`);function _(){let{t:o}=p(),[s,_]=n(``),[v,y]=n(``),[b,ne]=n(``),[x,S]=n(``),[C,w]=n([]),[T,E]=n(``),[D,O]=n(!1);e(async()=>{try{let e=await m.listRoles();w(e),S(e.find(e=>e.slug===`EDITOR`)?.id??e[0]?.id??``)}catch{}});let re=async e=>{if(e.preventDefault(),E(``),b().length<8){E(o(`users.detail.passwordError`));return}O(!0);try{await m.createUser({name:s(),email:v(),password:b(),roleId:x()||void 0}),window.location.href=`/users`}catch(e){E(e instanceof Error?e.message:String(e)),O(!1)}};return(()=>{var e=d(te),n=e.firstChild,[p,m]=f(n.nextSibling),w=p.nextSibling,E=w.firstChild,O=E.nextSibling,k=O.firstChild,ie=k.firstChild,[A,j]=f(ie.nextSibling),M=A.nextSibling,N=k.nextSibling,P=N.firstChild,[F,ae]=f(P.nextSibling),I=F.nextSibling,L=N.nextSibling,oe=L.firstChild,[R,z]=f(oe.nextSibling),B=R.nextSibling,V=B.nextSibling,H=L.nextSibling,U=H.firstChild,[W,G]=f(U.nextSibling),K=W.nextSibling,q=K.firstChild,se=q.nextSibling,[ce,le]=f(se.nextSibling),J=O.nextSibling,ue=J.firstChild,[Y,de]=f(ue.nextSibling),fe=Y.nextSibling.nextSibling,[X,pe]=f(fe.nextSibling),me=X.nextSibling.nextSibling,[Z,he]=f(me.nextSibling),ge=Z.nextSibling.nextSibling,[Q,_e]=f(ge.nextSibling);Q.nextSibling;var $=J.nextSibling.firstChild,ve=$.nextSibling;return l(e,r(t,{get when(){return T()},get children(){var e=d(h);return l(e,T),e}}),p,m),w.addEventListener(`submit`,re),l(E,()=>o(`users.new`)),l(k,()=>o(`users.detail.fields.name`),A,j),M.$$input=e=>_(e.currentTarget.value),l(N,()=>o(`users.detail.fields.email`),F,ae),I.$$input=e=>y(e.currentTarget.value),l(L,()=>o(`users.detail.fields.password`),R,z),l(B,()=>o(`users.detail.passwordPrompt`,{email:``})),V.$$input=e=>ne(e.currentTarget.value),l(H,()=>o(`users.detail.fields.role`),W,G),K.addEventListener(`change`,e=>S(e.currentTarget.value)),l(q,()=>o(`users.detail.rolePlaceholder`)),l(K,r(a,{get each(){return C()},children:e=>(()=>{var t=d(g),n=t.firstChild,[r,a]=f(n.nextSibling),o=r.nextSibling.nextSibling,[s,c]=f(o.nextSibling);return s.nextSibling,l(t,()=>e.name,r,a),l(t,()=>e.slug,s,c),i(()=>u(t,`value`,e.id)),t})()}),ce,le),l(J,()=>o(`common.save`),Y,de),l(J,()=>o(`users.new`).toLowerCase(),X,pe),l(J,()=>o(`users.detail.fields.role`),Z,he),l(J,()=>o(`users.toolbar.newBtn`).toLowerCase(),Q,_e),l($,(()=>{var e=ee(()=>!!D());return()=>e()?o(`common.loading`):o(`common.create`)})()),l(ve,()=>o(`common.back`)),i(()=>u($,`disabled`,D())),i(()=>u(M,`value`,s())),i(()=>u(I,`value`,v())),i(()=>u(V,`value`,b())),i(()=>u(K,`value`,x())),c(),e})()}s([`input`]);export{_ as UserCreateForm};
@@ -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,s as f}from"./web.DD6VKaIp.js";import{n as p}from"./i18n.DeOz3HxE.js";import{n as m}from"./api.B03e8F6d.js";import{i as h,n as g,o as _,s as v,t as y}from"./src.CYKGYEyR.js";var b=o(`<div class="notice notice--error">`),x=o(`<div class=notice>`),S=o(`<table class=users-table><thead><tr><th></th><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody>`),C=o(`<div class=users-manager><!$><!/><!$><!/><div class=toolbar><!$><!/><!$><!/><a class="btn btn-primary"href=/users/new></a><!$><!/></div><!$><!/><!$><!/><!$><!/>`),w=o(`<p class=muted>`),T=o(`<tr><td></td><td class=muted></td><td></td><td><span class=status-dot></span><!$><!/></td><td class=muted></td><td class=users-table__actions><!$><!/><!$><!/>`),E=o(`<span class=muted>`),D=o(`<div class="card user-details"><h3></h3><div class=form-grid><label><!$><!/><input class=input></label><label><!$><!/><input class=input type=email></label><label><!$><!/><select class=input><option value=ACTIVE></option><option value=INACTIVE></option></select></label><label><!$><!/><select class=input><option value></option><!$><!/></select></label></div><p class=muted></p><div class=media-details__actions><!$><!/><!$><!/><!$><!/>`),O=o(`<option><!$><!/> (<!$><!/>)`);function k(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleString(`pt-BR`)}function A(){let{t:o}=p(),[s,A]=n([]),[j,M]=n([]),[N,P]=n(0),[F,I]=n(1),[L,R]=n(``),[z,B]=n(``),[V,H]=n(``),[U,W]=n(``),[G,K]=n(null),[q,J]=n(!1),Y=async()=>{try{let e=await m.listUsers({page:F(),limit:20,search:L()||void 0,status:z()||void 0});A(e.data??[]),P(e.total??0)}catch(e){H(e instanceof Error?e.message:String(e))}};e(async()=>{await Y();try{M(await m.listRoles())}catch{}});let X=async()=>{I(1),await Y()},ee=async(e,t)=>{if(t){J(!0),H(``);try{let n=await m.assignRole(e.id,t);K({...e,roles:n.roles}),W(o(`users.detail.toasts.roleUpdated`,{name:e.name})),await Y()}catch(e){H(e instanceof Error?e.message:String(e))}finally{J(!1)}}},te=async e=>{let t=prompt(o(`users.detail.passwordPrompt`,{email:e.email}));if(t){if(t.length<8){H(o(`users.detail.passwordError`));return}J(!0),H(``);try{await m.setUserPassword(e.id,t),W(o(`users.detail.toasts.passwordChanged`,{name:e.name}))}catch(e){H(e instanceof Error?e.message:String(e))}finally{J(!1)}}},ne=async e=>{J(!0),H(``);try{await m.updateUser(e.id,{name:e.name,email:e.email,status:e.status}),W(o(`users.detail.toasts.saved`,{name:e.name})),K(null),await Y()}catch(e){H(e instanceof Error?e.message:String(e))}finally{J(!1)}},re=async e=>{if(confirm(o(`users.detail.confirmDelete`,{email:e.email}))){J(!0),H(``);try{await m.deleteUser(e.id),G()?.id===e.id&&K(null),W(o(`users.detail.toasts.deleted`,{name:e.name})),await Y()}catch(e){H(e instanceof Error?e.message:String(e))}finally{J(!1)}}},ie=e=>j().find(t=>t.slug===e.roles[0]);return(()=>{var e=d(C),n=e.firstChild,[p,m]=f(n.nextSibling),A=p.nextSibling,[M,P]=f(A.nextSibling),H=M.nextSibling,W=H.firstChild,[J,Z]=f(W.nextSibling),ae=J.nextSibling,[Q,oe]=f(ae.nextSibling),$=Q.nextSibling,se=$.nextSibling,[ce,le]=f(se.nextSibling),ue=H.nextSibling,[de,fe]=f(ue.nextSibling),pe=de.nextSibling,[me,he]=f(pe.nextSibling),ge=me.nextSibling,[_e,ve]=f(ge.nextSibling);return l(e,r(t,{get when(){return V()},get children(){var e=d(b);return l(e,V),e}}),p,m),l(e,r(t,{get when(){return U()},get children(){var e=d(x);return l(e,U),e}}),M,P),l(H,r(h,{name:`user-search`,get placeholder(){return o(`users.toolbar.search`)},get value(){return L()},onInput:e=>{R(e),X()}}),J,Z),l(H,r(v,{name:`user-status`,get placeholder(){return o(`users.toolbar.allStatus`)},get value(){return z()},get options(){return[{value:`ACTIVE`,label:o(`users.toolbar.active`)},{value:`INACTIVE`,label:o(`users.toolbar.inactive`)}]},onChange:e=>{B(e),X()}}),Q,oe),l($,()=>o(`users.toolbar.newBtn`)),l(H,r(g,{variant:`secondary`,onClick:()=>void X(),get children(){return o(`users.toolbar.searchBtn`)}}),ce,le),l(e,r(t,{get when(){return s().length>0},get fallback(){return(()=>{var e=d(w);return l(e,()=>o(`users.empty`)),e})()},get children(){var e=d(S),n=e.firstChild,c=n.firstChild.firstChild,u=c.nextSibling,p=u.nextSibling,m=p.nextSibling,h=m.nextSibling,_=n.nextSibling;return l(c,()=>o(`users.table.name`)),l(u,()=>o(`users.table.email`)),l(p,()=>o(`users.table.role`)),l(m,()=>o(`users.table.status`)),l(h,()=>o(`users.table.lastAccess`)),l(_,r(a,{get each(){return s()},children:e=>(()=>{var n=d(T),a=n.firstChild,s=a.nextSibling,c=s.nextSibling,u=c.nextSibling,p=u.firstChild,m=p.nextSibling,[h,_]=f(m.nextSibling),v=u.nextSibling,b=v.nextSibling,x=b.firstChild,[S,C]=f(x.nextSibling),w=S.nextSibling,[D,O]=f(w.nextSibling);return l(a,()=>e.name),l(s,()=>e.email),l(c,r(t,{get when(){return e.roles.length>0},get fallback(){return(()=>{var e=d(E);return l(e,()=>o(`users.noRole`)),e})()},get children(){return r(y,{get children(){return e.roles.join(`, `)}})}})),l(u,()=>o(`common.status.`+e.status.toLowerCase()),h,_),l(v,()=>k(e.last_login_at)),l(b,r(g,{variant:`secondary`,size:`sm`,onClick:()=>K(e),get children(){return o(`users.table.actions.manage`)}}),S,C),l(b,r(g,{variant:`danger`,size:`sm`,onClick:()=>void re(e),get children(){return o(`users.table.actions.delete`)}}),D,O),i(t=>{var r=G()?.id===e.id,i=e.status===`ACTIVE`;return r!==t.e&&n.classList.toggle(`users-table__row--selected`,t.e=r),i!==t.t&&p.classList.toggle(`status-dot--active`,t.t=i),t},{e:void 0,t:void 0}),n})()})),e}}),de,fe),l(e,r(_,{get page(){return F()},limit:20,get total(){return N()},onPageChange:e=>{I(e),Y()}}),me,he),l(e,r(t,{get when(){return G()},children:e=>(()=>{var t=d(D),n=t.firstChild,s=n.nextSibling,p=s.firstChild,m=p.firstChild,[h,_]=f(m.nextSibling),v=h.nextSibling,y=p.nextSibling,b=y.firstChild,[x,S]=f(b.nextSibling),C=x.nextSibling,w=y.nextSibling,T=w.firstChild,[E,A]=f(T.nextSibling),M=E.nextSibling,N=M.firstChild,P=N.nextSibling,F=w.nextSibling,I=F.firstChild,[L,R]=f(I.nextSibling),z=L.nextSibling,B=z.firstChild,V=B.nextSibling,[H,U]=f(V.nextSibling),W=s.nextSibling,G=W.nextSibling,J=G.firstChild,[Y,X]=f(J.nextSibling),re=Y.nextSibling,[Z,ae]=f(re.nextSibling),Q=Z.nextSibling,[oe,$]=f(Q.nextSibling);return l(n,()=>o(`users.detail.title`)),l(p,()=>o(`users.detail.fields.name`),h,_),v.$$input=t=>K({...e(),name:t.currentTarget.value}),l(y,()=>o(`users.detail.fields.email`),x,S),C.$$input=t=>K({...e(),email:t.currentTarget.value}),l(w,()=>o(`users.detail.fields.status`),E,A),M.addEventListener(`change`,t=>K({...e(),status:t.currentTarget.value})),l(N,()=>o(`users.detail.statusOptions.active`)),l(P,()=>o(`users.detail.statusOptions.inactive`)),l(F,()=>o(`users.detail.fields.role`),L,R),z.addEventListener(`change`,t=>void ee(e(),t.currentTarget.value)),l(B,()=>o(`users.detail.rolePlaceholder`)),l(z,r(a,{get each(){return j()},children:e=>(()=>{var t=d(O),n=t.firstChild,[r,a]=f(n.nextSibling),o=r.nextSibling.nextSibling,[s,c]=f(o.nextSibling);return s.nextSibling,l(t,()=>e.name,r,a),l(t,()=>e.slug,s,c),i(()=>u(t,`value`,e.id)),t})()}),H,U),l(W,()=>o(`users.detail.meta`,{created:k(e().created_at),lastAccess:k(e().last_login_at)})),l(G,r(g,{variant:`primary`,get disabled(){return q()},get loading(){return q()},onClick:()=>void ne(e()),get children(){return o(`users.detail.actions.save`)}}),Y,X),l(G,r(g,{variant:`secondary`,get disabled(){return q()},onClick:()=>void te(e()),get children(){return o(`users.detail.actions.resetPassword`)}}),Z,ae),l(G,r(g,{variant:`secondary`,onClick:()=>K(null),get children(){return o(`users.detail.actions.close`)}}),oe,$),i(()=>u(z,`disabled`,q())),i(()=>u(v,`value`,e().name)),i(()=>u(C,`value`,e().email)),i(()=>u(M,`value`,e().status)),i(()=>u(z,`value`,ie(e())?.id??``)),c(),t})()}),_e,ve),e})()}s([`input`]);export{A as UsersManager};
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,s as f}from"./web.DD6VKaIp.js";import{n as p}from"./i18n.fOaTPvDv.js";import{n as m}from"./api.B03e8F6d.js";import{i as h,n as g,o as _,s as v,t as y}from"./src.CYKGYEyR.js";var b=o(`<div class="notice notice--error">`),x=o(`<div class=notice>`),S=o(`<table class=users-table><thead><tr><th></th><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody>`),C=o(`<div class=users-manager><!$><!/><!$><!/><div class=toolbar><!$><!/><!$><!/><a class="btn btn-primary"href=/users/new></a><!$><!/></div><!$><!/><!$><!/><!$><!/>`),w=o(`<p class=muted>`),T=o(`<tr><td></td><td class=muted></td><td></td><td><span class=status-dot></span><!$><!/></td><td class=muted></td><td class=users-table__actions><!$><!/><!$><!/>`),E=o(`<span class=muted>`),D=o(`<div class="card user-details"><h3></h3><div class=form-grid><label><!$><!/><input class=input></label><label><!$><!/><input class=input type=email></label><label><!$><!/><select class=input><option value=ACTIVE></option><option value=INACTIVE></option></select></label><label><!$><!/><select class=input><option value></option><!$><!/></select></label></div><p class=muted></p><div class=media-details__actions><!$><!/><!$><!/><!$><!/>`),O=o(`<option><!$><!/> (<!$><!/>)`);function k(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleString(`pt-BR`)}function A(){let{t:o}=p(),[s,A]=n([]),[j,M]=n([]),[N,P]=n(0),[F,I]=n(1),[L,R]=n(``),[z,B]=n(``),[V,H]=n(``),[U,W]=n(``),[G,K]=n(null),[q,J]=n(!1),Y=async()=>{try{let e=await m.listUsers({page:F(),limit:20,search:L()||void 0,status:z()||void 0});A(e.data??[]),P(e.total??0)}catch(e){H(e instanceof Error?e.message:String(e))}};e(async()=>{await Y();try{M(await m.listRoles())}catch{}});let X=async()=>{I(1),await Y()},ee=async(e,t)=>{if(t){J(!0),H(``);try{let n=await m.assignRole(e.id,t);K({...e,roles:n.roles}),W(o(`users.detail.toasts.roleUpdated`,{name:e.name})),await Y()}catch(e){H(e instanceof Error?e.message:String(e))}finally{J(!1)}}},te=async e=>{let t=prompt(o(`users.detail.passwordPrompt`,{email:e.email}));if(t){if(t.length<8){H(o(`users.detail.passwordError`));return}J(!0),H(``);try{await m.setUserPassword(e.id,t),W(o(`users.detail.toasts.passwordChanged`,{name:e.name}))}catch(e){H(e instanceof Error?e.message:String(e))}finally{J(!1)}}},ne=async e=>{J(!0),H(``);try{await m.updateUser(e.id,{name:e.name,email:e.email,status:e.status}),W(o(`users.detail.toasts.saved`,{name:e.name})),K(null),await Y()}catch(e){H(e instanceof Error?e.message:String(e))}finally{J(!1)}},re=async e=>{if(confirm(o(`users.detail.confirmDelete`,{email:e.email}))){J(!0),H(``);try{await m.deleteUser(e.id),G()?.id===e.id&&K(null),W(o(`users.detail.toasts.deleted`,{name:e.name})),await Y()}catch(e){H(e instanceof Error?e.message:String(e))}finally{J(!1)}}},ie=e=>j().find(t=>t.slug===e.roles[0]);return(()=>{var e=d(C),n=e.firstChild,[p,m]=f(n.nextSibling),A=p.nextSibling,[M,P]=f(A.nextSibling),H=M.nextSibling,W=H.firstChild,[J,Z]=f(W.nextSibling),ae=J.nextSibling,[Q,oe]=f(ae.nextSibling),$=Q.nextSibling,se=$.nextSibling,[ce,le]=f(se.nextSibling),ue=H.nextSibling,[de,fe]=f(ue.nextSibling),pe=de.nextSibling,[me,he]=f(pe.nextSibling),ge=me.nextSibling,[_e,ve]=f(ge.nextSibling);return l(e,r(t,{get when(){return V()},get children(){var e=d(b);return l(e,V),e}}),p,m),l(e,r(t,{get when(){return U()},get children(){var e=d(x);return l(e,U),e}}),M,P),l(H,r(h,{name:`user-search`,get placeholder(){return o(`users.toolbar.search`)},get value(){return L()},onInput:e=>{R(e),X()}}),J,Z),l(H,r(v,{name:`user-status`,get placeholder(){return o(`users.toolbar.allStatus`)},get value(){return z()},get options(){return[{value:`ACTIVE`,label:o(`users.toolbar.active`)},{value:`INACTIVE`,label:o(`users.toolbar.inactive`)}]},onChange:e=>{B(e),X()}}),Q,oe),l($,()=>o(`users.toolbar.newBtn`)),l(H,r(g,{variant:`secondary`,onClick:()=>void X(),get children(){return o(`users.toolbar.searchBtn`)}}),ce,le),l(e,r(t,{get when(){return s().length>0},get fallback(){return(()=>{var e=d(w);return l(e,()=>o(`users.empty`)),e})()},get children(){var e=d(S),n=e.firstChild,c=n.firstChild.firstChild,u=c.nextSibling,p=u.nextSibling,m=p.nextSibling,h=m.nextSibling,_=n.nextSibling;return l(c,()=>o(`users.table.name`)),l(u,()=>o(`users.table.email`)),l(p,()=>o(`users.table.role`)),l(m,()=>o(`users.table.status`)),l(h,()=>o(`users.table.lastAccess`)),l(_,r(a,{get each(){return s()},children:e=>(()=>{var n=d(T),a=n.firstChild,s=a.nextSibling,c=s.nextSibling,u=c.nextSibling,p=u.firstChild,m=p.nextSibling,[h,_]=f(m.nextSibling),v=u.nextSibling,b=v.nextSibling,x=b.firstChild,[S,C]=f(x.nextSibling),w=S.nextSibling,[D,O]=f(w.nextSibling);return l(a,()=>e.name),l(s,()=>e.email),l(c,r(t,{get when(){return e.roles.length>0},get fallback(){return(()=>{var e=d(E);return l(e,()=>o(`users.noRole`)),e})()},get children(){return r(y,{get children(){return e.roles.join(`, `)}})}})),l(u,()=>o(`common.status.`+e.status.toLowerCase()),h,_),l(v,()=>k(e.last_login_at)),l(b,r(g,{variant:`secondary`,size:`sm`,onClick:()=>K(e),get children(){return o(`users.table.actions.manage`)}}),S,C),l(b,r(g,{variant:`danger`,size:`sm`,onClick:()=>void re(e),get children(){return o(`users.table.actions.delete`)}}),D,O),i(t=>{var r=G()?.id===e.id,i=e.status===`ACTIVE`;return r!==t.e&&n.classList.toggle(`users-table__row--selected`,t.e=r),i!==t.t&&p.classList.toggle(`status-dot--active`,t.t=i),t},{e:void 0,t:void 0}),n})()})),e}}),de,fe),l(e,r(_,{get page(){return F()},limit:20,get total(){return N()},onPageChange:e=>{I(e),Y()}}),me,he),l(e,r(t,{get when(){return G()},children:e=>(()=>{var t=d(D),n=t.firstChild,s=n.nextSibling,p=s.firstChild,m=p.firstChild,[h,_]=f(m.nextSibling),v=h.nextSibling,y=p.nextSibling,b=y.firstChild,[x,S]=f(b.nextSibling),C=x.nextSibling,w=y.nextSibling,T=w.firstChild,[E,A]=f(T.nextSibling),M=E.nextSibling,N=M.firstChild,P=N.nextSibling,F=w.nextSibling,I=F.firstChild,[L,R]=f(I.nextSibling),z=L.nextSibling,B=z.firstChild,V=B.nextSibling,[H,U]=f(V.nextSibling),W=s.nextSibling,G=W.nextSibling,J=G.firstChild,[Y,X]=f(J.nextSibling),re=Y.nextSibling,[Z,ae]=f(re.nextSibling),Q=Z.nextSibling,[oe,$]=f(Q.nextSibling);return l(n,()=>o(`users.detail.title`)),l(p,()=>o(`users.detail.fields.name`),h,_),v.$$input=t=>K({...e(),name:t.currentTarget.value}),l(y,()=>o(`users.detail.fields.email`),x,S),C.$$input=t=>K({...e(),email:t.currentTarget.value}),l(w,()=>o(`users.detail.fields.status`),E,A),M.addEventListener(`change`,t=>K({...e(),status:t.currentTarget.value})),l(N,()=>o(`users.detail.statusOptions.active`)),l(P,()=>o(`users.detail.statusOptions.inactive`)),l(F,()=>o(`users.detail.fields.role`),L,R),z.addEventListener(`change`,t=>void ee(e(),t.currentTarget.value)),l(B,()=>o(`users.detail.rolePlaceholder`)),l(z,r(a,{get each(){return j()},children:e=>(()=>{var t=d(O),n=t.firstChild,[r,a]=f(n.nextSibling),o=r.nextSibling.nextSibling,[s,c]=f(o.nextSibling);return s.nextSibling,l(t,()=>e.name,r,a),l(t,()=>e.slug,s,c),i(()=>u(t,`value`,e.id)),t})()}),H,U),l(W,()=>o(`users.detail.meta`,{created:k(e().created_at),lastAccess:k(e().last_login_at)})),l(G,r(g,{variant:`primary`,get disabled(){return q()},get loading(){return q()},onClick:()=>void ne(e()),get children(){return o(`users.detail.actions.save`)}}),Y,X),l(G,r(g,{variant:`secondary`,get disabled(){return q()},onClick:()=>void te(e()),get children(){return o(`users.detail.actions.resetPassword`)}}),Z,ae),l(G,r(g,{variant:`secondary`,onClick:()=>K(null),get children(){return o(`users.detail.actions.close`)}}),oe,$),i(()=>u(z,`disabled`,q())),i(()=>u(v,`value`,e().name)),i(()=>u(C,`value`,e().email)),i(()=>u(M,`value`,e().status)),i(()=>u(z,`value`,ie(e())?.id??``)),c(),t})()}),_e,ve),e})()}s([`input`]);export{A as UsersManager};
@@ -1 +1 @@
1
- import{S as e,a as t,h as n,l as r,p as i,r as a,x 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,v as g}from"./web.DD6VKaIp.js";import{n as _}from"./i18n.DeOz3HxE.js";import{n as v}from"./api.B03e8F6d.js";var y=s(`<div class=webhook-event-select__dropdown role=listbox><input class=input><div class=webhook-event-select__options>`),b=s(`<div class=webhook-event-select><button type=button class="input webhook-event-select__trigger"aria-haspopup=listbox><span></span><span aria-hidden=true>⌄</span></button><!$><!/><div class=webhook-event-select__chips>`),x=s(`<span class=muted>`),S=s(`<label class=webhook-event-option><input type=checkbox><span><!$><!/><small>`),C=s(`<button type=button class=webhook-event-chip><!$><!/> ×`),w=s(`<div class="notice notice--error">`),T=s(`<div class=table-scroll><table class=table><thead><tr><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody>`),E=s(`<div class="resource-hub webhooks-manager"><!$><!/><div class=card-header-row><div><h3></h3></div><button class="btn btn-primary"type=button></button></div><!$><!/><section class=card></section><style>.webhook-event-select{position:relative}.webhook-event-select__trigger{width:100%;display:flex;justify-content:space-between;align-items:center;text-align:left;cursor:pointer}.webhook-event-select__dropdown{position:absolute;z-index:20;top:calc(100% + .25rem);left:0;right:0;background:var(--color-surface,#fff);border:1px solid var(--color-border,#dcdcde);box-shadow:0 8px 22px rgba(0,0,0,.14);padding:.6rem}.webhook-event-select__options{max-height:240px;overflow:auto;margin-top:.5rem;display:grid;gap:.2rem}.webhook-event-option{display:flex!important;align-items:flex-start;gap:.5rem!important;padding:.45rem;border-radius:4px;cursor:pointer}.webhook-event-option:hover{background:var(--color-surface-muted,#f5f5f5)}.webhook-event-option span{display:grid;gap:.12rem}.webhook-event-option small{color:var(--color-muted);font-size:.75rem}.webhook-event-select__chips{display:flex;flex-wrap:wrap;gap:.35rem;margin-top:.4rem}.webhook-event-chip{border:1px solid var(--color-border,#dcdcde);background:var(--color-surface-muted,#f5f5f5);border-radius:999px;padding:.2rem .55rem;cursor:pointer;font-size:.78rem}`),D=s(`<label><!$><!/><input class=input type=password>`),O=s(`<div class=form-grid><label><!$><!/><input class=input></label><label><!$><!/><input class=input type=password>`),k=s(`<div class=form-grid><label><!$><!/><input class=input type=password></label><label><!$><!/><input class=input>`),A=s(`<section class=card><h3></h3><form class=resource-form><label><!$><!/><input class=input required type=url></label><label><!$><!/><!$><!/></label><label><!$><!/><select class=input><option value=none></option><option value=bearer></option><option value=basic></option><option value=api_key></option><option value=hmac_sha256></option></select></label><!$><!/><!$><!/><!$><!/><!$><!/><label class=checkbox-label><input type=checkbox> <!$><!/></label><div><button class="btn btn-primary"type=submit></button> <button class=btn type=button>`),j=s(`<p>`),M=s(`<tr><td></td><td></td><td></td><td></td><td><button class=btn type=button></button> <button class="btn btn-danger"type=button>`),N=()=>({url:``,events:[],active:!0,auth_type:`hmac_sha256`,auth_config:{signatureHeader:`X-Webhook-Signature`}});function P(s){let[c,_]=n(!1),[v,w]=n(``),T;e(()=>{let e=e=>{T&&!T.contains(e.target)&&_(!1)};document.addEventListener(`mousedown`,e),o(()=>document.removeEventListener(`mousedown`,e))});let E=()=>s.options.filter(e=>`${e.label} ${e.value}`.toLowerCase().includes(v().toLowerCase())),D=e=>s.onChange(s.value.includes(e)?s.value.filter(t=>t!==e):[...s.value,e]);return(()=>{var e=f(b),n=e.firstChild,o=n.firstChild,O=n.nextSibling,[k,A]=m(O.nextSibling),j=k.nextSibling,M=T;return typeof M==`function`?g(M,e):T=e,n.$$click=()=>_(!c()),u(o,(()=>{var e=h(()=>s.value.length>0);return()=>e()?`${s.value.length} selecionado(s)`:s.placeholder})()),u(e,r(t,{get when(){return c()},get children(){var e=f(y),n=e.firstChild,o=n.nextSibling;return n.$$input=e=>w(e.currentTarget.value),u(o,r(t,{get when(){return E().length>0},get fallback(){return(()=>{var e=f(x);return u(e,()=>s.empty),e})()},get children(){return r(a,{get each(){return E()},children:e=>(()=>{var t=f(S),n=t.firstChild,r=n.nextSibling,a=r.firstChild,[o,c]=m(a.nextSibling),l=o.nextSibling;return n.addEventListener(`change`,()=>D(e.value)),u(r,()=>e.label,o,c),u(l,()=>e.value),i(()=>d(n,`checked`,s.value.includes(e.value))),t})()})}})),i(()=>p(n,`placeholder`,s.searchPlaceholder)),i(()=>d(n,`value`,v())),l(),e}}),k,A),u(j,r(a,{get each(){return s.value},children:e=>(()=>{var t=f(C),n=t.firstChild,[r,i]=m(n.nextSibling);return r.nextSibling,t.$$click=()=>D(e),u(t,()=>s.options.find(t=>t.value===e)?.label??e,r,i),l(),t})()})),i(()=>p(n,`aria-expanded`,c())),l(),e})()}function F(){let{t:o}=_(),[s,c]=n([]),[g,y]=n([]),[b,x]=n(null),[S,C]=n(``),[F,I]=n(!0),L=async()=>{I(!0);try{let[e,t]=await Promise.all([v.getWebhooks(),v.getWebhookEvents()]);c(e),y(t)}catch(e){C(e instanceof Error?e.message:String(e))}finally{I(!1)}};e(L);let R=e=>{if(!e){x(N());return}x({...e,events:[...e.events??[]],auth_type:e.auth_type??`hmac_sha256`,auth_config:{...e.auth_config??{}}})},z=(e,t)=>{let n=b();if(n){if(!n.events||n.events.length===0){C(o(`webhooks.eventsRequired`));return}x({...n,auth_config:{...n.auth_config,[e]:t}})}},B=async e=>{e.preventDefault();let t=b();if(!t)return;let n=Object.fromEntries(Object.entries(t.auth_config).filter(([,e])=>e));try{t.id?await v.updateWebhook(t.id,{...t,auth_config:n}):await v.createWebhook({...t,auth_config:n}),x(null),await L()}catch(e){C(e instanceof Error?e.message:String(e))}};return(()=>{var e=f(E),n=e.firstChild,[c,_]=m(n.nextSibling),y=c.nextSibling,C=y.firstChild,N=C.firstChild,I=C.nextSibling,V=y.nextSibling,[H,U]=m(V.nextSibling),W=H.nextSibling;return u(e,r(t,{get when(){return S()},get children(){var e=f(w);return u(e,S),e}}),c,_),u(N,()=>o(`webhooks.listTitle`)),I.$$click=()=>R(),u(I,()=>o(`webhooks.new`)),u(e,r(t,{get when(){return b()},children:e=>(()=>{var n=f(A),a=n.firstChild,s=a.nextSibling,c=s.firstChild,_=c.firstChild,[v,y]=m(_.nextSibling),b=v.nextSibling,S=c.nextSibling,C=S.firstChild,[w,T]=m(C.nextSibling),E=w.nextSibling,[j,M]=m(E.nextSibling),N=S.nextSibling,F=N.firstChild,[I,L]=m(F.nextSibling),R=I.nextSibling,V=R.firstChild,H=V.nextSibling,U=H.nextSibling,W=U.nextSibling,G=W.nextSibling,ee=N.nextSibling,[K,te]=m(ee.nextSibling),ne=K.nextSibling,[q,re]=m(ne.nextSibling),ie=q.nextSibling,[J,ae]=m(ie.nextSibling),oe=J.nextSibling,[Y,se]=m(oe.nextSibling),X=Y.nextSibling,Z=X.firstChild,ce=Z.nextSibling.nextSibling,[le,ue]=m(ce.nextSibling),Q=X.nextSibling.firstChild,$=Q.nextSibling.nextSibling;return u(a,(()=>{var t=h(()=>!!e().id);return()=>t()?o(`webhooks.edit`):o(`webhooks.create`)})()),s.addEventListener(`submit`,B),u(c,()=>o(`webhooks.url`),v,y),b.$$input=t=>x({...e(),url:t.currentTarget.value}),u(S,()=>o(`webhooks.events`),w,T),u(S,r(P,{get options(){return g()},get value(){return e().events??[]},onChange:t=>x({...e(),events:t}),get placeholder(){return o(`webhooks.selectEvents`)},get searchPlaceholder(){return o(`webhooks.searchEvents`)},get empty(){return o(`webhooks.noEvents`)}}),j,M),u(N,()=>o(`webhooks.authentication`),I,L),R.addEventListener(`change`,t=>x({...e(),auth_type:t.currentTarget.value,auth_config:{}})),u(V,()=>o(`webhooks.auth.none`)),u(H,()=>o(`webhooks.auth.bearer`)),u(U,()=>o(`webhooks.auth.basic`)),u(W,()=>o(`webhooks.auth.apiKey`)),u(G,()=>o(`webhooks.auth.hmac_sha256`)),u(s,r(t,{get when(){return e().auth_type===`bearer`},get children(){var t=f(D),n=t.firstChild,[r,a]=m(n.nextSibling),s=r.nextSibling;return u(t,()=>o(`webhooks.token`),r,a),s.$$input=e=>z(`token`,e.currentTarget.value),i(()=>p(s,`placeholder`,e().id?o(`webhooks.keepExisting`):``)),i(()=>d(s,`value`,e().auth_config.token??``)),l(),t}}),K,te),u(s,r(t,{get when(){return e().auth_type===`basic`},get children(){var t=f(O),n=t.firstChild,r=n.firstChild,[a,s]=m(r.nextSibling),c=a.nextSibling,h=n.nextSibling,g=h.firstChild,[_,v]=m(g.nextSibling),y=_.nextSibling;return u(n,()=>o(`webhooks.username`),a,s),c.$$input=e=>z(`username`,e.currentTarget.value),u(h,()=>o(`webhooks.password`),_,v),y.$$input=e=>z(`password`,e.currentTarget.value),i(()=>p(y,`placeholder`,e().id?o(`webhooks.keepExisting`):``)),i(()=>d(c,`value`,e().auth_config.username??``)),i(()=>d(y,`value`,e().auth_config.password??``)),l(),t}}),q,re),u(s,r(t,{get when(){return e().auth_type===`api_key`},get children(){var t=f(O),n=t.firstChild,r=n.firstChild,[a,s]=m(r.nextSibling),c=a.nextSibling,h=n.nextSibling,g=h.firstChild,[_,v]=m(g.nextSibling),y=_.nextSibling;return u(n,()=>o(`webhooks.headerName`),a,s),c.$$input=e=>z(`headerName`,e.currentTarget.value),u(h,()=>o(`webhooks.apiKeyValue`),_,v),y.$$input=e=>z(`value`,e.currentTarget.value),i(()=>p(y,`placeholder`,e().id?o(`webhooks.keepExisting`):``)),i(()=>d(c,`value`,e().auth_config.headerName??``)),i(()=>d(y,`value`,e().auth_config.value??``)),l(),t}}),J,ae),u(s,r(t,{get when(){return e().auth_type===`hmac_sha256`},get children(){var t=f(k),n=t.firstChild,r=n.firstChild,[a,s]=m(r.nextSibling),c=a.nextSibling,h=n.nextSibling,g=h.firstChild,[_,v]=m(g.nextSibling),y=_.nextSibling;return u(n,()=>o(`webhooks.secret`),a,s),c.$$input=e=>z(`secret`,e.currentTarget.value),u(h,()=>o(`webhooks.signatureHeader`),_,v),y.$$input=e=>z(`signatureHeader`,e.currentTarget.value),i(t=>{var n=!e().id,r=e().id?o(`webhooks.keepExisting`):``;return n!==t.e&&d(c,`required`,t.e=n),r!==t.t&&p(c,`placeholder`,t.t=r),t},{e:void 0,t:void 0}),i(()=>d(c,`value`,e().auth_config.secret??``)),i(()=>d(y,`value`,e().auth_config.signatureHeader??`X-Webhook-Signature`)),l(),t}}),Y,se),Z.addEventListener(`change`,t=>x({...e(),active:t.currentTarget.checked})),u(X,()=>o(`webhooks.active`),le,ue),u(Q,()=>o(`common.save`)),$.$$click=()=>x(null),u($,()=>o(`common.cancel`)),i(()=>d(b,`value`,e().url??``)),i(()=>d(R,`value`,e().auth_type)),i(()=>d(Z,`checked`,e().active??!0)),l(),n})()}),H,U),u(W,r(t,{get when(){return!F()},get fallback(){return(()=>{var e=f(j);return u(e,()=>o(`webhooks.loading`)),e})()},get children(){return r(t,{get when(){return s().length>0},get fallback(){return(()=>{var e=f(j);return u(e,()=>o(`webhooks.empty`)),e})()},get children(){var e=f(T),t=e.firstChild.firstChild,n=t.firstChild.firstChild,i=n.nextSibling,c=i.nextSibling,d=c.nextSibling,p=d.nextSibling,m=t.nextSibling;return u(n,()=>o(`webhooks.url`)),u(i,()=>o(`webhooks.events`)),u(c,()=>o(`webhooks.authentication`)),u(d,()=>o(`webhooks.active`)),u(p,()=>o(`common.actions`)),u(m,r(a,{get each(){return s()},children:e=>(()=>{var t=f(M),n=t.firstChild,r=n.nextSibling,i=r.nextSibling,a=i.nextSibling,s=a.nextSibling.firstChild,c=s.nextSibling.nextSibling;return u(n,()=>e.url),u(r,()=>(e.events??[]).join(`, `)),u(i,()=>o(`webhooks.auth.${e.auth_type??`hmac_sha256`}`)),u(a,(()=>{var t=h(()=>!!e.active);return()=>t()?o(`common.yes`):o(`common.no`)})()),s.$$click=()=>R(e),u(s,()=>o(`common.edit`)),c.$$click=()=>e.id&&void v.deleteWebhook(e.id).then(L),u(c,()=>o(`common.delete`)),l(),t})()})),e}})}})),l(),e})()}c([`click`,`input`]);export{F as WebhooksManager};
1
+ import{S as e,a as t,h as n,l as r,p as i,r as a,x 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,v as g}from"./web.DD6VKaIp.js";import{n as _}from"./i18n.fOaTPvDv.js";import{n as v}from"./api.B03e8F6d.js";var y=s(`<div class=webhook-event-select__dropdown role=listbox><input class=input><div class=webhook-event-select__options>`),b=s(`<div class=webhook-event-select><button type=button class="input webhook-event-select__trigger"aria-haspopup=listbox><span></span><span aria-hidden=true>⌄</span></button><!$><!/><div class=webhook-event-select__chips>`),x=s(`<span class=muted>`),S=s(`<label class=webhook-event-option><input type=checkbox><span><!$><!/><small>`),C=s(`<button type=button class=webhook-event-chip><!$><!/> ×`),w=s(`<div class="notice notice--error">`),T=s(`<div class=table-scroll><table class=table><thead><tr><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody>`),E=s(`<div class="resource-hub webhooks-manager"><!$><!/><div class=card-header-row><div><h3></h3></div><button class="btn btn-primary"type=button></button></div><!$><!/><section class=card></section><style>.webhook-event-select{position:relative}.webhook-event-select__trigger{width:100%;display:flex;justify-content:space-between;align-items:center;text-align:left;cursor:pointer}.webhook-event-select__dropdown{position:absolute;z-index:20;top:calc(100% + .25rem);left:0;right:0;background:var(--color-surface,#fff);border:1px solid var(--color-border,#dcdcde);box-shadow:0 8px 22px rgba(0,0,0,.14);padding:.6rem}.webhook-event-select__options{max-height:240px;overflow:auto;margin-top:.5rem;display:grid;gap:.2rem}.webhook-event-option{display:flex!important;align-items:flex-start;gap:.5rem!important;padding:.45rem;border-radius:4px;cursor:pointer}.webhook-event-option:hover{background:var(--color-surface-muted,#f5f5f5)}.webhook-event-option span{display:grid;gap:.12rem}.webhook-event-option small{color:var(--color-muted);font-size:.75rem}.webhook-event-select__chips{display:flex;flex-wrap:wrap;gap:.35rem;margin-top:.4rem}.webhook-event-chip{border:1px solid var(--color-border,#dcdcde);background:var(--color-surface-muted,#f5f5f5);border-radius:999px;padding:.2rem .55rem;cursor:pointer;font-size:.78rem}`),D=s(`<label><!$><!/><input class=input type=password>`),O=s(`<div class=form-grid><label><!$><!/><input class=input></label><label><!$><!/><input class=input type=password>`),k=s(`<div class=form-grid><label><!$><!/><input class=input type=password></label><label><!$><!/><input class=input>`),A=s(`<section class=card><h3></h3><form class=resource-form><label><!$><!/><input class=input required type=url></label><label><!$><!/><!$><!/></label><label><!$><!/><select class=input><option value=none></option><option value=bearer></option><option value=basic></option><option value=api_key></option><option value=hmac_sha256></option></select></label><!$><!/><!$><!/><!$><!/><!$><!/><label class=checkbox-label><input type=checkbox> <!$><!/></label><div><button class="btn btn-primary"type=submit></button> <button class=btn type=button>`),j=s(`<p>`),M=s(`<tr><td></td><td></td><td></td><td></td><td><button class=btn type=button></button> <button class="btn btn-danger"type=button>`),N=()=>({url:``,events:[],active:!0,auth_type:`hmac_sha256`,auth_config:{signatureHeader:`X-Webhook-Signature`}});function P(s){let[c,_]=n(!1),[v,w]=n(``),T;e(()=>{let e=e=>{T&&!T.contains(e.target)&&_(!1)};document.addEventListener(`mousedown`,e),o(()=>document.removeEventListener(`mousedown`,e))});let E=()=>s.options.filter(e=>`${e.label} ${e.value}`.toLowerCase().includes(v().toLowerCase())),D=e=>s.onChange(s.value.includes(e)?s.value.filter(t=>t!==e):[...s.value,e]);return(()=>{var e=f(b),n=e.firstChild,o=n.firstChild,O=n.nextSibling,[k,A]=m(O.nextSibling),j=k.nextSibling,M=T;return typeof M==`function`?g(M,e):T=e,n.$$click=()=>_(!c()),u(o,(()=>{var e=h(()=>s.value.length>0);return()=>e()?`${s.value.length} selecionado(s)`:s.placeholder})()),u(e,r(t,{get when(){return c()},get children(){var e=f(y),n=e.firstChild,o=n.nextSibling;return n.$$input=e=>w(e.currentTarget.value),u(o,r(t,{get when(){return E().length>0},get fallback(){return(()=>{var e=f(x);return u(e,()=>s.empty),e})()},get children(){return r(a,{get each(){return E()},children:e=>(()=>{var t=f(S),n=t.firstChild,r=n.nextSibling,a=r.firstChild,[o,c]=m(a.nextSibling),l=o.nextSibling;return n.addEventListener(`change`,()=>D(e.value)),u(r,()=>e.label,o,c),u(l,()=>e.value),i(()=>d(n,`checked`,s.value.includes(e.value))),t})()})}})),i(()=>p(n,`placeholder`,s.searchPlaceholder)),i(()=>d(n,`value`,v())),l(),e}}),k,A),u(j,r(a,{get each(){return s.value},children:e=>(()=>{var t=f(C),n=t.firstChild,[r,i]=m(n.nextSibling);return r.nextSibling,t.$$click=()=>D(e),u(t,()=>s.options.find(t=>t.value===e)?.label??e,r,i),l(),t})()})),i(()=>p(n,`aria-expanded`,c())),l(),e})()}function F(){let{t:o}=_(),[s,c]=n([]),[g,y]=n([]),[b,x]=n(null),[S,C]=n(``),[F,I]=n(!0),L=async()=>{I(!0);try{let[e,t]=await Promise.all([v.getWebhooks(),v.getWebhookEvents()]);c(e),y(t)}catch(e){C(e instanceof Error?e.message:String(e))}finally{I(!1)}};e(L);let R=e=>{if(!e){x(N());return}x({...e,events:[...e.events??[]],auth_type:e.auth_type??`hmac_sha256`,auth_config:{...e.auth_config??{}}})},z=(e,t)=>{let n=b();if(n){if(!n.events||n.events.length===0){C(o(`webhooks.eventsRequired`));return}x({...n,auth_config:{...n.auth_config,[e]:t}})}},B=async e=>{e.preventDefault();let t=b();if(!t)return;let n=Object.fromEntries(Object.entries(t.auth_config).filter(([,e])=>e));try{t.id?await v.updateWebhook(t.id,{...t,auth_config:n}):await v.createWebhook({...t,auth_config:n}),x(null),await L()}catch(e){C(e instanceof Error?e.message:String(e))}};return(()=>{var e=f(E),n=e.firstChild,[c,_]=m(n.nextSibling),y=c.nextSibling,C=y.firstChild,N=C.firstChild,I=C.nextSibling,V=y.nextSibling,[H,U]=m(V.nextSibling),W=H.nextSibling;return u(e,r(t,{get when(){return S()},get children(){var e=f(w);return u(e,S),e}}),c,_),u(N,()=>o(`webhooks.listTitle`)),I.$$click=()=>R(),u(I,()=>o(`webhooks.new`)),u(e,r(t,{get when(){return b()},children:e=>(()=>{var n=f(A),a=n.firstChild,s=a.nextSibling,c=s.firstChild,_=c.firstChild,[v,y]=m(_.nextSibling),b=v.nextSibling,S=c.nextSibling,C=S.firstChild,[w,T]=m(C.nextSibling),E=w.nextSibling,[j,M]=m(E.nextSibling),N=S.nextSibling,F=N.firstChild,[I,L]=m(F.nextSibling),R=I.nextSibling,V=R.firstChild,H=V.nextSibling,U=H.nextSibling,W=U.nextSibling,G=W.nextSibling,ee=N.nextSibling,[K,te]=m(ee.nextSibling),ne=K.nextSibling,[q,re]=m(ne.nextSibling),ie=q.nextSibling,[J,ae]=m(ie.nextSibling),oe=J.nextSibling,[Y,se]=m(oe.nextSibling),X=Y.nextSibling,Z=X.firstChild,ce=Z.nextSibling.nextSibling,[le,ue]=m(ce.nextSibling),Q=X.nextSibling.firstChild,$=Q.nextSibling.nextSibling;return u(a,(()=>{var t=h(()=>!!e().id);return()=>t()?o(`webhooks.edit`):o(`webhooks.create`)})()),s.addEventListener(`submit`,B),u(c,()=>o(`webhooks.url`),v,y),b.$$input=t=>x({...e(),url:t.currentTarget.value}),u(S,()=>o(`webhooks.events`),w,T),u(S,r(P,{get options(){return g()},get value(){return e().events??[]},onChange:t=>x({...e(),events:t}),get placeholder(){return o(`webhooks.selectEvents`)},get searchPlaceholder(){return o(`webhooks.searchEvents`)},get empty(){return o(`webhooks.noEvents`)}}),j,M),u(N,()=>o(`webhooks.authentication`),I,L),R.addEventListener(`change`,t=>x({...e(),auth_type:t.currentTarget.value,auth_config:{}})),u(V,()=>o(`webhooks.auth.none`)),u(H,()=>o(`webhooks.auth.bearer`)),u(U,()=>o(`webhooks.auth.basic`)),u(W,()=>o(`webhooks.auth.apiKey`)),u(G,()=>o(`webhooks.auth.hmac_sha256`)),u(s,r(t,{get when(){return e().auth_type===`bearer`},get children(){var t=f(D),n=t.firstChild,[r,a]=m(n.nextSibling),s=r.nextSibling;return u(t,()=>o(`webhooks.token`),r,a),s.$$input=e=>z(`token`,e.currentTarget.value),i(()=>p(s,`placeholder`,e().id?o(`webhooks.keepExisting`):``)),i(()=>d(s,`value`,e().auth_config.token??``)),l(),t}}),K,te),u(s,r(t,{get when(){return e().auth_type===`basic`},get children(){var t=f(O),n=t.firstChild,r=n.firstChild,[a,s]=m(r.nextSibling),c=a.nextSibling,h=n.nextSibling,g=h.firstChild,[_,v]=m(g.nextSibling),y=_.nextSibling;return u(n,()=>o(`webhooks.username`),a,s),c.$$input=e=>z(`username`,e.currentTarget.value),u(h,()=>o(`webhooks.password`),_,v),y.$$input=e=>z(`password`,e.currentTarget.value),i(()=>p(y,`placeholder`,e().id?o(`webhooks.keepExisting`):``)),i(()=>d(c,`value`,e().auth_config.username??``)),i(()=>d(y,`value`,e().auth_config.password??``)),l(),t}}),q,re),u(s,r(t,{get when(){return e().auth_type===`api_key`},get children(){var t=f(O),n=t.firstChild,r=n.firstChild,[a,s]=m(r.nextSibling),c=a.nextSibling,h=n.nextSibling,g=h.firstChild,[_,v]=m(g.nextSibling),y=_.nextSibling;return u(n,()=>o(`webhooks.headerName`),a,s),c.$$input=e=>z(`headerName`,e.currentTarget.value),u(h,()=>o(`webhooks.apiKeyValue`),_,v),y.$$input=e=>z(`value`,e.currentTarget.value),i(()=>p(y,`placeholder`,e().id?o(`webhooks.keepExisting`):``)),i(()=>d(c,`value`,e().auth_config.headerName??``)),i(()=>d(y,`value`,e().auth_config.value??``)),l(),t}}),J,ae),u(s,r(t,{get when(){return e().auth_type===`hmac_sha256`},get children(){var t=f(k),n=t.firstChild,r=n.firstChild,[a,s]=m(r.nextSibling),c=a.nextSibling,h=n.nextSibling,g=h.firstChild,[_,v]=m(g.nextSibling),y=_.nextSibling;return u(n,()=>o(`webhooks.secret`),a,s),c.$$input=e=>z(`secret`,e.currentTarget.value),u(h,()=>o(`webhooks.signatureHeader`),_,v),y.$$input=e=>z(`signatureHeader`,e.currentTarget.value),i(t=>{var n=!e().id,r=e().id?o(`webhooks.keepExisting`):``;return n!==t.e&&d(c,`required`,t.e=n),r!==t.t&&p(c,`placeholder`,t.t=r),t},{e:void 0,t:void 0}),i(()=>d(c,`value`,e().auth_config.secret??``)),i(()=>d(y,`value`,e().auth_config.signatureHeader??`X-Webhook-Signature`)),l(),t}}),Y,se),Z.addEventListener(`change`,t=>x({...e(),active:t.currentTarget.checked})),u(X,()=>o(`webhooks.active`),le,ue),u(Q,()=>o(`common.save`)),$.$$click=()=>x(null),u($,()=>o(`common.cancel`)),i(()=>d(b,`value`,e().url??``)),i(()=>d(R,`value`,e().auth_type)),i(()=>d(Z,`checked`,e().active??!0)),l(),n})()}),H,U),u(W,r(t,{get when(){return!F()},get fallback(){return(()=>{var e=f(j);return u(e,()=>o(`webhooks.loading`)),e})()},get children(){return r(t,{get when(){return s().length>0},get fallback(){return(()=>{var e=f(j);return u(e,()=>o(`webhooks.empty`)),e})()},get children(){var e=f(T),t=e.firstChild.firstChild,n=t.firstChild.firstChild,i=n.nextSibling,c=i.nextSibling,d=c.nextSibling,p=d.nextSibling,m=t.nextSibling;return u(n,()=>o(`webhooks.url`)),u(i,()=>o(`webhooks.events`)),u(c,()=>o(`webhooks.authentication`)),u(d,()=>o(`webhooks.active`)),u(p,()=>o(`common.actions`)),u(m,r(a,{get each(){return s()},children:e=>(()=>{var t=f(M),n=t.firstChild,r=n.nextSibling,i=r.nextSibling,a=i.nextSibling,s=a.nextSibling.firstChild,c=s.nextSibling.nextSibling;return u(n,()=>e.url),u(r,()=>(e.events??[]).join(`, `)),u(i,()=>o(`webhooks.auth.${e.auth_type??`hmac_sha256`}`)),u(a,(()=>{var t=h(()=>!!e.active);return()=>t()?o(`common.yes`):o(`common.no`)})()),s.$$click=()=>R(e),u(s,()=>o(`common.edit`)),c.$$click=()=>e.id&&void v.deleteWebhook(e.id).then(L),u(c,()=>o(`common.delete`)),l(),t})()})),e}})}})),l(),e})()}c([`click`,`input`]);export{F as WebhooksManager};