nsthorat's picture
Push
df815f7
raw
history blame
No virus
11.5 kB
import{S as pe,i as de,s as _e,E as ee,_ as Q,$ as W,m as k,h as d,n as E,a0 as te,b as S,J as v,O as ke,a1 as O,D as ne,F as le,q as M,r as N,u as Y,y as R,z as q,A as H,g as w,d as y,B as L,R as J,k as A,a as j,e as ae,l as B,c as K,v as X,f as Z,a5 as Ce,K as he,a3 as we,H as G,a6 as Ee,a7 as ye,P as Se,a8 as Ie}from"../chunks/index.5fd689e7.js";import{P as Ae,g as se,h as Be}from"../chunks/Page.ad40f1eb.js";import{q as Te,d as De,a as Pe,C as ze,t as re,b as oe,I as ie,c as Me,T as Ne,e as Ve,f as Re}from"../chunks/ConceptView.9a72f1f9.js";import{a as qe,B as He}from"../chunks/taskQueries.ab6be53f.js";import{M as Le,u as Oe}from"../chunks/urlHashStore.e0ea589e.js";import{c as x,S as ge}from"../chunks/utils.ae90bc8b.js";function ce(a){let e,n;return{c(){e=Q("title"),n=M(a[1])},l(t){e=W(t,"title",{});var l=k(e);n=N(l,a[1]),l.forEach(d)},m(t,l){S(t,e,l),v(e,n)},p(t,l){l&2&&Y(n,t[1])},d(t){t&&d(e)}}}function Ue(a){let e,n,t,l=a[1]&&ce(a),i=[{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]],g={};for(let u=0;u<i.length;u+=1)g=ee(g,i[u]);return{c(){e=Q("svg"),l&&l.c(),n=Q("path"),t=Q("path"),this.h()},l(u){e=W(u,"svg",{xmlns:!0,viewBox:!0,fill:!0,preserveAspectRatio:!0,width:!0,height:!0});var c=k(e);l&&l.l(c),n=W(c,"path",{d:!0}),k(n).forEach(d),t=W(c,"path",{d:!0}),k(t).forEach(d),c.forEach(d),this.h()},h(){E(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"),E(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"),te(e,g)},m(u,c){S(u,e,c),l&&l.m(e,null),v(e,n),v(e,t)},p(u,[c]){u[1]?l?l.p(u,c):(l=ce(u),l.c(),l.m(e,n)):l&&(l.d(1),l=null),te(e,g=ke(i,[{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&&d(e),l&&l.d()}}}function je(a,e,n){let t,l;const i=["size","title"];let g=ne(e,i),{size:u=16}=e,{title:c=void 0}=e;return a.$$set=o=>{n(5,e=ee(ee({},e),le(o))),n(3,g=ne(e,i)),"size"in o&&n(0,u=o.size),"title"in o&&n(1,c=o.title)},a.$$.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=le(e),[u,c,l,g,t]}class Ke extends pe{constructor(e){super(),de(this,e,je,Ue,_e,{size:0,title:1})}}function fe(a,e,n){const t=a.slice();return t[20]=e[n],t}function Ye(a){let e,n,t,l,i,g,u,c=a[5].data,o=[];for(let f=0;f<c.length;f+=1)o[f]=ue(fe(a,c,f));const $=f=>y(o[f],1,1,()=>{o[f]=null});return t=new Ke({}),{c(){for(let f=0;f<o.length;f+=1)o[f].c();e=j(),n=A("button"),R(t.$$.fragment),l=M(" Add Concept"),this.h()},l(f){for(let r=0;r<o.length;r+=1)o[r].l(f);e=K(f),n=B(f,"BUTTON",{class:!0});var m=k(n);q(t.$$.fragment,m),l=N(m," Add Concept"),m.forEach(d),this.h()},h(){E(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 r=0;r<o.length;r+=1)o[r]&&o[r].m(f,m);S(f,e,m),S(f,n,m),H(t,n,null),v(n,l),i=!0,g||(u=he(n,"click",a[16]),g=!0)},p(f,m){if(m&43){c=f[5].data;let r;for(r=0;r<c.length;r+=1){const _=fe(f,c,r);o[r]?(o[r].p(_,m),w(o[r],1)):(o[r]=ue(_),o[r].c(),w(o[r],1),o[r].m(e.parentNode,e))}for(X(),r=c.length;r<o.length;r+=1)$(r);Z()}},i(f){if(!i){for(let m=0;m<c.length;m+=1)w(o[m]);w(t.$$.fragment,f),i=!0}},o(f){o=o.filter(Boolean);for(let m=0;m<o.length;m+=1)y(o[m]);y(t.$$.fragment,f),i=!1},d(f){we(o,f),f&&d(e),f&&d(n),L(t),g=!1,u()}}}function Fe(a){let e,n;return e=new ge({}),{c(){R(e.$$.fragment)},l(t){q(e.$$.fragment,t)},m(t,l){H(e,t,l),n=!0},p:O,i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function ue(a){let e,n,t,l=a[20].namespace+"",i,g,u,c=a[20].name+"",o,$,f,m,r,_,T,C,I,V,z;_=new Ne({props:{size:16}});function U(){return a[15](a[20])}return{c(){e=A("div"),n=A("a"),t=A("span"),i=M(l),g=M(" / "),u=A("span"),o=M(c),f=j(),m=A("div"),r=A("button"),R(_.$$.fragment),this.h()},l(h){e=B(h,"DIV",{class:!0});var s=k(e);n=B(s,"A",{href:!0,class:!0});var b=k(n);t=B(b,"SPAN",{class:!0});var D=k(t);i=N(D,l),g=N(D," / "),D.forEach(d),u=B(b,"SPAN",{});var p=k(u);o=N(p,c),p.forEach(d),b.forEach(d),f=K(s),m=B(s,"DIV",{});var P=k(m);r=B(P,"BUTTON",{title:!0,class:!0});var F=k(r);q(_.$$.fragment,F),F.forEach(d),P.forEach(d),s.forEach(d),this.h()},h(){E(t,"class","opacity-50"),E(n,"href",$=x(a[20].namespace,a[20].name)),E(n,"class","flex w-full flex-row items-center whitespace-pre px-4 py-2"),E(r,"title","Remove concept"),r.disabled=T=!a[3],E(r,"class","p-3 opacity-50 hover:text-red-400 hover:opacity-100"),G(m,"opacity-40",!a[3]),E(e,"class","flex justify-between border-b border-gray-200 hover:bg-gray-100"),G(e,"bg-blue-100",a[20].name===a[0])},m(h,s){S(h,e,s),v(e,n),v(n,t),v(t,i),v(t,g),v(n,u),v(u,o),v(e,f),v(e,m),v(m,r),H(_,r,null),I=!0,V||(z=[he(r,"click",U),Ee(C=Be.call(null,m,{text:a[3]?"":"User does not have access to delete concepts."}))],V=!0)},p(h,s){a=h,(!I||s&32)&&l!==(l=a[20].namespace+"")&&Y(i,l),(!I||s&32)&&c!==(c=a[20].name+"")&&Y(o,c),(!I||s&32&&$!==($=x(a[20].namespace,a[20].name)))&&E(n,"href",$),(!I||s&8&&T!==(T=!a[3]))&&(r.disabled=T),C&&ye(C.update)&&s&8&&C.update.call(null,{text:a[3]?"":"User does not have access to delete concepts."}),(!I||s&8)&&G(m,"opacity-40",!a[3]),(!I||s&33)&&G(e,"bg-blue-100",a[20].name===a[0])},i(h){I||(w(_.$$.fragment,h),I=!0)},o(h){y(_.$$.fragment,h),I=!1},d(h){h&&d(e),L(_),V=!1,Se(z)}}}function Je(a){let e,n;return e=new Ve({props:{concept:a[6].data}}),{c(){R(e.$$.fragment)},l(t){q(e.$$.fragment,t)},m(t,l){H(e,t,l),n=!0},p(t,l){const i={};l&64&&(i.concept=t[6].data),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function Ge(a){let e,n=a[6].error.message+"",t;return{c(){e=A("p"),t=M(n)},l(l){e=B(l,"P",{});var i=k(e);t=N(i,n),i.forEach(d)},m(l,i){S(l,e,i),v(e,t)},p(l,i){i&64&&n!==(n=l[6].error.message+"")&&Y(t,n)},i:O,o:O,d(l){l&&d(e)}}}function Qe(a){let e,n;return e=new ge({}),{c(){R(e.$$.fragment)},l(t){q(e.$$.fragment,t)},m(t,l){H(e,t,l),n=!0},p:O,i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function me(a){let e,n;return e=new Le({props:{danger:!0,open:!0,modalHeading:"Delete concept",primaryButtonText:"Delete",primaryButtonIcon:a[4].isLoading?ie:void 0,secondaryButtonText:"Cancel",$$slots:{default:[We]},$$scope:{ctx:a}}}),e.$on("click:button--secondary",a[17]),e.$on("close",a[18]),e.$on("submit",a[19]),{c(){R(e.$$.fragment)},l(t){q(e.$$.fragment,t)},m(t,l){H(e,t,l),n=!0},p(t,l){const i={};l&16&&(i.primaryButtonIcon=t[4].isLoading?ie:void 0),l&8388610&&(i.$$scope={dirty:l,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function We(a){let e,n,t,l=a[1].namespace+"",i,g,u=a[1].name+"",c,o,$,f,m;return{c(){e=A("p"),n=M("Confirm deleting "),t=A("code"),i=M(l),g=M("/"),c=M(u),o=M(" ?"),$=j(),f=A("p"),m=M("This is a permanent action and cannot be undone."),this.h()},l(r){e=B(r,"P",{class:!0});var _=k(e);n=N(_,"Confirm deleting "),t=B(_,"CODE",{});var T=k(t);i=N(T,l),g=N(T,"/"),c=N(T,u),T.forEach(d),o=N(_," ?"),_.forEach(d),$=K(r),f=B(r,"P",{class:!0});var C=k(f);m=N(C,"This is a permanent action and cannot be undone."),C.forEach(d),this.h()},h(){E(e,"class","!text-lg"),E(f,"class","mt-2")},m(r,_){S(r,e,_),v(e,n),v(e,t),v(t,i),v(t,g),v(t,c),v(e,o),S(r,$,_),S(r,f,_),v(f,m)},p(r,_){_&2&&l!==(l=r[1].namespace+"")&&Y(i,l),_&2&&u!==(u=r[1].name+"")&&Y(c,u)},d(r){r&&d(e),r&&d($),r&&d(f)}}}function Xe(a){let e,n,t,l,i,g,u,c,o,$,f,m,r,_;const T=[Fe,Ye],C=[];function I(s,b){return s[5].isLoading?0:s[5].isSuccess?1:-1}~(n=I(a))&&(t=C[n]=T[n](a));const V=[Qe,Ge,Je],z=[];function U(s,b){var D,p,P;return(D=s[6])!=null&&D.isLoading?0:(p=s[6])!=null&&p.isError?1:(P=s[6])!=null&&P.isSuccess?2:-1}~(c=U(a))&&(o=z[c]=V[c](a)),f=new ze({});let h=a[1]&&me(a);return{c(){e=A("div"),t&&t.c(),l=j(),i=A("div"),g=A("div"),u=A("div"),o&&o.c(),$=j(),R(f.$$.fragment),m=j(),h&&h.c(),r=ae(),this.h()},l(s){e=B(s,"DIV",{class:!0});var b=k(e);t&&t.l(b),b.forEach(d),l=K(s),i=B(s,"DIV",{class:!0});var D=k(i);g=B(D,"DIV",{class:!0});var p=k(g);u=B(p,"DIV",{class:!0});var P=k(u);o&&o.l(P),P.forEach(d),p.forEach(d),D.forEach(d),$=K(s),q(f.$$.fragment,s),m=K(s),h&&h.l(s),r=ae(),this.h()},h(){E(e,"class","flex-col border-r border-gray-200"),E(u,"class","lilac-page flex"),E(g,"class","lilac-container"),E(i,"class","flex h-full w-full")},m(s,b){S(s,e,b),~n&&C[n].m(e,null),S(s,l,b),S(s,i,b),v(i,g),v(g,u),~c&&z[c].m(u,null),S(s,$,b),H(f,s,b),S(s,m,b),h&&h.m(s,b),S(s,r,b),_=!0},p(s,b){let D=n;n=I(s),n===D?~n&&C[n].p(s,b):(t&&(X(),y(C[D],1,1,()=>{C[D]=null}),Z()),~n?(t=C[n],t?t.p(s,b):(t=C[n]=T[n](s),t.c()),w(t,1),t.m(e,null)):t=null);let p=c;c=U(s),c===p?~c&&z[c].p(s,b):(o&&(X(),y(z[p],1,1,()=>{z[p]=null}),Z()),~c?(o=z[c],o?o.p(s,b):(o=z[c]=V[c](s),o.c()),w(o,1),o.m(u,null)):o=null),s[1]?h?(h.p(s,b),b&2&&w(h,1)):(h=me(s),h.c(),w(h,1),h.m(r.parentNode,r)):h&&(X(),y(h,1,1,()=>{h=null}),Z())},i(s){_||(w(t),w(o),w(f.$$.fragment,s),w(h),_=!0)},o(s){y(t),y(o),y(f.$$.fragment,s),y(h),_=!1},d(s){s&&d(e),~n&&C[n].d(),s&&d(l),s&&d(i),~c&&z[c].d(),s&&d($),L(f,s),s&&d(m),h&&h.d(s),s&&d(r)}}}function Ze(a){let e;return{c(){e=M("Add Concept")},l(n){e=N(n,"Add Concept")},m(n,t){S(n,e,t)},d(n){n&&d(e)}}}function xe(a){let e,n,t;return n=new He({props:{size:"small",$$slots:{default:[Ze]},$$scope:{ctx:a}}}),n.$on("click",a[14]),{c(){e=A("div"),R(n.$$.fragment),this.h()},l(l){e=B(l,"DIV",{slot:!0});var i=k(e);q(n.$$.fragment,i),i.forEach(d),this.h()},h(){E(e,"slot","header-right")},m(l,i){S(l,e,i),H(n,e,null),t=!0},p(l,i){const g={};i&8388608&&(g.$$scope={dirty:i,ctx:l}),n.$set(g)},i(l){t||(w(n.$$.fragment,l),t=!0)},o(l){y(n.$$.fragment,l),t=!1},d(l){l&&d(e),L(n)}}}function et(a){let e,n;return e=new Ae({props:{title:"Concepts",$$slots:{"header-right":[xe],default:[Xe]},$$scope:{ctx:a}}}),{c(){R(e.$$.fragment)},l(t){q(e.$$.fragment,t)},m(t,l){H(e,t,l),n=!0},p(t,[l]){const i={};l&8388731&&(i.$$scope={dirty:l,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){y(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function tt(a,e,n){let t,l,i,g,u,c,o,$=O,f=()=>($(),$=Ce(l,p=>n(6,o=p)),l);J(a,Oe,p=>n(13,u=p)),a.$$.on_destroy.push(()=>$());let m,r,_=null;const T=Te();J(a,T,p=>n(5,c=p));const C=De();J(a,C,p=>n(4,i=p));const I=qe();J(a,I,p=>n(12,g=p));function V(){if(_==null)return;const{namespace:p,name:P}=_;i.mutate([p,P],{onSuccess:()=>{var F;for(const[be,ve]of Object.entries(Me)){const $e=(F=Ie(Re[be]).selectRowsSchema)==null?void 0:F.data;ve.deleteConcept(p,P,$e)}n(1,_=null)}})}const z=()=>re({command:oe.CreateConcept,onCreate:p=>se(x(p.detail.namespace,p.detail.name))}),U=p=>n(1,_={namespace:p.namespace,name:p.name}),h=()=>re({command:oe.CreateConcept,onCreate:p=>se(x(p.detail.namespace,p.detail.name))}),s=()=>n(1,_=null),b=()=>n(1,_=null),D=()=>V();return a.$$.update=()=>{var p;a.$$.dirty&8192&&u.onHashChange("",()=>{n(11,m=void 0),n(0,r=void 0)}),a.$$.dirty&8192&&u.onHashChange("/(?<namespace>.+)/(?<conceptName>.+)",P=>{n(11,m=P.namespace),n(0,r=P.conceptName)}),a.$$.dirty&4096&&n(3,t=(p=g.data)==null?void 0:p.access.concept.delete_any_concept),a.$$.dirty&2049&&f(n(2,l=m&&r?Pe(m,r):void 0))},[r,_,l,t,i,c,o,T,C,I,V,m,g,u,z,U,h,s,b,D]}class it extends pe{constructor(e){super(),de(this,e,tt,et,_e,{})}}export{it as component};