nsthorat's picture
Push
e39b632
raw
history blame
No virus
10.9 kB
import{S as me,i as pe,s as _e,E as Z,_ as F,$ as J,m as C,h as p,n as w,a0 as x,b as y,J as $,O as be,a1 as O,D as ee,F as te,q as D,r as M,u as Y,y as z,z as V,A as R,g as k,d as E,B as H,R as X,k as B,a as K,e as ne,l as I,c as U,v as G,f as Q,a5 as ve,K as de,a3 as $e,H as le,a6 as ke}from"../chunks/index.4fe0636c.js";import{B as Ce,g as ae}from"../chunks/navigation.1d956f81.js";import{P as we}from"../chunks/Page.a668fc01.js";import{q as Ee,d as ye,a as Se,C as Ae,t as se,b as re,I as oe,c as Be,T as Ie,e as Te,f as De}from"../chunks/ConceptView.ac768a1a.js";import{M as Me,u as Ne}from"../chunks/urlHashStore.b5f29cd0.js";import{c as W,S as he}from"../chunks/utils.72a3bae8.js";function ie(s){let e,n;return{c(){e=F("title"),n=D(s[1])},l(t){e=J(t,"title",{});var l=C(e);n=M(l,s[1]),l.forEach(p)},m(t,l){y(t,e,l),$(e,n)},p(t,l){l&2&&Y(n,t[1])},d(t){t&&p(e)}}}function Pe(s){let e,n,t,l=s[1]&&ie(s),r=[{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 32 32"},{fill:"currentColor"},{preserveAspectRatio:"xMidYMid meet"},{width:s[0]},{height:s[0]},s[2],s[3]],_={};for(let u=0;u<r.length;u+=1)_=Z(_,r[u]);return{c(){e=F("svg"),l&&l.c(),n=F("path"),t=F("path"),this.h()},l(u){e=J(u,"svg",{xmlns:!0,viewBox:!0,fill:!0,preserveAspectRatio:!0,width:!0,height:!0});var c=C(e);l&&l.l(c),n=J(c,"path",{d:!0}),C(n).forEach(p),t=J(c,"path",{d:!0}),C(t).forEach(p),c.forEach(p),this.h()},h(){w(n,"d","M16,4c6.6,0,12,5.4,12,12s-5.4,12-12,12S4,22.6,4,16S9.4,4,16,4 M16,2C8.3,2,2,8.3,2,16s6.3,14,14,14s14-6.3,14-14 S23.7,2,16,2z"),w(t,"d","M24 15L17 15 17 8 15 8 15 15 8 15 8 17 15 17 15 24 17 24 17 17 24 17z"),x(e,_)},m(u,c){y(u,e,c),l&&l.m(e,null),$(e,n),$(e,t)},p(u,[c]){u[1]?l?l.p(u,c):(l=ie(u),l.c(),l.m(e,n)):l&&(l.d(1),l=null),x(e,_=be(r,[{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 32 32"},{fill:"currentColor"},{preserveAspectRatio:"xMidYMid meet"},c&1&&{width:u[0]},c&1&&{height:u[0]},c&4&&u[2],c&8&&u[3]]))},i:O,o:O,d(u){u&&p(e),l&&l.d()}}}function ze(s,e,n){let t,l;const r=["size","title"];let _=ee(e,r),{size:u=16}=e,{title:c=void 0}=e;return s.$$set=o=>{n(5,e=Z(Z({},e),te(o))),n(3,_=ee(e,r)),"size"in o&&n(0,u=o.size),"title"in o&&n(1,c=o.title)},s.$$.update=()=>{n(4,t=e["aria-label"]||e["aria-labelledby"]||c),n(2,l={"aria-hidden":t?void 0:!0,role:t?"img":void 0,focusable:Number(e.tabindex)===0?!0:void 0})},e=te(e),[u,c,l,_,t]}class Ve extends me{constructor(e){super(),pe(this,e,ze,Pe,_e,{size:0,title:1})}}function ce(s,e,n){const t=s.slice();return t[17]=e[n],t}function Re(s){let e,n,t,l,r,_,u,c=s[4].data,o=[];for(let f=0;f<c.length;f+=1)o[f]=fe(ce(s,c,f));const b=f=>E(o[f],1,1,()=>{o[f]=null});return t=new Ve({}),{c(){for(let f=0;f<o.length;f+=1)o[f].c();e=K(),n=B("button"),z(t.$$.fragment),l=D(" Add Concept"),this.h()},l(f){for(let i=0;i<o.length;i+=1)o[i].l(f);e=U(f),n=I(f,"BUTTON",{class:!0});var m=C(n);V(t.$$.fragment,m),l=M(m," Add Concept"),m.forEach(p),this.h()},h(){w(n,"class","mt-4 flex w-full items-center gap-x-1 px-4 py-2 text-left text-sm text-gray-500 hover:text-blue-500")},m(f,m){for(let i=0;i<o.length;i+=1)o[i]&&o[i].m(f,m);y(f,e,m),y(f,n,m),R(t,n,null),$(n,l),r=!0,_||(u=de(n,"click",s[13]),_=!0)},p(f,m){if(m&19){c=f[4].data;let i;for(i=0;i<c.length;i+=1){const d=ce(f,c,i);o[i]?(o[i].p(d,m),k(o[i],1)):(o[i]=fe(d),o[i].c(),k(o[i],1),o[i].m(e.parentNode,e))}for(G(),i=c.length;i<o.length;i+=1)b(i);Q()}},i(f){if(!r){for(let m=0;m<c.length;m+=1)k(o[m]);k(t.$$.fragment,f),r=!0}},o(f){o=o.filter(Boolean);for(let m=0;m<o.length;m+=1)E(o[m]);E(t.$$.fragment,f),r=!1},d(f){$e(o,f),f&&p(e),f&&p(n),H(t),_=!1,u()}}}function He(s){let e,n;return e=new he({}),{c(){z(e.$$.fragment)},l(t){V(e.$$.fragment,t)},m(t,l){R(e,t,l),n=!0},p:O,i(t){n||(k(e.$$.fragment,t),n=!0)},o(t){E(e.$$.fragment,t),n=!1},d(t){H(e,t)}}}function fe(s){let e,n,t,l=s[17].namespace+"",r,_,u,c=s[17].name+"",o,b,f,m,i,d,T,S;i=new Ie({props:{size:16}});function j(){return s[12](s[17])}return{c(){e=B("div"),n=B("a"),t=B("span"),r=D(l),_=D(" / "),u=B("span"),o=D(c),f=K(),m=B("button"),z(i.$$.fragment),this.h()},l(A){e=I(A,"DIV",{class:!0});var v=C(e);n=I(v,"A",{href:!0,class:!0});var L=C(n);t=I(L,"SPAN",{class:!0});var h=C(t);r=M(h,l),_=M(h," / "),h.forEach(p),u=I(L,"SPAN",{});var a=C(u);o=M(a,c),a.forEach(p),L.forEach(p),f=U(v),m=I(v,"BUTTON",{title:!0,class:!0});var g=C(m);V(i.$$.fragment,g),g.forEach(p),v.forEach(p),this.h()},h(){w(t,"class","opacity-50"),w(n,"href",b=W(s[17].namespace,s[17].name)),w(n,"class","flex w-full flex-row items-center whitespace-pre px-4 py-2"),w(m,"title","Remove concept"),w(m,"class","p-3 opacity-50 hover:text-red-400 hover:opacity-100"),w(e,"class","flex justify-between border-b border-gray-200 hover:bg-gray-100"),le(e,"bg-blue-100",s[17].name===s[0])},m(A,v){y(A,e,v),$(e,n),$(n,t),$(t,r),$(t,_),$(n,u),$(u,o),$(e,f),$(e,m),R(i,m,null),d=!0,T||(S=de(m,"click",j),T=!0)},p(A,v){s=A,(!d||v&16)&&l!==(l=s[17].namespace+"")&&Y(r,l),(!d||v&16)&&c!==(c=s[17].name+"")&&Y(o,c),(!d||v&16&&b!==(b=W(s[17].namespace,s[17].name)))&&w(n,"href",b),(!d||v&17)&&le(e,"bg-blue-100",s[17].name===s[0])},i(A){d||(k(i.$$.fragment,A),d=!0)},o(A){E(i.$$.fragment,A),d=!1},d(A){A&&p(e),H(i),T=!1,S()}}}function Le(s){let e,n;return e=new Te({props:{concept:s[5].data}}),{c(){z(e.$$.fragment)},l(t){V(e.$$.fragment,t)},m(t,l){R(e,t,l),n=!0},p(t,l){const r={};l&32&&(r.concept=t[5].data),e.$set(r)},i(t){n||(k(e.$$.fragment,t),n=!0)},o(t){E(e.$$.fragment,t),n=!1},d(t){H(e,t)}}}function qe(s){let e,n=s[5].error.message+"",t;return{c(){e=B("p"),t=D(n)},l(l){e=I(l,"P",{});var r=C(e);t=M(r,n),r.forEach(p)},m(l,r){y(l,e,r),$(e,t)},p(l,r){r&32&&n!==(n=l[5].error.message+"")&&Y(t,n)},i:O,o:O,d(l){l&&p(e)}}}function Oe(s){let e,n;return e=new he({}),{c(){z(e.$$.fragment)},l(t){V(e.$$.fragment,t)},m(t,l){R(e,t,l),n=!0},p:O,i(t){n||(k(e.$$.fragment,t),n=!0)},o(t){E(e.$$.fragment,t),n=!1},d(t){H(e,t)}}}function ue(s){let e,n;return e=new Me({props:{danger:!0,open:!0,modalHeading:"Delete concept",primaryButtonText:"Delete",primaryButtonIcon:s[3].isLoading?oe:void 0,secondaryButtonText:"Cancel",$$slots:{default:[je]},$$scope:{ctx:s}}}),e.$on("click:button--secondary",s[14]),e.$on("close",s[15]),e.$on("submit",s[16]),{c(){z(e.$$.fragment)},l(t){V(e.$$.fragment,t)},m(t,l){R(e,t,l),n=!0},p(t,l){const r={};l&8&&(r.primaryButtonIcon=t[3].isLoading?oe:void 0),l&1048578&&(r.$$scope={dirty:l,ctx:t}),e.$set(r)},i(t){n||(k(e.$$.fragment,t),n=!0)},o(t){E(e.$$.fragment,t),n=!1},d(t){H(e,t)}}}function je(s){let e,n,t,l=s[1].namespace+"",r,_,u=s[1].name+"",c,o,b,f,m;return{c(){e=B("p"),n=D("Confirm deleting "),t=B("code"),r=D(l),_=D("/"),c=D(u),o=D(" ?"),b=K(),f=B("p"),m=D("This is a permanent action and cannot be undone."),this.h()},l(i){e=I(i,"P",{class:!0});var d=C(e);n=M(d,"Confirm deleting "),t=I(d,"CODE",{});var T=C(t);r=M(T,l),_=M(T,"/"),c=M(T,u),T.forEach(p),o=M(d," ?"),d.forEach(p),b=U(i),f=I(i,"P",{class:!0});var S=C(f);m=M(S,"This is a permanent action and cannot be undone."),S.forEach(p),this.h()},h(){w(e,"class","!text-lg"),w(f,"class","mt-2")},m(i,d){y(i,e,d),$(e,n),$(e,t),$(t,r),$(t,_),$(t,c),$(e,o),y(i,b,d),y(i,f,d),$(f,m)},p(i,d){d&2&&l!==(l=i[1].namespace+"")&&Y(r,l),d&2&&u!==(u=i[1].name+"")&&Y(c,u)},d(i){i&&p(e),i&&p(b),i&&p(f)}}}function Ke(s){let e,n,t,l,r,_,u,c,o,b,f,m,i,d;const T=[He,Re],S=[];function j(a,g){return a[4].isLoading?0:a[4].isSuccess?1:-1}~(n=j(s))&&(t=S[n]=T[n](s));const A=[Oe,qe,Le],v=[];function L(a,g){var N,P,q;return(N=a[5])!=null&&N.isLoading?0:(P=a[5])!=null&&P.isError?1:(q=a[5])!=null&&q.isSuccess?2:-1}~(c=L(s))&&(o=v[c]=A[c](s)),f=new Ae({});let h=s[1]&&ue(s);return{c(){e=B("div"),t&&t.c(),l=K(),r=B("div"),_=B("div"),u=B("div"),o&&o.c(),b=K(),z(f.$$.fragment),m=K(),h&&h.c(),i=ne(),this.h()},l(a){e=I(a,"DIV",{class:!0});var g=C(e);t&&t.l(g),g.forEach(p),l=U(a),r=I(a,"DIV",{class:!0});var N=C(r);_=I(N,"DIV",{class:!0});var P=C(_);u=I(P,"DIV",{class:!0});var q=C(u);o&&o.l(q),q.forEach(p),P.forEach(p),N.forEach(p),b=U(a),V(f.$$.fragment,a),m=U(a),h&&h.l(a),i=ne(),this.h()},h(){w(e,"class","flex-col border-r border-gray-200"),w(u,"class","lilac-page flex"),w(_,"class","lilac-container"),w(r,"class","flex h-full w-full")},m(a,g){y(a,e,g),~n&&S[n].m(e,null),y(a,l,g),y(a,r,g),$(r,_),$(_,u),~c&&v[c].m(u,null),y(a,b,g),R(f,a,g),y(a,m,g),h&&h.m(a,g),y(a,i,g),d=!0},p(a,g){let N=n;n=j(a),n===N?~n&&S[n].p(a,g):(t&&(G(),E(S[N],1,1,()=>{S[N]=null}),Q()),~n?(t=S[n],t?t.p(a,g):(t=S[n]=T[n](a),t.c()),k(t,1),t.m(e,null)):t=null);let P=c;c=L(a),c===P?~c&&v[c].p(a,g):(o&&(G(),E(v[P],1,1,()=>{v[P]=null}),Q()),~c?(o=v[c],o?o.p(a,g):(o=v[c]=A[c](a),o.c()),k(o,1),o.m(u,null)):o=null),a[1]?h?(h.p(a,g),g&2&&k(h,1)):(h=ue(a),h.c(),k(h,1),h.m(i.parentNode,i)):h&&(G(),E(h,1,1,()=>{h=null}),Q())},i(a){d||(k(t),k(o),k(f.$$.fragment,a),k(h),d=!0)},o(a){E(t),E(o),E(f.$$.fragment,a),E(h),d=!1},d(a){a&&p(e),~n&&S[n].d(),a&&p(l),a&&p(r),~c&&v[c].d(),a&&p(b),H(f,a),a&&p(m),h&&h.d(a),a&&p(i)}}}function Ue(s){let e;return{c(){e=D("Add Concept")},l(n){e=M(n,"Add Concept")},m(n,t){y(n,e,t)},d(n){n&&p(e)}}}function Ye(s){let e,n,t;return n=new Ce({props:{$$slots:{default:[Ue]},$$scope:{ctx:s}}}),n.$on("click",s[11]),{c(){e=B("div"),z(n.$$.fragment),this.h()},l(l){e=I(l,"DIV",{slot:!0});var r=C(e);V(n.$$.fragment,r),r.forEach(p),this.h()},h(){w(e,"slot","header-right")},m(l,r){y(l,e,r),R(n,e,null),t=!0},p(l,r){const _={};r&1048576&&(_.$$scope={dirty:r,ctx:l}),n.$set(_)},i(l){t||(k(n.$$.fragment,l),t=!0)},o(l){E(n.$$.fragment,l),t=!1},d(l){l&&p(e),H(n)}}}function Fe(s){let e,n;return e=new we({props:{title:"Concepts",$$slots:{"header-right":[Ye],default:[Ke]},$$scope:{ctx:s}}}),{c(){z(e.$$.fragment)},l(t){V(e.$$.fragment,t)},m(t,l){R(e,t,l),n=!0},p(t,[l]){const r={};l&1048635&&(r.$$scope={dirty:l,ctx:t}),e.$set(r)},i(t){n||(k(e.$$.fragment,t),n=!0)},o(t){E(e.$$.fragment,t),n=!1},d(t){H(e,t)}}}function Je(s,e,n){let t,l,r,_,u,c=O,o=()=>(c(),c=ve(t,a=>n(5,u=a)),t);X(s,Ne,a=>n(10,r=a)),s.$$.on_destroy.push(()=>c());let b,f,m=null;const i=Ee();X(s,i,a=>n(4,_=a));const d=ye();X(s,d,a=>n(3,l=a));function T(){if(m==null)return;const{namespace:a,name:g}=m;l.mutate([a,g],{onSuccess:()=>{var N;for(const[P,q]of Object.entries(Be)){const ge=(N=ke(De[P]).selectRowsSchema)==null?void 0:N.data;q.deleteConcept(a,g,ge)}n(1,m=null)}})}const S=()=>se({command:re.CreateConcept,onCreate:a=>ae(W(a.detail.namespace,a.detail.name))}),j=a=>n(1,m={namespace:a.namespace,name:a.name}),A=()=>se({command:re.CreateConcept,onCreate:a=>ae(W(a.detail.namespace,a.detail.name))}),v=()=>n(1,m=null),L=()=>n(1,m=null),h=()=>T();return s.$$.update=()=>{s.$$.dirty&1024&&r.onHashChange("",()=>{n(9,b=void 0),n(0,f=void 0)}),s.$$.dirty&1024&&r.onHashChange("/(?<namespace>.+)/(?<conceptName>.+)",a=>{n(9,b=a.namespace),n(0,f=a.conceptName)}),s.$$.dirty&513&&o(n(2,t=b&&f?Se(b,f):void 0))},[f,m,t,l,_,u,i,d,T,b,r,S,j,A,v,L,h]}class et extends me{constructor(e){super(),pe(this,e,Je,Fe,_e,{})}}export{et as component};