import{B as e,Ft as t,H as n,It as r,K as i,Mt as a,Q as o,U as s,V as c,W as l,Z as u,_t as d,at as f,d as p,ft as m,ht as h,jt as g,mt as _,ot as v,pt as y,s as b,st as x,tt as S,yt as C}from"../chunks/BA99CCI5.js";import{a as w}from"../chunks/DP37y6wO.js";import"../chunks/xihTtKlq.js";import"../chunks/DGo8yE5j.js";import"../chunks/BymfG72d2.js";import{t as T}from"../chunks/CEQEwD8g.js";import{t as E}from"../chunks/CSUcPJXH.js";import{t as D}from"../chunks/DCohNkHF.js";import{t as O}from"../chunks/Cme17KJK.js";import{t as k}from"../chunks/BhExzYrM2.js";import{t as A}from"../chunks/rAXfrEzK2.js";var j=l(`<div class="flex items-center justify-center gap-1"><!> <!></div>`),M=l(`<p class="text-sm text-neutral-500 dark:text-neutral-400">Not used in any custom formats.</p>`),N=l(`<!> <div class="p-4 md:p-8"><!> <div data-onboarding="regex-references" class="mt-6 space-y-3 md:px-4"><div class="text-sm font-medium text-neutral-900 dark:text-neutral-100"> </div> <!></div></div> <!>`,1);function P(l,P){a(P,!1);let F=h(),I=h(),L=b(P,`data`,8);function R(){w(`/regular-expressions/${L().currentDatabase.id}`)}let z=[{key:`cfName`,header:`Custom Format`},{key:`conditionName`,header:`Condition`},{key:`flags`,header:`Flags`,align:`center`}];f(()=>u(L()),()=>{d(F,{name:L().regularExpression.name,tags:L().regularExpression.tags.map(e=>e.name),pattern:L().regularExpression.pattern,description:L().regularExpression.description??``,regex101Id:L().regularExpression.regex101_id??``})}),f(()=>u(L()),()=>{d(I,new Set(L().conditionRefs.map(e=>e.cfId)).size)}),v(),p();var B=N(),V=y(B);{let e=C(()=>(u(L()),S(()=>`${L().regularExpression.name} · General`)));D(V,{get title(){return o(e)}})}var H=_(V,2),U=m(H);{let e=C(()=>(u(L()),S(()=>L().currentDatabase?.name))),t=C(()=>(u(L()),S(()=>[{label:L().currentDatabase.name,href:`/regular-expressions/${L().currentDatabase.id}`}])));A(U,{mode:`edit`,get databaseName(){return o(e)},get canWriteToBase(){return u(L()),S(()=>L().canWriteToBase)},actionUrl:`?/update`,get initialData(){return o(F)},get failOnReferencedDelete(){return u(L()),S(()=>L().failOnReferencedDelete)},get referenceCount(){return o(I)},onCancel:R,get breadcrumbItems(){return o(t)},get breadcrumbCurrent(){return u(L()),S(()=>L().regularExpression.name)}})}var W=_(U,2),G=m(W),K=m(G);r(G);var q=_(G,2),J=a=>{O(a,{get data(){return u(L()),S(()=>L().conditionRefs)},get columns(){return z},compact:!0,responsive:!0,$$slots:{cell:(a,l)=>{let d=C(()=>l.row),f=C(()=>l.column);var p=s(),h=y(p),g=e=>{k(e,{get href(){return`/custom-formats/${u(L()),S(()=>L().currentDatabase.id)??``}/${u(o(d)),S(()=>o(d).cfId)??``}/conditions`},get text(){return u(o(d)),S(()=>o(d).cfName)},external:!0})},v=e=>{var t=i();x(()=>c(t,(u(o(d)),S(()=>o(d).conditionName)))),n(e,t)},b=a=>{var s=j(),c=m(s),l=e=>{E(e,{variant:`warning`,size:`sm`,children:(e,r)=>{t();var a=i(`Negate`);n(e,a)},$$slots:{default:!0}})};e(c,e=>{u(o(d)),S(()=>o(d).negate)&&e(l)});var f=_(c,2),p=e=>{E(e,{variant:`info`,size:`sm`,children:(e,r)=>{t();var a=i(`Required`);n(e,a)},$$slots:{default:!0}})};e(f,e=>{u(o(d)),S(()=>o(d).required)&&e(p)}),r(s),n(a,s)};e(h,e=>{u(o(f)),S(()=>o(f).key===`cfName`)?e(g):(u(o(f)),S(()=>o(f).key===`conditionName`)?e(v,1):(u(o(f)),S(()=>o(f).key===`flags`)&&e(b,2)))}),n(a,p)}}})},Y=e=>{var t=M();n(e,t)};e(q,e=>{u(L()),S(()=>L().conditionRefs.length>0)?e(J):e(Y,-1)}),r(W),r(H);var X=_(H,2);T(X,{}),x(()=>c(K,`References (${u(L()),S(()=>L().conditionRefs.length)??``})`)),n(l,B),g()}export{P as component};