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