@budibase/server 2.7.37-alpha.12 → 2.7.37-alpha.13
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.
|
@@ -371,7 +371,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
371
371
|
}`;var j2=d7(function(){return o8(y0,w2+"return "+e2).apply(b0,M0)});if(j2.source=e2,cb(j2))throw j2;return j2}function X8(g1){return Jd(g1).toLowerCase()}function Ab(g1){return Jd(g1).toUpperCase()}function Z8(g1,w1,M1){if(g1=Jd(g1),g1&&(M1||w1===b0))return B1(g1);if(!g1||!(w1=R_(w1)))return g1;var x1=N0(g1),Z1=N0(w1);return e4(x1,G1(x1,Z1),K1(x1,Z1)+1).join("")}function K8(g1,w1,M1){if(g1=Jd(g1),g1&&(M1||w1===b0))return g1.slice(0,J0(g1)+1);if(!g1||!(w1=R_(w1)))return g1;var x1=N0(g1);return e4(x1,0,K1(x1,N0(w1))+1).join("")}function m7(g1,w1,M1){if(g1=Jd(g1),g1&&(M1||w1===b0))return g1.replace(G3,"");if(!g1||!(w1=R_(w1)))return g1;var x1=N0(g1);return e4(x1,G1(x1,N0(w1))).join("")}function _7(g1,w1){var M1=Hd,x1=T0;if(n_(w1)){var Z1="separator"in w1?w1.separator:Z1;M1="length"in w1?Td(w1.length):M1,x1="omission"in w1?R_(w1.omission):x1}g1=Jd(g1);var i0=g1.length;if(W1(g1)){var m0=N0(g1);i0=m0.length}if(M1>=i0)return g1;var y0=M1-B0(x1);if(y0<1)return x1;var M0=m0?e4(m0,0,y0).join(""):g1.slice(0,y0);if(Z1===b0)return M0+x1;if(m0&&(y0+=M0.length-y0),A$(Z1)){if(g1.slice(y0).search(Z1)){var Y0,G0=M0;for(Z1.global||(Z1=U3(Z1.source,Jd(Mg.exec(Z1))+"g")),Z1.lastIndex=0;Y0=Z1.exec(G0);)var e2=Y0.index;M0=M0.slice(0,e2===b0?y0:e2)}}else if(g1.indexOf(R_(Z1),y0)!=y0){var g2=M0.lastIndexOf(Z1);g2>-1&&(M0=M0.slice(0,g2))}return M0+x1}function h7(g1){return g1=Jd(g1),g1&&Cg.test(g1)?g1.replace(i8,Dg):g1}function R$(g1,w1,M1){return g1=Jd(g1),w1=M1?b0:w1,w1===b0?a0(g1)?t2(g1):h1(g1):g1.match(w1)||[]}function Cb(g1){var w1=g1==null?0:g1.length,M1=ud();return g1=w1?u1(g1,function(x1){if(typeof x1[1]!="function")throw new $5(v0);return[M1(x1[0]),x1[1]]}):[],hd(function(x1){for(var Z1=-1;++Z1<w1;){var i0=g1[Z1];if(t1(i0[0],this,x1))return t1(i0[1],this,x1)}})}function g7(g1){return B4(Yh(g1,H0))}function Eb(g1){return function(){return g1}}function B$(g1,w1){return g1==null||g1!==g1?w1:g1}function F3(g1){return g1}function Mb(g1){return jg(typeof g1=="function"?g1:Yh(g1,H0))}function H$(g1){return V8(Yh(g1,H0))}function N$(g1,w1){return ag(g1,Yh(w1,H0))}function Tb(g1,w1,M1){var x1=Q0(w1),Z1=Vg(w1,x1);M1!=null||n_(w1)&&(Z1.length||!x1.length)||(M1=w1,w1=g1,g1=this,Z1=Vg(w1,Q0(w1)));var i0=!(n_(M1)&&"chain"in M1&&!M1.chain),m0=Q5(g1);return o1(Z1,function(y0){var M0=w1[y0];g1[y0]=M0,m0&&(g1.prototype[y0]=function(){var Y0=this.__chain__;if(i0||Y0){var G0=g1(this.__wrapped__);return(G0.__actions__=A_(this.__actions__)).push({func:M0,args:arguments,thisArg:g1}),G0.__chain__=Y0,G0}return M0.apply(g1,f1([this.value()],arguments))})}),g1}function b7(){return Kd._===this&&(Kd._=Db),this}function u$(){}function $7(g1){return g1=Td(g1),hd(function(w1){return U6(w1,g1)})}function db(g1){return _4(g1)?C1(N_(g1)):vm(g1)}function zb(g1){return function(w1){return g1==null?b0:a_(g1,w1)}}function f$(){return[]}function p$(){return!1}function d$(){return{}}function x$(){return""}function v7(){return!0}function y7(g1,w1){if(g1=Td(g1),g1<1||g1>S2)return[];var M1=H2,x1=pd(g1,H2);w1=ud(w1),g1-=H2;for(var Z1=j1(x1,w1);++M1<g1;)w1(M1);return Z1}function w7(g1){return zd(g1)?u1(g1,N_):V3(g1)?[g1]:A_(t7(Jd(g1)))}function k7(g1){var w1=++_$;return Jd(g1)+w1}function S7(g1){return g1&&g1.length?j_(g1,F3,L3):b0}function O7(g1,w1){return g1&&g1.length?j_(g1,ud(w1,2),L3):b0}function A7(g1){return A1(g1,F3)}function C7(g1,w1){return A1(g1,ud(w1,2))}function E7(g1){return g1&&g1.length?j_(g1,F3,Qg):b0}function M7(g1,w1){return g1&&g1.length?j_(g1,ud(w1,2),Qg):b0}function T7(g1){return g1&&g1.length?N1(g1,F3):0}function z7(g1,w1){return g1&&g1.length?N1(g1,ud(w1,2)):0}q0=q0==null?Kd:r3.defaults(Kd.Object(),q0,r3.pick(Kd,H8));var gm=q0.Array,Lb=q0.Date,m$=q0.Error,o8=q0.Function,Sd=q0.Math,r_=q0.Object,U3=q0.RegExp,V_=q0.String,$5=q0.TypeError,Y5=gm.prototype,L7=o8.prototype,J8=r_.prototype,Pb=q0["__core-js_shared__"],Ib=L7.toString,bm=J8.hasOwnProperty,_$=0,V$=function(){var g1=/[^.]+$/.exec(Pb&&Pb.keys&&Pb.keys.IE_PROTO||"");return g1?"Symbol(src)_1."+g1:""}(),v5=J8.toString,F$=Ib.call(r_),Db=Kd._,m_=U3("^"+Ib.call(bm).replace(v6,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),o_=T3?q0.Buffer:b0,u6=q0.Symbol,Rb=q0.Uint8Array,U$=o_?o_.allocUnsafe:b0,Bb=c0(r_.getPrototypeOf,r_),j$=r_.create,q$=J8.propertyIsEnumerable,Hb=Y5.splice,h$=u6?u6.isConcatSpreadable:b0,f6=u6?u6.iterator:b0,p6=u6?u6.toStringTag:b0,Nb=function(){try{var g1=r4(r_,"defineProperty");return g1({},"",{}),g1}catch{}}(),Q$=q0.clearTimeout!==Kd.clearTimeout&&q0.clearTimeout,xb=Lb&&Lb.now!==Kd.Date.now&&Lb.now,Y4=q0.setTimeout!==Kd.setTimeout&&q0.setTimeout,d6=Sd.ceil,Vb=Sd.floor,g$=r_.getOwnPropertySymbols,P7=o_?o_.isBuffer:b0,W$=q0.isFinite,I7=Y5.join,G$=c0(r_.keys,r_),Bm=Sd.max,pd=Sd.min,Y$=Lb.now,y5=q0.parseInt,b$=Sd.random,D7=Y5.reverse,em=r4(q0,"DataView"),mb=r4(q0,"Map"),Fb=r4(q0,"Promise"),m6=r4(q0,"Set"),_b=r4(q0,"WeakMap"),hb=r4(r_,"create"),Ub=_b&&new _b,eb={},R7=a4(em),B7=a4(mb),H7=a4(Fb),N7=a4(m6),x7=a4(_b),jb=u6?u6.prototype:b0,gb=jb?jb.valueOf:b0,X$=jb?jb.toString:b0,tb=function(){function g1(){}return function(w1){if(!n_(w1))return{};if(j$)return j$(w1);g1.prototype=w1;var M1=new g1;return g1.prototype=b0,M1}}();o0.templateSettings={escape:Z4,evaluate:a8,interpolate:b6,variable:"",imports:{_:o0}},o0.prototype=m2.prototype,o0.prototype.constructor=o0,E2.prototype=tb(m2.prototype),E2.prototype.constructor=E2,M2.prototype=tb(m2.prototype),M2.prototype.constructor=M2,z4.prototype.clear=$_,z4.prototype.delete=L4,z4.prototype.get=n5,z4.prototype.has=z3,z4.prototype.set=E5,P_.prototype.clear=Vd,P_.prototype.delete=r5,P_.prototype.get=P4,P_.prototype.has=i_,P_.prototype.set=o5,v_.prototype.clear=Rg,v_.prototype.delete=Bg,v_.prototype.get=u4,v_.prototype.has=Z3,v_.prototype.set=I6,g3.prototype.add=g3.prototype.push=ig,g3.prototype.has=D6,I_.prototype.clear=Hg,I_.prototype.delete=I4,I_.prototype.get=$d,I_.prototype.has=D4,I_.prototype.set=R6;var Og=w3(D_),Z$=w3(f4,!0),bb=B3(),K$=B3(!0),J$=Ub?function(g1,w1){return Ub.set(g1,w1),g1}:F3,V7=Nb?function(g1,w1){return Nb(g1,"toString",{configurable:!0,enumerable:!1,value:Eb(w1),writable:!0})}:F3,p3=hd,l4=Q$||function(g1){return Kd.clearTimeout(g1)},F7=m6&&1/$0(new m6([,-0]))[1]==A2?function(g1){return new m6(g1)}:u$,$$=Ub?function(g1){return Ub.get(g1)}:u$,v$=g$?function(g1){return g1==null?[]:(g1=r_(g1),s1(g$(g1),function(w1){return q$.call(g1,w1)}))}:f$,y$=g$?function(g1){for(var w1=[];g1;)f1(w1,v$(g1)),g1=Bb(g1);return w1}:f$,j3=Zm;(em&&j3(new em(new ArrayBuffer(1)))!=W0||mb&&j3(new mb)!=$m||Fb&&j3(Fb.resolve())!=Q3||m6&&j3(new m6)!=Ym||_b&&j3(new _b)!=Jh)&&(j3=function(g1){var w1=Zm(g1),M1=w1==__?g1.constructor:b0,x1=M1?a4(M1):"";if(x1)switch(x1){case R7:return W0;case B7:return $m;case H7:return Q3;case N7:return Ym;case x7:return Jh}return w1});var U7=Pb?Q5:p$,e7=K6(J$),nb=Y4||function(g1,w1){return Kd.setTimeout(g1,w1)},w$=K6(V7),t7=U4(function(g1){var w1=[];return g1.charCodeAt(0)===46&&w1.push(""),g1.replace(C8,function(M1,x1,Z1,i0){w1.push(Z1?i0.replace(M8,"$1"):x1||M1)}),w1}),j7=hd(function(g1,w1){return Am(g1)?b3(g1,Lm(w1,1,Am,!0)):[]}),n7=hd(function(g1,w1){var M1=km(w1);return Am(M1)&&(M1=b0),Am(g1)?b3(g1,Lm(w1,1,Am,!0),ud(M1,2)):[]}),r7=hd(function(g1,w1){var M1=km(w1);return Am(M1)&&(M1=b0),Am(g1)?b3(g1,Lm(w1,1,Am,!0),b0,M1):[]}),q7=hd(function(g1){var w1=u1(g1,Xg);return w1.length&&w1[0]===g1[0]?um(w1):[]}),Q7=hd(function(g1){var w1=km(g1),M1=u1(g1,Xg);return w1===km(M1)?w1=b0:M1.pop(),M1.length&&M1[0]===g1[0]?um(M1,ud(w1,2)):[]}),W7=hd(function(g1){var w1=km(g1),M1=u1(g1,Xg);return w1=typeof w1=="function"?w1:b0,w1&&M1.pop(),M1.length&&M1[0]===g1[0]?um(M1,b0,w1):[]}),G7=hd(b4),rb=Pm(function(g1,w1){var M1=g1==null?0:g1.length,x1=xg(g1,w1);return Kh(g1,u1(w1,function(Z1){return qm(Z1,M1)?+Z1:Z1}).sort(Um)),x1}),Y7=hd(function(g1){return B_(Lm(g1,1,Am,!0))}),X7=hd(function(g1){var w1=km(g1);return Am(w1)&&(w1=b0),B_(Lm(g1,1,Am,!0),ud(w1,2))}),Z7=hd(function(g1){var w1=km(g1);return w1=typeof w1=="function"?w1:b0,B_(Lm(g1,1,Am,!0),b0,w1)}),K7=hd(function(g1,w1){return Am(g1)?b3(g1,w1):[]}),J7=hd(function(g1){return x4(s1(g1,Am))}),o7=hd(function(g1){var w1=km(g1);return Am(w1)&&(w1=b0),x4(s1(g1,Am),ud(w1,2))}),i7=hd(function(g1){var w1=km(g1);return w1=typeof w1=="function"?w1:b0,x4(s1(g1,Am),b0,w1)}),e9=hd(E_),t9=hd(function(g1){var w1=g1.length,M1=w1>1?g1[w1-1]:b0;return M1=typeof M1=="function"?(g1.pop(),M1):b0,q5(g1,M1)}),n9=Pm(function(g1){var w1=g1.length,M1=w1?g1[0]:0,x1=this.__wrapped__,Z1=function(i0){return xg(i0,g1)};return!(w1>1||this.__actions__.length)&&x1 instanceof M2&&qm(M1)?(x1=x1.slice(M1,+M1+(w1?1:0)),x1.__actions__.push({func:s6,args:[Z1],thisArg:b0}),new E2(x1,this.__chain__).thru(function(i0){return w1&&!i0.length&&i0.push(b0),i0})):this.thru(Z1)}),r9=l_(function(g1,w1,M1){bm.call(g1,M1)?++g1[M1]:Xd(g1,M1,1)}),o9=V4(Jm),i9=V4(Qm),a9=l_(function(g1,w1,M1){bm.call(g1,M1)?g1[M1].push(w1):Xd(g1,M1,[w1])}),s9=hd(function(g1,w1,M1){var x1=-1,Z1=typeof w1=="function",i0=f_(g1)?gm(g1.length):[];return Og(g1,function(m0){i0[++x1]=Z1?t1(w1,m0,M1):kd(m0,w1,M1)}),i0}),l9=l_(function(g1,w1,M1){Xd(g1,M1,w1)}),c9=l_(function(g1,w1,M1){g1[M1?0:1].push(w1)},function(){return[[],[]]}),u9=hd(function(g1,w1){if(g1==null)return[];var M1=w1.length;return M1>1&&Km(g1,w1[0],w1[1])?w1=[]:M1>2&&Km(w1[0],w1[1],w1[2])&&(w1=[w1[0]]),I3(g1,Lm(w1,1),[])}),qb=xb||function(){return Kd.Date.now()},k$=hd(function(g1,w1,M1){var x1=a2;if(M1.length){var Z1=e0(M1,yd(k$));x1|=td}return jm(g1,x1,w1,M1,Z1)}),a7=hd(function(g1,w1,M1){var x1=a2|c2;if(M1.length){var Z1=e0(M1,yd(a7));x1|=td}return jm(w1,x1,g1,M1,Z1)}),f9=hd(function(g1,w1){return i3(g1,1,w1)}),p9=hd(function(g1,w1,M1){return i3(g1,y4(w1)||0,M1)});Wm.Cache=v_;var d9=p3(function(g1,w1){w1=w1.length==1&&zd(w1[0])?u1(w1[0],D1(ud())):u1(Lm(w1,1),D1(ud()));var M1=w1.length;return hd(function(x1){for(var Z1=-1,i0=pd(x1.length,M1);++Z1<i0;)x1[Z1]=w1[Z1].call(this,x1[Z1]);return t1(g1,this,x1)})}),S$=hd(function(g1,w1){return jm(g1,td,b0,w1,e0(w1,yd(S$)))}),s7=hd(function(g1,w1){return jm(g1,ad,b0,w1,e0(w1,yd(s7)))}),m9=Pm(function(g1,w1){return jm(g1,R2,b0,b0,b0,w1)}),_9=Bd(L3),h9=Bd(function(g1,w1){return g1>=w1}),O8=m8(function(){return arguments}())?m8:function(g1){return p_(g1)&&bm.call(g1,"callee")&&!q$.call(g1,"callee")},zd=gm.isArray,g9=rg?D1(rg):Fg,Ag=P7||p$,l7=Ig?D1(Ig):H6,O$=N8?D1(N8):Ug,A$=M4?D1(M4):x8,c7=Xm?D1(Xm):a3,ob=T4?D1(T4):V6,C$=Bd(Qg),b9=Bd(function(g1,w1){return g1<=w1}),$9=rm(function(g1,w1){if(o4(w1)||f_(w1))return C_(w1,Q0(w1),g1),b0;for(var M1 in w1)bm.call(w1,M1)&&R4(g1,M1,w1[M1])}),u7=rm(function(g1,w1){C_(w1,K0(w1),g1)}),C3=rm(function(g1,w1,M1,x1){C_(w1,K0(w1),g1,x1)}),E$=rm(function(g1,w1,M1,x1){C_(w1,Q0(w1),g1,x1)}),v9=Pm(xg),y9=hd(function(g1,w1){g1=r_(g1);var M1=-1,x1=w1.length,Z1=x1>2?w1[2]:b0;for(Z1&&Km(w1[0],w1[1],Z1)&&(x1=1);++M1<x1;)for(var i0=w1[M1],m0=K0(i0),y0=-1,M0=m0.length;++y0<M0;){var Y0=m0[y0],G0=g1[Y0];(G0===b0||im(G0,J8[Y0])&&!bm.call(g1,Y0))&&(g1[Y0]=i0[Y0])}return g1}),w9=hd(function(g1){return g1.push(b0,f5),t1(f7,b0,g1)}),k9=N5(function(g1,w1,M1){w1!=null&&typeof w1.toString!="function"&&(w1=v5.call(w1)),g1[w1]=M1},Eb(F3)),M$=N5(function(g1,w1,M1){w1!=null&&typeof w1.toString!="function"&&(w1=v5.call(w1)),bm.call(g1,w1)?g1[w1].push(M1):g1[w1]=[M1]},ud),S9=hd(kd),T$=rm(function(g1,w1,M1){s_(g1,w1,M1)}),f7=rm(function(g1,w1,M1,x1){s_(g1,w1,M1,x1)}),O9=Pm(function(g1,w1){var M1={};if(g1==null)return M1;var x1=!1;w1=u1(w1,function(i0){return i0=nm(i0,g1),x1||(x1=i0.length>1),i0}),C_(g1,n6(g1),M1),x1&&(M1=Yh(M1,H0|b2|d2,F8));for(var Z1=w1.length;Z1--;)wm(M1,w1[Z1]);return M1}),A9=Pm(function(g1,w1){return g1==null?{}:k_(g1,w1)}),p7=pm(Q0),z$=pm(K0),C9=Dd(function(g1,w1,M1){return w1=w1.toLowerCase(),g1+(M1?u3(w1):w1)}),E9=Dd(function(g1,w1,M1){return g1+(M1?"-":"")+w1.toLowerCase()}),M9=Dd(function(g1,w1,M1){return g1+(M1?" ":"")+w1.toLowerCase()}),L$=fg("toLowerCase"),P$=Dd(function(g1,w1,M1){return g1+(M1?"_":"")+w1.toLowerCase()}),T9=Dd(function(g1,w1,M1){return g1+(M1?" ":"")+I$(w1)}),z9=Dd(function(g1,w1,M1){return g1+(M1?" ":"")+w1.toUpperCase()}),I$=fg("toUpperCase"),d7=hd(function(g1,w1){try{return t1(g1,b0,w1)}catch(M1){return cb(M1)?M1:new m$(M1)}}),L9=Pm(function(g1,w1){return o1(w1,function(M1){M1=N_(M1),Xd(g1,M1,k$(g1[M1],g1))}),g1}),P9=H5(),I9=H5(!0),D9=hd(function(g1,w1){return function(M1){return kd(M1,g1,w1)}}),R9=hd(function(g1,w1){return function(M1){return kd(g1,M1,w1)}}),B9=gd(u1),H9=gd(a1),N9=gd(m1),x9=e6(),V9=e6(!0),F9=q_(function(g1,w1){return g1+w1},0),U9=n4("ceil"),j9=q_(function(g1,w1){return g1/w1},1),q9=n4("floor"),Q9=q_(function(g1,w1){return g1*w1},1),W9=n4("round"),G9=q_(function(g1,w1){return g1-w1},0);return o0.after=Fd,o0.ary=Im,o0.assign=$9,o0.assignIn=u7,o0.assignInWith=C3,o0.assignWith=E$,o0.at=v9,o0.before=om,o0.bind=k$,o0.bindAll=L9,o0.bindKey=a7,o0.castArray=$4,o0.chain=t8,o0.chunk=h4,o0.compact=$g,o0.concat=m5,o0.cond=Cb,o0.conforms=g7,o0.constant=Eb,o0.countBy=r9,o0.create=i$,o0.curry=M_,o0.curryRight=x_,o0.debounce=jd,o0.defaults=y9,o0.defaultsDeep=w9,o0.defer=f9,o0.delay=p9,o0.difference=j7,o0.differenceBy=n7,o0.differenceWith=r7,o0.drop=g4,o0.dropRight=vg,o0.dropRightWhile=J6,o0.dropWhile=U8,o0.fill=sb,o0.filter=s0,o0.flatMap=p0,o0.flatMapDeep=h0,o0.flatMapDepth=R0,o0.flatten=F5,o0.flattenDeep=lb,o0.flattenDepth=h8,o0.flip=Dm,o0.flow=P9,o0.flowRight=I9,o0.fromPairs=g8,o0.functions=H1,o0.functionsIn=Y1,o0.groupBy=a9,o0.initial=yg,o0.intersection=q7,o0.intersectionBy=Q7,o0.intersectionWith=W7,o0.invert=k9,o0.invertBy=M$,o0.invokeMap=s9,o0.iteratee=Mb,o0.keyBy=l9,o0.keys=Q0,o0.keysIn=K0,o0.map=_2,o0.mapKeys=s2,o0.mapValues=y2,o0.matches=H$,o0.matchesProperty=N$,o0.memoize=Wm,o0.merge=T$,o0.mergeWith=f7,o0.method=D9,o0.methodOf=R9,o0.mixin=Tb,o0.negate=Sm,o0.nthArg=$7,o0.omit=O9,o0.omitBy=k2,o0.once=e_,o0.orderBy=v2,o0.over=B9,o0.overArgs=d9,o0.overEvery=H9,o0.overSome=N9,o0.partial=S$,o0.partialRight=s7,o0.partition=c9,o0.pick=A9,o0.pickBy=T2,o0.property=db,o0.propertyOf=zb,o0.pull=G7,o0.pullAll=b4,o0.pullAllBy=j8,o0.pullAllWith=b8,o0.pullAt=rb,o0.range=x9,o0.rangeRight=V9,o0.rearg=m9,o0.reject=U2,o0.remove=hm,o0.rest=Rm,o0.reverse=e8,o0.sampleSize=Q2,o0.set=J2,o0.setWith=ld,o0.shuffle=od,o0.slice=s4,o0.sortBy=u9,o0.sortedUniq=N3,o0.sortedUniqBy=kg,o0.split=G8,o0.spread=t_,o0.tail=i6,o0.take=v8,o0.takeRight=Sg,o0.takeRightWhile=h5,o0.takeWhile=F2,o0.tap=q8,o0.throttle=bd,o0.thru=s6,o0.toArray=wb,o0.toPairs=p7,o0.toPairsIn=z$,o0.toPath=w7,o0.toPlainObject=Sb,o0.transform=P2,o0.unary=g5,o0.union=Y7,o0.unionBy=X7,o0.unionWith=Z7,o0.uniq=j5,o0.uniqBy=a6,o0.uniqWith=A3,o0.unset=V2,o0.unzip=E_,o0.unzipWith=q5,o0.update=Od,o0.updateWith=Y2,o0.values=md,o0.valuesIn=Zd,o0.without=K7,o0.words=R$,o0.wrap=Om,o0.xor=J7,o0.xorBy=o7,o0.xorWith=i7,o0.zip=e9,o0.zipObject=y8,o0.zipObjectDeep=Cd,o0.zipWith=t9,o0.entries=p7,o0.entriesIn=z$,o0.extend=u7,o0.extendWith=C3,Tb(o0,o0),o0.add=F9,o0.attempt=d7,o0.camelCase=C9,o0.capitalize=u3,o0.ceil=U9,o0.clamp=X_,o0.clone=u_,o0.cloneDeep=v4,o0.cloneDeepWith=x3,o0.cloneWith=l6,o0.conformsTo=b5,o0.deburr=f3,o0.defaultTo=B$,o0.divide=j9,o0.endsWith=w4,o0.eq=im,o0.escape=Gm,o0.escapeRegExp=k4,o0.every=t0,o0.find=o9,o0.findIndex=Jm,o0.findKey=a$,o0.findLast=i9,o0.findLastIndex=Qm,o0.findLastKey=s$,o0.floor=q9,o0.forEach=V0,o0.forEachRight=n2,o0.forIn=l$,o0.forInRight=c$,o0.forOwn=fb,o0.forOwnRight=z1,o0.get=u0,o0.gt=_9,o0.gte=h9,o0.has=g0,o0.hasIn=I0,o0.head=j4,o0.identity=F3,o0.includes=Z0,o0.indexOf=U5,o0.inRange=_d,o0.invoke=S9,o0.isArguments=O8,o0.isArray=zd,o0.isArrayBuffer=g9,o0.isArrayLike=f_,o0.isArrayLikeObject=Am,o0.isBoolean=Q8,o0.isBuffer=Ag,o0.isDate=l7,o0.isElement=Qb,o0.isEmpty=$b,o0.isEqual=Wb,o0.isEqualWith=Gb,o0.isError=cb,o0.isFinite=Yb,o0.isFunction=Q5,o0.isInteger=vb,o0.isLength=c3,o0.isMap=O$,o0.isMatch=yb,o0.isMatchWith=ub,o0.isNaN=Xb,o0.isNative=Zb,o0.isNil=Jb,o0.isNull=Kb,o0.isNumber=W8,o0.isObject=n_,o0.isObjectLike=p_,o0.isPlainObject=w8,o0.isRegExp=A$,o0.isSafeInteger=e$,o0.isSet=c7,o0.isString=r8,o0.isSymbol=V3,o0.isTypedArray=ob,o0.isUndefined=t$,o0.isWeakMap=n$,o0.isWeakSet=r$,o0.join=q4,o0.kebabCase=E9,o0.last=km,o0.lastIndexOf=wg,o0.lowerCase=M9,o0.lowerFirst=L$,o0.lt=C$,o0.lte=b9,o0.max=S7,o0.maxBy=O7,o0.mean=A7,o0.meanBy=C7,o0.min=E7,o0.minBy=M7,o0.stubArray=f$,o0.stubFalse=p$,o0.stubObject=d$,o0.stubString=x$,o0.stubTrue=v7,o0.multiply=Q9,o0.nth=_5,o0.noConflict=b7,o0.noop=u$,o0.now=qb,o0.pad=S4,o0.padEnd=k8,o0.padStart=c6,o0.parseInt=G5,o0.random=Ad,o0.reduce=L2,o0.reduceRight=D2,o0.repeat=Ob,o0.replace=S8,o0.result=W2,o0.round=W9,o0.runInContext=A0,o0.sample=I2,o0.size=rd,o0.snakeCase=P$,o0.some=wd,o0.sortedIndex=Q4,o0.sortedIndexBy=Y_,o0.sortedIndexOf=o6,o0.sortedLastIndex=W4,o0.sortedLastIndexBy=G4,o0.sortedLastIndexOf=$8,o0.startCase=T9,o0.startsWith=pb,o0.subtract=G9,o0.sum=T7,o0.sumBy=z7,o0.template=Y8,o0.times=y7,o0.toFinite=W5,o0.toInteger=Td,o0.toLength=kb,o0.toLower=X8,o0.toNumber=y4,o0.toSafeInteger=o$,o0.toString=Jd,o0.toUpper=Ab,o0.trim=Z8,o0.trimEnd=K8,o0.trimStart=m7,o0.truncate=_7,o0.unescape=h7,o0.uniqueId=k7,o0.upperCase=z9,o0.upperFirst=I$,o0.each=V0,o0.eachRight=n2,o0.first=j4,Tb(o0,function(){var g1={};return D_(o0,function(w1,M1){bm.call(o0.prototype,M1)||(g1[M1]=w1)}),g1}(),{chain:!1}),o0.VERSION=O2,o1(["bind","bindKey","curry","curryRight","partial","partialRight"],function(g1){o0[g1].placeholder=o0}),o1(["drop","take"],function(g1,w1){M2.prototype[g1]=function(M1){M1=M1===b0?1:Bm(Td(M1),0);var x1=this.__filtered__&&!w1?new M2(this):this.clone();return x1.__filtered__?x1.__takeCount__=pd(M1,x1.__takeCount__):x1.__views__.push({size:pd(M1,H2),type:g1+(x1.__dir__<0?"Right":"")}),x1},M2.prototype[g1+"Right"]=function(M1){return this.reverse()[g1](M1).reverse()}}),o1(["filter","map","takeWhile"],function(g1,w1){var M1=w1+1,x1=M1==P0||M1==l2;M2.prototype[g1]=function(Z1){var i0=this.clone();return i0.__iteratees__.push({iteratee:ud(Z1,3),type:M1}),i0.__filtered__=i0.__filtered__||x1,i0}}),o1(["head","last"],function(g1,w1){var M1="take"+(w1?"Right":"");M2.prototype[g1]=function(){return this[M1](1).value()[0]}}),o1(["initial","tail"],function(g1,w1){var M1="drop"+(w1?"":"Right");M2.prototype[g1]=function(){return this.__filtered__?new M2(this):this[M1](1)}}),M2.prototype.compact=function(){return this.filter(F3)},M2.prototype.find=function(g1){return this.filter(g1).head()},M2.prototype.findLast=function(g1){return this.reverse().find(g1)},M2.prototype.invokeMap=hd(function(g1,w1){return typeof g1=="function"?new M2(this):this.map(function(M1){return kd(M1,g1,w1)})}),M2.prototype.reject=function(g1){return this.filter(Sm(ud(g1)))},M2.prototype.slice=function(g1,w1){g1=Td(g1);var M1=this;return M1.__filtered__&&(g1>0||w1<0)?new M2(M1):(g1<0?M1=M1.takeRight(-g1):g1&&(M1=M1.drop(g1)),w1!==b0&&(w1=Td(w1),M1=w1<0?M1.dropRight(-w1):M1.take(w1-g1)),M1)},M2.prototype.takeRightWhile=function(g1){return this.reverse().takeWhile(g1).reverse()},M2.prototype.toArray=function(){return this.take(H2)},D_(M2.prototype,function(g1,w1){var M1=/^(?:filter|find|map|reject)|While$/.test(w1),x1=/^(?:head|last)$/.test(w1),Z1=o0[x1?"take"+(w1=="last"?"Right":""):w1],i0=x1||/^find/.test(w1);Z1&&(o0.prototype[w1]=function(){var m0=this.__wrapped__,y0=x1?[1]:arguments,M0=m0 instanceof M2,Y0=y0[0],G0=M0||zd(m0),e2=function(X2){var Z2=Z1.apply(o0,f1([X2],y0));return x1&&g2?Z2[0]:Z2};G0&&M1&&typeof Y0=="function"&&Y0.length!=1&&(M0=G0=!1);var g2=this.__chain__,w2=!!this.__actions__.length,C2=i0&&!g2,j2=M0&&!w2;if(!i0&&G0){m0=j2?m0:new M2(this);var z2=g1.apply(m0,y0);return z2.__actions__.push({func:s6,args:[e2],thisArg:b0}),new E2(z2,g2)}return C2&&j2?g1.apply(this,y0):(z2=this.thru(e2),C2?x1?z2.value()[0]:z2.value():z2)})}),o1(["pop","push","shift","sort","splice","unshift"],function(g1){var w1=Y5[g1],M1=/^(?:push|sort|unshift)$/.test(g1)?"tap":"thru",x1=/^(?:pop|shift)$/.test(g1);o0.prototype[g1]=function(){var Z1=arguments;if(x1&&!this.__chain__){var i0=this.value();return w1.apply(zd(i0)?i0:[],Z1)}return this[M1](function(m0){return w1.apply(zd(m0)?m0:[],Z1)})}}),D_(M2.prototype,function(g1,w1){var M1=o0[w1];if(M1){var x1=M1.name+"";bm.call(eb,x1)||(eb[x1]=[]),eb[x1].push({name:w1,func:M1})}}),eb[H_(b0,c2).name]=[{name:"wrapper",func:b0}],M2.prototype.clone=Md,M2.prototype.reverse=Qd,M2.prototype.value=L_,o0.prototype.at=n9,o0.prototype.chain=n8,o0.prototype.commit=v1,o0.prototype.next=O1,o0.prototype.plant=L1,o0.prototype.reverse=R1,o0.prototype.toJSON=o0.prototype.valueOf=o0.prototype.value=Q1,o0.prototype.first=o0.prototype.head,f6&&(o0.prototype[f6]=P1),o0},r3=og();Vh?((Vh.exports=r3)._=r3,ng._=r3):Kd._=r3}).call(commonjsGlobal)})(lodash_min,lodash_min.exports);var _mapping={};(function(n1){n1.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendAll:"assignInAll",extendAllWith:"assignInAllWith",extendWith:"assignInWith",first:"head",conforms:"conformsTo",matches:"isMatch",property:"get",__:"placeholder",F:"stubFalse",T:"stubTrue",all:"every",allPass:"overEvery",always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",dropLast:"dropRight",dropLastWhile:"dropRightWhile",equals:"isEqual",identical:"eq",indexBy:"keyBy",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",props:"at",symmetricDifference:"xor",symmetricDifferenceBy:"xorBy",symmetricDifferenceWith:"xorWith",takeLast:"takeRight",takeLastWhile:"takeRightWhile",unapply:"rest",unnest:"flatten",useWith:"overArgs",where:"conformsTo",whereEq:"isMatch",zipObj:"zipObject"},n1.aryMethod={1:["assignAll","assignInAll","attempt","castArray","ceil","create","curry","curryRight","defaultsAll","defaultsDeepAll","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","mergeAll","methodOf","mixin","nthArg","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words","zipAll"],2:["add","after","ary","assign","assignAllWith","assignIn","assignInAllWith","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","conformsTo","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","defaultTo","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","meanBy","merge","mergeAllWith","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","propertyOf","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","findFrom","findIndexFrom","findLastFrom","findLastIndexFrom","getOr","includesFrom","indexOfFrom","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqualWith","isMatchWith","flatMapDepth","lastIndexOfFrom","mergeWith","orderBy","padChars","padCharsEnd","padCharsStart","pullAllBy","pullAllWith","rangeStep","rangeStepRight","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","update","xorBy","xorWith","zipWith"],4:["fill","setWith","updateWith"]},n1.aryRearg={2:[1,0],3:[2,0,1],4:[3,2,0,1]},n1.iterateeAry={dropRightWhile:1,dropWhile:1,every:1,filter:1,find:1,findFrom:1,findIndex:1,findIndexFrom:1,findKey:1,findLast:1,findLastFrom:1,findLastIndex:1,findLastIndexFrom:1,findLastKey:1,flatMap:1,flatMapDeep:1,flatMapDepth:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,transform:2},n1.iterateeRearg={mapKeys:[1],reduceRight:[1,0]},n1.methodRearg={assignInAllWith:[1,0],assignInWith:[1,2,0],assignAllWith:[1,0],assignWith:[1,2,0],differenceBy:[1,2,0],differenceWith:[1,2,0],getOr:[2,1,0],intersectionBy:[1,2,0],intersectionWith:[1,2,0],isEqualWith:[1,2,0],isMatchWith:[2,1,0],mergeAllWith:[1,0],mergeWith:[1,2,0],padChars:[2,1,0],padCharsEnd:[2,1,0],padCharsStart:[2,1,0],pullAllBy:[2,1,0],pullAllWith:[2,1,0],rangeStep:[1,2,0],rangeStepRight:[1,2,0],setWith:[3,1,2,0],sortedIndexBy:[2,1,0],sortedLastIndexBy:[2,1,0],unionBy:[1,2,0],unionWith:[1,2,0],updateWith:[3,1,2,0],xorBy:[1,2,0],xorWith:[1,2,0],zipWith:[1,2,0]},n1.methodSpread={assignAll:{start:0},assignAllWith:{start:0},assignInAll:{start:0},assignInAllWith:{start:0},defaultsAll:{start:0},defaultsDeepAll:{start:0},invokeArgs:{start:2},invokeArgsMap:{start:2},mergeAll:{start:0},mergeAllWith:{start:0},partial:{start:1},partialRight:{start:1},without:{start:1},zipAll:{start:0}},n1.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAllWith:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignAll:!0,assignAllWith:!0,assignIn:!0,assignInAll:!0,assignInAllWith:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsAll:!0,defaultsDeep:!0,defaultsDeepAll:!0,merge:!0,mergeAll:!0,mergeAllWith:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0,update:!0,updateWith:!0}},n1.realToAlias=function(){var e1=Object.prototype.hasOwnProperty,t1=n1.aliasToReal,r1={};for(var o1 in t1){var i1=t1[o1];e1.call(r1,i1)?r1[i1].push(o1):r1[i1]=[o1]}return r1}(),n1.remap={assignAll:"assign",assignAllWith:"assignWith",assignInAll:"assignIn",assignInAllWith:"assignInWith",curryN:"curry",curryRightN:"curryRight",defaultsAll:"defaults",defaultsDeepAll:"defaultsDeep",findFrom:"find",findIndexFrom:"findIndex",findLastFrom:"findLast",findLastIndexFrom:"findLastIndex",getOr:"get",includesFrom:"includes",indexOfFrom:"indexOf",invokeArgs:"invoke",invokeArgsMap:"invokeMap",lastIndexOfFrom:"lastIndexOf",mergeAll:"merge",mergeAllWith:"mergeWith",padChars:"pad",padCharsEnd:"padEnd",padCharsStart:"padStart",propertyOf:"get",rangeStep:"range",rangeStepRight:"rangeRight",restFrom:"rest",spreadFrom:"spread",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart",zipAll:"zip"},n1.skipFixed={castArray:!0,flow:!0,flowRight:!0,iteratee:!0,mixin:!0,rearg:!0,runInContext:!0},n1.skipRearg={add:!0,assign:!0,assignIn:!0,bind:!0,bindKey:!0,concat:!0,difference:!0,divide:!0,eq:!0,gt:!0,gte:!0,isEqual:!0,lt:!0,lte:!0,matchesProperty:!0,merge:!0,multiply:!0,overArgs:!0,partial:!0,partialRight:!0,propertyOf:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0,zipObjectDeep:!0}})(_mapping);var placeholder$2={},mapping=_mapping,fallbackHolder=placeholder$2,push$1=Array.prototype.push;function baseArity(n1,e1){return e1==2?function(t1,r1){return n1.apply(void 0,arguments)}:function(t1){return n1.apply(void 0,arguments)}}function baseAry(n1,e1){return e1==2?function(t1,r1){return n1(t1,r1)}:function(t1){return n1(t1)}}function cloneArray(n1){for(var e1=n1?n1.length:0,t1=Array(e1);e1--;)t1[e1]=n1[e1];return t1}function createCloner(n1){return function(e1){return n1({},e1)}}function flatSpread(n1,e1){return function(){for(var t1=arguments.length,r1=t1-1,o1=Array(t1);t1--;)o1[t1]=arguments[t1];var i1=o1[e1],a1=o1.slice(0,e1);return i1&&push$1.apply(a1,i1),e1!=r1&&push$1.apply(a1,o1.slice(e1+1)),n1.apply(this,a1)}}function wrapImmutable(n1,e1){return function(){var t1=arguments.length;if(!!t1){for(var r1=Array(t1);t1--;)r1[t1]=arguments[t1];var o1=r1[0]=e1.apply(void 0,r1);return n1.apply(void 0,r1),o1}}}function baseConvert$1(n1,e1,t1,r1){var o1=typeof e1=="function",i1=e1===Object(e1);if(i1&&(r1=t1,t1=e1,e1=void 0),t1==null)throw new TypeError;r1||(r1={});var a1={cap:"cap"in r1?r1.cap:!0,curry:"curry"in r1?r1.curry:!0,fixed:"fixed"in r1?r1.fixed:!0,immutable:"immutable"in r1?r1.immutable:!0,rearg:"rearg"in r1?r1.rearg:!0},s1=o1?t1:fallbackHolder,l1="curry"in r1&&r1.curry,c1="fixed"in r1&&r1.fixed,u1="rearg"in r1&&r1.rearg,f1=o1?t1.runInContext():void 0,p1=o1?t1:{ary:n1.ary,assign:n1.assign,clone:n1.clone,curry:n1.curry,forEach:n1.forEach,isArray:n1.isArray,isError:n1.isError,isFunction:n1.isFunction,isWeakMap:n1.isWeakMap,iteratee:n1.iteratee,keys:n1.keys,rearg:n1.rearg,toInteger:n1.toInteger,toPath:n1.toPath},d1=p1.ary,m1=p1.assign,_1=p1.clone,h1=p1.curry,b1=p1.forEach,$1=p1.isArray,y1=p1.isError,k1=p1.isFunction,S1=p1.isWeakMap,A1=p1.keys,C1=p1.rearg,E1=p1.toInteger,T1=p1.toPath,I1=A1(mapping.aryMethod),N1={castArray:function(f0){return function(){var n0=arguments[0];return $1(n0)?f0(cloneArray(n0)):f0.apply(void 0,arguments)}},iteratee:function(f0){return function(){var n0=arguments[0],c0=arguments[1],e0=f0(n0,c0),$0=e0.length;return a1.cap&&typeof c0=="number"?(c0=c0>2?c0-2:1,$0&&$0<=c0?e0:baseAry(e0,c0)):e0}},mixin:function(f0){return function(n0){var c0=this;if(!k1(c0))return f0(c0,Object(n0));var e0=[];return b1(A1(n0),function($0){k1(n0[$0])&&e0.push([$0,c0.prototype[$0]])}),f0(c0,Object(n0)),b1(e0,function($0){var E0=$0[1];k1(E0)?c0.prototype[$0[0]]=E0:delete c0.prototype[$0[0]]}),c0}},nthArg:function(f0){return function(n0){var c0=n0<0?1:E1(n0)+1;return h1(f0(n0),c0)}},rearg:function(f0){return function(n0,c0){var e0=c0?c0.length:0;return h1(f0(n0,c0),e0)}},runInContext:function(f0){return function(n0){return baseConvert$1(n1,f0(n0),r1)}}};function j1(f0,n0){if(a1.cap){var c0=mapping.iterateeRearg[f0];if(c0)return q1(n0,c0);var e0=!o1&&mapping.iterateeAry[f0];if(e0)return K1(n0,e0)}return n0}function V1(f0,n0,c0){return l1||a1.curry&&c0>1?h1(n0,c0):n0}function B1(f0,n0,c0){if(a1.fixed&&(c1||!mapping.skipFixed[f0])){var e0=mapping.methodSpread[f0],$0=e0&&e0.start;return $0===void 0?d1(n0,c0):flatSpread(n0,$0)}return n0}function D1(f0,n0,c0){return a1.rearg&&c0>1&&(u1||!mapping.skipRearg[f0])?C1(n0,mapping.methodRearg[f0]||mapping.aryRearg[c0]):n0}function F1(f0,n0){n0=T1(n0);for(var c0=-1,e0=n0.length,$0=e0-1,E0=_1(Object(f0)),r0=E0;r0!=null&&++c0<e0;){var w0=n0[c0],B0=r0[w0];B0!=null&&!(k1(B0)||y1(B0)||S1(B0))&&(r0[w0]=_1(c0==$0?B0:Object(B0))),r0=r0[w0]}return E0}function U1(f0){return W1.runInContext.convert(f0)(void 0)}function G1(f0,n0){var c0=mapping.aliasToReal[f0]||f0,e0=mapping.remap[c0]||c0,$0=r1;return function(E0){var r0=o1?f1:p1,w0=o1?f1[e0]:n0,B0=m1(m1({},$0),E0);return baseConvert$1(r0,c0,w0,B0)}}function K1(f0,n0){return J1(f0,function(c0){return typeof c0=="function"?baseAry(c0,n0):c0})}function q1(f0,n0){return J1(f0,function(c0){var e0=n0.length;return baseArity(C1(baseAry(c0,e0),n0),e0)})}function J1(f0,n0){return function(){var c0=arguments.length;if(!c0)return f0();for(var e0=Array(c0);c0--;)e0[c0]=arguments[c0];var $0=a1.rearg?0:c0-1;return e0[$0]=n0(e0[$0]),f0.apply(void 0,e0)}}function X1(f0,n0,c0){var e0,$0=mapping.aliasToReal[f0]||f0,E0=n0,r0=N1[$0];return r0?E0=r0(n0):a1.immutable&&(mapping.mutate.array[$0]?E0=wrapImmutable(n0,cloneArray):mapping.mutate.object[$0]?E0=wrapImmutable(n0,createCloner(n0)):mapping.mutate.set[$0]&&(E0=wrapImmutable(n0,F1))),b1(I1,function(w0){return b1(mapping.aryMethod[w0],function(B0){if($0==B0){var N0=mapping.methodSpread[$0],J0=N0&&N0.afterRearg;return e0=J0?B1($0,D1($0,E0,w0),w0):D1($0,B1($0,E0,w0),w0),e0=j1($0,e0),e0=V1($0,e0,w0),!1}}),!e0}),e0||(e0=E0),e0==n0&&(e0=l1?h1(e0,1):function(){return n0.apply(this,arguments)}),e0.convert=G1($0,n0),e0.placeholder=n0.placeholder=c0,e0}if(!i1)return X1(e1,t1,s1);var W1=t1,a0=[];return b1(I1,function(f0){b1(mapping.aryMethod[f0],function(n0){var c0=W1[mapping.remap[n0]||n0];c0&&a0.push([n0,X1(n0,c0,W1)])})}),b1(A1(W1),function(f0){var n0=W1[f0];if(typeof n0=="function"){for(var c0=a0.length;c0--;)if(a0[c0][0]==f0)return;n0.convert=G1(f0,n0),a0.push([f0,n0])}}),b1(a0,function(f0){W1[f0[0]]=f0[1]}),W1.convert=U1,W1.placeholder=W1,b1(A1(W1),function(f0){b1(mapping.realToAlias[f0]||[],function(n0){W1[n0]=W1[f0]})}),W1}var _baseConvert=baseConvert$1,_$2=lodash_min.exports.runInContext(),fp=_baseConvert(_$2,_$2);const getJSONArrayDatasourceSchema=(n1,e1)=>{let t1=n1,r1=[];e1.prefixKeys&&(r1=e1.prefixKeys.concat(["schema"])),r1=r1.concat(e1.label.split(".").slice(2));for(let o1=0;o1<r1.length;o1++)t1=t1==null?void 0:t1[r1[o1]],t1!=null&&t1.schema&&(t1=t1.schema);return convertJSONSchemaToTableSchema(t1,{squashObjects:!0,prefixKeys:r1})},convertJSONSchemaToTableSchema=(n1,e1)=>{if(!n1)return null;e1={squashObjects:!1,prefixKeys:null,...e1},n1.schema?n1=n1.schema:n1={value:n1};const t1=extractJSONSchemaKeys(n1,e1.squashObjects);let r1={};return t1.forEach(({key:o1,type:i1})=>{r1[o1]={type:i1,name:o1,prefixKeys:e1.prefixKeys}}),r1},extractJSONSchemaKeys=(n1,e1=!1)=>{if(!n1||!Object.keys(n1).length)return[];let t1=[];return Object.keys(n1).forEach(r1=>{const o1=n1[r1].type;if(o1==="json"&&e1){const i1=extractJSONSchemaKeys(n1[r1].schema,e1);t1=t1.concat(i1.map(a1=>({key:`${r1}.${a1.key}`,type:a1.type})))}else t1.push({key:r1,type:o1==="array"?"jsonarray":o1})}),t1};function setCookie(n1,e1){getCookie(n1)&&removeCookie(n1),window.document.cookie=`${n1}=${e1}; Path=/;`}function getCookie(n1){const t1=`; ${document.cookie}`.split(`; ${n1}=`);if(t1.length===2)return t1[1].split(";").shift()}function removeCookie(n1){getCookie(n1)&&(document.cookie=`${n1}=; Max-Age=-99999999; Path=/;`)}const RolePriorities={[Roles$1.ADMIN]:4,[Roles$1.POWER]:3,[Roles$1.BASIC]:2,[Roles$1.PUBLIC]:1},RoleColours={[Roles$1.ADMIN]:"var(--spectrum-global-color-static-red-400)",[Roles$1.POWER]:"var(--spectrum-global-color-static-orange-400)",[Roles$1.BASIC]:"var(--spectrum-global-color-static-green-400)",[Roles$1.PUBLIC]:"var(--spectrum-global-color-static-blue-400)"},getRolePriority=n1=>{var e1;return(e1=RolePriorities[n1])!=null?e1:0},getRoleColour=n1=>{var e1;return(e1=RoleColours[n1])!=null?e1:"var(--spectrum-global-color-static-magenta-400)"},sequential=n1=>{let e1=[];return(...t1)=>new Promise((r1,o1)=>{e1.push(async()=>{let i1,a1;try{i1=await n1(...t1)}catch(s1){a1=s1}e1.shift(),e1.length&&e1[0](),a1?o1(a1):r1(i1)}),e1.length===1&&e1[0]()})},debounce=(n1,e1=1e3)=>{let t1;return async(...r1)=>new Promise(o1=>{t1&&clearTimeout(t1),t1=setTimeout(async()=>{o1(await n1(...r1))},e1)})},domDebounce=n1=>{let e1=!1,t1;return(...r1)=>{t1=r1,e1||(e1=!0,requestAnimationFrame(()=>{n1(...t1),e1=!1}))}},memo=n1=>{const e1=writable(n1),t1=(r1,o1)=>{if(o1===r1)return;const i1=JSON.stringify(o1),a1=JSON.stringify(r1);i1!==a1&&e1.set(r1)};return{subscribe:e1.subscribe,set:r1=>{const o1=get_store_value(e1);t1(r1,o1)},update:r1=>{const o1=get_store_value(e1);let i1=JSON.parse(JSON.stringify(o1));const a1=r1(i1);t1(a1,o1)}}},derivedMemo=(n1,e1)=>{const t1=derived(n1,e1),r1=memo(get_store_value(t1));return t1.subscribe(r1.set),r1},PACKET_TYPES=Object.create(null);PACKET_TYPES.open="0";PACKET_TYPES.close="1";PACKET_TYPES.ping="2";PACKET_TYPES.pong="3";PACKET_TYPES.message="4";PACKET_TYPES.upgrade="5";PACKET_TYPES.noop="6";const PACKET_TYPES_REVERSE=Object.create(null);Object.keys(PACKET_TYPES).forEach(n1=>{PACKET_TYPES_REVERSE[PACKET_TYPES[n1]]=n1});const ERROR_PACKET={type:"error",data:"parser error"},withNativeBlob$1=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",withNativeArrayBuffer$2=typeof ArrayBuffer=="function",isView$1=n1=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n1):n1&&n1.buffer instanceof ArrayBuffer,encodePacket=({type:n1,data:e1},t1,r1)=>withNativeBlob$1&&e1 instanceof Blob?t1?r1(e1):encodeBlobAsBase64(e1,r1):withNativeArrayBuffer$2&&(e1 instanceof ArrayBuffer||isView$1(e1))?t1?r1(e1):encodeBlobAsBase64(new Blob([e1]),r1):r1(PACKET_TYPES[n1]+(e1||"")),encodeBlobAsBase64=(n1,e1)=>{const t1=new FileReader;return t1.onload=function(){const r1=t1.result.split(",")[1];e1("b"+(r1||""))},t1.readAsDataURL(n1)},chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lookup$2=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n1=0;n1<chars.length;n1++)lookup$2[chars.charCodeAt(n1)]=n1;const decode$3=n1=>{let e1=n1.length*.75,t1=n1.length,r1,o1=0,i1,a1,s1,l1;n1[n1.length-1]==="="&&(e1--,n1[n1.length-2]==="="&&e1--);const c1=new ArrayBuffer(e1),u1=new Uint8Array(c1);for(r1=0;r1<t1;r1+=4)i1=lookup$2[n1.charCodeAt(r1)],a1=lookup$2[n1.charCodeAt(r1+1)],s1=lookup$2[n1.charCodeAt(r1+2)],l1=lookup$2[n1.charCodeAt(r1+3)],u1[o1++]=i1<<2|a1>>4,u1[o1++]=(a1&15)<<4|s1>>2,u1[o1++]=(s1&3)<<6|l1&63;return c1},withNativeArrayBuffer$1=typeof ArrayBuffer=="function",decodePacket=(n1,e1)=>{if(typeof n1!="string")return{type:"message",data:mapBinary(n1,e1)};const t1=n1.charAt(0);return t1==="b"?{type:"message",data:decodeBase64Packet(n1.substring(1),e1)}:PACKET_TYPES_REVERSE[t1]?n1.length>1?{type:PACKET_TYPES_REVERSE[t1],data:n1.substring(1)}:{type:PACKET_TYPES_REVERSE[t1]}:ERROR_PACKET},decodeBase64Packet=(n1,e1)=>{if(withNativeArrayBuffer$1){const t1=decode$3(n1);return mapBinary(t1,e1)}else return{base64:!0,data:n1}},mapBinary=(n1,e1)=>{switch(e1){case"blob":return n1 instanceof ArrayBuffer?new Blob([n1]):n1;case"arraybuffer":default:return n1}},SEPARATOR=String.fromCharCode(30),encodePayload=(n1,e1)=>{const t1=n1.length,r1=new Array(t1);let o1=0;n1.forEach((i1,a1)=>{encodePacket(i1,!1,s1=>{r1[a1]=s1,++o1===t1&&e1(r1.join(SEPARATOR))})})},decodePayload=(n1,e1)=>{const t1=n1.split(SEPARATOR),r1=[];for(let o1=0;o1<t1.length;o1++){const i1=decodePacket(t1[o1],e1);if(r1.push(i1),i1.type==="error")break}return r1},protocol$1=4;function Emitter(n1){if(n1)return mixin(n1)}function mixin(n1){for(var e1 in Emitter.prototype)n1[e1]=Emitter.prototype[e1];return n1}Emitter.prototype.on=Emitter.prototype.addEventListener=function(n1,e1){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n1]=this._callbacks["$"+n1]||[]).push(e1),this};Emitter.prototype.once=function(n1,e1){function t1(){this.off(n1,t1),e1.apply(this,arguments)}return t1.fn=e1,this.on(n1,t1),this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(n1,e1){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t1=this._callbacks["$"+n1];if(!t1)return this;if(arguments.length==1)return delete this._callbacks["$"+n1],this;for(var r1,o1=0;o1<t1.length;o1++)if(r1=t1[o1],r1===e1||r1.fn===e1){t1.splice(o1,1);break}return t1.length===0&&delete this._callbacks["$"+n1],this};Emitter.prototype.emit=function(n1){this._callbacks=this._callbacks||{};for(var e1=new Array(arguments.length-1),t1=this._callbacks["$"+n1],r1=1;r1<arguments.length;r1++)e1[r1-1]=arguments[r1];if(t1){t1=t1.slice(0);for(var r1=0,o1=t1.length;r1<o1;++r1)t1[r1].apply(this,e1)}return this};Emitter.prototype.emitReserved=Emitter.prototype.emit;Emitter.prototype.listeners=function(n1){return this._callbacks=this._callbacks||{},this._callbacks["$"+n1]||[]};Emitter.prototype.hasListeners=function(n1){return!!this.listeners(n1).length};const globalThisShim=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function pick(n1,...e1){return e1.reduce((t1,r1)=>(n1.hasOwnProperty(r1)&&(t1[r1]=n1[r1]),t1),{})}const NATIVE_SET_TIMEOUT=globalThisShim.setTimeout,NATIVE_CLEAR_TIMEOUT=globalThisShim.clearTimeout;function installTimerFunctions(n1,e1){e1.useNativeTimers?(n1.setTimeoutFn=NATIVE_SET_TIMEOUT.bind(globalThisShim),n1.clearTimeoutFn=NATIVE_CLEAR_TIMEOUT.bind(globalThisShim)):(n1.setTimeoutFn=globalThisShim.setTimeout.bind(globalThisShim),n1.clearTimeoutFn=globalThisShim.clearTimeout.bind(globalThisShim))}const BASE64_OVERHEAD=1.33;function byteLength(n1){return typeof n1=="string"?utf8Length$1(n1):Math.ceil((n1.byteLength||n1.size)*BASE64_OVERHEAD)}function utf8Length$1(n1){let e1=0,t1=0;for(let r1=0,o1=n1.length;r1<o1;r1++)e1=n1.charCodeAt(r1),e1<128?t1+=1:e1<2048?t1+=2:e1<55296||e1>=57344?t1+=3:(r1++,t1+=4);return t1}class TransportError extends Error{constructor(e1,t1,r1){super(e1),this.description=t1,this.context=r1,this.type="TransportError"}}class Transport extends Emitter{constructor(e1){super(),this.writable=!1,installTimerFunctions(this,e1),this.opts=e1,this.query=e1.query,this.socket=e1.socket}onError(e1,t1,r1){return super.emitReserved("error",new TransportError(e1,t1,r1)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e1){this.readyState==="open"&&this.write(e1)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e1){const t1=decodePacket(e1,this.socket.binaryType);this.onPacket(t1)}onPacket(e1){super.emitReserved("packet",e1)}onClose(e1){this.readyState="closed",super.emitReserved("close",e1)}pause(e1){}}const alphabet$3="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),length=64,map={};let seed$1=0,i$2=0,prev;function encode$3(n1){let e1="";do e1=alphabet$3[n1%length]+e1,n1=Math.floor(n1/length);while(n1>0);return e1}function yeast(){const n1=encode$3(+new Date);return n1!==prev?(seed$1=0,prev=n1):n1+"."+encode$3(seed$1++)}for(;i$2<length;i$2++)map[alphabet$3[i$2]]=i$2;function encode$2(n1){let e1="";for(let t1 in n1)n1.hasOwnProperty(t1)&&(e1.length&&(e1+="&"),e1+=encodeURIComponent(t1)+"="+encodeURIComponent(n1[t1]));return e1}function decode$2(n1){let e1={},t1=n1.split("&");for(let r1=0,o1=t1.length;r1<o1;r1++){let i1=t1[r1].split("=");e1[decodeURIComponent(i1[0])]=decodeURIComponent(i1[1])}return e1}let value$1=!1;try{value$1=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const hasCORS=value$1;function XHR(n1){const e1=n1.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e1||hasCORS))return new XMLHttpRequest}catch{}if(!e1)try{return new globalThisShim[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function empty(){}const hasXHR2=function(){return new XHR({xdomain:!1}).responseType!=null}();class Polling extends Transport{constructor(e1){if(super(e1),this.polling=!1,typeof location<"u"){const r1=location.protocol==="https:";let o1=location.port;o1||(o1=r1?"443":"80"),this.xd=typeof location<"u"&&e1.hostname!==location.hostname||o1!==e1.port,this.xs=e1.secure!==r1}const t1=e1&&e1.forceBase64;this.supportsBinary=hasXHR2&&!t1}get name(){return"polling"}doOpen(){this.poll()}pause(e1){this.readyState="pausing";const t1=()=>{this.readyState="paused",e1()};if(this.polling||!this.writable){let r1=0;this.polling&&(r1++,this.once("pollComplete",function(){--r1||t1()})),this.writable||(r1++,this.once("drain",function(){--r1||t1()}))}else t1()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e1){const t1=r1=>{if(this.readyState==="opening"&&r1.type==="open"&&this.onOpen(),r1.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r1)};decodePayload(e1,this.socket.binaryType).forEach(t1),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e1=()=>{this.write([{type:"close"}])};this.readyState==="open"?e1():this.once("open",e1)}write(e1){this.writable=!1,encodePayload(e1,t1=>{this.doWrite(t1,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e1=this.query||{};const t1=this.opts.secure?"https":"http";let r1="";this.opts.timestampRequests!==!1&&(e1[this.opts.timestampParam]=yeast()),!this.supportsBinary&&!e1.sid&&(e1.b64=1),this.opts.port&&(t1==="https"&&Number(this.opts.port)!==443||t1==="http"&&Number(this.opts.port)!==80)&&(r1=":"+this.opts.port);const o1=encode$2(e1),i1=this.opts.hostname.indexOf(":")!==-1;return t1+"://"+(i1?"["+this.opts.hostname+"]":this.opts.hostname)+r1+this.opts.path+(o1.length?"?"+o1:"")}request(e1={}){return Object.assign(e1,{xd:this.xd,xs:this.xs},this.opts),new Request$1(this.uri(),e1)}doWrite(e1,t1){const r1=this.request({method:"POST",data:e1});r1.on("success",t1),r1.on("error",(o1,i1)=>{this.onError("xhr post error",o1,i1)})}doPoll(){const e1=this.request();e1.on("data",this.onData.bind(this)),e1.on("error",(t1,r1)=>{this.onError("xhr poll error",t1,r1)}),this.pollXhr=e1}}class Request$1 extends Emitter{constructor(e1,t1){super(),installTimerFunctions(this,t1),this.opts=t1,this.method=t1.method||"GET",this.uri=e1,this.async=t1.async!==!1,this.data=t1.data!==void 0?t1.data:null,this.create()}create(){const e1=pick(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e1.xdomain=!!this.opts.xd,e1.xscheme=!!this.opts.xs;const t1=this.xhr=new XHR(e1);try{t1.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){t1.setDisableHeaderCheck&&t1.setDisableHeaderCheck(!0);for(let r1 in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r1)&&t1.setRequestHeader(r1,this.opts.extraHeaders[r1])}}catch{}if(this.method==="POST")try{t1.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{t1.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in t1&&(t1.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(t1.timeout=this.opts.requestTimeout),t1.onreadystatechange=()=>{t1.readyState===4&&(t1.status===200||t1.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof t1.status=="number"?t1.status:0)},0))},t1.send(this.data)}catch(r1){this.setTimeoutFn(()=>{this.onError(r1)},0);return}typeof document<"u"&&(this.index=Request$1.requestsCount++,Request$1.requests[this.index]=this)}onError(e1){this.emitReserved("error",e1,this.xhr),this.cleanup(!0)}cleanup(e1){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=empty,e1)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Request$1.requests[this.index],this.xhr=null}}onLoad(){const e1=this.xhr.responseText;e1!==null&&(this.emitReserved("data",e1),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}Request$1.requestsCount=0;Request$1.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",unloadHandler);else if(typeof addEventListener=="function"){const n1="onpagehide"in globalThisShim?"pagehide":"unload";addEventListener(n1,unloadHandler,!1)}}function unloadHandler(){for(let n1 in Request$1.requests)Request$1.requests.hasOwnProperty(n1)&&Request$1.requests[n1].abort()}const nextTick=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e1=>Promise.resolve().then(e1):(e1,t1)=>t1(e1,0))(),WebSocket=globalThisShim.WebSocket||globalThisShim.MozWebSocket,usingBrowserWebSocket=!0,defaultBinaryType="arraybuffer",isReactNative=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class WS extends Transport{constructor(e1){super(e1),this.supportsBinary=!e1.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e1=this.uri(),t1=this.opts.protocols,r1=isReactNative?{}:pick(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r1.headers=this.opts.extraHeaders);try{this.ws=usingBrowserWebSocket&&!isReactNative?t1?new WebSocket(e1,t1):new WebSocket(e1):new WebSocket(e1,t1,r1)}catch(o1){return this.emitReserved("error",o1)}this.ws.binaryType=this.socket.binaryType||defaultBinaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e1=>this.onClose({description:"websocket connection closed",context:e1}),this.ws.onmessage=e1=>this.onData(e1.data),this.ws.onerror=e1=>this.onError("websocket error",e1)}write(e1){this.writable=!1;for(let t1=0;t1<e1.length;t1++){const r1=e1[t1],o1=t1===e1.length-1;encodePacket(r1,this.supportsBinary,i1=>{const a1={};try{usingBrowserWebSocket&&this.ws.send(i1)}catch{}o1&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){let e1=this.query||{};const t1=this.opts.secure?"wss":"ws";let r1="";this.opts.port&&(t1==="wss"&&Number(this.opts.port)!==443||t1==="ws"&&Number(this.opts.port)!==80)&&(r1=":"+this.opts.port),this.opts.timestampRequests&&(e1[this.opts.timestampParam]=yeast()),this.supportsBinary||(e1.b64=1);const o1=encode$2(e1),i1=this.opts.hostname.indexOf(":")!==-1;return t1+"://"+(i1?"["+this.opts.hostname+"]":this.opts.hostname)+r1+this.opts.path+(o1.length?"?"+o1:"")}check(){return!!WebSocket}}const transports={websocket:WS,polling:Polling},re$1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,parts=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function parse$8(n1){const e1=n1,t1=n1.indexOf("["),r1=n1.indexOf("]");t1!=-1&&r1!=-1&&(n1=n1.substring(0,t1)+n1.substring(t1,r1).replace(/:/g,";")+n1.substring(r1,n1.length));let o1=re$1.exec(n1||""),i1={},a1=14;for(;a1--;)i1[parts[a1]]=o1[a1]||"";return t1!=-1&&r1!=-1&&(i1.source=e1,i1.host=i1.host.substring(1,i1.host.length-1).replace(/;/g,":"),i1.authority=i1.authority.replace("[","").replace("]","").replace(/;/g,":"),i1.ipv6uri=!0),i1.pathNames=pathNames(i1,i1.path),i1.queryKey=queryKey(i1,i1.query),i1}function pathNames(n1,e1){const t1=/\/{2,9}/g,r1=e1.replace(t1,"/").split("/");return(e1.slice(0,1)=="/"||e1.length===0)&&r1.splice(0,1),e1.slice(-1)=="/"&&r1.splice(r1.length-1,1),r1}function queryKey(n1,e1){const t1={};return e1.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r1,o1,i1){o1&&(t1[o1]=i1)}),t1}class Socket$1 extends Emitter{constructor(e1,t1={}){super(),this.writeBuffer=[],e1&&typeof e1=="object"&&(t1=e1,e1=null),e1?(e1=parse$8(e1),t1.hostname=e1.host,t1.secure=e1.protocol==="https"||e1.protocol==="wss",t1.port=e1.port,e1.query&&(t1.query=e1.query)):t1.host&&(t1.hostname=parse$8(t1.host).host),installTimerFunctions(this,t1),this.secure=t1.secure!=null?t1.secure:typeof location<"u"&&location.protocol==="https:",t1.hostname&&!t1.port&&(t1.port=this.secure?"443":"80"),this.hostname=t1.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t1.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=t1.transports||["polling","websocket"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},t1),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=decode$2(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e1){const t1=Object.assign({},this.opts.query);t1.EIO=protocol$1,t1.transport=e1,this.id&&(t1.sid=this.id);const r1=Object.assign({},this.opts.transportOptions[e1],this.opts,{query:t1,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new transports[e1](r1)}open(){let e1;if(this.opts.rememberUpgrade&&Socket$1.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e1="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e1=this.transports[0];this.readyState="opening";try{e1=this.createTransport(e1)}catch{this.transports.shift(),this.open();return}e1.open(),this.setTransport(e1)}setTransport(e1){this.transport&&this.transport.removeAllListeners(),this.transport=e1,e1.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t1=>this.onClose("transport close",t1))}probe(e1){let t1=this.createTransport(e1),r1=!1;Socket$1.priorWebsocketSuccess=!1;const o1=()=>{r1||(t1.send([{type:"ping",data:"probe"}]),t1.once("packet",f1=>{if(!r1)if(f1.type==="pong"&&f1.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t1),!t1)return;Socket$1.priorWebsocketSuccess=t1.name==="websocket",this.transport.pause(()=>{r1||this.readyState!=="closed"&&(u1(),this.setTransport(t1),t1.send([{type:"upgrade"}]),this.emitReserved("upgrade",t1),t1=null,this.upgrading=!1,this.flush())})}else{const p1=new Error("probe error");p1.transport=t1.name,this.emitReserved("upgradeError",p1)}}))};function i1(){r1||(r1=!0,u1(),t1.close(),t1=null)}const a1=f1=>{const p1=new Error("probe error: "+f1);p1.transport=t1.name,i1(),this.emitReserved("upgradeError",p1)};function s1(){a1("transport closed")}function l1(){a1("socket closed")}function c1(f1){t1&&f1.name!==t1.name&&i1()}const u1=()=>{t1.removeListener("open",o1),t1.removeListener("error",a1),t1.removeListener("close",s1),this.off("close",l1),this.off("upgrading",c1)};t1.once("open",o1),t1.once("error",a1),t1.once("close",s1),this.once("close",l1),this.once("upgrading",c1),t1.open()}onOpen(){if(this.readyState="open",Socket$1.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e1=0;const t1=this.upgrades.length;for(;e1<t1;e1++)this.probe(this.upgrades[e1])}}onPacket(e1){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e1),this.emitReserved("heartbeat"),e1.type){case"open":this.onHandshake(JSON.parse(e1.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t1=new Error("server error");t1.code=e1.data,this.onError(t1);break;case"message":this.emitReserved("data",e1.data),this.emitReserved("message",e1.data);break}}onHandshake(e1){this.emitReserved("handshake",e1),this.id=e1.sid,this.transport.query.sid=e1.sid,this.upgrades=this.filterUpgrades(e1.upgrades),this.pingInterval=e1.pingInterval,this.pingTimeout=e1.pingTimeout,this.maxPayload=e1.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e1=this.getWritablePackets();this.transport.send(e1),this.prevBufferLen=e1.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t1=1;for(let r1=0;r1<this.writeBuffer.length;r1++){const o1=this.writeBuffer[r1].data;if(o1&&(t1+=byteLength(o1)),r1>0&&t1>this.maxPayload)return this.writeBuffer.slice(0,r1);t1+=2}return this.writeBuffer}write(e1,t1,r1){return this.sendPacket("message",e1,t1,r1),this}send(e1,t1,r1){return this.sendPacket("message",e1,t1,r1),this}sendPacket(e1,t1,r1,o1){if(typeof t1=="function"&&(o1=t1,t1=void 0),typeof r1=="function"&&(o1=r1,r1=null),this.readyState==="closing"||this.readyState==="closed")return;r1=r1||{},r1.compress=r1.compress!==!1;const i1={type:e1,data:t1,options:r1};this.emitReserved("packetCreate",i1),this.writeBuffer.push(i1),o1&&this.once("flush",o1),this.flush()}close(){const e1=()=>{this.onClose("forced close"),this.transport.close()},t1=()=>{this.off("upgrade",t1),this.off("upgradeError",t1),e1()},r1=()=>{this.once("upgrade",t1),this.once("upgradeError",t1)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r1():e1()}):this.upgrading?r1():e1()),this}onError(e1){Socket$1.priorWebsocketSuccess=!1,this.emitReserved("error",e1),this.onClose("transport error",e1)}onClose(e1,t1){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e1,t1),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e1){const t1=[];let r1=0;const o1=e1.length;for(;r1<o1;r1++)~this.transports.indexOf(e1[r1])&&t1.push(e1[r1]);return t1}}Socket$1.protocol=protocol$1;function url$1(n1,e1="",t1){let r1=n1;t1=t1||typeof location<"u"&&location,n1==null&&(n1=t1.protocol+"//"+t1.host),typeof n1=="string"&&(n1.charAt(0)==="/"&&(n1.charAt(1)==="/"?n1=t1.protocol+n1:n1=t1.host+n1),/^(https?|wss?):\/\//.test(n1)||(typeof t1<"u"?n1=t1.protocol+"//"+n1:n1="https://"+n1),r1=parse$8(n1)),r1.port||(/^(http|ws)$/.test(r1.protocol)?r1.port="80":/^(http|ws)s$/.test(r1.protocol)&&(r1.port="443")),r1.path=r1.path||"/";const i1=r1.host.indexOf(":")!==-1?"["+r1.host+"]":r1.host;return r1.id=r1.protocol+"://"+i1+":"+r1.port+e1,r1.href=r1.protocol+"://"+i1+(t1&&t1.port===r1.port?"":":"+r1.port),r1}const withNativeArrayBuffer=typeof ArrayBuffer=="function",isView=n1=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n1):n1.buffer instanceof ArrayBuffer,toString$6=Object.prototype.toString,withNativeBlob=typeof Blob=="function"||typeof Blob<"u"&&toString$6.call(Blob)==="[object BlobConstructor]",withNativeFile=typeof File=="function"||typeof File<"u"&&toString$6.call(File)==="[object FileConstructor]";function isBinary(n1){return withNativeArrayBuffer&&(n1 instanceof ArrayBuffer||isView(n1))||withNativeBlob&&n1 instanceof Blob||withNativeFile&&n1 instanceof File}function hasBinary(n1,e1){if(!n1||typeof n1!="object")return!1;if(Array.isArray(n1)){for(let t1=0,r1=n1.length;t1<r1;t1++)if(hasBinary(n1[t1]))return!0;return!1}if(isBinary(n1))return!0;if(n1.toJSON&&typeof n1.toJSON=="function"&&arguments.length===1)return hasBinary(n1.toJSON(),!0);for(const t1 in n1)if(Object.prototype.hasOwnProperty.call(n1,t1)&&hasBinary(n1[t1]))return!0;return!1}function deconstructPacket(n1){const e1=[],t1=n1.data,r1=n1;return r1.data=_deconstructPacket(t1,e1),r1.attachments=e1.length,{packet:r1,buffers:e1}}function _deconstructPacket(n1,e1){if(!n1)return n1;if(isBinary(n1)){const t1={_placeholder:!0,num:e1.length};return e1.push(n1),t1}else if(Array.isArray(n1)){const t1=new Array(n1.length);for(let r1=0;r1<n1.length;r1++)t1[r1]=_deconstructPacket(n1[r1],e1);return t1}else if(typeof n1=="object"&&!(n1 instanceof Date)){const t1={};for(const r1 in n1)Object.prototype.hasOwnProperty.call(n1,r1)&&(t1[r1]=_deconstructPacket(n1[r1],e1));return t1}return n1}function reconstructPacket(n1,e1){return n1.data=_reconstructPacket(n1.data,e1),delete n1.attachments,n1}function _reconstructPacket(n1,e1){if(!n1)return n1;if(n1&&n1._placeholder===!0){if(typeof n1.num=="number"&&n1.num>=0&&n1.num<e1.length)return e1[n1.num];throw new Error("illegal attachments")}else if(Array.isArray(n1))for(let t1=0;t1<n1.length;t1++)n1[t1]=_reconstructPacket(n1[t1],e1);else if(typeof n1=="object")for(const t1 in n1)Object.prototype.hasOwnProperty.call(n1,t1)&&(n1[t1]=_reconstructPacket(n1[t1],e1));return n1}const protocol=5;var PacketType;(function(n1){n1[n1.CONNECT=0]="CONNECT",n1[n1.DISCONNECT=1]="DISCONNECT",n1[n1.EVENT=2]="EVENT",n1[n1.ACK=3]="ACK",n1[n1.CONNECT_ERROR=4]="CONNECT_ERROR",n1[n1.BINARY_EVENT=5]="BINARY_EVENT",n1[n1.BINARY_ACK=6]="BINARY_ACK"})(PacketType||(PacketType={}));class Encoder{constructor(e1){this.replacer=e1}encode(e1){return(e1.type===PacketType.EVENT||e1.type===PacketType.ACK)&&hasBinary(e1)?this.encodeAsBinary({type:e1.type===PacketType.EVENT?PacketType.BINARY_EVENT:PacketType.BINARY_ACK,nsp:e1.nsp,data:e1.data,id:e1.id}):[this.encodeAsString(e1)]}encodeAsString(e1){let t1=""+e1.type;return(e1.type===PacketType.BINARY_EVENT||e1.type===PacketType.BINARY_ACK)&&(t1+=e1.attachments+"-"),e1.nsp&&e1.nsp!=="/"&&(t1+=e1.nsp+","),e1.id!=null&&(t1+=e1.id),e1.data!=null&&(t1+=JSON.stringify(e1.data,this.replacer)),t1}encodeAsBinary(e1){const t1=deconstructPacket(e1),r1=this.encodeAsString(t1.packet),o1=t1.buffers;return o1.unshift(r1),o1}}class Decoder extends Emitter{constructor(e1){super(),this.reviver=e1}add(e1){let t1;if(typeof e1=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t1=this.decodeString(e1);const r1=t1.type===PacketType.BINARY_EVENT;r1||t1.type===PacketType.BINARY_ACK?(t1.type=r1?PacketType.EVENT:PacketType.ACK,this.reconstructor=new BinaryReconstructor(t1),t1.attachments===0&&super.emitReserved("decoded",t1)):super.emitReserved("decoded",t1)}else if(isBinary(e1)||e1.base64)if(this.reconstructor)t1=this.reconstructor.takeBinaryData(e1),t1&&(this.reconstructor=null,super.emitReserved("decoded",t1));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e1)}decodeString(e1){let t1=0;const r1={type:Number(e1.charAt(0))};if(PacketType[r1.type]===void 0)throw new Error("unknown packet type "+r1.type);if(r1.type===PacketType.BINARY_EVENT||r1.type===PacketType.BINARY_ACK){const i1=t1+1;for(;e1.charAt(++t1)!=="-"&&t1!=e1.length;);const a1=e1.substring(i1,t1);if(a1!=Number(a1)||e1.charAt(t1)!=="-")throw new Error("Illegal attachments");r1.attachments=Number(a1)}if(e1.charAt(t1+1)==="/"){const i1=t1+1;for(;++t1&&!(e1.charAt(t1)===","||t1===e1.length););r1.nsp=e1.substring(i1,t1)}else r1.nsp="/";const o1=e1.charAt(t1+1);if(o1!==""&&Number(o1)==o1){const i1=t1+1;for(;++t1;){const a1=e1.charAt(t1);if(a1==null||Number(a1)!=a1){--t1;break}if(t1===e1.length)break}r1.id=Number(e1.substring(i1,t1+1))}if(e1.charAt(++t1)){const i1=this.tryParse(e1.substr(t1));if(Decoder.isPayloadValid(r1.type,i1))r1.data=i1;else throw new Error("invalid payload")}return r1}tryParse(e1){try{return JSON.parse(e1,this.reviver)}catch{return!1}}static isPayloadValid(e1,t1){switch(e1){case PacketType.CONNECT:return typeof t1=="object";case PacketType.DISCONNECT:return t1===void 0;case PacketType.CONNECT_ERROR:return typeof t1=="string"||typeof t1=="object";case PacketType.EVENT:case PacketType.BINARY_EVENT:return Array.isArray(t1)&&(typeof t1[0]=="string"||typeof t1[0]=="number");case PacketType.ACK:case PacketType.BINARY_ACK:return Array.isArray(t1)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class BinaryReconstructor{constructor(e1){this.packet=e1,this.buffers=[],this.reconPack=e1}takeBinaryData(e1){if(this.buffers.push(e1),this.buffers.length===this.reconPack.attachments){const t1=reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),t1}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const parser$2=Object.freeze(Object.defineProperty({__proto__:null,protocol,get PacketType(){return PacketType},Encoder,Decoder},Symbol.toStringTag,{value:"Module"}));function on(n1,e1,t1){return n1.on(e1,t1),function(){n1.off(e1,t1)}}const RESERVED_EVENTS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Socket extends Emitter{constructor(e1,t1,r1){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e1,this.nsp=t1,r1&&r1.auth&&(this.auth=r1.auth),this._opts=Object.assign({},r1),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e1=this.io;this.subs=[on(e1,"open",this.onopen.bind(this)),on(e1,"packet",this.onpacket.bind(this)),on(e1,"error",this.onerror.bind(this)),on(e1,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e1){return e1.unshift("message"),this.emit.apply(this,e1),this}emit(e1,...t1){if(RESERVED_EVENTS.hasOwnProperty(e1))throw new Error('"'+e1.toString()+'" is a reserved event name');if(t1.unshift(e1),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t1),this;const r1={type:PacketType.EVENT,data:t1};if(r1.options={},r1.options.compress=this.flags.compress!==!1,typeof t1[t1.length-1]=="function"){const a1=this.ids++,s1=t1.pop();this._registerAckCallback(a1,s1),r1.id=a1}const o1=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!o1||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r1),this.packet(r1)):this.sendBuffer.push(r1)),this.flags={},this}_registerAckCallback(e1,t1){var r1;const o1=(r1=this.flags.timeout)!==null&&r1!==void 0?r1:this._opts.ackTimeout;if(o1===void 0){this.acks[e1]=t1;return}const i1=this.io.setTimeoutFn(()=>{delete this.acks[e1];for(let a1=0;a1<this.sendBuffer.length;a1++)this.sendBuffer[a1].id===e1&&this.sendBuffer.splice(a1,1);t1.call(this,new Error("operation has timed out"))},o1);this.acks[e1]=(...a1)=>{this.io.clearTimeoutFn(i1),t1.apply(this,[null,...a1])}}emitWithAck(e1,...t1){const r1=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((o1,i1)=>{t1.push((a1,s1)=>r1?a1?i1(a1):o1(s1):o1(a1)),this.emit(e1,...t1)})}_addToQueue(e1){let t1;typeof e1[e1.length-1]=="function"&&(t1=e1.pop());const r1={id:this._queueSeq++,tryCount:0,pending:!1,args:e1,flags:Object.assign({fromQueue:!0},this.flags)};e1.push((o1,...i1)=>r1!==this._queue[0]?void 0:(o1!==null?r1.tryCount>this._opts.retries&&(this._queue.shift(),t1&&t1(o1)):(this._queue.shift(),t1&&t1(null,...i1)),r1.pending=!1,this._drainQueue())),this._queue.push(r1),this._drainQueue()}_drainQueue(e1=!1){if(!this.connected||this._queue.length===0)return;const t1=this._queue[0];t1.pending&&!e1||(t1.pending=!0,t1.tryCount++,this.flags=t1.flags,this.emit.apply(this,t1.args))}packet(e1){e1.nsp=this.nsp,this.io._packet(e1)}onopen(){typeof this.auth=="function"?this.auth(e1=>{this._sendConnectPacket(e1)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e1){this.packet({type:PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e1):e1})}onerror(e1){this.connected||this.emitReserved("connect_error",e1)}onclose(e1,t1){this.connected=!1,delete this.id,this.emitReserved("disconnect",e1,t1)}onpacket(e1){if(e1.nsp===this.nsp)switch(e1.type){case PacketType.CONNECT:e1.data&&e1.data.sid?this.onconnect(e1.data.sid,e1.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case PacketType.EVENT:case PacketType.BINARY_EVENT:this.onevent(e1);break;case PacketType.ACK:case PacketType.BINARY_ACK:this.onack(e1);break;case PacketType.DISCONNECT:this.ondisconnect();break;case PacketType.CONNECT_ERROR:this.destroy();const r1=new Error(e1.data.message);r1.data=e1.data.data,this.emitReserved("connect_error",r1);break}}onevent(e1){const t1=e1.data||[];e1.id!=null&&t1.push(this.ack(e1.id)),this.connected?this.emitEvent(t1):this.receiveBuffer.push(Object.freeze(t1))}emitEvent(e1){if(this._anyListeners&&this._anyListeners.length){const t1=this._anyListeners.slice();for(const r1 of t1)r1.apply(this,e1)}super.emit.apply(this,e1),this._pid&&e1.length&&typeof e1[e1.length-1]=="string"&&(this._lastOffset=e1[e1.length-1])}ack(e1){const t1=this;let r1=!1;return function(...o1){r1||(r1=!0,t1.packet({type:PacketType.ACK,id:e1,data:o1}))}}onack(e1){const t1=this.acks[e1.id];typeof t1=="function"&&(t1.apply(this,e1.data),delete this.acks[e1.id])}onconnect(e1,t1){this.id=e1,this.recovered=t1&&this._pid===t1,this._pid=t1,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e1=>this.emitEvent(e1)),this.receiveBuffer=[],this.sendBuffer.forEach(e1=>{this.notifyOutgoingListeners(e1),this.packet(e1)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e1=>e1()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:PacketType.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e1){return this.flags.compress=e1,this}get volatile(){return this.flags.volatile=!0,this}timeout(e1){return this.flags.timeout=e1,this}onAny(e1){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e1),this}prependAny(e1){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e1),this}offAny(e1){if(!this._anyListeners)return this;if(e1){const t1=this._anyListeners;for(let r1=0;r1<t1.length;r1++)if(e1===t1[r1])return t1.splice(r1,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e1){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e1),this}prependAnyOutgoing(e1){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e1),this}offAnyOutgoing(e1){if(!this._anyOutgoingListeners)return this;if(e1){const t1=this._anyOutgoingListeners;for(let r1=0;r1<t1.length;r1++)if(e1===t1[r1])return t1.splice(r1,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e1){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t1=this._anyOutgoingListeners.slice();for(const r1 of t1)r1.apply(this,e1.data)}}}function Backoff(n1){n1=n1||{},this.ms=n1.min||100,this.max=n1.max||1e4,this.factor=n1.factor||2,this.jitter=n1.jitter>0&&n1.jitter<=1?n1.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var n1=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e1=Math.random(),t1=Math.floor(e1*this.jitter*n1);n1=(Math.floor(e1*10)&1)==0?n1-t1:n1+t1}return Math.min(n1,this.max)|0};Backoff.prototype.reset=function(){this.attempts=0};Backoff.prototype.setMin=function(n1){this.ms=n1};Backoff.prototype.setMax=function(n1){this.max=n1};Backoff.prototype.setJitter=function(n1){this.jitter=n1};class Manager extends Emitter{constructor(e1,t1){var r1;super(),this.nsps={},this.subs=[],e1&&typeof e1=="object"&&(t1=e1,e1=void 0),t1=t1||{},t1.path=t1.path||"/socket.io",this.opts=t1,installTimerFunctions(this,t1),this.reconnection(t1.reconnection!==!1),this.reconnectionAttempts(t1.reconnectionAttempts||1/0),this.reconnectionDelay(t1.reconnectionDelay||1e3),this.reconnectionDelayMax(t1.reconnectionDelayMax||5e3),this.randomizationFactor((r1=t1.randomizationFactor)!==null&&r1!==void 0?r1:.5),this.backoff=new Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t1.timeout==null?2e4:t1.timeout),this._readyState="closed",this.uri=e1;const o1=t1.parser||parser$2;this.encoder=new o1.Encoder,this.decoder=new o1.Decoder,this._autoConnect=t1.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e1){return arguments.length?(this._reconnection=!!e1,this):this._reconnection}reconnectionAttempts(e1){return e1===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e1,this)}reconnectionDelay(e1){var t1;return e1===void 0?this._reconnectionDelay:(this._reconnectionDelay=e1,(t1=this.backoff)===null||t1===void 0||t1.setMin(e1),this)}randomizationFactor(e1){var t1;return e1===void 0?this._randomizationFactor:(this._randomizationFactor=e1,(t1=this.backoff)===null||t1===void 0||t1.setJitter(e1),this)}reconnectionDelayMax(e1){var t1;return e1===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e1,(t1=this.backoff)===null||t1===void 0||t1.setMax(e1),this)}timeout(e1){return arguments.length?(this._timeout=e1,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e1){if(~this._readyState.indexOf("open"))return this;this.engine=new Socket$1(this.uri,this.opts);const t1=this.engine,r1=this;this._readyState="opening",this.skipReconnect=!1;const o1=on(t1,"open",function(){r1.onopen(),e1&&e1()}),i1=on(t1,"error",a1=>{r1.cleanup(),r1._readyState="closed",this.emitReserved("error",a1),e1?e1(a1):r1.maybeReconnectOnOpen()});if(this._timeout!==!1){const a1=this._timeout;a1===0&&o1();const s1=this.setTimeoutFn(()=>{o1(),t1.close(),t1.emit("error",new Error("timeout"))},a1);this.opts.autoUnref&&s1.unref(),this.subs.push(function(){clearTimeout(s1)})}return this.subs.push(o1),this.subs.push(i1),this}connect(e1){return this.open(e1)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e1=this.engine;this.subs.push(on(e1,"ping",this.onping.bind(this)),on(e1,"data",this.ondata.bind(this)),on(e1,"error",this.onerror.bind(this)),on(e1,"close",this.onclose.bind(this)),on(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e1){try{this.decoder.add(e1)}catch(t1){this.onclose("parse error",t1)}}ondecoded(e1){nextTick(()=>{this.emitReserved("packet",e1)},this.setTimeoutFn)}onerror(e1){this.emitReserved("error",e1)}socket(e1,t1){let r1=this.nsps[e1];return r1?this._autoConnect&&!r1.active&&r1.connect():(r1=new Socket(this,e1,t1),this.nsps[e1]=r1),r1}_destroy(e1){const t1=Object.keys(this.nsps);for(const r1 of t1)if(this.nsps[r1].active)return;this._close()}_packet(e1){const t1=this.encoder.encode(e1);for(let r1=0;r1<t1.length;r1++)this.engine.write(t1[r1],e1.options)}cleanup(){this.subs.forEach(e1=>e1()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e1,t1){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e1,t1),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e1=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t1=this.backoff.duration();this._reconnecting=!0;const r1=this.setTimeoutFn(()=>{e1.skipReconnect||(this.emitReserved("reconnect_attempt",e1.backoff.attempts),!e1.skipReconnect&&e1.open(o1=>{o1?(e1._reconnecting=!1,e1.reconnect(),this.emitReserved("reconnect_error",o1)):e1.onreconnect()}))},t1);this.opts.autoUnref&&r1.unref(),this.subs.push(function(){clearTimeout(r1)})}}onreconnect(){const e1=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e1)}}const cache$1={};function lookup$1(n1,e1){typeof n1=="object"&&(e1=n1,n1=void 0),e1=e1||{};const t1=url$1(n1,e1.path||"/socket.io"),r1=t1.source,o1=t1.id,i1=t1.path,a1=cache$1[o1]&&i1 in cache$1[o1].nsps,s1=e1.forceNew||e1["force new connection"]||e1.multiplex===!1||a1;let l1;return s1?l1=new Manager(r1,e1):(cache$1[o1]||(cache$1[o1]=new Manager(r1,e1)),l1=cache$1[o1]),t1.query&&!e1.query&&(e1.query=t1.queryKey),l1.socket(t1.path,e1)}Object.assign(lookup$1,{Manager,Socket,io:lookup$1,connect:lookup$1});const DefaultOptions={heartbeat:!0},createWebsocket=(n1,e1=DefaultOptions)=>{if(!n1)throw"A websocket path must be provided";const{heartbeat:t1}={...DefaultOptions,...e1},r1=location.protocol==="https:",o1=r1?"wss:":"ws:",i1=location.hostname,a1=location.port||(r1?443:80);let s1=lookup$1(`${o1}//${i1}:${a1}`,{path:n1,reconnectionAttempts:3,reconnectionDelay:5e3,reconnectionDelayMax:5e3,timeout:4e3,transports:["websocket"]}),l1;return t1&&(l1=setInterval(()=>{s1.emit(SocketEvent.Heartbeat)},SocketSessionTTL*500)),s1.on("disconnect",()=>{clearInterval(l1)}),s1.onOther=(c1,u1)=>{s1.on(c1,f1=>{(f1==null?void 0:f1.apiSessionId)!==APISessionID&&u1(f1)})},s1};function downloadText(n1,e1){typeof e1=="object"&&(e1=JSON.stringify(e1));const t1=new Blob([e1],{type:"plain/text"}),r1=URL.createObjectURL(t1),o1=document.createElement("a");o1.href=r1,o1.download=n1,o1.click(),URL.revokeObjectURL(r1)}const{buildLuceneQuery,luceneLimit,runLuceneQuery,luceneSort}=LuceneUtils;class DataFetch{constructor(e1){if(this.API=null,this.features={supportsSearch:!1,supportsSort:!1,supportsPagination:!1},this.options={datasource:null,limit:10,filter:null,query:null,sortColumn:null,sortOrder:"ascending",sortType:null,paginate:!0},this.store=writable({rows:[],info:null,schema:null,loading:!1,loaded:!1,query:null,pageNumber:0,cursor:null,cursors:[],resetKey:Math.random(),error:null}),this.API=e1==null?void 0:e1.API,this.options={...this.options,...e1},!this.API)throw"An API client is required for fetching data";if(this.getData=this.getData.bind(this),this.getPage=this.getPage.bind(this),this.getInitialData=this.getInitialData.bind(this),this.determineFeatureFlags=this.determineFeatureFlags.bind(this),this.refresh=this.refresh.bind(this),this.update=this.update.bind(this),this.hasNextPage=this.hasNextPage.bind(this),this.hasPrevPage=this.hasPrevPage.bind(this),this.nextPage=this.nextPage.bind(this),this.prevPage=this.prevPage.bind(this),this.derivedStore=derived(this.store,t1=>({...t1,...this.features,hasNextPage:this.hasNextPage(t1),hasPrevPage:this.hasPrevPage(t1)})),!this.options.datasource){this.store.update(t1=>({...t1,loaded:!0}));return}this.getInitialData()}get subscribe(){return this.derivedStore.subscribe}async getInitialData(){var d1;const{datasource:e1,filter:t1,paginate:r1}=this.options,o1=await this.getDefinition(e1),i1=this.determineFeatureFlags(o1);this.features={supportsSearch:!!(i1!=null&&i1.supportsSearch),supportsSort:!!(i1!=null&&i1.supportsSort),supportsPagination:r1&&!!(i1!=null&&i1.supportsPagination)};let a1=this.getSchema(e1,o1);if(a1=this.enrichSchema(a1),!a1)return;if(this.options.sortOrder||(this.options.sortOrder="ascending"),!(this.options.sortColumn&&a1[this.options.sortColumn])){let m1;(o1==null?void 0:o1.primaryDisplay)&&a1[o1.primaryDisplay]?m1=o1.primaryDisplay:m1=Object.keys(a1)[0],this.options.sortColumn=m1}const{sortOrder:l1,sortColumn:c1}=this.options;let u1="string";c1&&(u1=((d1=a1==null?void 0:a1[c1])==null?void 0:d1.type)==="number"?"number":"string"),this.options.sortType=u1;let f1=this.options.query;f1||(f1=buildLuceneQuery(t1)),this.store.update(m1=>({...m1,definition:o1,schema:a1,query:f1,loading:!0,cursors:[],cursor:null,sortOrder:l1,sortColumn:c1}));const p1=await this.getPage();this.store.update(m1=>({...m1,loading:!1,loaded:!0,pageNumber:0,rows:p1.rows,info:p1.info,cursors:r1&&p1.hasNextPage?[null,p1.cursor]:[null],error:p1.error,resetKey:Math.random()}))}async getPage(){const{sortColumn:e1,sortOrder:t1,sortType:r1,limit:o1}=this.options,{query:i1}=get_store_value(this.store);let{rows:a1,info:s1,hasNextPage:l1,cursor:c1,error:u1}=await this.getData();return this.features.supportsSearch||(a1=runLuceneQuery(a1,i1)),this.features.supportsSort||(a1=luceneSort(a1,e1,t1,r1)),this.features.supportsPagination||(a1=luceneLimit(a1,o1)),{rows:a1,info:s1,hasNextPage:l1,cursor:c1,error:u1}}async getData(){return{rows:[],info:null,hasNextPage:!1,cursor:null}}async getDefinition(e1){if(!(e1!=null&&e1.tableId))return null;try{return await this.API.fetchTableDefinition(e1.tableId)}catch(t1){return this.store.update(r1=>({...r1,error:t1})),null}}getSchema(e1,t1){return t1==null?void 0:t1.schema}enrichSchema(e1){if(e1==null)return null;let t1={};Object.keys(e1).forEach(o1=>{const i1=e1[o1];if((i1==null?void 0:i1.type)==="json"){const a1=convertJSONSchemaToTableSchema(i1,{squashObjects:!0});Object.keys(a1).forEach(s1=>{t1[`${o1}.${s1}`]={type:a1[s1].type,nestedJSON:!0}})}}),e1={...e1,...t1};let r1={};return Object.entries(e1).forEach(([o1,i1])=>{typeof i1=="string"?r1[o1]={type:i1,name:o1}:r1[o1]={...i1,name:o1}}),r1}determineFeatureFlags(e1){return{supportsSearch:!1,supportsSort:!1,supportsPagination:!1}}async update(e1){let t1=!1;const r1=Object.entries(e1||{});for(let[o1,i1]of r1)if(JSON.stringify(i1)!==JSON.stringify(this.options[o1])){t1=!0;break}!t1||(this.options={...this.options,...fp.cloneDeep(e1)},await this.getInitialData())}async refresh(){if(get_store_value(this.store).loading)return;this.store.update(l1=>({...l1,loading:!0}));const{rows:e1,info:t1,error:r1,cursor:o1}=await this.getPage();let{cursors:i1}=get_store_value(this.store);const{pageNumber:a1}=get_store_value(this.store);if(!e1.length&&a1>0)return this.store.update(l1=>({...l1,loading:!1,cursors:i1.slice(0,a1)})),await this.prevPage();i1[a1+1]!=o1&&(i1=i1.slice(0,a1+1),i1[a1+1]=o1),this.store.update(l1=>({...l1,rows:e1,info:t1,loading:!1,error:r1,cursors:i1}))}hasNextPage(e1){return e1.cursors[e1.pageNumber+1]!=null}hasPrevPage(e1){return e1.pageNumber>0}async nextPage(){const e1=get_store_value(this.derivedStore);if(e1.loading||!this.options.paginate||!e1.hasNextPage)return;const t1=e1.cursors[e1.pageNumber+1];this.store.update(l1=>({...l1,loading:!0,cursor:t1,pageNumber:l1.pageNumber+1}));const{rows:r1,info:o1,hasNextPage:i1,cursor:a1,error:s1}=await this.getPage();this.store.update(l1=>{let{cursors:c1,pageNumber:u1}=l1;return i1&&(c1[u1+1]=a1),{...l1,rows:r1,info:o1,cursors:c1,loading:!1,error:s1}})}async prevPage(){const e1=get_store_value(this.derivedStore);if(e1.loading||!this.options.paginate||!e1.hasPrevPage)return;const t1=e1.cursors[e1.pageNumber-1];this.store.update(a1=>({...a1,loading:!0,cursor:t1,pageNumber:a1.pageNumber-1}));const{rows:r1,info:o1,error:i1}=await this.getPage();this.store.update(a1=>({...a1,rows:r1,info:o1,loading:!1,error:i1}))}}class TableFetch extends DataFetch{determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!0,supportsPagination:!0}}async getData(){var u1;const{datasource:e1,limit:t1,sortColumn:r1,sortOrder:o1,sortType:i1,paginate:a1}=this.options,{tableId:s1}=e1,{cursor:l1,query:c1}=get_store_value(this.store);try{const f1=await this.API.searchTable({tableId:s1,query:c1,limit:t1,sort:r1,sortOrder:(u1=o1==null?void 0:o1.toLowerCase())!=null?u1:"ascending",sortType:i1,paginate:a1,bookmark:l1});return{rows:(f1==null?void 0:f1.rows)||[],hasNextPage:(f1==null?void 0:f1.hasNextPage)||!1,cursor:(f1==null?void 0:f1.bookmark)||null}}catch(f1){return{rows:[],hasNextPage:!1,error:f1}}}}class ViewFetch extends DataFetch{getSchema(e1,t1){var r1,o1;return(o1=(r1=t1==null?void 0:t1.views)==null?void 0:r1[e1.name])==null?void 0:o1.schema}async getData(){const{datasource:e1}=this.options;try{return{rows:await this.API.fetchViewData(e1)||[]}}catch{return{rows:[]}}}}class QueryFetch extends DataFetch{determineFeatureFlags(e1){var r1,o1,i1,a1,s1,l1;return{supportsPagination:!!((o1=(r1=e1==null?void 0:e1.fields)==null?void 0:r1.pagination)!=null&&o1.type)&&!!((a1=(i1=e1==null?void 0:e1.fields)==null?void 0:i1.pagination)!=null&&a1.location)&&!!((l1=(s1=e1==null?void 0:e1.fields)==null?void 0:s1.pagination)!=null&&l1.pageParam)}}async getDefinition(e1){if(!(e1!=null&&e1._id))return null;try{const t1=await this.API.fetchQueryDefinition(e1._id);return t1.fields||(t1.fields=e1.fields),t1}catch{return null}}async getData(){var u1,f1;const{datasource:e1,limit:t1,paginate:r1}=this.options,{supportsPagination:o1}=this.features,{cursor:i1,definition:a1}=get_store_value(this.store),s1=(f1=(u1=a1==null?void 0:a1.fields)==null?void 0:u1.pagination)==null?void 0:f1.type;let l1=cloneDeep((e1==null?void 0:e1.queryParams)||{});for(let p1 of(e1==null?void 0:e1.parameters)||{})l1[p1.name]||(l1[p1.name]=p1.default);let c1={queryId:e1==null?void 0:e1._id,parameters:l1};if(r1&&o1){const p1=s1==="page"?parseInt(i1||1):i1;c1.pagination={page:p1,limit:t1}}try{const p1=await this.API.executeQuery(c1),{data:d1,pagination:m1,..._1}=p1;let h1=null,b1=!1;return r1&&o1&&(s1==="page"?(h1=c1.pagination.page+1,b1=(d1==null?void 0:d1.length)===t1&&t1>0):(h1=m1==null?void 0:m1.cursor,b1=h1!=null)),{rows:d1||[],info:_1,cursor:h1,hasNextPage:b1}}catch{return{rows:[],hasNextPage:!1}}}}class RelationshipFetch extends DataFetch{async getData(){const{datasource:e1}=this.options;try{return{rows:await this.API.fetchRelationshipData({rowId:e1==null?void 0:e1.rowId,tableId:e1==null?void 0:e1.rowTableId,fieldName:e1==null?void 0:e1.fieldName})||[]}}catch{return{rows:[]}}}}class NestedProviderFetch extends DataFetch{async getDefinition(e1){var t1;return{schema:(t1=e1==null?void 0:e1.value)==null?void 0:t1.schema}}async getData(){var t1;const{datasource:e1}=this.options;return{rows:((t1=e1==null?void 0:e1.value)==null?void 0:t1.rows)||[],hasNextPage:!1,cursor:null}}}class FieldFetch extends DataFetch{async getDefinition(e1){let t1;return e1.fieldType==="attachment"?t1={url:{type:"string"},name:{type:"string"}}:e1.fieldType==="array"&&(t1={value:{type:"string"}}),{schema:t1}}async getData(){const{datasource:e1}=this.options,t1=(e1==null?void 0:e1.value)||[];let r1;return Array.isArray(t1)&&t1[0]&&typeof t1[0]!="object"?r1=t1.map(o1=>({value:o1})):r1=t1,{rows:r1||[],hasNextPage:!1,cursor:null}}}class JSONArrayFetch extends FieldFetch{async getDefinition(e1){try{const t1=await this.API.fetchTableDefinition(e1.tableId);return{schema:getJSONArrayDatasourceSchema(t1==null?void 0:t1.schema,e1)}}catch{return null}}}class UserFetch extends DataFetch{constructor(e1){super({...e1,datasource:{tableId:TableNames$1.USERS}})}determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!1,supportsPagination:!0}}async getDefinition(){return{schema:{}}}async getData(){const{cursor:e1,query:t1}=get_store_value(this.store);try{const r1=await this.API.searchUsers({page:e1,email:t1.email,appId:t1.appId,paginated:t1.paginated});return{rows:(r1==null?void 0:r1.data)||[],hasNextPage:(r1==null?void 0:r1.hasNextPage)||!1,cursor:(r1==null?void 0:r1.nextPage)||null}}catch(r1){return{rows:[],hasNextPage:!1,error:r1}}}}class GroupUserFetch extends DataFetch{constructor(e1){super({...e1,datasource:{tableId:TableNames$1.USERS}})}determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!1,supportsPagination:!0}}async getDefinition(){return{schema:{}}}async getData(){const{query:e1,cursor:t1}=get_store_value(this.store);try{const r1=await this.API.getGroupUsers({id:e1.groupId,emailSearch:e1.emailSearch,bookmark:t1});return{rows:(r1==null?void 0:r1.users)||[],hasNextPage:(r1==null?void 0:r1.hasNextPage)||!1,cursor:(r1==null?void 0:r1.bookmark)||null}}catch(r1){return{rows:[],hasNextPage:!1,error:r1}}}}const DataFetchMap={table:TableFetch,view:ViewFetch,query:QueryFetch,link:RelationshipFetch,user:UserFetch,groupUser:GroupUserFetch,provider:NestedProviderFetch,field:FieldFetch,jsonarray:JSONArrayFetch},fetchData=({API:n1,datasource:e1,options:t1})=>{const r1=DataFetchMap[e1==null?void 0:e1.type]||TableFetch;return new r1({API:n1,datasource:e1,...t1})},createLocalStorageStore=(n1,e1)=>{const t1=writable(e1,()=>{i1();const a1=({key:s1})=>s1===n1&&i1();return window.addEventListener("storage",a1),()=>window.removeEventListener("storage",a1)}),r1=a1=>{t1.set(a1),localStorage.setItem(n1,JSON.stringify(a1))},o1=a1=>r1(a1(get_store_value(t1))),i1=()=>{const a1=localStorage.getItem(n1);if(a1==null)r1(e1);else try{t1.set(JSON.parse(a1))}catch{r1(e1)}};return{...t1,set:r1,update:o1}},BG="/builder/assets/bg.29e85dd5.png",SplitPage_svelte_svelte_type_style_lang="",get_right_slot_changes$1=n1=>({}),get_right_slot_context$1=n1=>({});function create_fragment$7D(n1){let e1,t1,r1,o1,i1,a1,s1,l1,c1;const u1=n1[1].default,f1=create_slot(u1,n1,n1[0],null),p1=n1[1].right,d1=create_slot(p1,n1,n1[0],get_right_slot_context$1);return{c(){e1=element("div"),t1=element("div"),r1=element("div"),f1&&f1.c(),o1=space$1(),i1=element("div"),a1=element("img"),l1=space$1(),d1&&d1.c(),attr(r1,"class","content svelte-63esek"),attr(t1,"class","left svelte-63esek"),src_url_equal(a1.src,s1=BG)||attr(a1,"src",s1),attr(a1,"alt"," "),attr(a1,"class","svelte-63esek"),attr(i1,"class","right spectrum spectrum--darkest svelte-63esek"),attr(e1,"class","split-page svelte-63esek")},m(m1,_1){insert$1(m1,e1,_1),append$1(e1,t1),append$1(t1,r1),f1&&f1.m(r1,null),append$1(e1,o1),append$1(e1,i1),append$1(i1,a1),append$1(i1,l1),d1&&d1.m(i1,null),c1=!0},p(m1,[_1]){f1&&f1.p&&(!c1||_1&1)&&update_slot_base(f1,u1,m1,m1[0],c1?get_slot_changes(u1,m1[0],_1,null):get_all_dirty_from_scope(m1[0]),null),d1&&d1.p&&(!c1||_1&1)&&update_slot_base(d1,p1,m1,m1[0],c1?get_slot_changes(p1,m1[0],_1,get_right_slot_changes$1):get_all_dirty_from_scope(m1[0]),get_right_slot_context$1)},i(m1){c1||(transition_in(f1,m1),transition_in(d1,m1),c1=!0)},o(m1){transition_out(f1,m1),transition_out(d1,m1),c1=!1},d(m1){m1&&detach(e1),f1&&f1.d(m1),d1&&d1.d(m1)}}}function instance$7N(n1,e1,t1){let{$$slots:r1={},$$scope:o1}=e1;return n1.$$set=i1=>{"$$scope"in i1&&t1(0,o1=i1.$$scope)},[o1,r1]}class SplitPage extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7N,create_fragment$7D,safe_not_equal,{})}}const Bulgaria="/builder/assets/bulgaria.bd68393d.png",Covanta="/builder/assets/covanta.72c46c1e.png",Schnellecke="/builder/assets/schnellecke.cf1837a8.png",Testimonial_svelte_svelte_type_style_lang="";function create_default_slot$4$(n1){let e1,t1,r1,o1,i1,a1,s1,l1,c1;return{c(){e1=element("img"),r1=space$1(),o1=element("div"),o1.textContent=`"${n1[0].text}"`,i1=space$1(),a1=element("div"),s1=element("div"),s1.textContent=`${n1[0].name}`,l1=space$1(),c1=element("div"),c1.textContent=`${n1[0].role}`,attr(e1,"width",n1[0].imageSize),attr(e1,"alt","a-happy-budibase-user"),src_url_equal(e1.src,t1=n1[0].image)||attr(e1,"src",t1),attr(o1,"class","text svelte-1rdu21t"),attr(s1,"class","name svelte-1rdu21t"),attr(c1,"class","company svelte-1rdu21t"),attr(a1,"class","author")},m(u1,f1){insert$1(u1,e1,f1),insert$1(u1,r1,f1),insert$1(u1,o1,f1),insert$1(u1,i1,f1),insert$1(u1,a1,f1),append$1(a1,s1),append$1(a1,l1),append$1(a1,c1)},p:noop$5,d(u1){u1&&detach(e1),u1&&detach(r1),u1&&detach(o1),u1&&detach(i1),u1&&detach(a1)}}}function create_fragment$7C(n1){let e1,t1,r1;return t1=new Layout$n({props:{noPadding:!0,gap:"S",$$slots:{default:[create_default_slot$4$]},$$scope:{ctx:n1}}}),{c(){e1=element("div"),create_component(t1.$$.fragment),attr(e1,"class","testimonial svelte-1rdu21t")},m(o1,i1){insert$1(o1,e1,i1),mount_component(t1,e1,null),r1=!0},p(o1,[i1]){const a1={};i1&4&&(a1.$$scope={dirty:i1,ctx:o1}),t1.$set(a1)},i(o1){r1||(transition_in(t1.$$.fragment,o1),r1=!0)},o(o1){transition_out(t1.$$.fragment,o1),r1=!1},d(o1){o1&&detach(e1),destroy_component(t1)}}}function instance$7M(n1){return[[{text:"Budibase was the only solution that checked all the boxes for Covanta. Covanta expects to realize $3.2MM in savings due to the elimination of redundant data entry.",name:"Charles Link",role:"Senior Director, Data and Analytics",image:Covanta,imageSize:105},{text:"Budibase was mission-critical for us and went a long way in preventing what could have become a humanitarian crisis here in Bulgaria.",name:"Bozhidar Bozhanov",role:"Government of Bulgaria",image:Bulgaria,imageSize:49},{text:"Centralization of authentication, quick turnaround time for requests, integration with different database systems has given it the edge and it\u2019s now used daily for internal development for those apps that you know you need but don\u2019t feel value in losing days of development to reinvent the wheel.",name:"Davide Lenzarini",role:"IT manager",image:Schnellecke,imageSize:141}][Math.floor(Math.random()*3)]]}class Testimonial extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7M,create_fragment$7C,safe_not_equal,{})}}const TestimonialPage_svelte_svelte_type_style_lang="";function create_default_slot$4_(n1){let e1;const t1=n1[1].default,r1=create_slot(t1,n1,n1[2],null);return{c(){r1&&r1.c()},m(o1,i1){r1&&r1.m(o1,i1),e1=!0},p(o1,i1){r1&&r1.p&&(!e1||i1&4)&&update_slot_base(r1,t1,o1,o1[2],e1?get_slot_changes(t1,o1[2],i1,null):get_all_dirty_from_scope(o1[2]),null)},i(o1){e1||(transition_in(r1,o1),e1=!0)},o(o1){transition_out(r1,o1),e1=!1},d(o1){r1&&r1.d(o1)}}}function create_if_block$3p(n1){let e1,t1;return e1=new Testimonial({}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_right_slot$2(n1){let e1,t1,r1=n1[0]&&create_if_block$3p();return{c(){e1=element("div"),r1&&r1.c(),attr(e1,"slot","right"),attr(e1,"class","svelte-1ow1lgm"),toggle_class(e1,"wrapper",n1[0])},m(o1,i1){insert$1(o1,e1,i1),r1&&r1.m(e1,null),t1=!0},p(o1,i1){o1[0]?r1?i1&1&&transition_in(r1,1):(r1=create_if_block$3p(),r1.c(),transition_in(r1,1),r1.m(e1,null)):r1&&(group_outros(),transition_out(r1,1,1,()=>{r1=null}),check_outros()),(!t1||i1&1)&&toggle_class(e1,"wrapper",o1[0])},i(o1){t1||(transition_in(r1),t1=!0)},o(o1){transition_out(r1),t1=!1},d(o1){o1&&detach(e1),r1&&r1.d()}}}function create_fragment$7B(n1){let e1,t1;return e1=new SplitPage({props:{$$slots:{right:[create_right_slot$2],default:[create_default_slot$4_]},$$scope:{ctx:n1}}}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},p(r1,[o1]){const i1={};o1&5&&(i1.$$scope={dirty:o1,ctx:r1}),e1.$set(i1)},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function instance$7L(n1,e1,t1){let{$$slots:r1={},$$scope:o1}=e1,{enabled:i1=!0}=e1;return n1.$$set=a1=>{"enabled"in a1&&t1(0,i1=a1.enabled),"$$scope"in a1&&t1(2,o1=a1.$$scope)},[i1,r1,o1]}class TestimonialPage extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7L,create_fragment$7B,safe_not_equal,{enabled:0})}}const UserAvatar_svelte_svelte_type_style_lang="";function create_if_block$3o(n1){let e1,t1,r1,o1;t1=new Avatar({props:{size:n1[1],initials:getUserInitials(n1[0]),color:getUserColor(n1[0])}});let i1=n1[3]&&create_if_block_1$1Y(n1);return{c(){e1=element("div"),create_component(t1.$$.fragment),r1=space$1(),i1&&i1.c(),attr(e1,"class","user-avatar svelte-10v3vdh")},m(a1,s1){insert$1(a1,e1,s1),mount_component(t1,e1,null),append$1(e1,r1),i1&&i1.m(e1,null),o1=!0},p(a1,s1){const l1={};s1&2&&(l1.size=a1[1]),s1&1&&(l1.initials=getUserInitials(a1[0])),s1&1&&(l1.color=getUserColor(a1[0])),t1.$set(l1),a1[3]?i1?(i1.p(a1,s1),s1&8&&transition_in(i1,1)):(i1=create_if_block_1$1Y(a1),i1.c(),transition_in(i1,1),i1.m(e1,null)):i1&&(group_outros(),transition_out(i1,1,1,()=>{i1=null}),check_outros())},i(a1){o1||(transition_in(t1.$$.fragment,a1),transition_in(i1),o1=!0)},o(a1){transition_out(t1.$$.fragment,a1),transition_out(i1),o1=!1},d(a1){a1&&detach(e1),destroy_component(t1),i1&&i1.d()}}}function create_if_block_1$1Y(n1){let e1,t1,r1;return t1=new Tooltip$1({props:{direction:n1[2],textWrapping:!0,text:n1[0].email,size:"S"}}),{c(){e1=element("div"),create_component(t1.$$.fragment),attr(e1,"class","tooltip svelte-10v3vdh"),attr(e1,"style",n1[4])},m(o1,i1){insert$1(o1,e1,i1),mount_component(t1,e1,null),r1=!0},p(o1,i1){const a1={};i1&4&&(a1.direction=o1[2]),i1&1&&(a1.text=o1[0].email),t1.$set(a1),(!r1||i1&16)&&attr(e1,"style",o1[4])},i(o1){r1||(transition_in(t1.$$.fragment,o1),r1=!0)},o(o1){transition_out(t1.$$.fragment,o1),r1=!1},d(o1){o1&&detach(e1),destroy_component(t1)}}}function create_fragment$7A(n1){let e1,t1,r1=n1[0]&&create_if_block$3o(n1);return{c(){r1&&r1.c(),e1=empty$1()},m(o1,i1){r1&&r1.m(o1,i1),insert$1(o1,e1,i1),t1=!0},p(o1,[i1]){o1[0]?r1?(r1.p(o1,i1),i1&1&&transition_in(r1,1)):(r1=create_if_block$3o(o1),r1.c(),transition_in(r1,1),r1.m(e1.parentNode,e1)):r1&&(group_outros(),transition_out(r1,1,1,()=>{r1=null}),check_outros())},i(o1){t1||(transition_in(r1),t1=!0)},o(o1){transition_out(r1),t1=!1},d(o1){r1&&r1.d(o1),o1&&detach(e1)}}}function instance$7K(n1,e1,t1){let r1,{user:o1}=e1,{size:i1}=e1,{tooltipDirection:a1="top"}=e1,{showTooltip:s1=!0}=e1;const l1=c1=>{if(!c1)return"";if(c1==="top")return"transform: translateX(-50%) translateY(-100%);";if(c1==="bottom")return"transform: translateX(-50%) translateY(100%);"};return n1.$$set=c1=>{"user"in c1&&t1(0,o1=c1.user),"size"in c1&&t1(1,i1=c1.size),"tooltipDirection"in c1&&t1(2,a1=c1.tooltipDirection),"showTooltip"in c1&&t1(3,s1=c1.showTooltip)},n1.$$.update=()=>{n1.$$.dirty&4&&t1(4,r1=l1(a1))},[o1,i1,a1,s1,r1]}class UserAvatar extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7K,create_fragment$7A,safe_not_equal,{user:0,size:1,tooltipDirection:2,showTooltip:3})}}const createEventManagers=()=>{const n1=createEventDispatcher();let e1={};return{dispatch:(o1,i1)=>{n1(o1,i1);const a1=e1[o1]||[];for(let s1=0;s1<a1.length;s1++)a1[s1](i1)},subscribe:(o1,i1)=>{const a1=e1[o1]||[];return e1[o1]=[...a1,i1],()=>{e1[o1]=e1[o1].filter(s1=>s1!==i1)}}}},createStores$e=()=>{const n1=writable({left:0,top:0,width:0,height:0}),e1=derived(n1,r1=>r1.width,0),t1=derived(n1,r1=>r1.height,0);return{bounds:n1,height:t1,width:e1}},Bounds=Object.freeze(Object.defineProperty({__proto__:null,createStores:createStores$e},Symbol.toStringTag,{value:"Module"})),Padding=246,MaxCellRenderHeight=222,ScrollBarSize=8,GutterWidth=72,DefaultColumnWidth=200,MinColumnWidth=80,SmallRowHeight=36,MediumRowHeight=64,LargeRowHeight=92,DefaultRowHeight=SmallRowHeight,NewRowID="new",BlankRowID="blank",RowPageSize=100,FocusedCellMinOffset=48,MaxCellRenderWidthOverflow=Padding-3*ScrollBarSize,createStores$d=()=>{const n1=writable([]),e1=writable(null),t1=derived(n1,i1=>{let a1=0;return i1.map(s1=>{const l1={...s1,left:a1};return s1.visible&&(a1+=s1.width),l1})},[]),r1=derived(t1,i1=>i1.filter(a1=>a1.visible),[]),o1=i1=>{const a1=get_store_value(n1),s1=get_store_value(e1);return a1.some(l1=>l1.name===i1)||(s1==null?void 0:s1.name)===i1};return{columns:{...n1,subscribe:t1.subscribe,actions:{hasColumn:o1}},stickyColumn:e1,visibleColumns:r1}},deriveStores$9=n1=>{const{table:e1,columns:t1,stickyColumn:r1,API:o1,dispatch:i1,config:a1}=n1,s1=async f1=>await u1({...get_store_value(e1),primaryDisplay:f1}),l1=async f1=>{t1.update(p1=>p1.map(d1=>({...d1,width:f1}))),get_store_value(r1)&&r1.update(p1=>({...p1,width:f1})),await c1()},c1=async()=>{const f1=get_store_value(t1),p1=get_store_value(e1),d1=get_store_value(r1),m1=fp.cloneDeep(p1.schema);Object.keys(m1).forEach(_1=>{var b1,$1,y1;const h1=f1.findIndex(k1=>k1.name===_1);h1!==-1?m1[_1].order=h1:delete m1[_1].order,_1===(d1==null?void 0:d1.name)?(m1[_1].visible=!0,m1[_1].width=d1.width||DefaultColumnWidth):(m1[_1].visible=($1=(b1=f1[h1])==null?void 0:b1.visible)!=null?$1:!0,m1[_1].width=((y1=f1[h1])==null?void 0:y1.width)||DefaultColumnWidth)}),await u1({...p1,schema:m1})},u1=async f1=>{e1.set(f1),get_store_value(a1).allowSchemaChanges&&await o1.saveTable(f1),i1("updatetable",f1)};return{columns:{...t1,actions:{...t1.actions,saveChanges:c1,saveTable:u1,changePrimaryDisplay:s1,changeAllColumnWidths:l1}}}},initialise$6=n1=>{const{table:e1,columns:t1,stickyColumn:r1,schemaOverrides:o1,columnWhitelist:i1}=n1;derived([e1,o1,i1],([s1,l1,c1])=>{if(!(s1!=null&&s1.schema))return null;let u1={...s1==null?void 0:s1.schema};return Object.keys(u1).forEach(f1=>{u1[f1]={...u1[f1],disabled:!1}}),Object.keys(l1||{}).forEach(f1=>{u1[f1]&&(u1[f1]={...u1[f1],...l1[f1]})}),c1!=null&&c1.length&&Object.keys(u1).forEach(f1=>{c1.includes(f1)||delete u1[f1]}),u1}).subscribe(s1=>{if(!s1){t1.set([]),r1.set(null);return}const l1=get_store_value(e1);let c1;l1.primaryDisplay&&s1[l1.primaryDisplay]&&(c1=l1.primaryDisplay);let u1=[];if(Object.keys(s1).forEach(f1=>{f1!==c1&&u1.push(f1)}),t1.set(u1.map(f1=>{var p1;return{name:f1,label:s1[f1].displayName||f1,schema:s1[f1],width:s1[f1].width||DefaultColumnWidth,visible:(p1=s1[f1].visible)!=null?p1:!0,order:s1[f1].order}}).sort((f1,p1)=>{var b1,$1;const d1=f1.order,m1=p1.order;if(d1!=null&&m1!=null)return d1<m1?-1:1;if(d1!=null)return-1;if(m1!=null)return 1;const _1=(b1=f1.schema)==null?void 0:b1.autocolumn,h1=($1=p1.schema)==null?void 0:$1.autocolumn;return _1===h1?0:_1?1:-1})),!c1){r1.set(null);return}r1.set({name:c1,label:s1[c1].displayName||c1,schema:s1[c1],width:s1[c1].width||DefaultColumnWidth,visible:!0,order:0,left:GutterWidth})})},Columns=Object.freeze(Object.defineProperty({__proto__:null,createStores:createStores$d,deriveStores:deriveStores$9,initialise:initialise$6},Symbol.toStringTag,{value:"Module"})),createStores$c=()=>({menu:writable({x:0,y:0,visible:!1,selectedRow:null})}),deriveStores$8=n1=>{const{menu:e1,focusedCellId:t1,rand:r1}=n1;return{menu:{...e1,actions:{open:(a1,s1)=>{var p1;s1.preventDefault();const l1=document.getElementById(`grid-${r1}`),c1=(p1=l1==null?void 0:l1.getElementsByClassName("grid-data-outer"))==null?void 0:p1[0];if(!c1)return;const u1=s1.target.getBoundingClientRect(),f1=c1.getBoundingClientRect();t1.set(a1),e1.set({left:u1.left-f1.left+s1.offsetX,top:u1.top-f1.top+s1.offsetY,visible:!0})},close:()=>{e1.update(a1=>({...a1,visible:!1}))}}}}},Menu=Object.freeze(Object.defineProperty({__proto__:null,createStores:createStores$c,deriveStores:deriveStores$8},Symbol.toStringTag,{value:"Module"})),initialise$5=n1=>{const{scrolledRowCount:e1,rows:t1,visualRowCapacity:r1}=n1,o1=derived(t1,a1=>a1.length,0);derived([e1,o1,r1],([a1,s1,l1])=>Math.max(0,s1-a1-l1),100).subscribe(a1=>{a1<25&&t1.actions.loadNextPage()})},Pagination=Object.freeze(Object.defineProperty({__proto__:null,initialise:initialise$5},Symbol.toStringTag,{value:"Module"})),reorderInitialState={sourceColumn:null,targetColumn:null,breakpoints:[],gridLeft:0,width:0,latestX:0,increment:0},createStores$b=()=>{const n1=writable(reorderInitialState),e1=derived(n1,t1=>!!t1.sourceColumn,!1);return{reorder:n1,isReordering:e1}},deriveStores$7=n1=>{const{reorder:e1,columns:t1,visibleColumns:r1,scroll:o1,bounds:i1,stickyColumn:a1,ui:s1,maxScrollLeft:l1}=n1;let c1,u1;const f1=(k1,S1)=>{const A1=get_store_value(r1),C1=get_store_value(i1),E1=get_store_value(a1);s1.actions.blur();let T1=A1.map(I1=>({x:I1.left+I1.width,column:I1.name}));E1&&T1.unshift({x:0,column:E1.name}),e1.set({sourceColumn:k1,targetColumn:null,breakpoints:T1,gridLeft:C1.left,width:C1.width}),document.addEventListener("mousemove",p1),document.addEventListener("mouseup",h1),p1(S1)},p1=k1=>{const S1=k1.clientX;e1.update(N1=>({...N1,latestX:S1})),d1();const A1=get_store_value(e1),C1=140,E1=8,T1=Math.max(0,A1.gridLeft+A1.width-S1),I1=Math.max(0,S1-A1.gridLeft);if(T1<C1){const j1=(C1-T1)/C1*E1;e1.update(V1=>({...V1,increment:j1})),m1()}else if(I1<C1){const j1=-1*(C1-I1)/C1*E1;e1.update(V1=>({...V1,increment:j1})),m1()}else _1()},d1=()=>{const k1=get_store_value(e1),S1=get_store_value(o1);let A1,C1=Number.MAX_SAFE_INTEGER;const E1=k1.latestX-k1.gridLeft+S1.left;k1.breakpoints.forEach(T1=>{const I1=Math.abs(T1.x-E1);I1<C1&&(C1=I1,A1=T1.column)}),A1!==k1.targetColumn&&e1.update(T1=>({...T1,targetColumn:A1}))},m1=()=>{u1||(u1=!0,c1=setInterval(()=>{const k1=get_store_value(l1),{increment:S1}=get_store_value(e1);o1.update(A1=>({...A1,left:Math.max(0,Math.min(k1,A1.left+S1))})),d1()},10))},_1=()=>{u1=!1,clearInterval(c1)},h1=async()=>{_1();let{sourceColumn:k1,targetColumn:S1}=get_store_value(e1);b1(k1,S1),e1.set(reorderInitialState),document.removeEventListener("mousemove",p1),document.removeEventListener("mouseup",h1),await t1.actions.saveChanges()},b1=(k1,S1)=>{let A1=get_store_value(t1),C1=A1.findIndex(T1=>T1.name===k1),E1=A1.findIndex(T1=>T1.name===S1);E1++,t1.update(T1=>{const I1=T1.splice(C1,1);return--E1<C1&&E1++,T1.splice(E1,0,I1[0]),T1.slice()})};return{reorder:{...e1,actions:{startReordering:f1,stopReordering:h1,moveColumnLeft:async k1=>{var C1;const S1=get_store_value(r1),A1=S1.findIndex(E1=>E1.name===k1);b1(k1,(C1=S1[A1-2])==null?void 0:C1.name),await t1.actions.saveChanges()},moveColumnRight:async k1=>{var C1;const S1=get_store_value(r1),A1=S1.findIndex(E1=>E1.name===k1);A1!==S1.length-1&&(b1(k1,(C1=S1[A1+1])==null?void 0:C1.name),await t1.actions.saveChanges())}}}}},Reorder=Object.freeze(Object.defineProperty({__proto__:null,createStores:createStores$b,deriveStores:deriveStores$7},Symbol.toStringTag,{value:"Module"})),initialState$2={initialMouseX:null,initialWidth:null,column:null,columnIdx:null,width:0,left:0},createStores$a=()=>{const n1=writable(initialState$2),e1=derived(n1,t1=>t1.column!=null,!1);return{resize:n1,isResizing:e1}},deriveStores$6=n1=>{const{resize:e1,columns:t1,stickyColumn:r1,ui:o1}=n1,i1=(c1,u1)=>{u1.stopPropagation(),o1.actions.blur();let f1=get_store_value(t1).findIndex(p1=>p1.name===c1.name);f1===-1&&(f1="sticky"),e1.set({width:c1.width,left:c1.left,initialWidth:c1.width,initialMouseX:u1.clientX,column:c1.name,columnIdx:f1}),document.addEventListener("mousemove",a1),document.addEventListener("mouseup",s1)},a1=c1=>{const{initialMouseX:u1,initialWidth:f1,width:p1,columnIdx:d1}=get_store_value(e1),m1=c1.clientX-u1,_1=Math.round(Math.max(MinColumnWidth,f1+m1));Math.abs(p1-_1)<5||(d1==="sticky"?r1.update(h1=>({...h1,width:_1})):t1.update(h1=>(h1[d1].width=_1,[...h1])),e1.update(h1=>({...h1,width:_1})))},s1=async()=>{const c1=get_store_value(e1);e1.set(initialState$2),document.removeEventListener("mousemove",a1),document.removeEventListener("mouseup",s1),c1.width!==c1.initialWidth&&await t1.actions.saveChanges()};return{resize:{...e1,actions:{startResizing:i1,resetSize:async c1=>{const u1=get_store_value(r1);c1.name===(u1==null?void 0:u1.name)?r1.update(f1=>({...f1,width:DefaultColumnWidth})):t1.update(f1=>{const p1=f1.findIndex(d1=>d1.name===c1.name);return f1[p1].width=DefaultColumnWidth,[...f1]}),await t1.actions.saveChanges()}}}}},Resize=Object.freeze(Object.defineProperty({__proto__:null,createStores:createStores$a,deriveStores:deriveStores$6},Symbol.toStringTag,{value:"Module"})),SuppressErrors=!0,createStores$9=()=>{const n1=writable([]),e1=writable(null),t1=writable(!1),r1=writable(!1),o1=writable({}),i1=writable({}),a1=writable(!1),s1=writable(null),l1=derived(n1,u1=>{let f1={};for(let p1=0;p1<u1.length;p1++)f1[u1[p1]._id]=p1;return f1},{});let c1=!1;return t1.subscribe(u1=>{u1?c1=!0:c1&&r1.set(!0)}),{rows:n1,rowLookupMap:l1,table:e1,loaded:r1,loading:t1,rowChangeCache:o1,inProgressChanges:i1,hasNextPage:a1,error:s1}},deriveStores$5=n1=>{const{rows:e1,rowLookupMap:t1,table:r1,filter:o1,loading:i1,sort:a1,tableId:s1,API:l1,scroll:c1,validation:u1,focusedCellId:f1,columns:p1,rowChangeCache:d1,inProgressChanges:m1,previousFocusedRowId:_1,hasNextPage:h1,error:b1,notifications:$1}=n1,y1=writable(!1),k1=writable(null);let S1={};const A1=derived([e1,d1],([f0,n0])=>f0.map((c0,e0)=>({...c0,...n0[c0._id],__idx:e0})),[]);let C1=null,E1=null;s1.subscribe(async f0=>{C1==null||C1(),k1.set(null),y1.set(!1),i1.set(!0),await tick();const n0=get_store_value(o1),c0=get_store_value(a1),e0=fetchData({API:l1,datasource:{type:"table",tableId:f0},options:{filter:n0,sortColumn:c0.column,sortOrder:c0.order,limit:RowPageSize,paginate:!0}});C1=e0.subscribe(async $0=>{if($0.error){let E0="An unknown error occurred";$0.error.status===403?E0="You don't have access to this data":$0.error.message&&(E0=$0.error.message),b1.set(E0)}else if($0.loaded&&!$0.loading){b1.set(null),h1.set($0.hasNextPage);const E0=get_store_value(y1),r0=$0.resetKey!==E1,w0=E1;E1=$0.resetKey,!E0&&w0&&(e1.set([]),await tick()),(!E0||r0)&&(r1.set($0.definition),a1.set({column:$0.sortColumn,order:$0.sortOrder})),E0?r0&&c1.update(B0=>({...B0,top:0})):(y1.set(!0),c1.set({top:0,left:0})),q1($0.rows,r0),i1.set(!1)}}),k1.set(e0)}),o1.subscribe(f0=>{var n0;(n0=get_store_value(k1))==null||n0.update({filter:f0})}),a1.subscribe(f0=>{var n0;(n0=get_store_value(k1))==null||n0.update({sortOrder:f0.order,sortColumn:f0.column})});const T1=f0=>{const n0=get_store_value(t1)[f0];return n0>=0?get_store_value(e1)[n0]:null},I1=(f0,n0)=>{var c0;if((c0=n0==null?void 0:n0.json)!=null&&c0.validationErrors){const e0=Object.keys(n0.json.validationErrors),$0=get_store_value(p1);let E0=[],r0=[];for(let w0 of e0)p1.actions.hasColumn(w0)?E0.push(w0):r0.push(w0);for(let w0 of E0){u1.actions.setError(`${f0}-${w0}`,`${w0} ${n0.json.validationErrors[w0]}`);const B0=$0.findIndex(N0=>N0.name===w0);B0!==-1&&!$0[B0].visible&&p1.update(N0=>(N0[B0].visible=!0,N0.slice()))}for(let w0 of r0)get_store_value($1).error(`${w0} is required but is missing`);E0.length&&f1.set(`${f0}-${E0[0]}`)}else get_store_value($1).error((n0==null?void 0:n0.message)||"An unknown error occurred")},N1=async(f0,n0,c0=!1)=>{try{const e0=await l1.saveRow({...f0,tableId:get_store_value(s1)},SuppressErrors);return n0!=null?(S1[e0._id]=!0,e1.update($0=>($0.splice(n0,0,e0),$0.slice()))):q1([e0]),get_store_value($1).success("Row created successfully"),e0}catch(e0){if(c0)throw e0;I1(NewRowID,e0)}},j1=async f0=>{let n0={...f0};delete n0._id,delete n0._rev,delete n0.__idx;try{return await N1(n0,f0.__idx+1,!0)}catch(c0){I1(f0._id,c0)}},V1=async f0=>{var c0;const n0=await l1.searchTable({tableId:get_store_value(s1),limit:1,query:{equal:{_id:f0}},paginate:!1});return(c0=n0==null?void 0:n0.rows)==null?void 0:c0[0]},B1=(f0,n0)=>{const c0=get_store_value(e1),$0=get_store_value(t1)[f0];n0?$0!=null?e1.update(E0=>(E0[$0]={...n0},E0)):q1([n0]):$0!=null&&J1([c0[$0]])},D1=async f0=>{const n0=await V1(f0);B1(f0,n0)},F1=()=>{var f0;(f0=get_store_value(k1))==null||f0.getInitialData()},U1=async(f0,n0)=>{const c0=get_store_value(e1),$0=get_store_value(t1)[f0],E0=c0[$0];if($0==null||!Object.keys(n0||{}).length)return;let r0=!0;for(let w0 of Object.keys(n0))if(E0[w0]!==n0[w0]){r0=!1;break}if(!r0){d1.update(w0=>({...w0,[f0]:{...w0[f0],...n0}}));try{m1.update(B0=>({...B0,[f0]:!0}));const w0=await l1.saveRow({...E0,...get_store_value(d1)[f0]},SuppressErrors);w0!=null&&w0._id?e1.update(B0=>(B0[$0]=w0,B0.slice())):w0!=null&&w0.id&&await D1(w0.id),d1.update(B0=>(delete B0[f0],B0))}catch(w0){I1(f0,w0)}m1.update(w0=>({...w0,[f0]:!1}))}},G1=async(f0,n0,c0)=>await U1(f0,{[n0]:c0}),K1=async f0=>{!(f0!=null&&f0.length)||(f0.forEach(n0=>{delete n0.__idx}),await l1.deleteRows({tableId:get_store_value(s1),rows:f0}),J1(f0))},q1=(f0,n0)=>{n0&&(S1={});let c0=[],e0;for(let $0=0;$0<f0.length;$0++)e0=f0[$0],S1[e0._id]||(S1[e0._id]=!0,c0.push(e0));n0?e1.set(c0):c0.length&&e1.update($0=>[...$0,...c0])},J1=f0=>{const n0=f0.map(c0=>c0._id);e1.update(c0=>c0.filter(e0=>!n0.includes(e0._id)))},X1=()=>{var f0;(f0=get_store_value(k1))==null||f0.nextPage()},W1=async()=>{const f0=await l1.fetchTableDefinition(get_store_value(s1));r1.set(f0)},a0=f0=>f0===NewRowID?!0:get_store_value(t1)[f0]!=null;return _1.subscribe(f0=>{f0&&!get_store_value(m1)[f0]&&d1.update(n0=>(delete n0[f0],n0))}),{enrichedRows:A1,rows:{...e1,actions:{addRow:N1,duplicateRow:j1,getRow:T1,updateValue:G1,updateRow:U1,deleteRows:K1,hasRow:a0,loadNextPage:X1,refreshRow:D1,replaceRow:B1,refreshData:F1,refreshTableDefinition:W1}}}},Rows=Object.freeze(Object.defineProperty({__proto__:null,createStores:createStores$9,deriveStores:deriveStores$5},Symbol.toStringTag,{value:"Module"})),createStores$8=()=>{const n1=writable({left:0,top:0}),e1=derived(n1,r1=>r1.top,0),t1=derived(n1,r1=>r1.left,0);return{scroll:n1,scrollTop:e1,scrollLeft:t1}},deriveStores$4=n1=>{const{rows:e1,visibleColumns:t1,stickyColumn:r1,rowHeight:o1,width:i1,height:a1}=n1,s1=derived(r1,_1=>(_1==null?void 0:_1.width)||0,0),l1=derived([e1,o1],([_1,h1])=>(_1.length+1)*h1+Padding,0),c1=derived([a1,l1],([_1,h1])=>Math.max(h1-_1,0),0),u1=derived([t1,s1],([_1,h1])=>{let b1=GutterWidth+Padding+h1;return _1.forEach($1=>{b1+=$1.width}),b1},0),f1=derived([i1,s1],([_1,h1])=>_1+GutterWidth+h1,0),p1=derived([u1,f1],([_1,h1])=>Math.max(_1-h1,0),0),d1=derived([l1,a1],([_1,h1])=>_1>h1),m1=derived([u1,f1],([_1,h1])=>_1>h1);return{contentHeight:l1,contentWidth:u1,screenWidth:f1,maxScrollTop:c1,maxScrollLeft:p1,showHScrollbar:m1,showVScrollbar:d1}},initialise$4=n1=>{const{focusedCellId:e1,focusedRow:t1,scroll:r1,bounds:o1,rowHeight:i1,visibleColumns:a1,scrollTop:s1,maxScrollTop:l1,scrollLeft:c1,maxScrollLeft:u1}=n1,f1=derived([s1,l1],([d1,m1])=>d1>m1,!1),p1=derived([c1,u1],([d1,m1])=>d1>m1,!1);f1.subscribe(d1=>{d1&&r1.update(m1=>({...m1,top:get_store_value(l1)}))}),p1.subscribe(d1=>{d1&&r1.update(m1=>({...m1,left:get_store_value(u1)}))}),e1.subscribe(async d1=>{await tick();const m1=get_store_value(t1),_1=get_store_value(r1),h1=get_store_value(o1),b1=get_store_value(i1);if(m1){const A1=m1.__idx*b1,C1=_1.top+h1.height-b1-FocusedCellMinOffset;let E1=A1-C1;if(E1>0)r1.update(T1=>({...T1,top:T1.top+E1}));else{const T1=_1.top-A1+FocusedCellMinOffset;T1>0&&r1.update(I1=>({...I1,top:Math.max(0,I1.top-T1)}))}}const $1=get_store_value(a1),y1=d1==null?void 0:d1.split("-")[1],k1=$1.find(A1=>A1.name===y1);if(!k1)return;let S1=_1.left-k1.left+FocusedCellMinOffset;if(S1>0)r1.update(A1=>({...A1,left:Math.max(0,A1.left-S1)}));else{const A1=k1.left+k1.width,C1=h1.width+_1.left-FocusedCellMinOffset;S1=A1-C1,S1>0&&r1.update(E1=>({...E1,left:E1.left+S1}))}})},Scroll=Object.freeze(Object.defineProperty({__proto__:null,createStores:createStores$8,deriveStores:deriveStores$4,initialise:initialise$4},Symbol.toStringTag,{value:"Module"})),createStores$7=n1=>{const{props:e1}=n1,t1=writable(null),r1=writable(null),o1=writable({}),i1=writable(null),a1=writable(e1.fixedRowHeight||DefaultRowHeight),s1=writable(null),l1=writable(!1),c1=writable(!1),u1=derived(t1,p1=>p1==null?void 0:p1.split("-")[0],null);return{focusedCellId:t1,focusedCellAPI:r1,focusedRowId:u1,previousFocusedRowId:s1,hoveredRowId:i1,rowHeight:a1,gridFocused:l1,isDragging:c1,selectedRows:{...o1,actions:{toggleRow:p1=>{o1.update(d1=>{let m1={...d1,[p1]:!d1[p1]};return m1[p1]||delete m1[p1],m1})}}}}},deriveStores$3=n1=>{const{focusedCellId:e1,selectedRows:t1,hoveredRowId:r1,enrichedRows:o1,rowLookupMap:i1,rowHeight:a1,stickyColumn:s1,width:l1}=n1,c1=derived([e1,i1,o1],([d1,m1,_1])=>{const h1=d1==null?void 0:d1.split("-")[0];if(h1===NewRowID)return{_id:NewRowID};const b1=m1[h1];return _1[b1]},null),u1=()=>{e1.set(null),t1.set({}),r1.set(null)},f1=derived(a1,d1=>d1>=LargeRowHeight?3:d1>=MediumRowHeight?2:1),p1=derived([s1,l1],([d1,m1])=>((d1==null?void 0:d1.width)||0)+m1+GutterWidth<1100);return{focusedRow:c1,contentLines:f1,compact:p1,ui:{actions:{blur:u1}}}},initialise$3=n1=>{const{focusedRowId:e1,previousFocusedRowId:t1,rows:r1,focusedCellId:o1,selectedRows:i1,hoveredRowId:a1,table:s1,rowHeight:l1,fixedRowHeight:c1}=n1;r1.subscribe(async()=>{await tick();const f1=get_store_value(o1),p1=get_store_value(i1),d1=get_store_value(a1),m1=r1.actions.hasRow,_1=f1==null?void 0:f1.split("-")[0];_1&&!m1(_1)&&o1.set(null),d1&&!m1(d1)&&a1.set(null);let h1={...p1},b1=!1;const $1=Object.keys(p1);for(let y1=0;y1<$1.length;y1++)m1($1[y1])||(delete h1[$1[y1]],b1=!0);b1&&i1.set(h1)});let u1=null;e1.subscribe(f1=>{t1.set(u1),u1=f1}),o1.subscribe(f1=>{f1&&get_store_value(a1)&&a1.set(null)}),s1.subscribe(f1=>{get_store_value(c1)||l1.set((f1==null?void 0:f1.rowHeight)||DefaultRowHeight)}),c1.subscribe(f1=>{var p1;f1?l1.set(f1):l1.set(((p1=get_store_value(s1))==null?void 0:p1.rowHeight)||DefaultRowHeight)})},UI=Object.freeze(Object.defineProperty({__proto__:null,createStores:createStores$7,deriveStores:deriveStores$3,initialise:initialise$3},Symbol.toStringTag,{value:"Module"})),createStores$6=()=>{const n1=writable([]),e1=derived(n1,t1=>t1.map(r1=>({...r1,color:getUserColor(r1),label:getUserLabel(r1)})));return{users:{...n1,subscribe:e1.subscribe}}},deriveStores$2=n1=>{const{users:e1,focusedCellId:t1}=n1,r1=derived([e1,t1],([a1,s1])=>{let l1={};return a1.forEach(c1=>{c1.focusedCellId&&c1.focusedCellId!==s1&&(l1[c1.focusedCellId]=c1)}),l1});return{users:{...e1,actions:{updateUser:a1=>{const s1=get_store_value(e1);s1.some(l1=>l1.sessionId===a1.sessionId)?e1.update(l1=>{const c1=l1.findIndex(u1=>u1.sessionId===a1.sessionId);return l1[c1]=a1,l1.slice()}):e1.set([...s1,a1])},removeUser:a1=>{e1.update(s1=>s1.filter(l1=>l1.sessionId!==a1))}}},selectedCellMap:r1}},Users$2=Object.freeze(Object.defineProperty({__proto__:null,createStores:createStores$6,deriveStores:deriveStores$2},Symbol.toStringTag,{value:"Module"})),createStores$5=()=>{const n1=writable({});return{validation:{...n1,actions:{setError:(t1,r1)=>{!t1||n1.update(o1=>({...o1,[t1]:r1}))}}}}},initialise$2=n1=>{const{validation:e1,previousFocusedRowId:t1,columns:r1,stickyColumn:o1}=n1;t1.subscribe(i1=>{if(i1){const a1=get_store_value(r1),s1=get_store_value(o1);e1.update(l1=>(a1.forEach(c1=>{l1[`${i1}-${c1.name}`]=null}),s1&&(l1[`${i1}-${s1.name}`]=null),l1))}})},Validation=Object.freeze(Object.defineProperty({__proto__:null,createStores:createStores$5,initialise:initialise$2},Symbol.toStringTag,{value:"Module"})),deriveStores$1=n1=>{const{rowHeight:e1,visibleColumns:t1,enrichedRows:r1,scrollTop:o1,scrollLeft:i1,width:a1,height:s1}=n1,l1=derived([o1,e1],([h1,b1])=>Math.floor(h1/b1),0),c1=derived([s1,e1],([h1,b1])=>Math.ceil(h1/b1)+1,0),u1=derived([r1,l1,c1],([h1,b1,$1])=>h1.slice(b1,b1+$1),[]),f1=derived(i1,h1=>{const b1=MinColumnWidth;return Math.round(h1/b1)*b1}),p1=derived([t1,f1,a1],([h1,b1,$1],y1)=>{if(!h1.length){y1([]);return}let k1=0,S1=h1[0].width;for(;S1<b1&&k1<h1.length-1;)k1++,S1+=h1[k1].width;let A1=k1+1,C1=S1;for(;C1<$1+b1&&A1<h1.length;)C1+=h1[A1].width,A1++;const E1=h1.slice(Math.max(0,k1-1),A1+1),T1=get_store_value(p1);JSON.stringify(E1)!==JSON.stringify(T1)&&y1(E1)}),d1=derived([p1,t1],([h1,b1])=>{const $1=b1.findIndex(k1=>{var S1;return k1.name===((S1=h1[0])==null?void 0:S1.name)});let y1=0;if($1>0)for(let k1=0;k1<$1;k1++)y1+=b1[k1].width;return y1},0),m1=derived([s1,e1,o1],([h1,b1,$1])=>{const y1=$1%b1,k1=h1-ScrollBarSize*3-MaxCellRenderHeight+y1,S1=Math.floor(k1/b1),A1=MaxCellRenderHeight+y1,C1=Math.ceil(A1/b1);return Math.max(S1,C1)}),_1=derived([p1,i1,a1],([h1,b1,$1])=>{const y1=$1+b1-ScrollBarSize*3;let k1=h1.length;for(let S1=h1.length-1;S1>=0&&!(h1[S1].left+h1[S1].width+MaxCellRenderWidthOverflow<=y1);S1--,k1--);return k1});return{scrolledRowCount:l1,visualRowCapacity:c1,renderedRows:u1,renderedColumns:p1,hiddenColumnsWidth:d1,rowVerticalInversionIndex:m1,columnHorizontalInversionIndex:_1}},Viewport$1=Object.freeze(Object.defineProperty({__proto__:null,deriveStores:deriveStores$1},Symbol.toStringTag,{value:"Module"})),createStores$4=()=>({copiedCell:writable(null)}),deriveStores=n1=>{const{copiedCell:e1,focusedCellAPI:t1}=n1;return{clipboard:{actions:{copy:()=>{var i1;e1.set((i1=get_store_value(t1))==null?void 0:i1.getValue())},paste:()=>{const i1=get_store_value(e1),a1=get_store_value(t1);i1!=null&&a1&&a1.setValue(i1)}}}}},Clipboard=Object.freeze(Object.defineProperty({__proto__:null,createStores:createStores$4,deriveStores},Symbol.toStringTag,{value:"Module"})),createStores$3=n1=>{const e1=writable(n1.props),t1=p1=>derivedMemo(e1,d1=>d1[p1]),r1=t1("tableId"),o1=t1("initialSortColumn"),i1=t1("initialSortOrder"),a1=t1("initialFilter"),s1=t1("fixedRowHeight"),l1=t1("schemaOverrides"),c1=t1("columnWhitelist"),u1=t1("notifySuccess"),f1=t1("notifyError");return{config:e1,tableId:r1,initialSortColumn:o1,initialSortOrder:i1,initialFilter:a1,fixedRowHeight:s1,schemaOverrides:l1,columnWhitelist:c1,notifySuccess:u1,notifyError:f1}},Config=Object.freeze(Object.defineProperty({__proto__:null,createStores:createStores$3},Symbol.toStringTag,{value:"Module"})),createStores$2=n1=>{const{props:e1}=n1;return{sort:writable({column:e1.initialSortColumn,order:e1.initialSortOrder||"ascending"})}},initialise$1=n1=>{const{sort:e1,initialSortColumn:t1,initialSortOrder:r1}=n1;t1.subscribe(o1=>{e1.update(i1=>({...i1,column:o1}))}),r1.subscribe(o1=>{e1.update(i1=>({...i1,order:o1}))})},Sort=Object.freeze(Object.defineProperty({__proto__:null,createStores:createStores$2,initialise:initialise$1},Symbol.toStringTag,{value:"Module"})),createStores$1=n1=>{const{props:e1}=n1;return{filter:writable(e1.initialFilter)}},initialise=n1=>{const{filter:e1,initialFilter:t1}=n1;t1.subscribe(e1.set)},Filter=Object.freeze(Object.defineProperty({__proto__:null,createStores:createStores$1,initialise},Symbol.toStringTag,{value:"Module"})),createStores=n1=>{const{notifySuccess:e1,notifyError:t1}=n1;return{notifications:derived([e1,t1],([o1,i1])=>({success:o1||notifications.success,error:i1||notifications.error}))}},Notifications=Object.freeze(Object.defineProperty({__proto__:null,createStores},Symbol.toStringTag,{value:"Module"})),DependencyOrderedStores=[Config,Notifications,Sort,Filter,Bounds,Scroll,Rows,Columns,UI,Validation,Resize,Viewport$1,Reorder,Users$2,Menu,Pagination,Clipboard],attachStores=n1=>{var e1,t1,r1;for(let o1 of DependencyOrderedStores)n1={...n1,...(e1=o1.createStores)==null?void 0:e1.call(o1,n1)};for(let o1 of DependencyOrderedStores)n1={...n1,...(t1=o1.deriveStores)==null?void 0:t1.call(o1,n1)};for(let o1 of DependencyOrderedStores)(r1=o1.initialise)==null||r1.call(o1,n1);return n1};function create_default_slot_1$3D(n1){let e1,t1,r1,o1=n1[1]===1?"":"s",i1,a1;return{c(){e1=text("Are you sure you want to delete "),t1=text(n1[1]),r1=text(`
|
|
372
372
|
row`),i1=text(o1),a1=text("?")},m(s1,l1){insert$1(s1,e1,l1),insert$1(s1,t1,l1),insert$1(s1,r1,l1),insert$1(s1,i1,l1),insert$1(s1,a1,l1)},p(s1,l1){l1&2&&set_data(t1,s1[1]),l1&2&&o1!==(o1=s1[1]===1?"":"s")&&set_data(i1,o1)},d(s1){s1&&detach(e1),s1&&detach(t1),s1&&detach(r1),s1&&detach(i1),s1&&detach(a1)}}}function create_default_slot$4Z(n1){let e1,t1;return e1=new ModalContent({props:{title:"Delete rows",confirmText:"Continue",cancelText:"Cancel",onConfirm:n1[5],size:"M",$$slots:{default:[create_default_slot_1$3D]},$$scope:{ctx:n1}}}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},p(r1,o1){const i1={};o1&4098&&(i1.$$scope={dirty:o1,ctx:r1}),e1.$set(i1)},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_fragment$7z(n1){let e1,t1,r1={$$slots:{default:[create_default_slot$4Z]},$$scope:{ctx:n1}};return e1=new Modal({props:r1}),n1[8](e1),{c(){create_component(e1.$$.fragment)},m(o1,i1){mount_component(e1,o1,i1),t1=!0},p(o1,[i1]){const a1={};i1&4098&&(a1.$$scope={dirty:i1,ctx:o1}),e1.$set(a1)},i(o1){t1||(transition_in(e1.$$.fragment,o1),t1=!0)},o(o1){transition_out(e1.$$.fragment,o1),t1=!1},d(o1){n1[8](null),destroy_component(e1,o1)}}}function instance$7J(n1,e1,t1){let r1,o1,i1,a1,s1;const{selectedRows:l1,rows:c1,subscribe:u1,notifications:f1}=getContext("grid");component_subscribe(n1,l1,_1=>t1(7,s1=_1)),component_subscribe(n1,c1,_1=>t1(6,a1=_1)),component_subscribe(n1,f1,_1=>t1(10,i1=_1));let p1;const d1=async()=>{const _1=o1.length;await c1.actions.deleteRows(o1),i1.success(`Deleted ${_1} row${_1===1?"":"s"}`)};onMount(()=>u1("request-bulk-delete",()=>p1==null?void 0:p1.show()));function m1(_1){binding_callbacks[_1?"unshift":"push"](()=>{p1=_1,t1(0,p1)})}return n1.$$.update=()=>{n1.$$.dirty&128&&t1(1,r1=Object.values(s1).length),n1.$$.dirty&192&&(o1=Object.entries(s1).map(_1=>a1.find(h1=>h1._id===_1[0])).filter(_1=>_1!=null))},[p1,r1,l1,c1,f1,d1,a1,s1,m1]}class BulkDeleteHandler extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7J,create_fragment$7z,safe_not_equal,{})}}const GridScrollWrapper_svelte_svelte_type_style_lang="";function create_fragment$7y(n1){let e1,t1,r1,o1,i1;const a1=n1[19].default,s1=create_slot(a1,n1,n1[18],null);return{c(){e1=element("div"),t1=element("div"),s1&&s1.c(),attr(t1,"style",n1[1]),attr(t1,"class","inner svelte-i68dpr"),attr(e1,"class","outer svelte-i68dpr")},m(l1,c1){insert$1(l1,e1,c1),append$1(e1,t1),s1&&s1.m(t1,null),r1=!0,o1||(i1=[listen(e1,"wheel",function(){is_function(n1[0]?n1[12]:null)&&(n1[0]?n1[12]:null).apply(this,arguments)}),listen(e1,"click",self$1(n1[20]))],o1=!0)},p(l1,[c1]){n1=l1,s1&&s1.p&&(!r1||c1&262144)&&update_slot_base(s1,a1,n1,n1[18],r1?get_slot_changes(a1,n1[18],c1,null):get_all_dirty_from_scope(n1[18]),null),(!r1||c1&2)&&attr(t1,"style",n1[1])},i(l1){r1||(transition_in(s1,l1),r1=!0)},o(l1){transition_out(s1,l1),r1=!1},d(l1){l1&&detach(e1),s1&&s1.d(l1),o1=!1,run_all(i1)}}}function instance$7I(n1,e1,t1){let r1,o1,i1,a1,s1,l1,c1,u1,f1,p1,{$$slots:d1={},$$scope:m1}=e1;const{rowHeight:_1,scroll:h1,focusedCellId:b1,renderedRows:$1,maxScrollTop:y1,maxScrollLeft:k1,bounds:S1,hoveredRowId:A1,hiddenColumnsWidth:C1,menu:E1}=getContext("grid");component_subscribe(n1,_1,F1=>t1(15,o1=F1)),component_subscribe(n1,h1,F1=>t1(16,c1=F1)),component_subscribe(n1,b1,F1=>t1(2,p1=F1)),component_subscribe(n1,$1,F1=>t1(21,i1=F1)),component_subscribe(n1,y1,F1=>t1(24,l1=F1)),component_subscribe(n1,k1,F1=>t1(23,s1=F1)),component_subscribe(n1,S1,F1=>t1(22,a1=F1)),component_subscribe(n1,C1,F1=>t1(17,f1=F1)),component_subscribe(n1,E1,F1=>t1(25,u1=F1));let{scrollVertically:T1=!1}=e1,{scrollHorizontally:I1=!1}=e1,{wheelInteractive:N1=!1}=e1;const j1=(F1,U1,G1)=>{const K1=I1?-1*F1.left+G1:0,q1=T1?-1*(F1.top%U1):0;return`transform: translate3d(${K1}px, ${q1}px, 0);`},V1=F1=>{F1.preventDefault(),B1(F1.deltaX,F1.deltaY,F1.clientY),u1.visible&&E1.actions.close()},B1=domDebounce((F1,U1,G1)=>{const{top:K1,left:q1}=c1;let J1=K1+U1;J1=Math.max(0,Math.min(J1,l1));let X1=q1+F1;X1=Math.max(0,Math.min(X1,s1)),h1.set({left:I1?X1:q1,top:T1?J1:K1});const W1=G1-a1.top+J1%o1,a0=i1[Math.floor(W1/o1)];A1.set(a0==null?void 0:a0._id)}),D1=()=>set_store_value(b1,p1=null,p1);return n1.$$set=F1=>{"scrollVertically"in F1&&t1(13,T1=F1.scrollVertically),"scrollHorizontally"in F1&&t1(14,I1=F1.scrollHorizontally),"wheelInteractive"in F1&&t1(0,N1=F1.wheelInteractive),"$$scope"in F1&&t1(18,m1=F1.$$scope)},n1.$$.update=()=>{n1.$$.dirty&229376&&t1(1,r1=j1(c1,o1,f1))},[N1,r1,p1,_1,h1,b1,$1,y1,k1,S1,C1,E1,V1,T1,I1,o1,c1,f1,m1,d1,D1]}class GridScrollWrapper extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7I,create_fragment$7y,safe_not_equal,{scrollVertically:13,scrollHorizontally:14,wheelInteractive:0})}}const GridCell_svelte_svelte_type_style_lang="";function create_if_block_1$1X(n1){let e1,t1;return{c(){e1=element("div"),t1=text(n1[4]),attr(e1,"class","label svelte-1ms5xpq")},m(r1,o1){insert$1(r1,e1,o1),append$1(e1,t1)},p(r1,o1){o1&16&&set_data(t1,r1[4])},d(r1){r1&&detach(e1)}}}function create_if_block$3n(n1){let e1,t1=n1[3].label+"",r1;return{c(){e1=element("div"),r1=text(t1),attr(e1,"class","label svelte-1ms5xpq")},m(o1,i1){insert$1(o1,e1,i1),append$1(e1,r1)},p(o1,i1){i1&8&&t1!==(t1=o1[3].label+"")&&set_data(r1,t1)},d(o1){o1&&detach(e1)}}}function create_fragment$7x(n1){let e1,t1,r1,o1,i1,a1,s1=n1[4]&&create_if_block_1$1X(n1);const l1=n1[13].default,c1=create_slot(l1,n1,n1[12],null);let u1=n1[3]&&!n1[0]&&create_if_block$3n(n1);return{c(){e1=element("div"),s1&&s1.c(),t1=space$1(),c1&&c1.c(),r1=space$1(),u1&&u1.c(),attr(e1,"class","cell svelte-1ms5xpq"),attr(e1,"style",n1[10]),toggle_class(e1,"selected",n1[1]),toggle_class(e1,"highlighted",n1[2]),toggle_class(e1,"focused",n1[0]),toggle_class(e1,"error",n1[4]),toggle_class(e1,"center",n1[8]),toggle_class(e1,"readonly",n1[9]),toggle_class(e1,"default-height",n1[7]),toggle_class(e1,"selected-other",n1[3]!=null),toggle_class(e1,"alt",n1[5]%2===1),toggle_class(e1,"top",n1[6])},m(f1,p1){insert$1(f1,e1,p1),s1&&s1.m(e1,null),append$1(e1,t1),c1&&c1.m(e1,null),append$1(e1,r1),u1&&u1.m(e1,null),o1=!0,i1||(a1=[listen(e1,"focus",n1[14]),listen(e1,"mousedown",n1[15]),listen(e1,"mouseup",n1[16]),listen(e1,"click",n1[17]),listen(e1,"contextmenu",n1[18])],i1=!0)},p(f1,[p1]){f1[4]?s1?s1.p(f1,p1):(s1=create_if_block_1$1X(f1),s1.c(),s1.m(e1,t1)):s1&&(s1.d(1),s1=null),c1&&c1.p&&(!o1||p1&4096)&&update_slot_base(c1,l1,f1,f1[12],o1?get_slot_changes(l1,f1[12],p1,null):get_all_dirty_from_scope(f1[12]),null),f1[3]&&!f1[0]?u1?u1.p(f1,p1):(u1=create_if_block$3n(f1),u1.c(),u1.m(e1,null)):u1&&(u1.d(1),u1=null),(!o1||p1&1024)&&attr(e1,"style",f1[10]),(!o1||p1&2)&&toggle_class(e1,"selected",f1[1]),(!o1||p1&4)&&toggle_class(e1,"highlighted",f1[2]),(!o1||p1&1)&&toggle_class(e1,"focused",f1[0]),(!o1||p1&16)&&toggle_class(e1,"error",f1[4]),(!o1||p1&256)&&toggle_class(e1,"center",f1[8]),(!o1||p1&512)&&toggle_class(e1,"readonly",f1[9]),(!o1||p1&128)&&toggle_class(e1,"default-height",f1[7]),(!o1||p1&8)&&toggle_class(e1,"selected-other",f1[3]!=null),(!o1||p1&32)&&toggle_class(e1,"alt",f1[5]%2===1),(!o1||p1&64)&&toggle_class(e1,"top",f1[6])},i(f1){o1||(transition_in(c1,f1),o1=!0)},o(f1){transition_out(c1,f1),o1=!1},d(f1){f1&&detach(e1),s1&&s1.d(),c1&&c1.d(f1),u1&&u1.d(),i1=!1,run_all(a1)}}}function instance$7H(n1,e1,t1){let r1,{$$slots:o1={},$$scope:i1}=e1,{focused:a1=!1}=e1,{selected:s1=!1}=e1,{highlighted:l1=!1}=e1,{width:c1=""}=e1,{selectedUser:u1=null}=e1,{error:f1=null}=e1,{rowIdx:p1}=e1,{topRow:d1=!1}=e1,{defaultHeight:m1=!1}=e1,{center:_1=!1}=e1,{readonly:h1=!1}=e1;const b1=(C1,E1)=>{let T1=`flex: 0 0 ${C1}px;`;return E1&&(T1+=`--user-color:${E1.color};`),T1};function $1(C1){bubble.call(this,n1,C1)}function y1(C1){bubble.call(this,n1,C1)}function k1(C1){bubble.call(this,n1,C1)}function S1(C1){bubble.call(this,n1,C1)}function A1(C1){bubble.call(this,n1,C1)}return n1.$$set=C1=>{"focused"in C1&&t1(0,a1=C1.focused),"selected"in C1&&t1(1,s1=C1.selected),"highlighted"in C1&&t1(2,l1=C1.highlighted),"width"in C1&&t1(11,c1=C1.width),"selectedUser"in C1&&t1(3,u1=C1.selectedUser),"error"in C1&&t1(4,f1=C1.error),"rowIdx"in C1&&t1(5,p1=C1.rowIdx),"topRow"in C1&&t1(6,d1=C1.topRow),"defaultHeight"in C1&&t1(7,m1=C1.defaultHeight),"center"in C1&&t1(8,_1=C1.center),"readonly"in C1&&t1(9,h1=C1.readonly),"$$scope"in C1&&t1(12,i1=C1.$$scope)},n1.$$.update=()=>{n1.$$.dirty&2056&&t1(10,r1=b1(c1,u1))},[a1,s1,l1,u1,f1,p1,d1,m1,_1,h1,r1,c1,i1,o1,$1,y1,k1,S1,A1]}class GridCell extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7H,create_fragment$7x,safe_not_equal,{focused:0,selected:1,highlighted:2,width:11,selectedUser:3,error:4,rowIdx:5,topRow:6,defaultHeight:7,center:8,readonly:9})}}const getColor=(n1,e1=.3)=>n1==null||n1===-1?null:`hsla(${(n1+1)*222%360}, 90%, 75%, ${e1})`,TypeIconMap={text:"Text",options:"Dropdown",datetime:"Date",barcodeqr:"Camera",longform:"TextAlignLeft",array:"Dropdown",number:"123",boolean:"Boolean",attachment:"AppleFiles",link:"DataCorrelated",formula:"Calculator",json:"Brackets"},getColumnIcon=n1=>{if(n1.schema.autocolumn)return"MagicWand";const e1=n1.schema.type;return TypeIconMap[e1]||"Text"},OptionsCell_svelte_svelte_type_style_lang="";function get_each_context$1u(n1,e1,t1){const r1=n1.slice();r1[22]=e1[t1],r1[25]=t1;const o1=r1[11](r1[22]);return r1[23]=o1,r1}function get_each_context_1$n(n1,e1,t1){const r1=n1.slice();r1[26]=e1[t1];const o1=r1[11](r1[26]);return r1[23]=o1,r1}function create_else_block$1a(n1){let e1,t1=(n1[26]||"")+"",r1,o1;return{c(){e1=element("div"),r1=text(t1),o1=space$1(),attr(e1,"class","text svelte-11w9cfl")},m(i1,a1){insert$1(i1,e1,a1),append$1(e1,r1),append$1(e1,o1)},p(i1,a1){a1&128&&t1!==(t1=(i1[26]||"")+"")&&set_data(r1,t1)},d(i1){i1&&detach(e1)}}}function create_if_block_3$P(n1){let e1,t1,r1=n1[26]+"",o1,i1;return{c(){e1=element("div"),t1=element("span"),o1=text(r1),i1=space$1(),attr(t1,"class","svelte-11w9cfl"),attr(e1,"class","badge text svelte-11w9cfl"),set_style(e1,"--color",n1[23])},m(a1,s1){insert$1(a1,e1,s1),append$1(e1,t1),append$1(t1,o1),append$1(e1,i1)},p(a1,s1){s1&128&&r1!==(r1=a1[26]+"")&&set_data(o1,r1),s1&128&&set_style(e1,"--color",a1[23])},d(a1){a1&&detach(e1)}}}function create_each_block_1$n(n1){let e1;function t1(i1,a1){return i1[23]?create_if_block_3$P:create_else_block$1a}let r1=t1(n1),o1=r1(n1);return{c(){o1.c(),e1=empty$1()},m(i1,a1){o1.m(i1,a1),insert$1(i1,e1,a1)},p(i1,a1){r1===(r1=t1(i1))&&o1?o1.p(i1,a1):(o1.d(1),o1=r1(i1),o1&&(o1.c(),o1.m(e1.parentNode,e1)))},d(i1){o1.d(i1),i1&&detach(e1)}}}function create_if_block_2$1b(n1){let e1,t1,r1,o1,i1;return t1=new Icon({props:{name:"ChevronDown"}}),{c(){e1=element("div"),create_component(t1.$$.fragment),attr(e1,"class","arrow svelte-11w9cfl")},m(a1,s1){insert$1(a1,e1,s1),mount_component(t1,e1,null),r1=!0,o1||(i1=listen(e1,"click",n1[9]),o1=!0)},p:noop$5,i(a1){r1||(transition_in(t1.$$.fragment,a1),r1=!0)},o(a1){transition_out(t1.$$.fragment,a1),r1=!1},d(a1){a1&&detach(e1),destroy_component(t1),o1=!1,i1()}}}function create_if_block$3m(n1){let e1,t1,r1,o1,i1=n1[6],a1=[];for(let l1=0;l1<i1.length;l1+=1)a1[l1]=create_each_block$1u(get_each_context$1u(n1,i1,l1));const s1=l1=>transition_out(a1[l1],1,1,()=>{a1[l1]=null});return{c(){e1=element("div");for(let l1=0;l1<a1.length;l1+=1)a1[l1].c();attr(e1,"class","options svelte-11w9cfl"),toggle_class(e1,"invertX",n1[1]),toggle_class(e1,"invertY",n1[2])},m(l1,c1){insert$1(l1,e1,c1);for(let u1=0;u1<a1.length;u1+=1)a1[u1].m(e1,null);t1=!0,r1||(o1=[listen(e1,"wheel",wheel_handler),action_destroyer(clickOutside.call(null,e1,n1[10]))],r1=!0)},p(l1,c1){if(c1&6368){i1=l1[6];let u1;for(u1=0;u1<i1.length;u1+=1){const f1=get_each_context$1u(l1,i1,u1);a1[u1]?(a1[u1].p(f1,c1),transition_in(a1[u1],1)):(a1[u1]=create_each_block$1u(f1),a1[u1].c(),transition_in(a1[u1],1),a1[u1].m(e1,null))}for(group_outros(),u1=i1.length;u1<a1.length;u1+=1)s1(u1);check_outros()}(!t1||c1&2)&&toggle_class(e1,"invertX",l1[1]),(!t1||c1&4)&&toggle_class(e1,"invertY",l1[2])},i(l1){if(!t1){for(let c1=0;c1<i1.length;c1+=1)transition_in(a1[c1]);t1=!0}},o(l1){a1=a1.filter(Boolean);for(let c1=0;c1<a1.length;c1+=1)transition_out(a1[c1]);t1=!1},d(l1){l1&&detach(e1),destroy_each(a1,l1),r1=!1,run_all(o1)}}}function create_if_block_1$1W(n1){let e1,t1;return e1=new Icon({props:{name:"Checkmark",color:"var(--accent-color)"}}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_each_block$1u(n1){let e1,t1,r1=n1[22]+"",o1,i1,a1=n1[7].includes(n1[22]),s1,l1,c1,u1,f1=a1&&create_if_block_1$1W();function p1(){return n1[19](n1[22])}function d1(){return n1[20](n1[25])}return{c(){e1=element("div"),t1=element("div"),o1=text(r1),i1=space$1(),f1&&f1.c(),s1=space$1(),attr(t1,"class","badge text svelte-11w9cfl"),set_style(t1,"--color",n1[23]),attr(e1,"class","option svelte-11w9cfl"),toggle_class(e1,"focused",n1[5]===n1[25])},m(m1,_1){insert$1(m1,e1,_1),append$1(e1,t1),append$1(t1,o1),append$1(e1,i1),f1&&f1.m(e1,null),append$1(e1,s1),l1=!0,c1||(u1=[listen(e1,"click",p1),listen(e1,"mouseenter",d1)],c1=!0)},p(m1,_1){n1=m1,(!l1||_1&64)&&r1!==(r1=n1[22]+"")&&set_data(o1,r1),(!l1||_1&64)&&set_style(t1,"--color",n1[23]),_1&192&&(a1=n1[7].includes(n1[22])),a1?f1?_1&192&&transition_in(f1,1):(f1=create_if_block_1$1W(),f1.c(),transition_in(f1,1),f1.m(e1,s1)):f1&&(group_outros(),transition_out(f1,1,1,()=>{f1=null}),check_outros()),(!l1||_1&32)&&toggle_class(e1,"focused",n1[5]===n1[25])},i(m1){l1||(transition_in(f1),l1=!0)},o(m1){transition_out(f1),l1=!1},d(m1){m1&&detach(e1),f1&&f1.d(),c1=!1,run_all(u1)}}}function create_fragment$7w(n1){let e1,t1,r1,o1,i1,a1,s1,l1=n1[7],c1=[];for(let p1=0;p1<l1.length;p1+=1)c1[p1]=create_each_block_1$n(get_each_context_1$n(n1,l1,p1));let u1=n1[8]&&create_if_block_2$1b(n1),f1=n1[4]&&create_if_block$3m(n1);return{c(){e1=element("div"),t1=element("div");for(let p1=0;p1<c1.length;p1+=1)c1[p1].c();r1=space$1(),u1&&u1.c(),o1=space$1(),f1&&f1.c(),attr(t1,"class","values svelte-11w9cfl"),toggle_class(t1,"wrap",n1[3]>1),attr(e1,"class","container svelte-11w9cfl"),toggle_class(e1,"multi",n1[0]),toggle_class(e1,"editable",n1[8]),toggle_class(e1,"open",n1[9])},m(p1,d1){insert$1(p1,e1,d1),append$1(e1,t1);for(let m1=0;m1<c1.length;m1+=1)c1[m1].m(t1,null);append$1(e1,r1),u1&&u1.m(e1,null),append$1(e1,o1),f1&&f1.m(e1,null),i1=!0,a1||(s1=[listen(t1,"click",function(){is_function(n1[8]?n1[9]:null)&&(n1[8]?n1[9]:null).apply(this,arguments)}),listen(e1,"click",self$1(function(){is_function(n1[8]?n1[9]:null)&&(n1[8]?n1[9]:null).apply(this,arguments)}))],a1=!0)},p(p1,[d1]){if(n1=p1,d1&2176){l1=n1[7];let m1;for(m1=0;m1<l1.length;m1+=1){const _1=get_each_context_1$n(n1,l1,m1);c1[m1]?c1[m1].p(_1,d1):(c1[m1]=create_each_block_1$n(_1),c1[m1].c(),c1[m1].m(t1,null))}for(;m1<c1.length;m1+=1)c1[m1].d(1);c1.length=l1.length}(!i1||d1&8)&&toggle_class(t1,"wrap",n1[3]>1),n1[8]?u1?(u1.p(n1,d1),d1&256&&transition_in(u1,1)):(u1=create_if_block_2$1b(n1),u1.c(),transition_in(u1,1),u1.m(e1,o1)):u1&&(group_outros(),transition_out(u1,1,1,()=>{u1=null}),check_outros()),n1[4]?f1?(f1.p(n1,d1),d1&16&&transition_in(f1,1)):(f1=create_if_block$3m(n1),f1.c(),transition_in(f1,1),f1.m(e1,null)):f1&&(group_outros(),transition_out(f1,1,1,()=>{f1=null}),check_outros()),(!i1||d1&1)&&toggle_class(e1,"multi",n1[0]),(!i1||d1&256)&&toggle_class(e1,"editable",n1[8])},i(p1){i1||(transition_in(u1),transition_in(f1),i1=!0)},o(p1){transition_out(u1),transition_out(f1),i1=!1},d(p1){p1&&detach(e1),destroy_each(c1,p1),u1&&u1.d(),f1&&f1.d(),a1=!1,run_all(s1)}}}const wheel_handler=n1=>n1.stopPropagation();function instance$7G(n1,e1,t1){let r1,o1,i1,{value:a1}=e1,{schema:s1}=e1,{onChange:l1}=e1,{focused:c1=!1}=e1,{multi:u1=!1}=e1,{readonly:f1=!1}=e1,{api:p1}=e1,{invertX:d1=!1}=e1,{invertY:m1=!1}=e1,{contentLines:_1=1}=e1,h1=!1,b1=null;const $1=()=>{t1(4,h1=!0),t1(5,b1=0)},y1=()=>{t1(4,h1=!1)},k1=T1=>{const I1=T1?r1.indexOf(T1):null;return getColor(I1)},S1=T1=>{if(!u1)l1(T1===a1?null:T1),y1();else{const I1=i1.filter(N1=>r1.includes(N1));I1.includes(T1)?l1(I1.filter(N1=>N1!==T1)):l1([...I1,T1])}},A1=T1=>h1?(T1.preventDefault(),T1.key==="ArrowDown"?t1(5,b1=Math.min(b1+1,r1.length-1)):T1.key==="ArrowUp"?t1(5,b1=Math.max(b1-1,0)):T1.key==="Enter"&&S1(r1[b1]),!0):!1;onMount(()=>{t1(13,p1={focus:$1,blur:y1,isActive:()=>h1,onKeyDown:A1})});const C1=T1=>S1(T1),E1=T1=>t1(5,b1=T1);return n1.$$set=T1=>{"value"in T1&&t1(14,a1=T1.value),"schema"in T1&&t1(15,s1=T1.schema),"onChange"in T1&&t1(16,l1=T1.onChange),"focused"in T1&&t1(17,c1=T1.focused),"multi"in T1&&t1(0,u1=T1.multi),"readonly"in T1&&t1(18,f1=T1.readonly),"api"in T1&&t1(13,p1=T1.api),"invertX"in T1&&t1(1,d1=T1.invertX),"invertY"in T1&&t1(2,m1=T1.invertY),"contentLines"in T1&&t1(3,_1=T1.contentLines)},n1.$$.update=()=>{var T1;n1.$$.dirty&32768&&t1(6,r1=((T1=s1==null?void 0:s1.constraints)==null?void 0:T1.inclusion)||[]),n1.$$.dirty&393216&&t1(8,o1=c1&&!f1),n1.$$.dirty&16384&&t1(7,i1=Array.isArray(a1)?a1:[a1].filter(I1=>I1!=null)),n1.$$.dirty&131072&&(c1||y1())},[u1,d1,m1,_1,h1,b1,r1,i1,o1,$1,y1,k1,S1,p1,a1,s1,l1,c1,f1,C1,E1]}class OptionsCell extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7G,create_fragment$7w,safe_not_equal,{value:14,schema:15,onChange:16,focused:17,multi:0,readonly:18,api:13,invertX:1,invertY:2,contentLines:3})}}const DateCell_svelte_svelte_type_style_lang="";function create_if_block_2$1a(n1){let e1;return{c(){e1=text(n1[7])},m(t1,r1){insert$1(t1,e1,r1)},p(t1,r1){r1&128&&set_data(e1,t1[7])},d(t1){t1&&detach(e1)}}}function create_if_block_1$1V(n1){let e1,t1;return e1=new Icon({props:{name:"Calendar"}}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_if_block$3l(n1){let e1,t1,r1,o1;function i1(s1){n1[14](s1)}let a1={value:n1[0],appendTo:document.documentElement,enableTime:!n1[5],timeOnly:n1[4],time24hr:!0,ignoreTimezones:n1[1].ignoreTimezones,useKeyboardShortcuts:!1};return n1[3]!==void 0&&(a1.flatpickr=n1[3]),t1=new DatePicker({props:a1}),binding_callbacks.push(()=>bind$3(t1,"flatpickr",i1)),t1.$on("change",n1[15]),t1.$on("open",n1[16]),t1.$on("close",n1[17]),{c(){e1=element("div"),create_component(t1.$$.fragment),attr(e1,"class","picker svelte-pa6vhv")},m(s1,l1){insert$1(s1,e1,l1),mount_component(t1,e1,null),o1=!0},p(s1,l1){const c1={};l1&1&&(c1.value=s1[0]),l1&32&&(c1.enableTime=!s1[5]),l1&16&&(c1.timeOnly=s1[4]),l1&2&&(c1.ignoreTimezones=s1[1].ignoreTimezones),!r1&&l1&8&&(r1=!0,c1.flatpickr=s1[3],add_flush_callback(()=>r1=!1)),t1.$set(c1)},i(s1){o1||(transition_in(t1.$$.fragment,s1),o1=!0)},o(s1){transition_out(t1.$$.fragment,s1),o1=!1},d(s1){s1&&detach(e1),destroy_component(t1)}}}function create_fragment$7v(n1){let e1,t1,r1,o1,i1,a1,s1=n1[0]&&create_if_block_2$1a(n1),l1=n1[8]&&create_if_block_1$1V(),c1=n1[8]&&create_if_block$3l(n1);return{c(){e1=element("div"),t1=element("div"),s1&&s1.c(),r1=space$1(),l1&&l1.c(),o1=space$1(),c1&&c1.c(),i1=empty$1(),attr(t1,"class","value svelte-pa6vhv"),attr(e1,"class","container svelte-pa6vhv")},m(u1,f1){insert$1(u1,e1,f1),append$1(e1,t1),s1&&s1.m(t1,null),append$1(e1,r1),l1&&l1.m(e1,null),insert$1(u1,o1,f1),c1&&c1.m(u1,f1),insert$1(u1,i1,f1),a1=!0},p(u1,[f1]){u1[0]?s1?s1.p(u1,f1):(s1=create_if_block_2$1a(u1),s1.c(),s1.m(t1,null)):s1&&(s1.d(1),s1=null),u1[8]?l1?f1&256&&transition_in(l1,1):(l1=create_if_block_1$1V(),l1.c(),transition_in(l1,1),l1.m(e1,null)):l1&&(group_outros(),transition_out(l1,1,1,()=>{l1=null}),check_outros()),u1[8]?c1?(c1.p(u1,f1),f1&256&&transition_in(c1,1)):(c1=create_if_block$3l(u1),c1.c(),transition_in(c1,1),c1.m(i1.parentNode,i1)):c1&&(group_outros(),transition_out(c1,1,1,()=>{c1=null}),check_outros())},i(u1){a1||(transition_in(l1),transition_in(c1),a1=!0)},o(u1){transition_out(l1),transition_out(c1),a1=!1},d(u1){u1&&detach(e1),s1&&s1.d(),l1&&l1.d(),u1&&detach(o1),c1&&c1.d(u1),u1&&detach(i1)}}}function instance$7F(n1,e1,t1){let r1,o1,i1,a1,s1,l1,{value:c1}=e1,{schema:u1}=e1,{onChange:f1}=e1,{focused:p1=!1}=e1,{readonly:d1=!1}=e1,{api:m1}=e1,_1,h1;const b1=(C1,E1,T1,I1)=>C1?!T1||!I1?dayjs(C1).format(E1):dayjs(`0-${C1}`).format(E1):"",$1=()=>h1;onMount(()=>{t1(9,m1={onKeyDown:$1,focus:()=>_1==null?void 0:_1.open(),blur:()=>_1==null?void 0:_1.close(),isActive:()=>h1})});function y1(C1){_1=C1,t1(3,_1)}const k1=C1=>f1(C1.detail),S1=()=>t1(6,h1=!0),A1=()=>t1(6,h1=!1);return n1.$$set=C1=>{"value"in C1&&t1(0,c1=C1.value),"schema"in C1&&t1(1,u1=C1.schema),"onChange"in C1&&t1(2,f1=C1.onChange),"focused"in C1&&t1(10,p1=C1.focused),"readonly"in C1&&t1(11,d1=C1.readonly),"api"in C1&&t1(9,m1=C1.api)},n1.$$.update=()=>{n1.$$.dirty&1&&t1(12,r1=!isNaN(new Date(`0-${c1}`))),n1.$$.dirty&4098&&t1(4,o1=r1||(u1==null?void 0:u1.timeOnly)),n1.$$.dirty&2&&t1(5,i1=u1==null?void 0:u1.dateOnly),n1.$$.dirty&48&&t1(13,a1=o1?"HH:mm:ss":i1?"MMM D YYYY":"MMM D YYYY, HH:mm"),n1.$$.dirty&3072&&t1(8,s1=p1&&!d1),n1.$$.dirty&12305&&t1(7,l1=b1(c1,a1,o1,r1)),n1.$$.dirty&1032&&(p1||_1==null||_1.close())},[c1,u1,f1,_1,o1,i1,h1,l1,s1,m1,p1,d1,r1,a1,y1,k1,S1,A1]}class DateCell extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7F,create_fragment$7v,safe_not_equal,{value:0,schema:1,onChange:2,focused:10,readonly:11,api:9})}}function create_fragment$7u(n1){let e1,t1,r1;const o1=[n1[1],{multi:!0}];function i1(s1){n1[2](s1)}let a1={};for(let s1=0;s1<o1.length;s1+=1)a1=assign$1(a1,o1[s1]);return n1[0]!==void 0&&(a1.api=n1[0]),e1=new OptionsCell({props:a1}),binding_callbacks.push(()=>bind$3(e1,"api",i1)),{c(){create_component(e1.$$.fragment)},m(s1,l1){mount_component(e1,s1,l1),r1=!0},p(s1,[l1]){const c1=l1&2?get_spread_update(o1,[get_spread_object(s1[1]),o1[1]]):{};!t1&&l1&1&&(t1=!0,c1.api=s1[0],add_flush_callback(()=>t1=!1)),e1.$set(c1)},i(s1){r1||(transition_in(e1.$$.fragment,s1),r1=!0)},o(s1){transition_out(e1.$$.fragment,s1),r1=!1},d(s1){destroy_component(e1,s1)}}}function instance$7E(n1,e1,t1){let{api:r1}=e1;function o1(i1){r1=i1,t1(0,r1)}return n1.$$set=i1=>{t1(1,e1=assign$1(assign$1({},e1),exclude_internal_props(i1))),"api"in i1&&t1(0,r1=i1.api)},e1=exclude_internal_props(e1),[r1,e1,o1]}class MultiSelectCell extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7E,create_fragment$7u,safe_not_equal,{api:0})}}const TextCell_svelte_svelte_type_style_lang="";function create_else_block$19(n1){var i1;let e1,t1,r1=((i1=n1[0])!=null?i1:"")+"",o1;return{c(){e1=element("div"),t1=element("div"),o1=text(r1),attr(t1,"class","value svelte-69b1qv"),attr(e1,"class","text-cell svelte-69b1qv"),toggle_class(e1,"number",n1[1]==="number")},m(a1,s1){insert$1(a1,e1,s1),append$1(e1,t1),append$1(t1,o1)},p(a1,s1){var l1;s1&1&&r1!==(r1=((l1=a1[0])!=null?l1:"")+"")&&set_data(o1,r1),s1&2&&toggle_class(e1,"number",a1[1]==="number")},d(a1){a1&&detach(e1)}}}function create_if_block$3k(n1){let e1,t1,r1,o1;return{c(){e1=element("input"),attr(e1,"type",n1[1]),e1.value=t1=n1[0]||"",attr(e1,"spellcheck","false"),attr(e1,"class","svelte-69b1qv")},m(i1,a1){insert$1(i1,e1,a1),n1[10](e1),r1||(o1=[listen(e1,"focus",n1[11]),listen(e1,"blur",n1[12]),listen(e1,"change",n1[5])],r1=!0)},p(i1,a1){a1&2&&attr(e1,"type",i1[1]),a1&1&&t1!==(t1=i1[0]||"")&&e1.value!==t1&&(e1.value=t1)},d(i1){i1&&detach(e1),n1[10](null),r1=!1,run_all(o1)}}}function create_fragment$7t(n1){let e1;function t1(i1,a1){return i1[4]?create_if_block$3k:create_else_block$19}let r1=t1(n1),o1=r1(n1);return{c(){o1.c(),e1=empty$1()},m(i1,a1){o1.m(i1,a1),insert$1(i1,e1,a1)},p(i1,[a1]){r1===(r1=t1(i1))&&o1?o1.p(i1,a1):(o1.d(1),o1=r1(i1),o1&&(o1.c(),o1.m(e1.parentNode,e1)))},i:noop$5,o:noop$5,d(i1){o1.d(i1),i1&&detach(e1)}}}function instance$7D(n1,e1,t1){let r1,{value:o1}=e1,{focused:i1=!1}=e1,{onChange:a1}=e1,{type:s1="text"}=e1,{readonly:l1=!1}=e1,{api:c1}=e1,u1,f1=!1;const p1=b1=>{a1(b1.target.value)},d1=b1=>{if(!f1)return!1;if(b1.key==="Enter"){u1==null||u1.blur();const $1=new KeyboardEvent("keydown",{key:"ArrowDown"});document.dispatchEvent($1)}return!0};onMount(()=>{t1(6,c1={focus:()=>u1==null?void 0:u1.focus(),blur:()=>u1==null?void 0:u1.blur(),isActive:()=>f1,onKeyDown:d1})});function m1(b1){binding_callbacks[b1?"unshift":"push"](()=>{u1=b1,t1(2,u1)})}const _1=()=>t1(3,f1=!0),h1=()=>t1(3,f1=!1);return n1.$$set=b1=>{"value"in b1&&t1(0,o1=b1.value),"focused"in b1&&t1(7,i1=b1.focused),"onChange"in b1&&t1(8,a1=b1.onChange),"type"in b1&&t1(1,s1=b1.type),"readonly"in b1&&t1(9,l1=b1.readonly),"api"in b1&&t1(6,c1=b1.api)},n1.$$.update=()=>{n1.$$.dirty&640&&t1(4,r1=i1&&!l1)},[o1,s1,u1,f1,r1,p1,c1,i1,a1,l1,m1,_1,h1]}class TextCell extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7D,create_fragment$7t,safe_not_equal,{value:0,focused:7,onChange:8,type:1,readonly:9,api:6})}}function create_fragment$7s(n1){let e1,t1,r1;const o1=[n1[2],{onChange:n1[1]},{type:"number"}];function i1(s1){n1[4](s1)}let a1={};for(let s1=0;s1<o1.length;s1+=1)a1=assign$1(a1,o1[s1]);return n1[0]!==void 0&&(a1.api=n1[0]),e1=new TextCell({props:a1}),binding_callbacks.push(()=>bind$3(e1,"api",i1)),{c(){create_component(e1.$$.fragment)},m(s1,l1){mount_component(e1,s1,l1),r1=!0},p(s1,[l1]){const c1=l1&6?get_spread_update(o1,[l1&4&&get_spread_object(s1[2]),l1&2&&{onChange:s1[1]},o1[2]]):{};!t1&&l1&1&&(t1=!0,c1.api=s1[0],add_flush_callback(()=>t1=!1)),e1.$set(c1)},i(s1){r1||(transition_in(e1.$$.fragment,s1),r1=!0)},o(s1){transition_out(e1.$$.fragment,s1),r1=!1},d(s1){destroy_component(e1,s1)}}}function instance$7C(n1,e1,t1){let{api:r1}=e1,{onChange:o1}=e1;const i1=s1=>{const l1=parseFloat(s1),c1=isNaN(l1)?null:l1;o1(c1)};function a1(s1){r1=s1,t1(0,r1)}return n1.$$set=s1=>{t1(2,e1=assign$1(assign$1({},e1),exclude_internal_props(s1))),"api"in s1&&t1(0,r1=s1.api),"onChange"in s1&&t1(3,o1=s1.onChange)},e1=exclude_internal_props(e1),[r1,i1,e1,o1,a1]}class NumberCell extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7C,create_fragment$7s,safe_not_equal,{api:0,onChange:3})}}const RelationshipCell_svelte_svelte_type_style_lang="";function get_each_context$1t(n1,e1,t1){const r1=n1.slice();return r1[44]=e1[t1],r1[46]=t1,r1}function get_each_context_1$m(n1,e1,t1){const r1=n1.slice();return r1[47]=e1[t1],r1[46]=t1,r1}function create_if_block_6$i(n1){let e1,t1,r1=n1[20](n1[47].primaryDisplay)+"",o1,i1,a1,s1,l1;function c1(){return n1[26](n1[47])}let u1=n1[13]&&create_if_block_7$g(n1);return{c(){e1=element("div"),t1=element("span"),o1=text(r1),i1=space$1(),u1&&u1.c(),attr(t1,"class","svelte-sn0two"),attr(e1,"class","badge svelte-sn0two")},m(f1,p1){insert$1(f1,e1,p1),append$1(e1,t1),append$1(t1,o1),append$1(e1,i1),u1&&u1.m(e1,null),a1=!0,s1||(l1=listen(t1,"click",function(){is_function(n1[13]?c1:null)&&(n1[13]?c1:null).apply(this,arguments)}),s1=!0)},p(f1,p1){n1=f1,(!a1||p1[0]&1)&&r1!==(r1=n1[20](n1[47].primaryDisplay)+"")&&set_data(o1,r1),n1[13]?u1?(u1.p(n1,p1),p1[0]&8192&&transition_in(u1,1)):(u1=create_if_block_7$g(n1),u1.c(),transition_in(u1,1),u1.m(e1,null)):u1&&(group_outros(),transition_out(u1,1,1,()=>{u1=null}),check_outros())},i(f1){a1||(transition_in(u1),a1=!0)},o(f1){transition_out(u1),a1=!1},d(f1){f1&&detach(e1),u1&&u1.d(),s1=!1,l1()}}}function create_if_block_7$g(n1){let e1,t1;function r1(){return n1[27](n1[47])}return e1=new Icon({props:{name:"Close",size:"XS",hoverable:!0}}),e1.$on("click",r1),{c(){create_component(e1.$$.fragment)},m(o1,i1){mount_component(e1,o1,i1),t1=!0},p(o1,i1){n1=o1},i(o1){t1||(transition_in(e1.$$.fragment,o1),t1=!0)},o(o1){transition_out(e1.$$.fragment,o1),t1=!1},d(o1){destroy_component(e1,o1)}}}function create_each_block_1$m(n1){let e1,t1,r1=n1[47].primaryDisplay&&create_if_block_6$i(n1);return{c(){r1&&r1.c(),e1=empty$1()},m(o1,i1){r1&&r1.m(o1,i1),insert$1(o1,e1,i1),t1=!0},p(o1,i1){o1[47].primaryDisplay?r1?(r1.p(o1,i1),i1[0]&1&&transition_in(r1,1)):(r1=create_if_block_6$i(o1),r1.c(),transition_in(r1,1),r1.m(e1.parentNode,e1)):r1&&(group_outros(),transition_out(r1,1,1,()=>{r1=null}),check_outros())},i(o1){t1||(transition_in(r1),t1=!0)},o(o1){transition_out(r1),t1=!1},d(o1){r1&&r1.d(o1),o1&&detach(e1)}}}function create_if_block_5$q(n1){let e1,t1,r1,o1,i1;return t1=new Icon({props:{name:"Add",size:"S"}}),{c(){e1=element("div"),create_component(t1.$$.fragment),attr(e1,"class","add svelte-sn0two")},m(a1,s1){insert$1(a1,e1,s1),mount_component(t1,e1,null),r1=!0,o1||(i1=listen(e1,"click",n1[16]),o1=!0)},p:noop$5,i(a1){r1||(transition_in(t1.$$.fragment,a1),r1=!0)},o(a1){transition_out(t1.$$.fragment,a1),r1=!1},d(a1){a1&&detach(e1),destroy_component(t1),o1=!1,i1()}}}function create_if_block_4$B(n1){var o1;let e1,t1=(((o1=n1[0])==null?void 0:o1.length)||0)+"",r1;return{c(){e1=element("div"),r1=text(t1),attr(e1,"class","count svelte-sn0two")},m(i1,a1){insert$1(i1,e1,a1),append$1(e1,r1)},p(i1,a1){var s1;a1[0]&1&&t1!==(t1=(((s1=i1[0])==null?void 0:s1.length)||0)+"")&&set_data(r1,t1)},d(i1){i1&&detach(e1)}}}function create_if_block$3j(n1){let e1,t1,r1,o1,i1,a1,s1,l1,c1,u1;function f1(h1){n1[30](h1)}let p1={autofocus:!0,quiet:!0,type:"text",placeholder:n1[8]?`Search by ${n1[8]}`:null};n1[6]!==void 0&&(p1.value=n1[6]),r1=new Input$5({props:p1}),binding_callbacks.push(()=>bind$3(r1,"value",f1));const d1=[create_if_block_1$1U,create_if_block_2$19],m1=[];function _1(h1,b1){var $1;return h1[10]?0:($1=h1[7])!=null&&$1.length?1:-1}return~(a1=_1(n1))&&(s1=m1[a1]=d1[a1](n1)),{c(){e1=element("div"),t1=element("div"),create_component(r1.$$.fragment),i1=space$1(),s1&&s1.c(),attr(t1,"class","search svelte-sn0two"),attr(e1,"class","dropdown svelte-sn0two"),set_style(e1,"--values-height",n1[11]+"px"),toggle_class(e1,"invertX",n1[2]),toggle_class(e1,"invertY",n1[3])},m(h1,b1){insert$1(h1,e1,b1),append$1(e1,t1),mount_component(r1,t1,null),append$1(e1,i1),~a1&&m1[a1].m(e1,null),l1=!0,c1||(u1=[listen(e1,"wheel",stop_propagation(n1[25])),action_destroyer(clickOutside.call(null,e1,n1[17]))],c1=!0)},p(h1,b1){const $1={};b1[0]&256&&($1.placeholder=h1[8]?`Search by ${h1[8]}`:null),!o1&&b1[0]&64&&(o1=!0,$1.value=h1[6],add_flush_callback(()=>o1=!1)),r1.$set($1);let y1=a1;a1=_1(h1),a1===y1?~a1&&m1[a1].p(h1,b1):(s1&&(group_outros(),transition_out(m1[y1],1,1,()=>{m1[y1]=null}),check_outros()),~a1?(s1=m1[a1],s1?s1.p(h1,b1):(s1=m1[a1]=d1[a1](h1),s1.c()),transition_in(s1,1),s1.m(e1,null)):s1=null),(!l1||b1[0]&2048)&&set_style(e1,"--values-height",h1[11]+"px"),(!l1||b1[0]&4)&&toggle_class(e1,"invertX",h1[2]),(!l1||b1[0]&8)&&toggle_class(e1,"invertY",h1[3])},i(h1){l1||(transition_in(r1.$$.fragment,h1),transition_in(s1),l1=!0)},o(h1){transition_out(r1.$$.fragment,h1),transition_out(s1),l1=!1},d(h1){h1&&detach(e1),destroy_component(r1),~a1&&m1[a1].d(),c1=!1,run_all(u1)}}}function create_if_block_2$19(n1){let e1,t1,r1=n1[7],o1=[];for(let a1=0;a1<r1.length;a1+=1)o1[a1]=create_each_block$1t(get_each_context$1t(n1,r1,a1));const i1=a1=>transition_out(o1[a1],1,1,()=>{o1[a1]=null});return{c(){e1=element("div");for(let a1=0;a1<o1.length;a1+=1)o1[a1].c();attr(e1,"class","results svelte-sn0two")},m(a1,s1){insert$1(a1,e1,s1);for(let l1=0;l1<o1.length;l1+=1)o1[l1].m(e1,null);t1=!0},p(a1,s1){if(s1[0]&1344128){r1=a1[7];let l1;for(l1=0;l1<r1.length;l1+=1){const c1=get_each_context$1t(a1,r1,l1);o1[l1]?(o1[l1].p(c1,s1),transition_in(o1[l1],1)):(o1[l1]=create_each_block$1t(c1),o1[l1].c(),transition_in(o1[l1],1),o1[l1].m(e1,null))}for(group_outros(),l1=r1.length;l1<o1.length;l1+=1)i1(l1);check_outros()}},i(a1){if(!t1){for(let s1=0;s1<r1.length;s1+=1)transition_in(o1[s1]);t1=!0}},o(a1){o1=o1.filter(Boolean);for(let s1=0;s1<o1.length;s1+=1)transition_out(o1[s1]);t1=!1},d(a1){a1&&detach(e1),destroy_each(o1,a1)}}}function create_if_block_1$1U(n1){let e1,t1,r1;return t1=new ProgressCircle({props:{size:"S"}}),{c(){e1=element("div"),create_component(t1.$$.fragment),attr(e1,"class","searching svelte-sn0two")},m(o1,i1){insert$1(o1,e1,i1),mount_component(t1,e1,null),r1=!0},p:noop$5,i(o1){r1||(transition_in(t1.$$.fragment,o1),r1=!0)},o(o1){transition_out(t1.$$.fragment,o1),r1=!1},d(o1){o1&&detach(e1),destroy_component(t1)}}}function create_if_block_3$O(n1){let e1,t1;return e1=new Icon({props:{size:"S",name:"Checkmark",color:"var(--accent-color)"}}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_each_block$1t(n1){let e1,t1,r1,o1=n1[20](n1[44].primaryDisplay)+"",i1,a1,s1=n1[15](n1[44]),l1,c1,u1,f1,p1=s1&&create_if_block_3$O();function d1(){return n1[31](n1[44])}function m1(){return n1[32](n1[46])}return{c(){e1=element("div"),t1=element("div"),r1=element("span"),i1=text(o1),a1=space$1(),p1&&p1.c(),l1=space$1(),attr(r1,"class","svelte-sn0two"),attr(t1,"class","badge svelte-sn0two"),attr(e1,"class","result svelte-sn0two"),toggle_class(e1,"candidate",n1[46]===n1[9])},m(_1,h1){insert$1(_1,e1,h1),append$1(e1,t1),append$1(t1,r1),append$1(r1,i1),append$1(e1,a1),p1&&p1.m(e1,null),append$1(e1,l1),c1=!0,u1||(f1=[listen(e1,"click",d1),listen(e1,"mouseenter",m1)],u1=!0)},p(_1,h1){n1=_1,(!c1||h1[0]&128)&&o1!==(o1=n1[20](n1[44].primaryDisplay)+"")&&set_data(i1,o1),h1[0]&128&&(s1=n1[15](n1[44])),s1?p1?h1[0]&128&&transition_in(p1,1):(p1=create_if_block_3$O(),p1.c(),transition_in(p1,1),p1.m(e1,l1)):p1&&(group_outros(),transition_out(p1,1,1,()=>{p1=null}),check_outros()),(!c1||h1[0]&512)&&toggle_class(e1,"candidate",n1[46]===n1[9])},i(_1){c1||(transition_in(p1),c1=!0)},o(_1){transition_out(p1),c1=!1},d(_1){_1&&detach(e1),p1&&p1.d(),u1=!1,run_all(f1)}}}function create_fragment$7r(n1){var h1;let e1,t1,r1,o1,i1,a1,s1,l1,c1,u1=n1[0]||[],f1=[];for(let b1=0;b1<u1.length;b1+=1)f1[b1]=create_each_block_1$m(get_each_context_1$m(n1,u1,b1));const p1=b1=>transition_out(f1[b1],1,1,()=>{f1[b1]=null});let d1=n1[13]&&create_if_block_5$q(n1),m1=((h1=n1[0])==null?void 0:h1.length)&&create_if_block_4$B(n1),_1=n1[5]&&create_if_block$3j(n1);return{c(){e1=element("div"),t1=element("div"),r1=element("div");for(let b1=0;b1<f1.length;b1+=1)f1[b1].c();o1=space$1(),d1&&d1.c(),i1=space$1(),m1&&m1.c(),a1=space$1(),_1&&_1.c(),attr(r1,"class","values svelte-sn0two"),toggle_class(r1,"wrap",n1[13]||n1[4]>1),attr(t1,"class","container svelte-sn0two"),attr(e1,"class","wrapper svelte-sn0two"),set_style(e1,"--color",n1[14]),toggle_class(e1,"editable",n1[13]),toggle_class(e1,"focused",n1[1]),toggle_class(e1,"invertY",n1[3])},m(b1,$1){insert$1(b1,e1,$1),append$1(e1,t1),append$1(t1,r1);for(let y1=0;y1<f1.length;y1+=1)f1[y1].m(r1,null);append$1(r1,o1),d1&&d1.m(r1,null),append$1(t1,i1),m1&&m1.m(t1,null),n1[29](t1),append$1(e1,a1),_1&&_1.m(e1,null),s1=!0,l1||(c1=listen(r1,"wheel",n1[28]),l1=!0)},p(b1,$1){var y1;if($1[0]&1843201){u1=b1[0]||[];let k1;for(k1=0;k1<u1.length;k1+=1){const S1=get_each_context_1$m(b1,u1,k1);f1[k1]?(f1[k1].p(S1,$1),transition_in(f1[k1],1)):(f1[k1]=create_each_block_1$m(S1),f1[k1].c(),transition_in(f1[k1],1),f1[k1].m(r1,o1))}for(group_outros(),k1=u1.length;k1<f1.length;k1+=1)p1(k1);check_outros()}b1[13]?d1?(d1.p(b1,$1),$1[0]&8192&&transition_in(d1,1)):(d1=create_if_block_5$q(b1),d1.c(),transition_in(d1,1),d1.m(r1,null)):d1&&(group_outros(),transition_out(d1,1,1,()=>{d1=null}),check_outros()),(!s1||$1[0]&8208)&&toggle_class(r1,"wrap",b1[13]||b1[4]>1),(y1=b1[0])!=null&&y1.length?m1?m1.p(b1,$1):(m1=create_if_block_4$B(b1),m1.c(),m1.m(t1,null)):m1&&(m1.d(1),m1=null),b1[5]?_1?(_1.p(b1,$1),$1[0]&32&&transition_in(_1,1)):(_1=create_if_block$3j(b1),_1.c(),transition_in(_1,1),_1.m(e1,null)):_1&&(group_outros(),transition_out(_1,1,1,()=>{_1=null}),check_outros()),(!s1||$1[0]&8192)&&toggle_class(e1,"editable",b1[13]),(!s1||$1[0]&2)&&toggle_class(e1,"focused",b1[1]),(!s1||$1[0]&8)&&toggle_class(e1,"invertY",b1[3])},i(b1){if(!s1){for(let $1=0;$1<u1.length;$1+=1)transition_in(f1[$1]);transition_in(d1),transition_in(_1),s1=!0}},o(b1){f1=f1.filter(Boolean);for(let $1=0;$1<f1.length;$1+=1)transition_out(f1[$1]);transition_out(d1),transition_out(_1),s1=!1},d(b1){b1&&detach(e1),destroy_each(f1,b1),d1&&d1.d(),m1&&m1.d(),n1[29](null),_1&&_1.d(),l1=!1,c1()}}}let primaryDisplayCache={};const getPrimaryDisplayForTableId=async(n1,e1)=>{var o1,i1;if(primaryDisplayCache[e1])return primaryDisplayCache[e1];const t1=await n1.fetchTableDefinition(e1),r1=(t1==null?void 0:t1.primaryDisplay)||((i1=(o1=t1==null?void 0:t1.schema)==null?void 0:o1[0])==null?void 0:i1.name);return primaryDisplayCache[e1]=r1,r1};function instance$7B(n1,e1,t1){let r1,o1,i1,{value:a1}=e1,{api:s1}=e1,{readonly:l1}=e1,{focused:c1}=e1,{schema:u1}=e1,{onChange:f1}=e1,{invertX:p1=!1}=e1,{invertY:d1=!1}=e1,{contentLines:m1=1}=e1;const{API:_1,dispatch:h1}=getContext("grid"),b1=getColor(0);let $1=!1,y1,k1,S1,A1,C1,E1,T1=!1,I1=0,N1;const j1=(r0,w0)=>{let B0={};if(!w0||!(r0!=null&&r0.length))return B0;for(let N0=0;N0<r0.length;N0++)B0[r0[N0]._id]=!0;return B0},V1=r0=>r0!=null&&r0._id?(i1==null?void 0:i1[r0._id])===!0:!1,B1=async(r0,w0=!1)=>{var J0;if(!w0&&!r0&&!S1)return;if(!(u1!=null&&u1.tableId)||!$1){S1=null,t1(9,C1=null),t1(7,y1=[]);return}E1=Math.random(),t1(10,T1=!0);const B0=E1,N0=await _1.searchTable({paginate:!1,tableId:u1.tableId,limit:20,query:{string:{[`1:${A1}`]:r0||""}}});t1(10,T1=!1),B0===E1&&(t1(7,y1=F1((J0=N0.rows)==null?void 0:J0.map($2=>({...$2,primaryDisplay:$2[A1]})))),t1(9,C1=y1!=null&&y1.length?0:null),S1=r0)},D1=debounce(B1,250),F1=r0=>r0!=null&&r0.length?r0.slice().sort((w0,B0)=>w0.primaryDisplay<B0.primaryDisplay?-1:1):[],U1=async()=>{t1(5,$1=!0),t1(11,I1=N1.getBoundingClientRect().height),A1||(t1(10,T1=!0),t1(8,A1=await getPrimaryDisplayForTableId(_1,u1.tableId))),await B1(null,!0)},G1=()=>{t1(5,$1=!1),t1(7,y1=[]),t1(6,k1=null),S1=null,t1(9,C1=null)},K1=r0=>$1?(r0.key==="ArrowDown"?(r0.preventDefault(),C1==null?t1(9,C1=0):t1(9,C1=Math.min(y1.length-1,C1+1))):r0.key==="ArrowUp"?(r0.preventDefault(),C1===0?t1(9,C1=null):C1!=null&&t1(9,C1=Math.max(0,C1-1))):r0.key==="Enter"&&C1!=null&&y1[C1]!=null&&q1(y1[C1]),!0):!1,q1=async r0=>{if(a1!=null&&a1.some(w0=>w0._id===r0._id))if(r1)await f1([]);else{const w0=a1.filter(B0=>B0._id!==r0._id);w0.length?t1(9,C1=Math.min(C1,w0.length-1)):t1(9,C1=null),await f1(w0)}else r1?await f1([r0]):await f1(F1([...a1||[],r0])),t1(9,C1=null);G1()},J1=async r0=>{const w0=await _1.fetchRow({tableId:u1.tableId,rowId:r0});h1("edit-row",w0)},X1=r0=>r0==null?"":r0 instanceof Object?JSON.stringify(r0):r0;onMount(()=>{t1(21,s1={focus:U1,blur:G1,isActive:()=>$1,onKeyDown:K1})});function W1(r0){bubble.call(this,n1,r0)}const a0=r0=>J1(r0._id),f0=r0=>q1(r0),n0=r0=>c1?r0.stopPropagation():null;function c0(r0){binding_callbacks[r0?"unshift":"push"](()=>{N1=r0,t1(12,N1)})}function e0(r0){k1=r0,t1(6,k1)}const $0=r0=>q1(r0),E0=r0=>t1(9,C1=r0);return n1.$$set=r0=>{"value"in r0&&t1(0,a1=r0.value),"api"in r0&&t1(21,s1=r0.api),"readonly"in r0&&t1(22,l1=r0.readonly),"focused"in r0&&t1(1,c1=r0.focused),"schema"in r0&&t1(23,u1=r0.schema),"onChange"in r0&&t1(24,f1=r0.onChange),"invertX"in r0&&t1(2,p1=r0.invertX),"invertY"in r0&&t1(3,d1=r0.invertY),"contentLines"in r0&&t1(4,m1=r0.contentLines)},n1.$$.update=()=>{n1.$$.dirty[0]&8388608&&(r1=(u1==null?void 0:u1.relationshipType)==="one-to-many"),n1.$$.dirty[0]&4194306&&t1(13,o1=c1&&!l1),n1.$$.dirty[0]&33&&(i1=j1(a1,$1)),n1.$$.dirty[0]&64&&D1(k1),n1.$$.dirty[0]&2&&(c1||G1())},[a1,c1,p1,d1,m1,$1,k1,y1,A1,C1,T1,I1,N1,o1,b1,V1,U1,G1,q1,J1,X1,s1,l1,u1,f1,W1,a0,f0,n0,c0,e0,$0,E0]}class RelationshipCell extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7B,create_fragment$7r,safe_not_equal,{value:0,api:21,readonly:22,focused:1,schema:23,onChange:24,invertX:2,invertY:3,contentLines:4},null,[-1,-1])}}const LongFormCell_svelte_svelte_type_style_lang="";function create_else_block$18(n1){let e1,t1,r1=(n1[0]||"")+"",o1,i1,a1;return{c(){e1=element("div"),t1=element("div"),o1=text(r1),attr(t1,"class","value svelte-2btbvg"),attr(e1,"class","long-form-cell svelte-2btbvg"),toggle_class(e1,"editable",n1[5])},m(s1,l1){insert$1(s1,e1,l1),append$1(e1,t1),append$1(t1,o1),i1||(a1=listen(e1,"click",function(){is_function(n1[5]?n1[7]:null)&&(n1[5]?n1[7]:null).apply(this,arguments)}),i1=!0)},p(s1,l1){n1=s1,l1&1&&r1!==(r1=(n1[0]||"")+"")&&set_data(o1,r1),l1&32&&toggle_class(e1,"editable",n1[5])},d(s1){s1&&detach(e1),i1=!1,a1()}}}function create_if_block$3i(n1){let e1,t1,r1,o1;return{c(){e1=element("textarea"),e1.value=t1=n1[0]||"",attr(e1,"spellcheck","false"),attr(e1,"class","svelte-2btbvg"),toggle_class(e1,"invertX",n1[1]),toggle_class(e1,"invertY",n1[2])},m(i1,a1){insert$1(i1,e1,a1),n1[14](e1),r1||(o1=[listen(e1,"change",n1[6]),listen(e1,"wheel",stop_propagation(n1[13])),action_destroyer(clickOutside.call(null,e1,n1[8]))],r1=!0)},p(i1,a1){a1&1&&t1!==(t1=i1[0]||"")&&(e1.value=t1),a1&2&&toggle_class(e1,"invertX",i1[1]),a1&4&&toggle_class(e1,"invertY",i1[2])},d(i1){i1&&detach(e1),n1[14](null),r1=!1,run_all(o1)}}}function create_fragment$7q(n1){let e1;function t1(i1,a1){return i1[4]?create_if_block$3i:create_else_block$18}let r1=t1(n1),o1=r1(n1);return{c(){o1.c(),e1=empty$1()},m(i1,a1){o1.m(i1,a1),insert$1(i1,e1,a1)},p(i1,[a1]){r1===(r1=t1(i1))&&o1?o1.p(i1,a1):(o1.d(1),o1=r1(i1),o1&&(o1.c(),o1.m(e1.parentNode,e1)))},i:noop$5,o:noop$5,d(i1){o1.d(i1),i1&&detach(e1)}}}function instance$7A(n1,e1,t1){let r1,{value:o1}=e1,{focused:i1=!1}=e1,{onChange:a1}=e1,{readonly:s1=!1}=e1,{api:l1}=e1,{invertX:c1=!1}=e1,{invertY:u1=!1}=e1,f1,p1=!1;const d1=y1=>{a1(y1.target.value)},m1=()=>p1,_1=async()=>{t1(4,p1=!0),await tick(),f1.focus(),(o1==null?void 0:o1.length)>100&&f1.setSelectionRange(0,0)},h1=()=>{f1==null||f1.blur(),t1(4,p1=!1)};onMount(()=>{t1(9,l1={focus:()=>_1(),blur:()=>h1(),isActive:()=>p1,onKeyDown:m1})});function b1(y1){bubble.call(this,n1,y1)}function $1(y1){binding_callbacks[y1?"unshift":"push"](()=>{f1=y1,t1(3,f1)})}return n1.$$set=y1=>{"value"in y1&&t1(0,o1=y1.value),"focused"in y1&&t1(10,i1=y1.focused),"onChange"in y1&&t1(11,a1=y1.onChange),"readonly"in y1&&t1(12,s1=y1.readonly),"api"in y1&&t1(9,l1=y1.api),"invertX"in y1&&t1(1,c1=y1.invertX),"invertY"in y1&&t1(2,u1=y1.invertY)},n1.$$.update=()=>{n1.$$.dirty&5120&&t1(5,r1=i1&&!s1),n1.$$.dirty&1024&&(i1||t1(4,p1=!1))},[o1,c1,u1,f1,p1,r1,d1,_1,h1,l1,i1,a1,s1,b1,$1]}class LongFormCell extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7A,create_fragment$7q,safe_not_equal,{value:0,focused:10,onChange:11,readonly:12,api:9,invertX:1,invertY:2})}}const BooleanCell_svelte_svelte_type_style_lang="";function create_fragment$7p(n1){let e1,t1,r1;return t1=new Checkbox_1({props:{value:n1[0]}}),t1.$on("change",n1[2]),{c(){e1=element("div"),create_component(t1.$$.fragment),attr(e1,"class","boolean-cell svelte-1l7j6r7"),toggle_class(e1,"editable",n1[1])},m(o1,i1){insert$1(o1,e1,i1),mount_component(t1,e1,null),r1=!0},p(o1,[i1]){const a1={};i1&1&&(a1.value=o1[0]),t1.$set(a1),(!r1||i1&2)&&toggle_class(e1,"editable",o1[1])},i(o1){r1||(transition_in(t1.$$.fragment,o1),r1=!0)},o(o1){transition_out(t1.$$.fragment,o1),r1=!1},d(o1){o1&&detach(e1),destroy_component(t1)}}}function instance$7z(n1,e1,t1){let r1,{value:o1}=e1,{focused:i1=!1}=e1,{onChange:a1}=e1,{readonly:s1=!1}=e1,{api:l1}=e1;const c1=f1=>{a1(f1.detail)},u1=f1=>f1.key==="Enter"?(a1(!o1),!0):!1;return onMount(()=>{t1(3,l1={onKeyDown:u1})}),n1.$$set=f1=>{"value"in f1&&t1(0,o1=f1.value),"focused"in f1&&t1(4,i1=f1.focused),"onChange"in f1&&t1(5,a1=f1.onChange),"readonly"in f1&&t1(6,s1=f1.readonly),"api"in f1&&t1(3,l1=f1.api)},n1.$$.update=()=>{n1.$$.dirty&80&&t1(1,r1=i1&&!s1)},[o1,r1,c1,l1,i1,a1,s1]}class BooleanCell extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7z,create_fragment$7p,safe_not_equal,{value:0,focused:4,onChange:5,readonly:6,api:3})}}function create_fragment$7o(n1){let e1,t1;const r1=[n1[0],{readonly:!0}];let o1={};for(let i1=0;i1<r1.length;i1+=1)o1=assign$1(o1,r1[i1]);return e1=new TextCell({props:o1}),{c(){create_component(e1.$$.fragment)},m(i1,a1){mount_component(e1,i1,a1),t1=!0},p(i1,[a1]){const s1=a1&1?get_spread_update(r1,[get_spread_object(i1[0]),r1[1]]):{};e1.$set(s1)},i(i1){t1||(transition_in(e1.$$.fragment,i1),t1=!0)},o(i1){transition_out(e1.$$.fragment,i1),t1=!1},d(i1){destroy_component(e1,i1)}}}function instance$7y(n1,e1,t1){return n1.$$set=r1=>{t1(0,e1=assign$1(assign$1({},e1),exclude_internal_props(r1)))},e1=exclude_internal_props(e1),[e1]}class FormulaCell extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7y,create_fragment$7o,safe_not_equal,{})}}function create_fragment$7n(n1){let e1,t1,r1;const o1=[n1[3],{value:n1[1]},{onChange:n1[2]}];function i1(s1){n1[6](s1)}let a1={};for(let s1=0;s1<o1.length;s1+=1)a1=assign$1(a1,o1[s1]);return n1[0]!==void 0&&(a1.api=n1[0]),e1=new LongFormCell({props:a1}),binding_callbacks.push(()=>bind$3(e1,"api",i1)),{c(){create_component(e1.$$.fragment)},m(s1,l1){mount_component(e1,s1,l1),r1=!0},p(s1,[l1]){const c1=l1&14?get_spread_update(o1,[l1&8&&get_spread_object(s1[3]),l1&2&&{value:s1[1]},l1&4&&{onChange:s1[2]}]):{};!t1&&l1&1&&(t1=!0,c1.api=s1[0],add_flush_callback(()=>t1=!1)),e1.$set(c1)},i(s1){r1||(transition_in(e1.$$.fragment,s1),r1=!0)},o(s1){transition_out(e1.$$.fragment,s1),r1=!1},d(s1){destroy_component(e1,s1)}}}function instance$7x(n1,e1,t1){let r1,{onChange:o1}=e1,{value:i1}=e1,{api:a1}=e1;const s1=u1=>{if(!u1)return u1;try{return JSON.stringify(u1,null,2)}catch{return null}},l1=u1=>{const f1=u1==null?void 0:u1.trim();if(!f1){o1(null);return}try{const p1=JSON.parse(f1);o1(p1)}catch{}};function c1(u1){a1=u1,t1(0,a1)}return n1.$$set=u1=>{t1(3,e1=assign$1(assign$1({},e1),exclude_internal_props(u1))),"onChange"in u1&&t1(4,o1=u1.onChange),"value"in u1&&t1(5,i1=u1.value),"api"in u1&&t1(0,a1=u1.api)},n1.$$.update=()=>{n1.$$.dirty&32&&t1(1,r1=s1(i1))},e1=exclude_internal_props(e1),[a1,r1,l1,e1,o1,i1,c1]}class JSONCell extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7x,create_fragment$7n,safe_not_equal,{onChange:4,value:5,api:0})}}const AttachmentCell_svelte_svelte_type_style_lang="";function get_each_context$1s(n1,e1,t1){const r1=n1.slice();return r1[21]=e1[t1],r1}function create_else_block$17(n1){let e1,t1=n1[21].extension+"",r1,o1,i1;return{c(){e1=element("div"),r1=text(t1),o1=space$1(),attr(e1,"class","file svelte-fygtfp"),attr(e1,"title",i1=n1[21].name)},m(a1,s1){insert$1(a1,e1,s1),append$1(e1,r1),append$1(e1,o1)},p(a1,s1){s1&1&&t1!==(t1=a1[21].extension+"")&&set_data(r1,t1),s1&1&&i1!==(i1=a1[21].name)&&attr(e1,"title",i1)},d(a1){a1&&detach(e1)}}}function create_if_block_1$1T(n1){let e1,t1,r1;return{c(){e1=element("img"),src_url_equal(e1.src,t1=n1[21].url)||attr(e1,"src",t1),attr(e1,"alt",r1=n1[21].extension)},m(o1,i1){insert$1(o1,e1,i1)},p(o1,i1){i1&1&&!src_url_equal(e1.src,t1=o1[21].url)&&attr(e1,"src",t1),i1&1&&r1!==(r1=o1[21].extension)&&attr(e1,"alt",r1)},d(o1){o1&&detach(e1)}}}function create_each_block$1s(n1){let e1,t1;function r1(a1,s1){return s1&1&&(e1=null),e1==null&&(e1=!!a1[8](a1[21].extension)),e1?create_if_block_1$1T:create_else_block$17}let o1=r1(n1,-1),i1=o1(n1);return{c(){i1.c(),t1=empty$1()},m(a1,s1){i1.m(a1,s1),insert$1(a1,t1,s1)},p(a1,s1){o1===(o1=r1(a1,s1))&&i1?i1.p(a1,s1):(i1.d(1),i1=o1(a1),i1&&(i1.c(),i1.m(t1.parentNode,t1)))},d(a1){i1.d(a1),a1&&detach(t1)}}}function create_if_block$3h(n1){let e1,t1,r1;return t1=new Dropzone({props:{value:n1[0],compact:!0,processFiles:n1[10],deleteAttachments:n1[11],handleFileTooLarge:n1[9]}}),t1.$on("change",n1[15]),{c(){e1=element("div"),create_component(t1.$$.fragment),attr(e1,"class","dropzone svelte-fygtfp"),toggle_class(e1,"invertX",n1[2]),toggle_class(e1,"invertY",n1[3])},m(o1,i1){insert$1(o1,e1,i1),mount_component(t1,e1,null),r1=!0},p(o1,i1){const a1={};i1&1&&(a1.value=o1[0]),t1.$set(a1),(!r1||i1&4)&&toggle_class(e1,"invertX",o1[2]),(!r1||i1&8)&&toggle_class(e1,"invertY",o1[3])},i(o1){r1||(transition_in(t1.$$.fragment,o1),r1=!0)},o(o1){transition_out(t1.$$.fragment,o1),r1=!1},d(o1){o1&&detach(e1),destroy_component(t1)}}}function create_fragment$7m(n1){let e1,t1,r1,o1,i1,a1,s1=n1[0]||[],l1=[];for(let u1=0;u1<s1.length;u1+=1)l1[u1]=create_each_block$1s(get_each_context$1s(n1,s1,u1));let c1=n1[4]&&create_if_block$3h(n1);return{c(){e1=element("div");for(let u1=0;u1<l1.length;u1+=1)l1[u1].c();t1=space$1(),c1&&c1.c(),r1=empty$1(),attr(e1,"class","attachment-cell svelte-fygtfp"),toggle_class(e1,"editable",n1[5])},m(u1,f1){insert$1(u1,e1,f1);for(let p1=0;p1<l1.length;p1+=1)l1[p1].m(e1,null);insert$1(u1,t1,f1),c1&&c1.m(u1,f1),insert$1(u1,r1,f1),o1=!0,i1||(a1=listen(e1,"click",function(){is_function(n1[5]?n1[7]:null)&&(n1[5]?n1[7]:null).apply(this,arguments)}),i1=!0)},p(u1,[f1]){if(n1=u1,f1&257){s1=n1[0]||[];let p1;for(p1=0;p1<s1.length;p1+=1){const d1=get_each_context$1s(n1,s1,p1);l1[p1]?l1[p1].p(d1,f1):(l1[p1]=create_each_block$1s(d1),l1[p1].c(),l1[p1].m(e1,null))}for(;p1<l1.length;p1+=1)l1[p1].d(1);l1.length=s1.length}(!o1||f1&32)&&toggle_class(e1,"editable",n1[5]),n1[4]?c1?(c1.p(n1,f1),f1&16&&transition_in(c1,1)):(c1=create_if_block$3h(n1),c1.c(),transition_in(c1,1),c1.m(r1.parentNode,r1)):c1&&(group_outros(),transition_out(c1,1,1,()=>{c1=null}),check_outros())},i(u1){o1||(transition_in(c1),o1=!0)},o(u1){transition_out(c1),o1=!1},d(u1){u1&&detach(e1),destroy_each(l1,u1),u1&&detach(t1),c1&&c1.d(u1),u1&&detach(r1),i1=!1,a1()}}}function instance$7w(n1,e1,t1){let r1,o1,{value:i1}=e1,{focused:a1=!1}=e1,{onChange:s1}=e1,{readonly:l1=!1}=e1,{api:c1}=e1,{invertX:u1=!1}=e1,{invertY:f1=!1}=e1;const{API:p1,notifications:d1}=getContext("grid");component_subscribe(n1,d1,E1=>t1(16,o1=E1));const m1=["png","tiff","gif","raw","jpg","jpeg"];let _1=!1;const h1=()=>_1,b1=()=>{t1(4,_1=!0)},$1=()=>{t1(4,_1=!1)},y1=E1=>m1.includes(E1==null?void 0:E1.toLowerCase()),k1=E1=>{o1.error(`Files cannot exceed ${E1/1e6}MB. Please try again with smaller files.`)},S1=async E1=>{let T1=new FormData;for(let I1=0;I1<E1.length;I1++)T1.append("file",E1[I1]);try{return await p1.uploadBuilderAttachment(T1)}catch{return o1.error("Failed to upload attachment"),[]}},A1=async E1=>{try{return await p1.deleteBuilderAttachments(E1)}catch{return[]}};onMount(()=>{t1(12,c1={focus:()=>b1(),blur:()=>$1(),isActive:()=>_1,onKeyDown:h1})});const C1=E1=>s1(E1.detail);return n1.$$set=E1=>{"value"in E1&&t1(0,i1=E1.value),"focused"in E1&&t1(13,a1=E1.focused),"onChange"in E1&&t1(1,s1=E1.onChange),"readonly"in E1&&t1(14,l1=E1.readonly),"api"in E1&&t1(12,c1=E1.api),"invertX"in E1&&t1(2,u1=E1.invertX),"invertY"in E1&&t1(3,f1=E1.invertY)},n1.$$.update=()=>{n1.$$.dirty&24576&&t1(5,r1=a1&&!l1),n1.$$.dirty&8192&&(a1||$1())},[i1,s1,u1,f1,_1,r1,d1,b1,y1,k1,S1,A1,c1,a1,l1,C1]}class AttachmentCell extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7w,create_fragment$7m,safe_not_equal,{value:0,focused:13,onChange:1,readonly:14,api:12,invertX:2,invertY:3})}}const TypeComponentMap={text:TextCell,options:OptionsCell,datetime:DateCell,barcodeqr:TextCell,longform:LongFormCell,array:MultiSelectCell,number:NumberCell,boolean:BooleanCell,attachment:AttachmentCell,link:RelationshipCell,formula:FormulaCell,json:JSONCell},getCellRenderer=n1=>{var e1;return TypeComponentMap[(e1=n1==null?void 0:n1.schema)==null?void 0:e1.type]||TextCell};function create_default_slot$4Y(n1){let e1,t1,r1,o1;function i1(u1){n1[24](u1)}var a1=getCellRenderer(n1[6]);function s1(u1){let f1={value:u1[7][u1[6].name],schema:u1[6].schema,onChange:u1[19].setValue,focused:u1[4],readonly:u1[13],invertY:u1[10],invertX:u1[9],contentLines:u1[11]};return u1[12]!==void 0&&(f1.api=u1[12]),{props:f1}}a1&&(e1=construct_svelte_component(a1,s1(n1)),binding_callbacks.push(()=>bind$3(e1,"api",i1)));const l1=n1[23].default,c1=create_slot(l1,n1,n1[27],null);return{c(){e1&&create_component(e1.$$.fragment),r1=space$1(),c1&&c1.c()},m(u1,f1){e1&&mount_component(e1,u1,f1),insert$1(u1,r1,f1),c1&&c1.m(u1,f1),o1=!0},p(u1,f1){const p1={};if(f1[0]&192&&(p1.value=u1[7][u1[6].name]),f1[0]&64&&(p1.schema=u1[6].schema),f1[0]&16&&(p1.focused=u1[4]),f1[0]&8192&&(p1.readonly=u1[13]),f1[0]&1024&&(p1.invertY=u1[10]),f1[0]&512&&(p1.invertX=u1[9]),f1[0]&2048&&(p1.contentLines=u1[11]),!t1&&f1[0]&4096&&(t1=!0,p1.api=u1[12],add_flush_callback(()=>t1=!1)),a1!==(a1=getCellRenderer(u1[6]))){if(e1){group_outros();const d1=e1;transition_out(d1.$$.fragment,1,0,()=>{destroy_component(d1,1)}),check_outros()}a1?(e1=construct_svelte_component(a1,s1(u1)),binding_callbacks.push(()=>bind$3(e1,"api",i1)),create_component(e1.$$.fragment),transition_in(e1.$$.fragment,1),mount_component(e1,r1.parentNode,r1)):e1=null}else a1&&e1.$set(p1);c1&&c1.p&&(!o1||f1[0]&134217728)&&update_slot_base(c1,l1,u1,u1[27],o1?get_slot_changes(l1,u1[27],f1,null):get_all_dirty_from_scope(u1[27]),null)},i(u1){o1||(e1&&transition_in(e1.$$.fragment,u1),transition_in(c1,u1),o1=!0)},o(u1){e1&&transition_out(e1.$$.fragment,u1),transition_out(c1,u1),o1=!1},d(u1){e1&&destroy_component(e1,u1),u1&&detach(r1),c1&&c1.d(u1)}}}function create_fragment$7l(n1){let e1,t1;return e1=new GridCell({props:{highlighted:n1[0],selected:n1[1],rowIdx:n1[2],topRow:n1[3],focused:n1[4],selectedUser:n1[5],readonly:n1[13],error:n1[15],width:n1[6].width,$$slots:{default:[create_default_slot$4Y]},$$scope:{ctx:n1}}}),e1.$on("click",n1[25]),e1.$on("contextmenu",n1[26]),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},p(r1,o1){const i1={};o1[0]&1&&(i1.highlighted=r1[0]),o1[0]&2&&(i1.selected=r1[1]),o1[0]&4&&(i1.rowIdx=r1[2]),o1[0]&8&&(i1.topRow=r1[3]),o1[0]&16&&(i1.focused=r1[4]),o1[0]&32&&(i1.selectedUser=r1[5]),o1[0]&8192&&(i1.readonly=r1[13]),o1[0]&32768&&(i1.error=r1[15]),o1[0]&64&&(i1.width=r1[6].width),o1[0]&134233808&&(i1.$$scope={dirty:o1,ctx:r1}),e1.$set(i1)},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function instance$7v(n1,e1,t1){let r1,o1,i1,a1,s1=noop$5,l1=()=>(s1(),s1=subscribe(r1,X1=>t1(15,a1=X1)),r1);n1.$$.on_destroy.push(()=>s1());let{$$slots:c1={},$$scope:u1}=e1;const{rows:f1,focusedCellId:p1,focusedCellAPI:d1,menu:m1,config:_1,validation:h1}=getContext("grid");component_subscribe(n1,_1,X1=>t1(22,i1=X1));let{highlighted:b1}=e1,{selected:$1}=e1,{rowFocused:y1}=e1,{rowIdx:k1}=e1,{topRow:S1=!1}=e1,{focused:A1}=e1,{selectedUser:C1}=e1,{column:E1}=e1,{row:T1}=e1,{cellId:I1}=e1,{updateValue:N1=f1.actions.updateValue}=e1,{invertX:j1=!1}=e1,{invertY:V1=!1}=e1,{contentLines:B1=1}=e1;const D1=writable(null);let F1;const U1=(X1,W1)=>X1?derived(h1,a0=>a0[W1]):D1,G1={focus:()=>{var X1;return(X1=F1==null?void 0:F1.focus)==null?void 0:X1.call(F1)},blur:()=>{var X1;return(X1=F1==null?void 0:F1.blur)==null?void 0:X1.call(F1)},isActive:()=>{var X1,W1;return(W1=(X1=F1==null?void 0:F1.isActive)==null?void 0:X1.call(F1))!=null?W1:!1},onKeyDown:(...X1)=>F1==null?void 0:F1.onKeyDown(...X1),isReadonly:()=>o1,getType:()=>E1.schema.type,getValue:()=>T1[E1.name],setValue:X1=>{h1.actions.setError(I1,null),N1(T1._id,E1.name,X1)}};function K1(X1){F1=X1,t1(12,F1)}const q1=()=>p1.set(I1),J1=X1=>m1.actions.open(I1,X1);return n1.$$set=X1=>{"highlighted"in X1&&t1(0,b1=X1.highlighted),"selected"in X1&&t1(1,$1=X1.selected),"rowFocused"in X1&&t1(20,y1=X1.rowFocused),"rowIdx"in X1&&t1(2,k1=X1.rowIdx),"topRow"in X1&&t1(3,S1=X1.topRow),"focused"in X1&&t1(4,A1=X1.focused),"selectedUser"in X1&&t1(5,C1=X1.selectedUser),"column"in X1&&t1(6,E1=X1.column),"row"in X1&&t1(7,T1=X1.row),"cellId"in X1&&t1(8,I1=X1.cellId),"updateValue"in X1&&t1(21,N1=X1.updateValue),"invertX"in X1&&t1(9,j1=X1.invertX),"invertY"in X1&&t1(10,V1=X1.invertY),"contentLines"in X1&&t1(11,B1=X1.contentLines),"$$scope"in X1&&t1(27,u1=X1.$$scope)},n1.$$.update=()=>{n1.$$.dirty[0]&1048832&&l1(t1(14,r1=U1(y1,I1))),n1.$$.dirty[0]&4194496&&t1(13,o1=E1.schema.autocolumn||E1.schema.disabled||E1.schema.type==="formula"||!i1.allowEditRows&&T1._id),n1.$$.dirty[0]&16&&A1&&d1.set(G1)},[b1,$1,k1,S1,A1,C1,E1,T1,I1,j1,V1,B1,F1,o1,r1,a1,p1,m1,_1,G1,y1,N1,i1,c1,K1,q1,J1,u1]}class DataCell extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7v,create_fragment$7l,safe_not_equal,{highlighted:0,selected:1,rowFocused:20,rowIdx:2,topRow:3,focused:4,selectedUser:5,column:6,row:7,cellId:8,updateValue:21,invertX:9,invertY:10,contentLines:11},null,[-1,-1])}}const GridRow_svelte_svelte_type_style_lang="";function get_each_context$1r(n1,e1,t1){const r1=n1.slice();r1[30]=e1[t1],r1[33]=t1;const o1=`${r1[0]._id}-${r1[30].name}`;return r1[31]=o1,r1}function create_each_block$1r(n1,e1){let t1,r1,o1;return r1=new DataCell({props:{cellId:e1[31],column:e1[30],row:e1[0],invertY:e1[2],rowFocused:e1[5],invertX:e1[33]>=e1[10],highlighted:e1[6]||e1[5]||e1[4]===e1[30].name,selected:e1[7],rowIdx:e1[0].__idx,topRow:e1[1],focused:e1[11]===e1[31],selectedUser:e1[12][e1[31]],width:e1[30].width,contentLines:e1[13]}}),{key:n1,first:null,c(){t1=empty$1(),create_component(r1.$$.fragment),this.first=t1},m(i1,a1){insert$1(i1,t1,a1),mount_component(r1,i1,a1),o1=!0},p(i1,a1){e1=i1;const s1={};a1[0]&513&&(s1.cellId=e1[31]),a1[0]&512&&(s1.column=e1[30]),a1[0]&1&&(s1.row=e1[0]),a1[0]&4&&(s1.invertY=e1[2]),a1[0]&32&&(s1.rowFocused=e1[5]),a1[0]&1536&&(s1.invertX=e1[33]>=e1[10]),a1[0]&624&&(s1.highlighted=e1[6]||e1[5]||e1[4]===e1[30].name),a1[0]&128&&(s1.selected=e1[7]),a1[0]&1&&(s1.rowIdx=e1[0].__idx),a1[0]&2&&(s1.topRow=e1[1]),a1[0]&2561&&(s1.focused=e1[11]===e1[31]),a1[0]&4609&&(s1.selectedUser=e1[12][e1[31]]),a1[0]&512&&(s1.width=e1[30].width),a1[0]&8192&&(s1.contentLines=e1[13]),r1.$set(s1)},i(i1){o1||(transition_in(r1.$$.fragment,i1),o1=!0)},o(i1){transition_out(r1.$$.fragment,i1),o1=!1},d(i1){i1&&detach(t1),destroy_component(r1,i1)}}}function create_fragment$7k(n1){let e1,t1=[],r1=new Map,o1,i1,a1,s1=n1[9];const l1=c1=>c1[30].name;for(let c1=0;c1<s1.length;c1+=1){let u1=get_each_context$1r(n1,s1,c1),f1=l1(u1);r1.set(f1,t1[c1]=create_each_block$1r(f1,u1))}return{c(){e1=element("div");for(let c1=0;c1<t1.length;c1+=1)t1[c1].c();attr(e1,"class","row svelte-1507qm8")},m(c1,u1){insert$1(c1,e1,u1);for(let f1=0;f1<t1.length;f1+=1)t1[f1].m(e1,null);o1=!0,i1||(a1=[listen(e1,"focus",n1[27]),listen(e1,"mouseenter",function(){is_function(n1[8]?null:n1[28])&&(n1[8]?null:n1[28]).apply(this,arguments)}),listen(e1,"mouseleave",function(){is_function(n1[8]?null:n1[29])&&(n1[8]?null:n1[29]).apply(this,arguments)})],i1=!0)},p(c1,u1){n1=c1,u1[0]&16119&&(s1=n1[9],group_outros(),t1=update_keyed_each(t1,u1,l1,1,n1,s1,r1,e1,outro_and_destroy_block,create_each_block$1r,null,get_each_context$1r),check_outros())},i(c1){if(!o1){for(let u1=0;u1<s1.length;u1+=1)transition_in(t1[u1]);o1=!0}},o(c1){for(let u1=0;u1<t1.length;u1+=1)transition_out(t1[u1]);o1=!1},d(c1){c1&&detach(e1);for(let u1=0;u1<t1.length;u1+=1)t1[u1].d();i1=!1,run_all(a1)}}}function instance$7u(n1,e1,t1){let r1,o1,i1,a1,s1,l1,c1,u1,f1,p1,d1,m1,_1,h1,{row:b1}=e1,{top:$1=!1}=e1,{invertY:y1=!1}=e1;const{focusedCellId:k1,reorder:S1,selectedRows:A1,renderedColumns:C1,hoveredRowId:E1,selectedCellMap:T1,focusedRow:I1,columnHorizontalInversionIndex:N1,contentLines:j1,isDragging:V1}=getContext("grid");component_subscribe(n1,k1,U1=>t1(11,m1=U1)),component_subscribe(n1,S1,U1=>t1(24,s1=U1)),component_subscribe(n1,A1,U1=>t1(26,u1=U1)),component_subscribe(n1,C1,U1=>t1(9,p1=U1)),component_subscribe(n1,E1,U1=>t1(3,c1=U1)),component_subscribe(n1,T1,U1=>t1(12,_1=U1)),component_subscribe(n1,I1,U1=>t1(25,l1=U1)),component_subscribe(n1,N1,U1=>t1(10,d1=U1)),component_subscribe(n1,j1,U1=>t1(13,h1=U1)),component_subscribe(n1,V1,U1=>t1(8,f1=U1));function B1(U1){bubble.call(this,n1,U1)}const D1=()=>set_store_value(E1,c1=b1._id,c1),F1=()=>set_store_value(E1,c1=null,c1);return n1.$$set=U1=>{"row"in U1&&t1(0,b1=U1.row),"top"in U1&&t1(1,$1=U1.top),"invertY"in U1&&t1(2,y1=U1.invertY)},n1.$$.update=()=>{n1.$$.dirty[0]&67108865&&t1(7,r1=!!u1[b1._id]),n1.$$.dirty[0]&9&&t1(6,o1=c1===b1._id),n1.$$.dirty[0]&33554433&&t1(5,i1=(l1==null?void 0:l1._id)===b1._id),n1.$$.dirty[0]&16777216&&t1(4,a1=s1.sourceColumn)},[b1,$1,y1,c1,a1,i1,o1,r1,f1,p1,d1,m1,_1,h1,k1,S1,A1,C1,E1,T1,I1,N1,j1,V1,s1,l1,u1,B1,D1,F1]}class GridRow extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7u,create_fragment$7k,safe_not_equal,{row:0,top:1,invertY:2},null,[-1,-1])}}const GridBody_svelte_svelte_type_style_lang="";function get_each_context$1q(n1,e1,t1){const r1=n1.slice();return r1[20]=e1[t1],r1[22]=t1,r1}function create_each_block$1q(n1){let e1,t1;return e1=new GridRow({props:{row:n1[20],top:n1[22]===0,invertY:n1[22]>=n1[4]}}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},p(r1,o1){const i1={};o1&8&&(i1.row=r1[20]),o1&16&&(i1.invertY=r1[22]>=r1[4]),e1.$set(i1)},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_if_block$3g(n1){let e1,t1,r1;return{c(){e1=element("div"),attr(e1,"class","blank svelte-46fi0c"),set_style(e1,"width",n1[2]+"px"),toggle_class(e1,"highlighted",n1[6]===BlankRowID)},m(o1,i1){insert$1(o1,e1,i1),t1||(r1=[listen(e1,"mouseenter",function(){is_function(n1[7]?null:n1[15])&&(n1[7]?null:n1[15]).apply(this,arguments)}),listen(e1,"mouseleave",function(){is_function(n1[7]?null:n1[16])&&(n1[7]?null:n1[16]).apply(this,arguments)}),listen(e1,"click",n1[17])],t1=!0)},p(o1,i1){n1=o1,i1&4&&set_style(e1,"width",n1[2]+"px"),i1&64&&toggle_class(e1,"highlighted",n1[6]===BlankRowID)},d(o1){o1&&detach(e1),t1=!1,run_all(r1)}}}function create_default_slot$4X(n1){let e1,t1,r1,o1=n1[3],i1=[];for(let l1=0;l1<o1.length;l1+=1)i1[l1]=create_each_block$1q(get_each_context$1q(n1,o1,l1));const a1=l1=>transition_out(i1[l1],1,1,()=>{i1[l1]=null});let s1=n1[5].allowAddRows&&n1[0].length&&create_if_block$3g(n1);return{c(){for(let l1=0;l1<i1.length;l1+=1)i1[l1].c();e1=space$1(),s1&&s1.c(),t1=empty$1()},m(l1,c1){for(let u1=0;u1<i1.length;u1+=1)i1[u1].m(l1,c1);insert$1(l1,e1,c1),s1&&s1.m(l1,c1),insert$1(l1,t1,c1),r1=!0},p(l1,c1){if(c1&24){o1=l1[3];let u1;for(u1=0;u1<o1.length;u1+=1){const f1=get_each_context$1q(l1,o1,u1);i1[u1]?(i1[u1].p(f1,c1),transition_in(i1[u1],1)):(i1[u1]=create_each_block$1q(f1),i1[u1].c(),transition_in(i1[u1],1),i1[u1].m(e1.parentNode,e1))}for(group_outros(),u1=o1.length;u1<i1.length;u1+=1)a1(u1);check_outros()}l1[5].allowAddRows&&l1[0].length?s1?s1.p(l1,c1):(s1=create_if_block$3g(l1),s1.c(),s1.m(t1.parentNode,t1)):s1&&(s1.d(1),s1=null)},i(l1){if(!r1){for(let c1=0;c1<o1.length;c1+=1)transition_in(i1[c1]);r1=!0}},o(l1){i1=i1.filter(Boolean);for(let c1=0;c1<i1.length;c1+=1)transition_out(i1[c1]);r1=!1},d(l1){destroy_each(i1,l1),l1&&detach(e1),s1&&s1.d(l1),l1&&detach(t1)}}}function create_fragment$7j(n1){let e1,t1,r1;return t1=new GridScrollWrapper({props:{scrollHorizontally:!0,scrollVertically:!0,wheelInteractive:!0,$$slots:{default:[create_default_slot$4X]},$$scope:{ctx:n1}}}),{c(){e1=element("div"),create_component(t1.$$.fragment),attr(e1,"class","grid-body svelte-46fi0c")},m(o1,i1){insert$1(o1,e1,i1),mount_component(t1,e1,null),n1[18](e1),r1=!0},p(o1,[i1]){const a1={};i1&8388861&&(a1.$$scope={dirty:i1,ctx:o1}),t1.$set(a1)},i(o1){r1||(transition_in(t1.$$.fragment,o1),r1=!0)},o(o1){transition_out(t1.$$.fragment,o1),r1=!1},d(o1){o1&&detach(e1),destroy_component(t1),n1[18](null)}}}function instance$7t(n1,e1,t1){let r1,o1,i1,a1,s1,l1,c1;const{bounds:u1,renderedRows:f1,renderedColumns:p1,rowVerticalInversionIndex:d1,config:m1,hoveredRowId:_1,dispatch:h1,isDragging:b1}=getContext("grid");component_subscribe(n1,f1,C1=>t1(3,i1=C1)),component_subscribe(n1,p1,C1=>t1(0,o1=C1)),component_subscribe(n1,d1,C1=>t1(4,a1=C1)),component_subscribe(n1,m1,C1=>t1(5,s1=C1)),component_subscribe(n1,_1,C1=>t1(6,l1=C1)),component_subscribe(n1,b1,C1=>t1(7,c1=C1));let $1;onMount(()=>{const C1=new ResizeObserver(()=>{u1.set($1.getBoundingClientRect())});return C1.observe($1),()=>{C1.disconnect()}});const y1=()=>set_store_value(_1,l1=BlankRowID,l1),k1=()=>set_store_value(_1,l1=null,l1),S1=()=>h1("add-row-inline");function A1(C1){binding_callbacks[C1?"unshift":"push"](()=>{$1=C1,t1(1,$1)})}return n1.$$.update=()=>{n1.$$.dirty&1&&t1(2,r1=o1.reduce((C1,E1)=>C1+=E1.width,0))},[o1,$1,r1,i1,a1,s1,l1,c1,f1,p1,d1,m1,_1,h1,b1,y1,k1,S1,A1]}class GridBody extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7t,create_fragment$7j,safe_not_equal,{})}}const ResizeOverlay_svelte_svelte_type_style_lang="";function get_each_context$1p(n1,e1,t1){const r1=n1.slice();return r1[20]=e1[t1],r1}function create_if_block$3f(n1){let e1,t1,r1=n1[0]&&create_if_block_1$1S(n1),o1=n1[5],i1=[];for(let a1=0;a1<o1.length;a1+=1)i1[a1]=create_each_block$1p(get_each_context$1p(n1,o1,a1));return{c(){r1&&r1.c(),e1=space$1();for(let a1=0;a1<i1.length;a1+=1)i1[a1].c();t1=empty$1()},m(a1,s1){r1&&r1.m(a1,s1),insert$1(a1,e1,s1);for(let l1=0;l1<i1.length;l1+=1)i1[l1].m(a1,s1);insert$1(a1,t1,s1)},p(a1,s1){if(a1[0]?r1?r1.p(a1,s1):(r1=create_if_block_1$1S(a1),r1.c(),r1.m(e1.parentNode,e1)):r1&&(r1.d(1),r1=null),s1&4270){o1=a1[5];let l1;for(l1=0;l1<o1.length;l1+=1){const c1=get_each_context$1p(a1,o1,l1);i1[l1]?i1[l1].p(c1,s1):(i1[l1]=create_each_block$1p(c1),i1[l1].c(),i1[l1].m(t1.parentNode,t1))}for(;l1<i1.length;l1+=1)i1[l1].d(1);i1.length=o1.length}},d(a1){r1&&r1.d(a1),a1&&detach(e1),destroy_each(i1,a1),a1&&detach(t1)}}}function create_if_block_1$1S(n1){let e1,t1,r1,o1;return{c(){e1=element("div"),t1=element("div"),attr(t1,"class","resize-indicator svelte-be62xg"),attr(e1,"class","resize-slider svelte-be62xg"),set_style(e1,"left",GutterWidth+n1[0].width+"px"),toggle_class(e1,"visible",n1[2]===n1[0].name)},m(i1,a1){insert$1(i1,e1,a1),append$1(e1,t1),r1||(o1=[listen(e1,"mousedown",n1[15]),listen(e1,"dblclick",n1[16])],r1=!0)},p(i1,a1){a1&1&&set_style(e1,"left",GutterWidth+i1[0].width+"px"),a1&5&&toggle_class(e1,"visible",i1[2]===i1[0].name)},d(i1){i1&&detach(e1),r1=!1,run_all(o1)}}}function create_each_block$1p(n1){let e1,t1,r1,o1,i1,a1;function s1(...c1){return n1[17](n1[20],...c1)}function l1(){return n1[18](n1[20])}return{c(){e1=element("div"),t1=element("div"),r1=space$1(),attr(t1,"class","resize-indicator svelte-be62xg"),attr(e1,"class","resize-slider svelte-be62xg"),attr(e1,"style",o1=n1[12](n1[20],n1[3],n1[1])),toggle_class(e1,"visible",n1[2]===n1[20].name)},m(c1,u1){insert$1(c1,e1,u1),append$1(e1,t1),append$1(e1,r1),i1||(a1=[listen(e1,"mousedown",s1),listen(e1,"dblclick",l1)],i1=!0)},p(c1,u1){n1=c1,u1&42&&o1!==(o1=n1[12](n1[20],n1[3],n1[1]))&&attr(e1,"style",o1),u1&36&&toggle_class(e1,"visible",n1[2]===n1[20].name)},d(c1){c1&&detach(e1),i1=!1,run_all(a1)}}}function create_fragment$7i(n1){let e1,t1=!n1[4]&&create_if_block$3f(n1);return{c(){t1&&t1.c(),e1=empty$1()},m(r1,o1){t1&&t1.m(r1,o1),insert$1(r1,e1,o1)},p(r1,[o1]){r1[4]?t1&&(t1.d(1),t1=null):t1?t1.p(r1,o1):(t1=create_if_block$3f(r1),t1.c(),t1.m(e1.parentNode,e1))},i:noop$5,o:noop$5,d(r1){t1&&t1.d(r1),r1&&detach(e1)}}}function instance$7s(n1,e1,t1){let r1,o1,i1,a1,s1,l1,c1,u1;const{columns:f1,resize:p1,renderedColumns:d1,stickyColumn:m1,isReordering:_1,scrollLeft:h1}=getContext("grid");component_subscribe(n1,f1,A1=>t1(14,s1=A1)),component_subscribe(n1,p1,A1=>t1(13,i1=A1)),component_subscribe(n1,d1,A1=>t1(5,u1=A1)),component_subscribe(n1,m1,A1=>t1(0,a1=A1)),component_subscribe(n1,_1,A1=>t1(4,c1=A1)),component_subscribe(n1,h1,A1=>t1(1,l1=A1));const b1=(A1,C1,E1)=>`left:${C1+A1.left+A1.width-E1}px;`,$1=A1=>p1.actions.startResizing(a1,A1),y1=()=>p1.actions.resetSize(a1),k1=(A1,C1)=>p1.actions.startResizing(A1,C1),S1=A1=>p1.actions.resetSize(A1);return n1.$$.update=()=>{var A1;n1.$$.dirty&16386&&l1+GutterWidth+(((A1=s1[0])==null?void 0:A1.width)||0),n1.$$.dirty&1&&t1(3,r1=GutterWidth+((a1==null?void 0:a1.width)||0)),n1.$$.dirty&8192&&t1(2,o1=i1.column)},[a1,l1,o1,r1,c1,u1,f1,p1,d1,m1,_1,h1,b1,i1,s1,$1,y1,k1,S1]}class ResizeOverlay extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7s,create_fragment$7i,safe_not_equal,{})}}const ReorderOverlay_svelte_svelte_type_style_lang="";function create_if_block$3e(n1){let e1,t1,r1;return t1=new GridScrollWrapper({props:{scrollVertically:!0,$$slots:{default:[create_default_slot$4W]},$$scope:{ctx:n1}}}),{c(){e1=element("div"),create_component(t1.$$.fragment),attr(e1,"class","reorder-wrapper svelte-1e4eaad")},m(o1,i1){insert$1(o1,e1,i1),mount_component(t1,e1,null),r1=!0},p(o1,i1){const a1={};i1&2097154&&(a1.$$scope={dirty:i1,ctx:o1}),t1.$set(a1)},i(o1){r1||(transition_in(t1.$$.fragment,o1),r1=!0)},o(o1){transition_out(t1.$$.fragment,o1),r1=!1},d(o1){o1&&detach(e1),destroy_component(t1)}}}function create_default_slot$4W(n1){let e1;return{c(){e1=element("div"),attr(e1,"class","reorder-overlay svelte-1e4eaad"),attr(e1,"style",n1[1])},m(t1,r1){insert$1(t1,e1,r1)},p(t1,r1){r1&2&&attr(e1,"style",t1[1])},d(t1){t1&&detach(e1)}}}function create_fragment$7h(n1){let e1,t1,r1=n1[0]&&create_if_block$3e(n1);return{c(){r1&&r1.c(),e1=empty$1()},m(o1,i1){r1&&r1.m(o1,i1),insert$1(o1,e1,i1),t1=!0},p(o1,[i1]){o1[0]?r1?(r1.p(o1,i1),i1&1&&transition_in(r1,1)):(r1=create_if_block$3e(o1),r1.c(),transition_in(r1,1),r1.m(e1.parentNode,e1)):r1&&(group_outros(),transition_out(r1,1,1,()=>{r1=null}),check_outros())},i(o1){t1||(transition_in(r1),t1=!0)},o(o1){transition_out(r1),t1=!1},d(o1){r1&&r1.d(o1),o1&&detach(e1)}}}function instance$7r(n1,e1,t1){let r1,o1,i1,a1,s1,l1,c1,u1,f1,p1,d1,m1,_1;const{isReordering:h1,reorder:b1,visibleColumns:$1,stickyColumn:y1,rowHeight:k1,renderedRows:S1,scrollLeft:A1}=getContext("grid");component_subscribe(n1,h1,E1=>t1(13,c1=E1)),component_subscribe(n1,b1,E1=>t1(19,_1=E1)),component_subscribe(n1,$1,E1=>t1(17,d1=E1)),component_subscribe(n1,y1,E1=>t1(18,m1=E1)),component_subscribe(n1,k1,E1=>t1(15,f1=E1)),component_subscribe(n1,S1,E1=>t1(14,u1=E1)),component_subscribe(n1,A1,E1=>t1(16,p1=E1));const C1=(E1,T1,I1,N1)=>{let j1=GutterWidth+((T1==null?void 0:T1.width)||0)-N1;if(E1!==(T1==null?void 0:T1.name)){const V1=I1.find(B1=>B1.name===E1);if(!V1)return j1;j1+=V1.left+V1.width}return j1};return n1.$$.update=()=>{n1.$$.dirty&524288&&t1(12,r1=_1.targetColumn),n1.$$.dirty&262144&&t1(9,o1=GutterWidth+((m1==null?void 0:m1.width)||0)),n1.$$.dirty&462848&&t1(10,i1=C1(r1,m1,d1,p1)),n1.$$.dirty&49152&&t1(11,a1=f1*u1.length+DefaultRowHeight),n1.$$.dirty&3072&&t1(1,s1=`left:${i1}px; height:${a1}px;`),n1.$$.dirty&9728&&t1(0,l1=c1&&i1>=o1)},[l1,s1,h1,b1,$1,y1,k1,S1,A1,o1,i1,a1,r1,c1,u1,f1,p1,d1,m1,_1]}class ReorderOverlay extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7r,create_fragment$7h,safe_not_equal,{})}}const HeaderCell_svelte_svelte_type_style_lang="";function create_if_block$3d(n1){let e1,t1,r1;return t1=new Icon({props:{size:"S",name:n1[2].order==="descending"?"SortOrderDown":"SortOrderUp",color:"var(--spectrum-global-color-gray-600)"}}),{c(){e1=element("div"),create_component(t1.$$.fragment),attr(e1,"class","sort-indicator svelte-1bwa3j0")},m(o1,i1){insert$1(o1,e1,i1),mount_component(t1,e1,null),r1=!0},p(o1,i1){const a1={};i1[0]&4&&(a1.name=o1[2].order==="descending"?"SortOrderDown":"SortOrderUp"),t1.$set(a1)},i(o1){r1||(transition_in(t1.$$.fragment,o1),r1=!0)},o(o1){transition_out(t1.$$.fragment,o1),r1=!1},d(o1){o1&&detach(e1),destroy_component(t1)}}}function create_default_slot_9$s(n1){let e1,t1,r1,o1=n1[0].label+"",i1,a1,s1,l1,c1,u1,f1,p1;e1=new Icon({props:{size:"S",name:getColumnIcon(n1[0]),color:"var(--spectrum-global-color-gray-600)"}});let d1=n1[9]&&create_if_block$3d(n1);return c1=new Icon({props:{size:"S",name:"MoreVertical",color:"var(--spectrum-global-color-gray-600)"}}),{c(){create_component(e1.$$.fragment),t1=space$1(),r1=element("div"),i1=text(o1),a1=space$1(),d1&&d1.c(),s1=space$1(),l1=element("div"),create_component(c1.$$.fragment),attr(r1,"class","name svelte-1bwa3j0"),attr(l1,"class","more svelte-1bwa3j0")},m(m1,_1){mount_component(e1,m1,_1),insert$1(m1,t1,_1),insert$1(m1,r1,_1),append$1(r1,i1),insert$1(m1,a1,_1),d1&&d1.m(m1,_1),insert$1(m1,s1,_1),insert$1(m1,l1,_1),mount_component(c1,l1,null),u1=!0,f1||(p1=listen(l1,"click",n1[32]),f1=!0)},p(m1,_1){const h1={};_1[0]&1&&(h1.name=getColumnIcon(m1[0])),e1.$set(h1),(!u1||_1[0]&1)&&o1!==(o1=m1[0].label+"")&&set_data(i1,o1),m1[9]?d1?(d1.p(m1,_1),_1[0]&512&&transition_in(d1,1)):(d1=create_if_block$3d(m1),d1.c(),transition_in(d1,1),d1.m(s1.parentNode,s1)):d1&&(group_outros(),transition_out(d1,1,1,()=>{d1=null}),check_outros())},i(m1){u1||(transition_in(e1.$$.fragment,m1),transition_in(d1),transition_in(c1.$$.fragment,m1),u1=!0)},o(m1){transition_out(e1.$$.fragment,m1),transition_out(d1),transition_out(c1.$$.fragment,m1),u1=!1},d(m1){destroy_component(e1,m1),m1&&detach(t1),m1&&detach(r1),m1&&detach(a1),d1&&d1.d(m1),m1&&detach(s1),m1&&detach(l1),destroy_component(c1),f1=!1,p1()}}}function create_default_slot_8$z(n1){let e1;return{c(){e1=text("Edit column")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_default_slot_7$M(n1){let e1;return{c(){e1=text("Use as display column")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_default_slot_6$Y(n1){let e1,t1;return{c(){e1=text("Sort "),t1=text(n1[6])},m(r1,o1){insert$1(r1,e1,o1),insert$1(r1,t1,o1)},p(r1,o1){o1[0]&64&&set_data(t1,r1[6])},d(r1){r1&&detach(e1),r1&&detach(t1)}}}function create_default_slot_5$1c(n1){let e1,t1;return{c(){e1=text("Sort "),t1=text(n1[5])},m(r1,o1){insert$1(r1,e1,o1),insert$1(r1,t1,o1)},p(r1,o1){o1[0]&32&&set_data(t1,r1[5])},d(r1){r1&&detach(e1),r1&&detach(t1)}}}function create_default_slot_4$1v(n1){let e1;return{c(){e1=text("Move left")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_default_slot_3$23(n1){let e1;return{c(){e1=text("Move right")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_default_slot_2$2F(n1){let e1;return{c(){e1=text("Hide column")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_default_slot_1$3C(n1){let e1,t1,r1,o1,i1,a1,s1,l1,c1,u1,f1,p1,d1,m1;return e1=new Item({props:{icon:"Edit",disabled:!n1[12].allowSchemaChanges||n1[0].schema.disabled,$$slots:{default:[create_default_slot_8$z]},$$scope:{ctx:n1}}}),e1.$on("click",n1[20]),r1=new Item({props:{icon:"Label",disabled:n1[1]==="sticky"||!n1[12].allowSchemaChanges||n1[19].includes(n1[0].schema.type),$$slots:{default:[create_default_slot_7$M]},$$scope:{ctx:n1}}}),r1.$on("click",n1[28]),i1=new Item({props:{icon:"SortOrderUp",disabled:n1[0].name===n1[2].column&&n1[2].order==="ascending",$$slots:{default:[create_default_slot_6$Y]},$$scope:{ctx:n1}}}),i1.$on("click",n1[24]),s1=new Item({props:{icon:"SortOrderDown",disabled:n1[0].name===n1[2].column&&n1[2].order==="descending",$$slots:{default:[create_default_slot_5$1c]},$$scope:{ctx:n1}}}),s1.$on("click",n1[25]),c1=new Item({props:{disabled:!n1[8],icon:"ChevronLeft",$$slots:{default:[create_default_slot_4$1v]},$$scope:{ctx:n1}}}),c1.$on("click",n1[26]),f1=new Item({props:{disabled:!n1[7],icon:"ChevronRight",$$slots:{default:[create_default_slot_3$23]},$$scope:{ctx:n1}}}),f1.$on("click",n1[27]),d1=new Item({props:{disabled:n1[1]==="sticky"||!n1[12].showControls,icon:"VisibilityOff",$$slots:{default:[create_default_slot_2$2F]},$$scope:{ctx:n1}}}),d1.$on("click",n1[29]),{c(){create_component(e1.$$.fragment),t1=space$1(),create_component(r1.$$.fragment),o1=space$1(),create_component(i1.$$.fragment),a1=space$1(),create_component(s1.$$.fragment),l1=space$1(),create_component(c1.$$.fragment),u1=space$1(),create_component(f1.$$.fragment),p1=space$1(),create_component(d1.$$.fragment)},m(_1,h1){mount_component(e1,_1,h1),insert$1(_1,t1,h1),mount_component(r1,_1,h1),insert$1(_1,o1,h1),mount_component(i1,_1,h1),insert$1(_1,a1,h1),mount_component(s1,_1,h1),insert$1(_1,l1,h1),mount_component(c1,_1,h1),insert$1(_1,u1,h1),mount_component(f1,_1,h1),insert$1(_1,p1,h1),mount_component(d1,_1,h1),m1=!0},p(_1,h1){const b1={};h1[0]&4097&&(b1.disabled=!_1[12].allowSchemaChanges||_1[0].schema.disabled),h1[1]&512&&(b1.$$scope={dirty:h1,ctx:_1}),e1.$set(b1);const $1={};h1[0]&4099&&($1.disabled=_1[1]==="sticky"||!_1[12].allowSchemaChanges||_1[19].includes(_1[0].schema.type)),h1[1]&512&&($1.$$scope={dirty:h1,ctx:_1}),r1.$set($1);const y1={};h1[0]&5&&(y1.disabled=_1[0].name===_1[2].column&&_1[2].order==="ascending"),h1[0]&64|h1[1]&512&&(y1.$$scope={dirty:h1,ctx:_1}),i1.$set(y1);const k1={};h1[0]&5&&(k1.disabled=_1[0].name===_1[2].column&&_1[2].order==="descending"),h1[0]&32|h1[1]&512&&(k1.$$scope={dirty:h1,ctx:_1}),s1.$set(k1);const S1={};h1[0]&256&&(S1.disabled=!_1[8]),h1[1]&512&&(S1.$$scope={dirty:h1,ctx:_1}),c1.$set(S1);const A1={};h1[0]&128&&(A1.disabled=!_1[7]),h1[1]&512&&(A1.$$scope={dirty:h1,ctx:_1}),f1.$set(A1);const C1={};h1[0]&4098&&(C1.disabled=_1[1]==="sticky"||!_1[12].showControls),h1[1]&512&&(C1.$$scope={dirty:h1,ctx:_1}),d1.$set(C1)},i(_1){m1||(transition_in(e1.$$.fragment,_1),transition_in(r1.$$.fragment,_1),transition_in(i1.$$.fragment,_1),transition_in(s1.$$.fragment,_1),transition_in(c1.$$.fragment,_1),transition_in(f1.$$.fragment,_1),transition_in(d1.$$.fragment,_1),m1=!0)},o(_1){transition_out(e1.$$.fragment,_1),transition_out(r1.$$.fragment,_1),transition_out(i1.$$.fragment,_1),transition_out(s1.$$.fragment,_1),transition_out(c1.$$.fragment,_1),transition_out(f1.$$.fragment,_1),transition_out(d1.$$.fragment,_1),m1=!1},d(_1){destroy_component(e1,_1),_1&&detach(t1),destroy_component(r1,_1),_1&&detach(o1),destroy_component(i1,_1),_1&&detach(a1),destroy_component(s1,_1),_1&&detach(l1),destroy_component(c1,_1),_1&&detach(u1),destroy_component(f1,_1),_1&&detach(p1),destroy_component(d1,_1)}}}function create_default_slot$4V(n1){let e1,t1;return e1=new Menu$1({props:{$$slots:{default:[create_default_slot_1$3C]},$$scope:{ctx:n1}}}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},p(r1,o1){const i1={};o1[0]&4583|o1[1]&512&&(i1.$$scope={dirty:o1,ctx:r1}),e1.$set(i1)},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_fragment$7g(n1){let e1,t1,r1,o1,i1,a1;t1=new GridCell({props:{width:n1[0].width,left:n1[0].left,defaultHeight:!0,center:!0,$$slots:{default:[create_default_slot_9$s]},$$scope:{ctx:n1}}}),t1.$on("mousedown",n1[21]),t1.$on("mouseup",n1[22]),t1.$on("contextmenu",n1[23]);function s1(c1){n1[34](c1)}let l1={anchor:n1[3],align:"right",offset:0,popoverTarget:document.getElementById(`grid-${n1[15]}`),animate:!1,$$slots:{default:[create_default_slot$4V]},$$scope:{ctx:n1}};return n1[4]!==void 0&&(l1.open=n1[4]),o1=new Popover({props:l1}),binding_callbacks.push(()=>bind$3(o1,"open",s1)),{c(){e1=element("div"),create_component(t1.$$.fragment),r1=space$1(),create_component(o1.$$.fragment),attr(e1,"class","header-cell svelte-1bwa3j0"),set_style(e1,"flex","0 0 "+n1[0].width+"px"),toggle_class(e1,"open",n1[4]),toggle_class(e1,"disabled",n1[10]||n1[11]),toggle_class(e1,"sticky",n1[1]==="sticky")},m(c1,u1){insert$1(c1,e1,u1),mount_component(t1,e1,null),n1[33](e1),insert$1(c1,r1,u1),mount_component(o1,c1,u1),a1=!0},p(c1,u1){const f1={};u1[0]&1&&(f1.width=c1[0].width),u1[0]&1&&(f1.left=c1[0].left),u1[0]&533|u1[1]&512&&(f1.$$scope={dirty:u1,ctx:c1}),t1.$set(f1),(!a1||u1[0]&1)&&set_style(e1,"flex","0 0 "+c1[0].width+"px"),(!a1||u1[0]&16)&&toggle_class(e1,"open",c1[4]),(!a1||u1[0]&3072)&&toggle_class(e1,"disabled",c1[10]||c1[11]),(!a1||u1[0]&2)&&toggle_class(e1,"sticky",c1[1]==="sticky");const p1={};u1[0]&8&&(p1.anchor=c1[3]),u1[0]&4583|u1[1]&512&&(p1.$$scope={dirty:u1,ctx:c1}),!i1&&u1[0]&16&&(i1=!0,p1.open=c1[4],add_flush_callback(()=>i1=!1)),o1.$set(p1)},i(c1){a1||(transition_in(t1.$$.fragment,c1),transition_in(o1.$$.fragment,c1),a1=!0)},o(c1){transition_out(t1.$$.fragment,c1),transition_out(o1.$$.fragment,c1),a1=!1},d(c1){c1&&detach(e1),destroy_component(t1),n1[33](null),c1&&detach(r1),destroy_component(o1,c1)}}}function instance$7q(n1,e1,t1){let r1,o1,i1,a1,s1,l1,c1,u1,f1,p1,{column:d1}=e1,{idx:m1}=e1,{orderable:_1=!0}=e1;const{reorder:h1,isReordering:b1,isResizing:$1,rand:y1,sort:k1,renderedColumns:S1,dispatch:A1,config:C1,ui:E1,columns:T1}=getContext("grid");component_subscribe(n1,b1,c0=>t1(10,u1=c0)),component_subscribe(n1,$1,c0=>t1(11,f1=c0)),component_subscribe(n1,k1,c0=>t1(2,c1=c0)),component_subscribe(n1,S1,c0=>t1(31,l1=c0)),component_subscribe(n1,C1,c0=>t1(12,p1=c0));const I1=["link","array","attachment","boolean","formula","json"];let N1,j1=!1,V1;const B1=()=>{A1("edit-column",d1.schema),t1(4,j1=!1)},D1=c0=>{c0.button===0&&_1&&(V1=setTimeout(()=>{h1.actions.startReordering(d1.name,c0)},200))},F1=c0=>{c0.button===0&&_1&&clearTimeout(V1)},U1=c0=>{c0.preventDefault(),E1.actions.blur(),t1(4,j1=!j1)},G1=()=>{k1.set({column:d1.name,order:"ascending"}),t1(4,j1=!1)},K1=()=>{k1.set({column:d1.name,order:"descending"}),t1(4,j1=!1)},q1=()=>{h1.actions.moveColumnLeft(d1.name),t1(4,j1=!1)},J1=()=>{h1.actions.moveColumnRight(d1.name),t1(4,j1=!1)},X1=()=>{T1.actions.changePrimaryDisplay(d1.name),t1(4,j1=!1)},W1=()=>{T1.update(c0=>{const e0=c0.findIndex($0=>$0.name===d1.name);return c0[e0].visible=!1,c0.slice()}),T1.actions.saveChanges(),t1(4,j1=!1)},a0=()=>t1(4,j1=!0);function f0(c0){binding_callbacks[c0?"unshift":"push"](()=>{N1=c0,t1(3,N1)})}function n0(c0){j1=c0,t1(4,j1)}return n1.$$set=c0=>{"column"in c0&&t1(0,d1=c0.column),"idx"in c0&&t1(1,m1=c0.idx),"orderable"in c0&&t1(30,_1=c0.orderable)},n1.$$.update=()=>{var c0,e0;n1.$$.dirty[0]&5&&t1(9,r1=d1.name===c1.column),n1.$$.dirty[0]&1073741826&&t1(8,o1=_1&&m1>0),n1.$$.dirty[0]&1073741826|n1.$$.dirty[1]&1&&t1(7,i1=_1&&m1<l1.length-1),n1.$$.dirty[0]&1&&t1(6,a1=((c0=d1.schema)==null?void 0:c0.type)==="number"?"low-high":"A-Z"),n1.$$.dirty[0]&1&&t1(5,s1=((e0=d1.schema)==null?void 0:e0.type)==="number"?"high-low":"Z-A")},[d1,m1,c1,N1,j1,s1,a1,i1,o1,r1,u1,f1,p1,b1,$1,y1,k1,S1,C1,I1,B1,D1,F1,U1,G1,K1,q1,J1,X1,W1,_1,l1,a0,f0,n0]}class HeaderCell extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7q,create_fragment$7g,safe_not_equal,{column:0,idx:1,orderable:30},null,[-1,-1])}}const HeaderRow_svelte_svelte_type_style_lang="";function get_each_context$1o(n1,e1,t1){const r1=n1.slice();return r1[15]=e1[t1],r1[17]=t1,r1}function create_each_block$1o(n1){let e1,t1;return e1=new HeaderCell({props:{column:n1[15],idx:n1[17]}}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},p(r1,o1){const i1={};o1&1&&(i1.column=r1[15]),e1.$set(i1)},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_default_slot$4U(n1){let e1,t1,r1=n1[0],o1=[];for(let a1=0;a1<r1.length;a1+=1)o1[a1]=create_each_block$1o(get_each_context$1o(n1,r1,a1));const i1=a1=>transition_out(o1[a1],1,1,()=>{o1[a1]=null});return{c(){e1=element("div");for(let a1=0;a1<o1.length;a1+=1)o1[a1].c();attr(e1,"class","row svelte-1iq0pnk")},m(a1,s1){insert$1(a1,e1,s1);for(let l1=0;l1<o1.length;l1+=1)o1[l1].m(e1,null);t1=!0},p(a1,s1){if(s1&1){r1=a1[0];let l1;for(l1=0;l1<r1.length;l1+=1){const c1=get_each_context$1o(a1,r1,l1);o1[l1]?(o1[l1].p(c1,s1),transition_in(o1[l1],1)):(o1[l1]=create_each_block$1o(c1),o1[l1].c(),transition_in(o1[l1],1),o1[l1].m(e1,null))}for(group_outros(),l1=r1.length;l1<o1.length;l1+=1)i1(l1);check_outros()}},i(a1){if(!t1){for(let s1=0;s1<r1.length;s1+=1)transition_in(o1[s1]);t1=!0}},o(a1){o1=o1.filter(Boolean);for(let s1=0;s1<o1.length;s1+=1)transition_out(o1[s1]);t1=!1},d(a1){a1&&detach(e1),destroy_each(o1,a1)}}}function create_if_block$3c(n1){let e1,t1,r1,o1,i1;return t1=new Icon({props:{name:"Add"}}),{c(){e1=element("div"),create_component(t1.$$.fragment),attr(e1,"class","add svelte-1iq0pnk"),set_style(e1,"left",n1[1]+"px")},m(a1,s1){insert$1(a1,e1,s1),mount_component(t1,e1,null),r1=!0,o1||(i1=listen(e1,"click",n1[14]),o1=!0)},p(a1,s1){(!r1||s1&2)&&set_style(e1,"left",a1[1]+"px")},i(a1){r1||(transition_in(t1.$$.fragment,a1),r1=!0)},o(a1){transition_out(t1.$$.fragment,a1),r1=!1},d(a1){a1&&detach(e1),destroy_component(t1),o1=!1,i1()}}}function create_fragment$7f(n1){let e1,t1,r1,o1;t1=new GridScrollWrapper({props:{scrollHorizontally:!0,$$slots:{default:[create_default_slot$4U]},$$scope:{ctx:n1}}});let i1=n1[2].allowSchemaChanges&&create_if_block$3c(n1);return{c(){e1=element("div"),create_component(t1.$$.fragment),r1=space$1(),i1&&i1.c(),attr(e1,"class","header svelte-1iq0pnk")},m(a1,s1){insert$1(a1,e1,s1),mount_component(t1,e1,null),append$1(e1,r1),i1&&i1.m(e1,null),o1=!0},p(a1,[s1]){const l1={};s1&262145&&(l1.$$scope={dirty:s1,ctx:a1}),t1.$set(l1),a1[2].allowSchemaChanges?i1?(i1.p(a1,s1),s1&4&&transition_in(i1,1)):(i1=create_if_block$3c(a1),i1.c(),transition_in(i1,1),i1.m(e1,null)):i1&&(group_outros(),transition_out(i1,1,1,()=>{i1=null}),check_outros())},i(a1){o1||(transition_in(t1.$$.fragment,a1),transition_in(i1),o1=!0)},o(a1){transition_out(t1.$$.fragment,a1),transition_out(i1),o1=!1},d(a1){a1&&detach(e1),destroy_component(t1),i1&&i1.d()}}}function instance$7p(n1,e1,t1){let r1,o1,i1,a1,s1,l1,c1,u1;const{renderedColumns:f1,dispatch:p1,scroll:d1,hiddenColumnsWidth:m1,width:_1,config:h1}=getContext("grid");component_subscribe(n1,f1,$1=>t1(0,c1=$1)),component_subscribe(n1,d1,$1=>t1(12,s1=$1)),component_subscribe(n1,m1,$1=>t1(13,l1=$1)),component_subscribe(n1,_1,$1=>t1(11,a1=$1)),component_subscribe(n1,h1,$1=>t1(2,u1=$1));const b1=()=>p1("add-column");return n1.$$.update=()=>{n1.$$.dirty&1&&t1(10,r1=c1.reduce(($1,y1)=>$1+=y1.width,0)),n1.$$.dirty&13312&&t1(9,o1=l1+r1-1-s1.left),n1.$$.dirty&2560&&t1(1,i1=Math.min(a1-40,o1))},[c1,i1,u1,f1,p1,d1,m1,_1,h1,o1,r1,a1,s1,l1,b1]}class HeaderRow extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7p,create_fragment$7f,safe_not_equal,{})}}const ScrollOverlay_svelte_svelte_type_style_lang="";function create_if_block_1$1R(n1){let e1,t1,r1;return{c(){e1=element("div"),attr(e1,"class","v-scrollbar svelte-131qly2"),set_style(e1,"--size",ScrollBarSize+"px"),set_style(e1,"top",n1[5]+"px"),set_style(e1,"height",n1[3]+"px"),toggle_class(e1,"dragging",n1[0])},m(o1,i1){insert$1(o1,e1,i1),t1||(r1=listen(e1,"mousedown",n1[19]),t1=!0)},p(o1,i1){i1[0]&32&&set_style(e1,"top",o1[5]+"px"),i1[0]&8&&set_style(e1,"height",o1[3]+"px"),i1[0]&1&&toggle_class(e1,"dragging",o1[0])},d(o1){o1&&detach(e1),t1=!1,r1()}}}function create_if_block$3b(n1){let e1,t1,r1;return{c(){e1=element("div"),attr(e1,"class","h-scrollbar svelte-131qly2"),set_style(e1,"--size",ScrollBarSize+"px"),set_style(e1,"left",n1[4]+"px"),set_style(e1,"width",n1[2]+"px"),toggle_class(e1,"dragging",n1[1])},m(o1,i1){insert$1(o1,e1,i1),t1||(r1=listen(e1,"mousedown",n1[20]),t1=!0)},p(o1,i1){i1[0]&16&&set_style(e1,"left",o1[4]+"px"),i1[0]&4&&set_style(e1,"width",o1[2]+"px"),i1[0]&2&&toggle_class(e1,"dragging",o1[1])},d(o1){o1&&detach(e1),t1=!1,r1()}}}function create_fragment$7e(n1){let e1,t1,r1=n1[6]&&create_if_block_1$1R(n1),o1=n1[7]&&create_if_block$3b(n1);return{c(){r1&&r1.c(),e1=space$1(),o1&&o1.c(),t1=empty$1()},m(i1,a1){r1&&r1.m(i1,a1),insert$1(i1,e1,a1),o1&&o1.m(i1,a1),insert$1(i1,t1,a1)},p(i1,a1){i1[6]?r1?r1.p(i1,a1):(r1=create_if_block_1$1R(i1),r1.c(),r1.m(e1.parentNode,e1)):r1&&(r1.d(1),r1=null),i1[7]?o1?o1.p(i1,a1):(o1=create_if_block$3b(i1),o1.c(),o1.m(t1.parentNode,t1)):o1&&(o1.d(1),o1=null)},i:noop$5,o:noop$5,d(i1){r1&&r1.d(i1),i1&&detach(e1),o1&&o1.d(i1),i1&&detach(t1)}}}function instance$7o(n1,e1,t1){let r1,o1,i1,a1,s1,l1,c1,u1,f1,p1,d1,m1,_1,h1,b1,$1,y1,k1,S1;const{scroll:A1,contentHeight:C1,maxScrollTop:E1,contentWidth:T1,maxScrollLeft:I1,screenWidth:N1,showHScrollbar:j1,showVScrollbar:V1,scrollLeft:B1,scrollTop:D1,height:F1,isDragging:U1,menu:G1}=getContext("grid");component_subscribe(n1,C1,E0=>t1(31,$1=E0)),component_subscribe(n1,E1,E0=>t1(27,d1=E0)),component_subscribe(n1,T1,E0=>t1(29,h1=E0)),component_subscribe(n1,I1,E0=>t1(25,f1=E0)),component_subscribe(n1,N1,E0=>t1(30,b1=E0)),component_subscribe(n1,j1,E0=>t1(7,S1=E0)),component_subscribe(n1,V1,E0=>t1(6,k1=E0)),component_subscribe(n1,B1,E0=>t1(26,p1=E0)),component_subscribe(n1,D1,E0=>t1(28,m1=E0)),component_subscribe(n1,F1,E0=>t1(32,y1=E0)),component_subscribe(n1,G1,E0=>t1(35,_1=E0));let K1,q1,J1=!1,X1=!1;const W1=()=>{_1.visible&&G1.actions.close()},a0=E0=>{E0.preventDefault(),K1=E0.clientY,q1=m1,document.addEventListener("mousemove",f0),document.addEventListener("mouseup",n0),t1(0,J1=!0),W1()},f0=domDebounce(E0=>{const w0=(E0.clientY-K1)/i1,B0=q1+w0*d1;A1.update(N0=>({...N0,top:Math.max(0,Math.min(B0,d1))}))}),n0=()=>{document.removeEventListener("mousemove",f0),document.removeEventListener("mouseup",n0),t1(0,J1=!1)},c0=E0=>{E0.preventDefault(),K1=E0.clientX,q1=p1,document.addEventListener("mousemove",e0),document.addEventListener("mouseup",$0),t1(1,X1=!0),W1()},e0=domDebounce(E0=>{const w0=(E0.clientX-K1)/c1,B0=q1+w0*f1;A1.update(N0=>({...N0,left:Math.max(0,Math.min(B0,f1))}))}),$0=()=>{document.removeEventListener("mousemove",e0),document.removeEventListener("mouseup",$0),t1(1,X1=!1)};return n1.$$.update=()=>{n1.$$.dirty[0]&3&&U1.set(J1||X1),n1.$$.dirty[1]&2&&t1(24,r1=y1-2*ScrollBarSize),n1.$$.dirty[0]&16777216|n1.$$.dirty[1]&3&&t1(3,o1=Math.max(50,y1/$1*r1)),n1.$$.dirty[0]&16777224&&t1(22,i1=r1-o1),n1.$$.dirty[0]&406847488&&t1(5,a1=ScrollBarSize+DefaultRowHeight+i1*(m1/d1)),n1.$$.dirty[0]&1073741824&&t1(23,s1=b1-2*ScrollBarSize),n1.$$.dirty[0]&1619001344&&t1(2,l1=Math.max(50,b1/h1*s1)),n1.$$.dirty[0]&8388612&&t1(21,c1=s1-l1),n1.$$.dirty[0]&102760448&&t1(4,u1=ScrollBarSize+c1*(p1/f1))},[J1,X1,l1,o1,u1,a1,k1,S1,C1,E1,T1,I1,N1,j1,V1,B1,D1,F1,G1,a0,c0,c1,i1,s1,r1,f1,p1,d1,m1,h1,b1,$1,y1]}class ScrollOverlay extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7o,create_fragment$7e,safe_not_equal,{},null,[-1,-1])}}const MenuOverlay_svelte_svelte_type_style_lang="";function create_if_block$3a(n1){let e1,t1,r1,o1,i1;return t1=new Menu$1({props:{$$slots:{default:[create_default_slot$4T]},$$scope:{ctx:n1}}}),{c(){e1=element("div"),create_component(t1.$$.fragment),attr(e1,"class","menu svelte-15s42d0"),attr(e1,"style",n1[2])},m(a1,s1){insert$1(a1,e1,s1),mount_component(t1,e1,null),r1=!0,o1||(i1=action_destroyer(clickOutside.call(null,e1,n1[26])),o1=!0)},p(a1,s1){const l1={};s1[0]&122|s1[1]&4&&(l1.$$scope={dirty:s1,ctx:a1}),t1.$set(l1),(!r1||s1[0]&4)&&attr(e1,"style",a1[2])},i(a1){r1||(transition_in(t1.$$.fragment,a1),r1=!0)},o(a1){transition_out(t1.$$.fragment,a1),r1=!1},d(a1){a1&&detach(e1),destroy_component(t1),o1=!1,i1()}}}function create_default_slot_7$L(n1){let e1;return{c(){e1=text("Copy")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_default_slot_6$X(n1){let e1;return{c(){e1=text("Paste")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_default_slot_5$1b(n1){let e1;return{c(){e1=text("Edit row in modal")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_default_slot_4$1u(n1){let e1;return{c(){e1=text("Copy row _id")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_default_slot_3$22(n1){let e1;return{c(){e1=text("Copy row _rev")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_default_slot_2$2E(n1){let e1;return{c(){e1=text("Duplicate row")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_default_slot_1$3B(n1){let e1;return{c(){e1=text("Delete row")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_default_slot$4T(n1){var _1,h1,b1;let e1,t1,r1,o1,i1,a1,s1,l1,c1,u1,f1,p1,d1,m1;return e1=new Item({props:{icon:"Copy",$$slots:{default:[create_default_slot_7$L]},$$scope:{ctx:n1}}}),e1.$on("click",n1[14].actions.copy),e1.$on("click",n1[8].actions.close),r1=new Item({props:{icon:"Paste",disabled:n1[4]==null||((_1=n1[5])==null?void 0:_1.isReadonly()),$$slots:{default:[create_default_slot_6$X]},$$scope:{ctx:n1}}}),r1.$on("click",n1[14].actions.paste),r1.$on("click",n1[8].actions.close),i1=new Item({props:{icon:"Maximize",disabled:n1[1]||!n1[6].allowEditRows||!n1[6].allowExpandRows,$$slots:{default:[create_default_slot_5$1b]},$$scope:{ctx:n1}}}),i1.$on("click",n1[23]),i1.$on("click",n1[8].actions.close),s1=new Item({props:{icon:"Copy",disabled:n1[1]||!((h1=n1[3])!=null&&h1._id),$$slots:{default:[create_default_slot_4$1u]},$$scope:{ctx:n1}}}),s1.$on("click",n1[24]),s1.$on("click",n1[8].actions.close),c1=new Item({props:{icon:"Copy",disabled:n1[1]||!((b1=n1[3])!=null&&b1._rev),$$slots:{default:[create_default_slot_3$22]},$$scope:{ctx:n1}}}),c1.$on("click",n1[25]),c1.$on("click",n1[8].actions.close),f1=new Item({props:{icon:"Duplicate",disabled:n1[1]||!n1[6].allowAddRows,$$slots:{default:[create_default_slot_2$2E]},$$scope:{ctx:n1}}}),f1.$on("click",n1[20]),d1=new Item({props:{icon:"Delete",disabled:n1[1]||!n1[6].allowDeleteRows,$$slots:{default:[create_default_slot_1$3B]},$$scope:{ctx:n1}}}),d1.$on("click",n1[19]),{c(){create_component(e1.$$.fragment),t1=space$1(),create_component(r1.$$.fragment),o1=space$1(),create_component(i1.$$.fragment),a1=space$1(),create_component(s1.$$.fragment),l1=space$1(),create_component(c1.$$.fragment),u1=space$1(),create_component(f1.$$.fragment),p1=space$1(),create_component(d1.$$.fragment)},m($1,y1){mount_component(e1,$1,y1),insert$1($1,t1,y1),mount_component(r1,$1,y1),insert$1($1,o1,y1),mount_component(i1,$1,y1),insert$1($1,a1,y1),mount_component(s1,$1,y1),insert$1($1,l1,y1),mount_component(c1,$1,y1),insert$1($1,u1,y1),mount_component(f1,$1,y1),insert$1($1,p1,y1),mount_component(d1,$1,y1),m1=!0},p($1,y1){var N1,j1,V1;const k1={};y1[1]&4&&(k1.$$scope={dirty:y1,ctx:$1}),e1.$set(k1);const S1={};y1[0]&48&&(S1.disabled=$1[4]==null||((N1=$1[5])==null?void 0:N1.isReadonly())),y1[1]&4&&(S1.$$scope={dirty:y1,ctx:$1}),r1.$set(S1);const A1={};y1[0]&66&&(A1.disabled=$1[1]||!$1[6].allowEditRows||!$1[6].allowExpandRows),y1[1]&4&&(A1.$$scope={dirty:y1,ctx:$1}),i1.$set(A1);const C1={};y1[0]&10&&(C1.disabled=$1[1]||!((j1=$1[3])!=null&&j1._id)),y1[1]&4&&(C1.$$scope={dirty:y1,ctx:$1}),s1.$set(C1);const E1={};y1[0]&10&&(E1.disabled=$1[1]||!((V1=$1[3])!=null&&V1._rev)),y1[1]&4&&(E1.$$scope={dirty:y1,ctx:$1}),c1.$set(E1);const T1={};y1[0]&66&&(T1.disabled=$1[1]||!$1[6].allowAddRows),y1[1]&4&&(T1.$$scope={dirty:y1,ctx:$1}),f1.$set(T1);const I1={};y1[0]&66&&(I1.disabled=$1[1]||!$1[6].allowDeleteRows),y1[1]&4&&(I1.$$scope={dirty:y1,ctx:$1}),d1.$set(I1)},i($1){m1||(transition_in(e1.$$.fragment,$1),transition_in(r1.$$.fragment,$1),transition_in(i1.$$.fragment,$1),transition_in(s1.$$.fragment,$1),transition_in(c1.$$.fragment,$1),transition_in(f1.$$.fragment,$1),transition_in(d1.$$.fragment,$1),m1=!0)},o($1){transition_out(e1.$$.fragment,$1),transition_out(r1.$$.fragment,$1),transition_out(i1.$$.fragment,$1),transition_out(s1.$$.fragment,$1),transition_out(c1.$$.fragment,$1),transition_out(f1.$$.fragment,$1),transition_out(d1.$$.fragment,$1),m1=!1},d($1){destroy_component(e1,$1),$1&&detach(t1),destroy_component(r1,$1),$1&&detach(o1),destroy_component(i1,$1),$1&&detach(a1),destroy_component(s1,$1),$1&&detach(l1),destroy_component(c1,$1),$1&&detach(u1),destroy_component(f1,$1),$1&&detach(p1),destroy_component(d1,$1)}}}function create_fragment$7d(n1){let e1,t1,r1=n1[0].visible&&create_if_block$3a(n1);return{c(){r1&&r1.c(),e1=empty$1()},m(o1,i1){r1&&r1.m(o1,i1),insert$1(o1,e1,i1),t1=!0},p(o1,i1){o1[0].visible?r1?(r1.p(o1,i1),i1[0]&1&&transition_in(r1,1)):(r1=create_if_block$3a(o1),r1.c(),transition_in(r1,1),r1.m(e1.parentNode,e1)):r1&&(group_outros(),transition_out(r1,1,1,()=>{r1=null}),check_outros())},i(o1){t1||(transition_in(r1),t1=!0)},o(o1){transition_out(r1),t1=!1},d(o1){r1&&r1.d(o1),o1&&detach(e1)}}}function instance$7n(n1,e1,t1){let r1,o1,i1,a1,s1,l1,c1,u1,f1,p1,d1,m1;const{focusedRow:_1,menu:h1,rows:b1,columns:$1,focusedCellId:y1,stickyColumn:k1,config:S1,copiedCell:A1,clipboard:C1,dispatch:E1,focusedCellAPI:T1,focusedRowId:I1,notifications:N1}=getContext("grid");component_subscribe(n1,_1,q1=>t1(3,c1=q1)),component_subscribe(n1,h1,q1=>t1(0,f1=q1)),component_subscribe(n1,$1,q1=>t1(29,s1=q1)),component_subscribe(n1,y1,q1=>t1(28,a1=q1)),component_subscribe(n1,k1,q1=>t1(30,l1=q1)),component_subscribe(n1,S1,q1=>t1(6,m1=q1)),component_subscribe(n1,A1,q1=>t1(4,p1=q1)),component_subscribe(n1,T1,q1=>t1(5,d1=q1)),component_subscribe(n1,I1,q1=>t1(22,u1=q1)),component_subscribe(n1,N1,q1=>t1(27,i1=q1));const j1=q1=>`left:${q1.left}px; top:${q1.top}px;`,V1=()=>{b1.actions.deleteRows([c1]),h1.actions.close(),i1.success("Deleted 1 row")},B1=async()=>{h1.actions.close();const q1=await b1.actions.duplicateRow(c1);if(q1){const J1=(l1==null?void 0:l1.name)||s1[0].name;set_store_value(y1,a1=`${q1._id}-${J1}`,a1)}},D1=async q1=>{await copyToClipboard(q1),i1.success("Copied to clipboard")},F1=()=>E1("edit-row",c1),U1=()=>D1(c1==null?void 0:c1._id),G1=()=>D1(c1==null?void 0:c1._rev),K1=()=>h1.actions.close();return n1.$$.update=()=>{n1.$$.dirty[0]&1&&t1(2,r1=j1(f1)),n1.$$.dirty[0]&4194304&&t1(1,o1=u1===NewRowID)},[f1,o1,r1,c1,p1,d1,m1,_1,h1,$1,y1,k1,S1,A1,C1,E1,T1,I1,N1,V1,B1,D1,u1,F1,U1,G1,K1]}class MenuOverlay extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7n,create_fragment$7d,safe_not_equal,{},null,[-1,-1])}}const GutterCell_svelte_svelte_type_style_lang="";function create_else_block_1$g(n1){let e1,t1,r1,o1,i1,a1,s1;t1=new Checkbox_1({props:{value:n1[3],disabled:n1[7]}});let l1=!n1[5]&&create_if_block_2$18(n1);return{c(){e1=element("div"),create_component(t1.$$.fragment),r1=space$1(),l1&&l1.c(),o1=empty$1(),attr(e1,"class","checkbox svelte-f4b1oc"),toggle_class(e1,"visible",n1[8].allowDeleteRows&&(n1[5]||n1[3]||n1[2]||n1[1]))},m(c1,u1){insert$1(c1,e1,u1),mount_component(t1,e1,null),insert$1(c1,r1,u1),l1&&l1.m(c1,u1),insert$1(c1,o1,u1),i1=!0,a1||(s1=listen(e1,"click",n1[12]),a1=!0)},p(c1,u1){const f1={};u1&8&&(f1.value=c1[3]),u1&128&&(f1.disabled=c1[7]),t1.$set(f1),(!i1||u1&302)&&toggle_class(e1,"visible",c1[8].allowDeleteRows&&(c1[5]||c1[3]||c1[2]||c1[1])),c1[5]?l1&&(l1.d(1),l1=null):l1?l1.p(c1,u1):(l1=create_if_block_2$18(c1),l1.c(),l1.m(o1.parentNode,o1))},i(c1){i1||(transition_in(t1.$$.fragment,c1),i1=!0)},o(c1){transition_out(t1.$$.fragment,c1),i1=!1},d(c1){c1&&detach(e1),destroy_component(t1),c1&&detach(r1),l1&&l1.d(c1),c1&&detach(o1),a1=!1,s1()}}}function create_if_block_1$1Q(n1){let e1;const t1=n1[14].default,r1=create_slot(t1,n1,n1[17],null);return{c(){r1&&r1.c()},m(o1,i1){r1&&r1.m(o1,i1),e1=!0},p(o1,i1){r1&&r1.p&&(!e1||i1&131072)&&update_slot_base(r1,t1,o1,o1[17],e1?get_slot_changes(t1,o1[17],i1,null):get_all_dirty_from_scope(o1[17]),null)},i(o1){e1||(transition_in(r1,o1),e1=!0)},o(o1){transition_out(r1,o1),e1=!1},d(o1){r1&&r1.d(o1)}}}function create_if_block_2$18(n1){let e1,t1=n1[0].__idx+1+"",r1;return{c(){e1=element("div"),r1=text(t1),attr(e1,"class","number svelte-f4b1oc"),toggle_class(e1,"visible",!n1[8].allowDeleteRows||!(n1[3]||n1[2]||n1[1]))},m(o1,i1){insert$1(o1,e1,i1),append$1(e1,r1)},p(o1,i1){i1&1&&t1!==(t1=o1[0].__idx+1+"")&&set_data(r1,t1),i1&270&&toggle_class(e1,"visible",!o1[8].allowDeleteRows||!(o1[3]||o1[2]||o1[1]))},d(o1){o1&&detach(e1)}}}function create_else_block$16(n1){let e1,t1,r1;return t1=new Icon({props:{size:"S",name:"Maximize",hoverable:!0}}),t1.$on("click",n1[16]),{c(){e1=element("div"),create_component(t1.$$.fragment),attr(e1,"class","expand svelte-f4b1oc"),toggle_class(e1,"visible",n1[8].allowExpandRows&&n1[4])},m(o1,i1){insert$1(o1,e1,i1),mount_component(t1,e1,null),r1=!0},p(o1,i1){(!r1||i1&272)&&toggle_class(e1,"visible",o1[8].allowExpandRows&&o1[4])},i(o1){r1||(transition_in(t1.$$.fragment,o1),r1=!0)},o(o1){transition_out(t1.$$.fragment,o1),r1=!1},d(o1){o1&&detach(e1),destroy_component(t1)}}}function create_if_block$39(n1){let e1,t1,r1,o1,i1;return t1=new Icon({props:{name:"Delete",size:"S",color:"var(--spectrum-global-color-red-400)"}}),{c(){e1=element("div"),create_component(t1.$$.fragment),attr(e1,"class","delete svelte-f4b1oc")},m(a1,s1){insert$1(a1,e1,s1),mount_component(t1,e1,null),r1=!0,o1||(i1=listen(e1,"click",n1[15]),o1=!0)},p:noop$5,i(a1){r1||(transition_in(t1.$$.fragment,a1),r1=!0)},o(a1){transition_out(t1.$$.fragment,a1),r1=!1},d(a1){a1&&detach(e1),destroy_component(t1),o1=!1,i1()}}}function create_default_slot$4S(n1){let e1,t1,r1,o1,i1,a1,s1;const l1=[create_if_block_1$1Q,create_else_block_1$g],c1=[];function u1(m1,_1){return m1[13].default?0:1}t1=u1(n1),r1=c1[t1]=l1[t1](n1);const f1=[create_if_block$39,create_else_block$16],p1=[];function d1(m1,_1){return m1[3]&&m1[8].allowDeleteRows?0:1}return i1=d1(n1),a1=p1[i1]=f1[i1](n1),{c(){e1=element("div"),r1.c(),o1=space$1(),a1.c(),attr(e1,"class","gutter svelte-f4b1oc")},m(m1,_1){insert$1(m1,e1,_1),c1[t1].m(e1,null),append$1(e1,o1),p1[i1].m(e1,null),s1=!0},p(m1,_1){let h1=t1;t1=u1(m1),t1===h1?c1[t1].p(m1,_1):(group_outros(),transition_out(c1[h1],1,1,()=>{c1[h1]=null}),check_outros(),r1=c1[t1],r1?r1.p(m1,_1):(r1=c1[t1]=l1[t1](m1),r1.c()),transition_in(r1,1),r1.m(e1,o1));let b1=i1;i1=d1(m1),i1===b1?p1[i1].p(m1,_1):(group_outros(),transition_out(p1[b1],1,1,()=>{p1[b1]=null}),check_outros(),a1=p1[i1],a1?a1.p(m1,_1):(a1=p1[i1]=f1[i1](m1),a1.c()),transition_in(a1,1),a1.m(e1,null))},i(m1){s1||(transition_in(r1),transition_in(a1),s1=!0)},o(m1){transition_out(r1),transition_out(a1),s1=!1},d(m1){m1&&detach(e1),c1[t1].d(),p1[i1].d()}}}function create_fragment$7c(n1){var r1;let e1,t1;return e1=new GridCell({props:{width:GutterWidth,highlighted:n1[1]||n1[2],selected:n1[3],defaultHeight:n1[6],rowIdx:(r1=n1[0])==null?void 0:r1.__idx,$$slots:{default:[create_default_slot$4S]},$$scope:{ctx:n1}}}),{c(){create_component(e1.$$.fragment)},m(o1,i1){mount_component(e1,o1,i1),t1=!0},p(o1,[i1]){var s1;const a1={};i1&6&&(a1.highlighted=o1[1]||o1[2]),i1&8&&(a1.selected=o1[3]),i1&64&&(a1.defaultHeight=o1[6]),i1&1&&(a1.rowIdx=(s1=o1[0])==null?void 0:s1.__idx),i1&139711&&(a1.$$scope={dirty:i1,ctx:o1}),e1.$set(a1)},i(o1){t1||(transition_in(e1.$$.fragment,o1),t1=!0)},o(o1){transition_out(e1.$$.fragment,o1),t1=!1},d(o1){destroy_component(e1,o1)}}}function instance$7m(n1,e1,t1){let r1,{$$slots:o1={},$$scope:i1}=e1;const a1=compute_slots(o1);let{row:s1}=e1,{rowFocused:l1=!1}=e1,{rowHovered:c1=!1}=e1,{rowSelected:u1=!1}=e1,{expandable:f1=!1}=e1,{disableNumber:p1=!1}=e1,{defaultHeight:d1=!1}=e1,{disabled:m1=!1}=e1;const{config:_1,dispatch:h1,selectedRows:b1}=getContext("grid");component_subscribe(n1,_1,A1=>t1(8,r1=A1));const $1=createEventDispatcher(),y1=()=>{$1("select");const A1=s1==null?void 0:s1._id;A1&&b1.actions.toggleRow(A1)},k1=()=>h1("request-bulk-delete"),S1=()=>$1("expand");return n1.$$set=A1=>{"row"in A1&&t1(0,s1=A1.row),"rowFocused"in A1&&t1(1,l1=A1.rowFocused),"rowHovered"in A1&&t1(2,c1=A1.rowHovered),"rowSelected"in A1&&t1(3,u1=A1.rowSelected),"expandable"in A1&&t1(4,f1=A1.expandable),"disableNumber"in A1&&t1(5,p1=A1.disableNumber),"defaultHeight"in A1&&t1(6,d1=A1.defaultHeight),"disabled"in A1&&t1(7,m1=A1.disabled),"$$scope"in A1&&t1(17,i1=A1.$$scope)},[s1,l1,c1,u1,f1,p1,d1,m1,r1,_1,h1,$1,y1,a1,o1,k1,S1,i1]}class GutterCell extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7m,create_fragment$7c,safe_not_equal,{row:0,rowFocused:1,rowHovered:2,rowSelected:3,expandable:4,disableNumber:5,defaultHeight:6,disabled:7})}}const KeyboardShortcut_svelte_svelte_type_style_lang="";function get_each_context$1n(n1,e1,t1){const r1=n1.slice();return r1[5]=e1[t1],r1}function create_each_block$1n(n1){let e1,t1=n1[5]+"",r1,o1;return{c(){e1=element("div"),r1=text(t1),o1=space$1(),attr(e1,"class","key svelte-uhg3e3")},m(i1,a1){insert$1(i1,e1,a1),append$1(e1,r1),append$1(e1,o1)},p(i1,a1){a1&4&&t1!==(t1=i1[5]+"")&&set_data(r1,t1)},d(i1){i1&&detach(e1)}}}function create_fragment$7b(n1){let e1,t1=n1[2],r1=[];for(let o1=0;o1<t1.length;o1+=1)r1[o1]=create_each_block$1n(get_each_context$1n(n1,t1,o1));return{c(){e1=element("div");for(let o1=0;o1<r1.length;o1+=1)r1[o1].c();attr(e1,"class","keys svelte-uhg3e3"),toggle_class(e1,"padded",n1[0]),toggle_class(e1,"overlay",n1[1])},m(o1,i1){insert$1(o1,e1,i1);for(let a1=0;a1<r1.length;a1+=1)r1[a1].m(e1,null)},p(o1,[i1]){if(i1&4){t1=o1[2];let a1;for(a1=0;a1<t1.length;a1+=1){const s1=get_each_context$1n(o1,t1,a1);r1[a1]?r1[a1].p(s1,i1):(r1[a1]=create_each_block$1n(s1),r1[a1].c(),r1[a1].m(e1,null))}for(;a1<r1.length;a1+=1)r1[a1].d(1);r1.length=t1.length}i1&1&&toggle_class(e1,"padded",o1[0]),i1&2&&toggle_class(e1,"overlay",o1[1])},i:noop$5,o:noop$5,d(o1){o1&&detach(e1),destroy_each(r1,o1)}}}function instance$7l(n1,e1,t1){let r1,{keybind:o1}=e1,{padded:i1=!1}=e1,{overlay:a1=!1}=e1;const s1=l1=>l1==null?void 0:l1.split("+").map(c1=>c1.toLowerCase()==="ctrl"?navigator.platform.startsWith("Mac")?"\u2318":c1:c1.toLowerCase()==="enter"?"\u21B5":c1);return n1.$$set=l1=>{"keybind"in l1&&t1(3,o1=l1.keybind),"padded"in l1&&t1(0,i1=l1.padded),"overlay"in l1&&t1(1,a1=l1.overlay)},n1.$$.update=()=>{n1.$$.dirty&8&&t1(2,r1=s1(o1))},[i1,a1,r1,o1]}class KeyboardShortcut extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7l,create_fragment$7b,safe_not_equal,{keybind:3,padded:0,overlay:1})}}const StickyColumn_svelte_svelte_type_style_lang="";function get_each_context$1m(n1,e1,t1){var l1,c1;const r1=n1.slice();r1[37]=e1[t1],r1[43]=t1;const o1=!!r1[0][r1[37]._id];r1[38]=o1;const i1=r1[7]===r1[37]._id;r1[39]=i1;const a1=((l1=r1[8])==null?void 0:l1._id)===r1[37]._id;r1[40]=a1;const s1=`${r1[37]._id}-${(c1=r1[1])==null?void 0:c1.name}`;return r1[41]=s1,r1}function create_if_block_3$N(n1){let e1,t1;return e1=new HeaderCell({props:{column:n1[1],orderable:!1,idx:"sticky"}}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},p(r1,o1){const i1={};o1[0]&2&&(i1.column=r1[1]),e1.$set(i1)},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_if_block_2$17(n1){let e1,t1;return e1=new DataCell({props:{row:n1[37],cellId:n1[41],rowFocused:n1[40],selected:n1[38],highlighted:n1[39]||n1[40],rowIdx:n1[37].__idx,topRow:n1[43]===0,focused:n1[10]===n1[41],selectedUser:n1[11][n1[41]],width:n1[1].width,column:n1[1],contentLines:n1[12]}}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},p(r1,o1){const i1={};o1[0]&64&&(i1.row=r1[37]),o1[0]&66&&(i1.cellId=r1[41]),o1[0]&320&&(i1.rowFocused=r1[40]),o1[0]&65&&(i1.selected=r1[38]),o1[0]&448&&(i1.highlighted=r1[39]||r1[40]),o1[0]&64&&(i1.rowIdx=r1[37].__idx),o1[0]&1090&&(i1.focused=r1[10]===r1[41]),o1[0]&2114&&(i1.selectedUser=r1[11][r1[41]]),o1[0]&2&&(i1.width=r1[1].width),o1[0]&2&&(i1.column=r1[1]),o1[0]&4096&&(i1.contentLines=r1[12]),e1.$set(i1)},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_each_block$1m(n1){let e1,t1,r1,o1,i1,a1;t1=new GutterCell({props:{row:n1[37],rowFocused:n1[40],rowHovered:n1[39],rowSelected:n1[38]}});let s1=n1[1]&&create_if_block_2$17(n1);function l1(){return n1[31](n1[37])}return{c(){e1=element("div"),create_component(t1.$$.fragment),r1=space$1(),s1&&s1.c(),attr(e1,"class","row svelte-10vx3p")},m(c1,u1){insert$1(c1,e1,u1),mount_component(t1,e1,null),append$1(e1,r1),s1&&s1.m(e1,null),o1=!0,i1||(a1=[listen(e1,"mouseenter",function(){is_function(n1[9]?null:l1)&&(n1[9]?null:l1).apply(this,arguments)}),listen(e1,"mouseleave",function(){is_function(n1[9]?null:n1[32])&&(n1[9]?null:n1[32]).apply(this,arguments)})],i1=!0)},p(c1,u1){n1=c1;const f1={};u1[0]&64&&(f1.row=n1[37]),u1[0]&320&&(f1.rowFocused=n1[40]),u1[0]&192&&(f1.rowHovered=n1[39]),u1[0]&65&&(f1.rowSelected=n1[38]),t1.$set(f1),n1[1]?s1?(s1.p(n1,u1),u1[0]&2&&transition_in(s1,1)):(s1=create_if_block_2$17(n1),s1.c(),transition_in(s1,1),s1.m(e1,null)):s1&&(group_outros(),transition_out(s1,1,1,()=>{s1=null}),check_outros())},i(c1){o1||(transition_in(t1.$$.fragment,c1),transition_in(s1),o1=!0)},o(c1){transition_out(t1.$$.fragment,c1),transition_out(s1),o1=!1},d(c1){c1&&detach(e1),destroy_component(t1),s1&&s1.d(),i1=!1,run_all(a1)}}}function create_if_block$38(n1){let e1,t1,r1,o1,i1,a1;t1=new GutterCell({props:{rowHovered:n1[7]===BlankRowID,$$slots:{default:[create_default_slot_2$2D]},$$scope:{ctx:n1}}});let s1=n1[1]&&create_if_block_1$1P(n1);return{c(){e1=element("div"),create_component(t1.$$.fragment),r1=space$1(),s1&&s1.c(),attr(e1,"class","row new svelte-10vx3p")},m(l1,c1){insert$1(l1,e1,c1),mount_component(t1,e1,null),append$1(e1,r1),s1&&s1.m(e1,null),o1=!0,i1||(a1=[listen(e1,"mouseenter",function(){is_function(n1[9]?null:n1[33])&&(n1[9]?null:n1[33]).apply(this,arguments)}),listen(e1,"mouseleave",function(){is_function(n1[9]?null:n1[34])&&(n1[9]?null:n1[34]).apply(this,arguments)}),listen(e1,"click",n1[35])],i1=!0)},p(l1,c1){n1=l1;const u1={};c1[0]&128&&(u1.rowHovered=n1[7]===BlankRowID),c1[1]&8192&&(u1.$$scope={dirty:c1,ctx:n1}),t1.$set(u1),n1[1]?s1?(s1.p(n1,c1),c1[0]&2&&transition_in(s1,1)):(s1=create_if_block_1$1P(n1),s1.c(),transition_in(s1,1),s1.m(e1,null)):s1&&(group_outros(),transition_out(s1,1,1,()=>{s1=null}),check_outros())},i(l1){o1||(transition_in(t1.$$.fragment,l1),transition_in(s1),o1=!0)},o(l1){transition_out(t1.$$.fragment,l1),transition_out(s1),o1=!1},d(l1){l1&&detach(e1),destroy_component(t1),s1&&s1.d(),i1=!1,run_all(a1)}}}function create_default_slot_2$2D(n1){let e1,t1;return e1=new Icon({props:{name:"Add",color:"var(--spectrum-global-color-gray-500)"}}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},p:noop$5,i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_if_block_1$1P(n1){let e1,t1;return e1=new GridCell({props:{width:n1[1].width,highlighted:n1[7]===BlankRowID,$$slots:{default:[create_default_slot_1$3A]},$$scope:{ctx:n1}}}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},p(r1,o1){const i1={};o1[0]&2&&(i1.width=r1[1].width),o1[0]&128&&(i1.highlighted=r1[7]===BlankRowID),o1[1]&8192&&(i1.$$scope={dirty:o1,ctx:r1}),e1.$set(i1)},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_default_slot_1$3A(n1){let e1,t1;return e1=new KeyboardShortcut({props:{padded:!0,keybind:"Ctrl+Enter"}}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},p:noop$5,i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_default_slot$4R(n1){let e1,t1,r1,o1=n1[6],i1=[];for(let l1=0;l1<o1.length;l1+=1)i1[l1]=create_each_block$1m(get_each_context$1m(n1,o1,l1));const a1=l1=>transition_out(i1[l1],1,1,()=>{i1[l1]=null});let s1=n1[13].allowAddRows&&(n1[14].length||n1[1])&&create_if_block$38(n1);return{c(){for(let l1=0;l1<i1.length;l1+=1)i1[l1].c();e1=space$1(),s1&&s1.c(),t1=empty$1()},m(l1,c1){for(let u1=0;u1<i1.length;u1+=1)i1[u1].m(l1,c1);insert$1(l1,e1,c1),s1&&s1.m(l1,c1),insert$1(l1,t1,c1),r1=!0},p(l1,c1){if(c1[0]&8131){o1=l1[6];let u1;for(u1=0;u1<o1.length;u1+=1){const f1=get_each_context$1m(l1,o1,u1);i1[u1]?(i1[u1].p(f1,c1),transition_in(i1[u1],1)):(i1[u1]=create_each_block$1m(f1),i1[u1].c(),transition_in(i1[u1],1),i1[u1].m(e1.parentNode,e1))}for(group_outros(),u1=o1.length;u1<i1.length;u1+=1)a1(u1);check_outros()}l1[13].allowAddRows&&(l1[14].length||l1[1])?s1?(s1.p(l1,c1),c1[0]&24578&&transition_in(s1,1)):(s1=create_if_block$38(l1),s1.c(),transition_in(s1,1),s1.m(t1.parentNode,t1)):s1&&(group_outros(),transition_out(s1,1,1,()=>{s1=null}),check_outros())},i(l1){if(!r1){for(let c1=0;c1<o1.length;c1+=1)transition_in(i1[c1]);transition_in(s1),r1=!0}},o(l1){i1=i1.filter(Boolean);for(let c1=0;c1<i1.length;c1+=1)transition_out(i1[c1]);transition_out(s1),r1=!1},d(l1){destroy_each(i1,l1),l1&&detach(e1),s1&&s1.d(l1),l1&&detach(t1)}}}function create_fragment$7a(n1){let e1,t1,r1,o1,i1,a1,s1,l1,c1,u1;r1=new GutterCell({props:{disableNumber:!0,defaultHeight:!0,rowSelected:n1[3]&&n1[3]===n1[2],disabled:!n1[6].length}}),r1.$on("select",n1[29]);let f1=n1[1]&&create_if_block_3$N(n1);return s1=new GridScrollWrapper({props:{scrollVertically:!0,wheelInteractive:!0,$$slots:{default:[create_default_slot$4R]},$$scope:{ctx:n1}}}),{c(){e1=element("div"),t1=element("div"),create_component(r1.$$.fragment),o1=space$1(),f1&&f1.c(),i1=space$1(),a1=element("div"),create_component(s1.$$.fragment),attr(t1,"class","header row svelte-10vx3p"),attr(a1,"class","content svelte-10vx3p"),attr(e1,"class","sticky-column svelte-10vx3p"),set_style(e1,"flex","0 0 "+n1[4]+"px"),toggle_class(e1,"scrolled",n1[5]>0)},m(p1,d1){insert$1(p1,e1,d1),append$1(e1,t1),mount_component(r1,t1,null),append$1(t1,o1),f1&&f1.m(t1,null),append$1(e1,i1),append$1(e1,a1),mount_component(s1,a1,null),l1=!0,c1||(u1=listen(a1,"mouseleave",n1[36]),c1=!0)},p(p1,d1){const m1={};d1[0]&12&&(m1.rowSelected=p1[3]&&p1[3]===p1[2]),d1[0]&64&&(m1.disabled=!p1[6].length),r1.$set(m1),p1[1]?f1?(f1.p(p1,d1),d1[0]&2&&transition_in(f1,1)):(f1=create_if_block_3$N(p1),f1.c(),transition_in(f1,1),f1.m(t1,null)):f1&&(group_outros(),transition_out(f1,1,1,()=>{f1=null}),check_outros());const _1={};d1[0]&32707|d1[1]&8192&&(_1.$$scope={dirty:d1,ctx:p1}),s1.$set(_1),(!l1||d1[0]&16)&&set_style(e1,"flex","0 0 "+p1[4]+"px"),(!l1||d1[0]&32)&&toggle_class(e1,"scrolled",p1[5]>0)},i(p1){l1||(transition_in(r1.$$.fragment,p1),transition_in(f1),transition_in(s1.$$.fragment,p1),l1=!0)},o(p1){transition_out(r1.$$.fragment,p1),transition_out(f1),transition_out(s1.$$.fragment,p1),l1=!1},d(p1){p1&&detach(e1),destroy_component(r1),f1&&f1.d(),destroy_component(s1),c1=!1,u1()}}}function instance$7k(n1,e1,t1){let r1,o1,i1,a1,s1,l1,c1,u1,f1,p1,d1,m1,_1,h1,b1,$1;const{rows:y1,selectedRows:k1,stickyColumn:S1,renderedColumns:A1,renderedRows:C1,focusedCellId:E1,hoveredRowId:T1,config:I1,selectedCellMap:N1,focusedRow:j1,scrollLeft:V1,dispatch:B1,contentLines:D1,isDragging:F1}=getContext("grid");component_subscribe(n1,y1,a0=>t1(30,s1=a0)),component_subscribe(n1,k1,a0=>t1(0,a1=a0)),component_subscribe(n1,S1,a0=>t1(1,l1=a0)),component_subscribe(n1,A1,a0=>t1(14,$1=a0)),component_subscribe(n1,C1,a0=>t1(6,u1=a0)),component_subscribe(n1,E1,a0=>t1(10,m1=a0)),component_subscribe(n1,T1,a0=>t1(7,f1=a0)),component_subscribe(n1,I1,a0=>t1(13,b1=a0)),component_subscribe(n1,N1,a0=>t1(11,_1=a0)),component_subscribe(n1,j1,a0=>t1(8,p1=a0)),component_subscribe(n1,V1,a0=>t1(5,c1=a0)),component_subscribe(n1,D1,a0=>t1(12,h1=a0)),component_subscribe(n1,F1,a0=>t1(9,d1=a0));const U1=()=>{if(o1===r1)set_store_value(k1,a1={},a1);else{let f0={};s1.forEach(n0=>{f0[n0._id]=!0}),set_store_value(k1,a1=f0,a1)}},G1=a0=>set_store_value(T1,f1=a0._id,f1),K1=()=>set_store_value(T1,f1=null,f1),q1=()=>set_store_value(T1,f1=BlankRowID,f1),J1=()=>set_store_value(T1,f1=null,f1),X1=()=>B1("add-row-inline"),W1=()=>set_store_value(T1,f1=null,f1);return n1.$$.update=()=>{n1.$$.dirty[0]&1073741824&&t1(2,r1=s1.length),n1.$$.dirty[0]&1&&t1(3,o1=Object.values(a1).length),n1.$$.dirty[0]&2&&t1(4,i1=GutterWidth+((l1==null?void 0:l1.width)||0))},[a1,l1,r1,o1,i1,c1,u1,f1,p1,d1,m1,_1,h1,b1,$1,y1,k1,S1,A1,C1,E1,T1,I1,N1,j1,V1,B1,D1,F1,U1,s1,G1,K1,q1,J1,X1,W1]}class StickyColumn extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7k,create_fragment$7a,safe_not_equal,{},null,[-1,-1])}}const UserAvatars_svelte_svelte_type_style_lang$1="";function get_each_context$1l(n1,e1,t1){const r1=n1.slice();return r1[4]=e1[t1],r1}function create_each_block$1l(n1){let e1,t1;return e1=new UserAvatar({props:{user:n1[4]}}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},p(r1,o1){const i1={};o1&1&&(i1.user=r1[4]),e1.$set(i1)},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_fragment$79(n1){let e1,t1,r1=n1[0],o1=[];for(let a1=0;a1<r1.length;a1+=1)o1[a1]=create_each_block$1l(get_each_context$1l(n1,r1,a1));const i1=a1=>transition_out(o1[a1],1,1,()=>{o1[a1]=null});return{c(){e1=element("div");for(let a1=0;a1<o1.length;a1+=1)o1[a1].c();attr(e1,"class","users svelte-1ex8wrg")},m(a1,s1){insert$1(a1,e1,s1);for(let l1=0;l1<o1.length;l1+=1)o1[l1].m(e1,null);t1=!0},p(a1,[s1]){if(s1&1){r1=a1[0];let l1;for(l1=0;l1<r1.length;l1+=1){const c1=get_each_context$1l(a1,r1,l1);o1[l1]?(o1[l1].p(c1,s1),transition_in(o1[l1],1)):(o1[l1]=create_each_block$1l(c1),o1[l1].c(),transition_in(o1[l1],1),o1[l1].m(e1,null))}for(group_outros(),l1=r1.length;l1<o1.length;l1+=1)i1(l1);check_outros()}},i(a1){if(!t1){for(let s1=0;s1<r1.length;s1+=1)transition_in(o1[s1]);t1=!0}},o(a1){o1=o1.filter(Boolean);for(let s1=0;s1<o1.length;s1+=1)transition_out(o1[s1]);t1=!1},d(a1){a1&&detach(e1),destroy_each(o1,a1)}}}function instance$7j(n1,e1,t1){let r1,o1;const{users:i1}=getContext("grid");component_subscribe(n1,i1,s1=>t1(2,o1=s1));const a1=s1=>{let l1={};return s1==null||s1.forEach(c1=>{l1[c1.email]=c1}),Object.values(l1)};return n1.$$.update=()=>{n1.$$.dirty&4&&t1(0,r1=a1(o1))},[r1,i1,o1]}class UserAvatars$1 extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7j,create_fragment$79,safe_not_equal,{})}}function instance$7i(n1,e1,t1){let r1,o1,i1,a1,s1,l1,c1,u1,f1;const{enrichedRows:p1,focusedCellId:d1,visibleColumns:m1,focusedRow:_1,stickyColumn:h1,focusedCellAPI:b1,clipboard:$1,dispatch:y1,selectedRows:k1,config:S1,menu:A1,gridFocused:C1}=getContext("grid");component_subscribe(n1,p1,K1=>t1(12,a1=K1)),component_subscribe(n1,d1,K1=>t1(11,i1=K1)),component_subscribe(n1,m1,K1=>t1(14,l1=K1)),component_subscribe(n1,_1,K1=>t1(9,r1=K1)),component_subscribe(n1,h1,K1=>t1(13,s1=K1)),component_subscribe(n1,b1,K1=>t1(10,o1=K1)),component_subscribe(n1,k1,K1=>t1(16,u1=K1)),component_subscribe(n1,S1,K1=>t1(15,c1=K1)),component_subscribe(n1,C1,K1=>t1(17,f1=K1));const E1=[".spectrum-Modal","#builder-side-panel-container"],T1=K1=>{var J1,X1,W1,a0;if(!f1)return;if((J1=K1.target)!=null&&J1.closest){for(let f0 of E1)if(K1.target.closest(f0))return}if(!i1){K1.key==="Tab"||((X1=K1.key)==null?void 0:X1.startsWith("Arrow"))?(K1.preventDefault(),I1()):K1.key==="Enter"&&(K1.ctrlKey||K1.metaKey)?c1.allowAddRows&&(K1.preventDefault(),y1("add-row-inline")):(K1.key==="Delete"||K1.key==="Backspace")&&Object.keys(u1).length&&c1.allowDeleteRows&&y1("request-bulk-delete");return}const q1=o1;if(K1.key==="Escape"){q1!=null&&q1.isActive()?setTimeout(q1==null?void 0:q1.blur,10):set_store_value(d1,i1=null,i1),A1.actions.close();return}else if(K1.key==="Tab"){K1.preventDefault(),(W1=q1==null?void 0:q1.blur)==null||W1.call(q1),N1(1);return}if(!(!(q1!=null&&q1.isReadonly())&&((a0=q1==null?void 0:q1.onKeyDown)==null?void 0:a0.call(q1,K1))))if(K1.preventDefault(),K1.metaKey||K1.ctrlKey)switch(K1.key){case"c":$1.actions.copy();break;case"v":q1!=null&&q1.isReadonly()||$1.actions.paste();break;case"Enter":c1.allowAddRows&&y1("add-row-inline")}else switch(K1.key){case"ArrowLeft":N1(-1);break;case"ArrowRight":N1(1);break;case"ArrowUp":j1(-1);break;case"ArrowDown":j1(1);break;case"Delete":case"Backspace":Object.keys(u1).length&&c1.allowDeleteRows?y1("request-bulk-delete"):V1();break;case"Enter":B1();break;case" ":case"Space":c1.allowDeleteRows&&G1();break;default:U1(K1.key,K1.which)}},I1=()=>{const K1=a1[0];if(!K1)return;const q1=s1||l1[0];!q1||d1.set(`${K1._id}-${q1.name}`)},N1=K1=>{var a0,f0;if(!i1)return;const q1=l1,J1=i1.split("-"),X1=J1[1];let W1;if(X1===(s1==null?void 0:s1.name)){const n0=K1-1;W1=(a0=q1[n0])==null?void 0:a0.name}else{const n0=q1.findIndex(c0=>c0.name===X1)+K1;n0===-1?W1=s1==null?void 0:s1.name:W1=(f0=q1[n0])==null?void 0:f0.name}W1&&set_store_value(d1,i1=`${J1[0]}-${W1}`,i1)},j1=K1=>{if(!r1)return;const q1=a1[r1.__idx+K1];if(q1){const J1=i1.split("-");set_store_value(d1,i1=`${q1._id}-${J1[1]}`,i1)}},V1=debounce(()=>{o1!=null&&o1.isReadonly()||o1.setValue(null)},100),B1=()=>{var K1;o1!=null&&o1.isReadonly()||(K1=o1==null?void 0:o1.focus)==null||K1.call(o1)},D1=K1=>K1>=48&&K1<=57,F1=K1=>K1>=65&&K1<=90,U1=(K1,q1)=>{if(o1&&!o1.isReadonly()){const J1=o1.getType();J1==="number"&&D1(q1)?(o1.setValue(parseInt(K1)),o1.focus()):["string","barcodeqr","longform"].includes(J1)&&(F1(q1)||D1(q1))&&(o1.setValue(K1),o1.focus())}},G1=()=>{const K1=r1==null?void 0:r1._id;!K1||K1===NewRowID||k1.actions.toggleRow(K1)};return onMount(()=>(document.addEventListener("keydown",T1),()=>{document.removeEventListener("keydown",T1)})),[p1,d1,m1,_1,h1,b1,k1,S1,C1]}class KeyboardManager extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7i,null,safe_not_equal,{},null,[-1,-1])}}const SortButton_svelte_svelte_type_style_lang="";function create_default_slot_1$3z(n1){let e1;return{c(){e1=text("Sort")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_default_slot$4Q(n1){let e1,t1,r1,o1,i1;return t1=new Select_1$1({props:{placeholder:null,value:n1[1].column,options:n1[0],autoWidth:!0,label:"Column"}}),t1.$on("change",n1[8]),o1=new Select_1$1({props:{placeholder:null,value:n1[1].order,options:n1[4],autoWidth:!0,label:"Order"}}),o1.$on("change",n1[9]),{c(){e1=element("div"),create_component(t1.$$.fragment),r1=space$1(),create_component(o1.$$.fragment),attr(e1,"class","content svelte-1inwx3j")},m(a1,s1){insert$1(a1,e1,s1),mount_component(t1,e1,null),append$1(e1,r1),mount_component(o1,e1,null),i1=!0},p(a1,s1){const l1={};s1&2&&(l1.value=a1[1].column),s1&1&&(l1.options=a1[0]),t1.$set(l1);const c1={};s1&2&&(c1.value=a1[1].order),s1&16&&(c1.options=a1[4]),o1.$set(c1)},i(a1){i1||(transition_in(t1.$$.fragment,a1),transition_in(o1.$$.fragment,a1),i1=!0)},o(a1){transition_out(t1.$$.fragment,a1),transition_out(o1.$$.fragment,a1),i1=!1},d(a1){a1&&detach(e1),destroy_component(t1),destroy_component(o1)}}}function create_fragment$78(n1){let e1,t1,r1,o1,i1,a1;t1=new ActionButton({props:{icon:"SortOrderDown",quiet:!0,size:"M",selected:n1[2],disabled:!n1[0].length,$$slots:{default:[create_default_slot_1$3z]},$$scope:{ctx:n1}}}),t1.$on("click",n1[12]);function s1(c1){n1[14](c1)}let l1={anchor:n1[3],align:"left",$$slots:{default:[create_default_slot$4Q]},$$scope:{ctx:n1}};return n1[2]!==void 0&&(l1.open=n1[2]),o1=new Popover({props:l1}),binding_callbacks.push(()=>bind$3(o1,"open",s1)),{c(){e1=element("div"),create_component(t1.$$.fragment),r1=space$1(),create_component(o1.$$.fragment)},m(c1,u1){insert$1(c1,e1,u1),mount_component(t1,e1,null),n1[13](e1),insert$1(c1,r1,u1),mount_component(o1,c1,u1),a1=!0},p(c1,[u1]){const f1={};u1&4&&(f1.selected=c1[2]),u1&1&&(f1.disabled=!c1[0].length),u1&262144&&(f1.$$scope={dirty:u1,ctx:c1}),t1.$set(f1);const p1={};u1&8&&(p1.anchor=c1[3]),u1&262163&&(p1.$$scope={dirty:u1,ctx:c1}),!i1&&u1&4&&(i1=!0,p1.open=c1[2],add_flush_callback(()=>i1=!1)),o1.$set(p1)},i(c1){a1||(transition_in(t1.$$.fragment,c1),transition_in(o1.$$.fragment,c1),a1=!0)},o(c1){transition_out(t1.$$.fragment,c1),transition_out(o1.$$.fragment,c1),a1=!1},d(c1){c1&&detach(e1),destroy_component(t1),n1[13](null),c1&&detach(r1),destroy_component(o1,c1)}}}function instance$7h(n1,e1,t1){let r1,o1,i1,a1,s1;const{sort:l1,columns:c1,stickyColumn:u1}=getContext("grid");component_subscribe(n1,l1,S1=>t1(1,i1=S1)),component_subscribe(n1,c1,S1=>t1(10,a1=S1)),component_subscribe(n1,u1,S1=>t1(11,s1=S1));let f1=!1,p1;const d1=(S1,A1)=>{var E1;let C1=[];return S1&&C1.push({label:S1.label||S1.name,value:S1.name,type:(E1=S1.schema)==null?void 0:E1.type}),[...C1,...A1.map(T1=>{var I1;return{label:T1.label||T1.name,value:T1.name,type:(I1=T1.schema)==null?void 0:I1.type}})]},m1=(S1,A1)=>{var E1;const C1=(E1=A1.find(T1=>T1.value===S1))==null?void 0:E1.type;return[{label:C1==="number"?"Low-high":"A-Z",value:"ascending"},{label:C1==="number"?"High-low":"Z-A",value:"descending"}]},_1=S1=>{l1.update(A1=>({...A1,column:S1.detail}))},h1=S1=>{l1.update(A1=>({...A1,order:S1.detail}))},b1=(S1,A1,C1)=>{!S1||S1!==(A1==null?void 0:A1.name)&&!C1.some(E1=>E1.name===S1)&&(A1?l1.update(E1=>({...E1,column:A1.name})):l1.update(E1=>{var T1;return{...E1,column:(T1=C1[0])==null?void 0:T1.name}}))},$1=()=>t1(2,f1=!f1);function y1(S1){binding_callbacks[S1?"unshift":"push"](()=>{p1=S1,t1(3,p1)})}function k1(S1){f1=S1,t1(2,f1)}return n1.$$.update=()=>{n1.$$.dirty&3072&&t1(0,r1=d1(s1,a1)),n1.$$.dirty&3074&&b1(i1.column,s1,a1),n1.$$.dirty&3&&t1(4,o1=m1(i1.column,r1))},[r1,i1,f1,p1,o1,l1,c1,u1,_1,h1,a1,s1,$1,y1,k1]}class SortButton extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7h,create_fragment$78,safe_not_equal,{})}}const HideColumnsButton_svelte_svelte_type_style_lang="";function get_each_context$1k(n1,e1,t1){const r1=n1.slice();return r1[16]=e1[t1],r1}function create_default_slot_3$21(n1){let e1;return{c(){e1=text(n1[3])},m(t1,r1){insert$1(t1,e1,r1)},p(t1,r1){r1&8&&set_data(e1,t1[3])},d(t1){t1&&detach(e1)}}}function create_if_block$37(n1){let e1,t1,r1,o1=n1[5].label+"",i1,a1,s1,l1;return t1=new Icon({props:{size:"S",name:getColumnIcon(n1[5])}}),s1=new Toggle({props:{disabled:!0,size:"S",value:!0}}),{c(){e1=element("div"),create_component(t1.$$.fragment),r1=space$1(),i1=text(o1),a1=space$1(),create_component(s1.$$.fragment),attr(e1,"class","column svelte-1de0dni")},m(c1,u1){insert$1(c1,e1,u1),mount_component(t1,e1,null),append$1(e1,r1),append$1(e1,i1),insert$1(c1,a1,u1),mount_component(s1,c1,u1),l1=!0},p(c1,u1){const f1={};u1&32&&(f1.name=getColumnIcon(c1[5])),t1.$set(f1),(!l1||u1&32)&&o1!==(o1=c1[5].label+"")&&set_data(i1,o1)},i(c1){l1||(transition_in(t1.$$.fragment,c1),transition_in(s1.$$.fragment,c1),l1=!0)},o(c1){transition_out(t1.$$.fragment,c1),transition_out(s1.$$.fragment,c1),l1=!1},d(c1){c1&&detach(e1),destroy_component(t1),c1&&detach(a1),destroy_component(s1,c1)}}}function create_each_block$1k(n1){let e1,t1,r1,o1=n1[16].label+"",i1,a1,s1,l1;t1=new Icon({props:{size:"S",name:getColumnIcon(n1[16])}});function c1(...u1){return n1[13](n1[16],...u1)}return s1=new Toggle({props:{size:"S",value:n1[16].visible}}),s1.$on("change",c1),{c(){e1=element("div"),create_component(t1.$$.fragment),r1=space$1(),i1=text(o1),a1=space$1(),create_component(s1.$$.fragment),attr(e1,"class","column svelte-1de0dni")},m(u1,f1){insert$1(u1,e1,f1),mount_component(t1,e1,null),append$1(e1,r1),append$1(e1,i1),insert$1(u1,a1,f1),mount_component(s1,u1,f1),l1=!0},p(u1,f1){n1=u1;const p1={};f1&1&&(p1.name=getColumnIcon(n1[16])),t1.$set(p1),(!l1||f1&1)&&o1!==(o1=n1[16].label+"")&&set_data(i1,o1);const d1={};f1&1&&(d1.value=n1[16].visible),s1.$set(d1)},i(u1){l1||(transition_in(t1.$$.fragment,u1),transition_in(s1.$$.fragment,u1),l1=!0)},o(u1){transition_out(t1.$$.fragment,u1),transition_out(s1.$$.fragment,u1),l1=!1},d(u1){u1&&detach(e1),destroy_component(t1),u1&&detach(a1),destroy_component(s1,u1)}}}function create_default_slot_2$2C(n1){let e1;return{c(){e1=text("Show all")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_default_slot_1$3y(n1){let e1;return{c(){e1=text("Hide all")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_default_slot$4P(n1){let e1,t1,r1,o1,i1,a1,s1,l1,c1,u1=n1[5]&&create_if_block$37(n1),f1=n1[0],p1=[];for(let m1=0;m1<f1.length;m1+=1)p1[m1]=create_each_block$1k(get_each_context$1k(n1,f1,m1));const d1=m1=>transition_out(p1[m1],1,1,()=>{p1[m1]=null});return a1=new ActionButton({props:{$$slots:{default:[create_default_slot_2$2C]},$$scope:{ctx:n1}}}),a1.$on("click",n1[9]),l1=new ActionButton({props:{$$slots:{default:[create_default_slot_1$3y]},$$scope:{ctx:n1}}}),l1.$on("click",n1[10]),{c(){e1=element("div"),t1=element("div"),u1&&u1.c(),r1=space$1();for(let m1=0;m1<p1.length;m1+=1)p1[m1].c();o1=space$1(),i1=element("div"),create_component(a1.$$.fragment),s1=space$1(),create_component(l1.$$.fragment),attr(t1,"class","columns svelte-1de0dni"),attr(i1,"class","buttons svelte-1de0dni"),attr(e1,"class","content svelte-1de0dni")},m(m1,_1){insert$1(m1,e1,_1),append$1(e1,t1),u1&&u1.m(t1,null),append$1(t1,r1);for(let h1=0;h1<p1.length;h1+=1)p1[h1].m(t1,null);append$1(e1,o1),append$1(e1,i1),mount_component(a1,i1,null),append$1(i1,s1),mount_component(l1,i1,null),c1=!0},p(m1,_1){if(m1[5]?u1?(u1.p(m1,_1),_1&32&&transition_in(u1,1)):(u1=create_if_block$37(m1),u1.c(),transition_in(u1,1),u1.m(t1,r1)):u1&&(group_outros(),transition_out(u1,1,1,()=>{u1=null}),check_outros()),_1&257){f1=m1[0];let $1;for($1=0;$1<f1.length;$1+=1){const y1=get_each_context$1k(m1,f1,$1);p1[$1]?(p1[$1].p(y1,_1),transition_in(p1[$1],1)):(p1[$1]=create_each_block$1k(y1),p1[$1].c(),transition_in(p1[$1],1),p1[$1].m(t1,null))}for(group_outros(),$1=f1.length;$1<p1.length;$1+=1)d1($1);check_outros()}const h1={};_1&524288&&(h1.$$scope={dirty:_1,ctx:m1}),a1.$set(h1);const b1={};_1&524288&&(b1.$$scope={dirty:_1,ctx:m1}),l1.$set(b1)},i(m1){if(!c1){transition_in(u1);for(let _1=0;_1<f1.length;_1+=1)transition_in(p1[_1]);transition_in(a1.$$.fragment,m1),transition_in(l1.$$.fragment,m1),c1=!0}},o(m1){transition_out(u1),p1=p1.filter(Boolean);for(let _1=0;_1<p1.length;_1+=1)transition_out(p1[_1]);transition_out(a1.$$.fragment,m1),transition_out(l1.$$.fragment,m1),c1=!1},d(m1){m1&&detach(e1),u1&&u1.d(),destroy_each(p1,m1),destroy_component(a1),destroy_component(l1)}}}function create_fragment$77(n1){let e1,t1,r1,o1,i1,a1;t1=new ActionButton({props:{icon:"VisibilityOff",quiet:!0,size:"M",selected:n1[1]||n1[4],disabled:!n1[0].length,$$slots:{default:[create_default_slot_3$21]},$$scope:{ctx:n1}}}),t1.$on("click",n1[11]);function s1(c1){n1[14](c1)}let l1={anchor:n1[2],align:"left",$$slots:{default:[create_default_slot$4P]},$$scope:{ctx:n1}};return n1[1]!==void 0&&(l1.open=n1[1]),o1=new Popover({props:l1}),binding_callbacks.push(()=>bind$3(o1,"open",s1)),{c(){e1=element("div"),create_component(t1.$$.fragment),r1=space$1(),create_component(o1.$$.fragment)},m(c1,u1){insert$1(c1,e1,u1),mount_component(t1,e1,null),n1[12](e1),insert$1(c1,r1,u1),mount_component(o1,c1,u1),a1=!0},p(c1,[u1]){const f1={};u1&18&&(f1.selected=c1[1]||c1[4]),u1&1&&(f1.disabled=!c1[0].length),u1&524296&&(f1.$$scope={dirty:u1,ctx:c1}),t1.$set(f1);const p1={};u1&4&&(p1.anchor=c1[2]),u1&524321&&(p1.$$scope={dirty:u1,ctx:c1}),!i1&&u1&2&&(i1=!0,p1.open=c1[1],add_flush_callback(()=>i1=!1)),o1.$set(p1)},i(c1){a1||(transition_in(t1.$$.fragment,c1),transition_in(o1.$$.fragment,c1),a1=!0)},o(c1){transition_out(t1.$$.fragment,c1),transition_out(o1.$$.fragment,c1),a1=!1},d(c1){c1&&detach(e1),destroy_component(t1),n1[12](null),c1&&detach(r1),destroy_component(o1,c1)}}}function instance$7g(n1,e1,t1){let r1,o1,i1,a1;const{columns:s1,stickyColumn:l1}=getContext("grid");component_subscribe(n1,s1,y1=>t1(0,i1=y1)),component_subscribe(n1,l1,y1=>t1(5,a1=y1));let c1=!1,u1;const f1=(y1,k1)=>{s1.update(S1=>{const A1=S1.findIndex(C1=>C1.name===y1.name);return S1[A1].visible=k1,S1.slice()}),s1.actions.saveChanges()},p1=()=>{s1.update(y1=>y1.map(k1=>({...k1,visible:!0}))),s1.actions.saveChanges()},d1=()=>{s1.update(y1=>y1.map(k1=>({...k1,visible:!1}))),s1.actions.saveChanges()},m1=y1=>{const k1=y1.filter(S1=>!S1.visible).length;return k1?`Hide columns (${k1})`:"Hide columns"},_1=()=>t1(1,c1=!c1);function h1(y1){binding_callbacks[y1?"unshift":"push"](()=>{u1=y1,t1(2,u1)})}const b1=(y1,k1)=>f1(y1,k1.detail);function $1(y1){c1=y1,t1(1,c1)}return n1.$$.update=()=>{n1.$$.dirty&1&&t1(4,r1=i1.some(y1=>!y1.visible)),n1.$$.dirty&1&&t1(3,o1=m1(i1))},[i1,c1,u1,o1,r1,a1,s1,l1,f1,p1,d1,_1,h1,b1,$1]}class HideColumnsButton extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7g,create_fragment$77,safe_not_equal,{})}}const SizeButton_svelte_svelte_type_style_lang="";function get_each_context$1j(n1,e1,t1){const r1=n1.slice();return r1[27]=e1[t1],r1}function get_each_context_1$l(n1,e1,t1){const r1=n1.slice();return r1[27]=e1[t1],r1}function create_default_slot_6$W(n1){let e1;return{c(){e1=text("Size")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_default_slot_5$1a(n1){let e1;return{c(){e1=text("Row height")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_default_slot_4$1t(n1){let e1=n1[27].label+"",t1,r1;return{c(){t1=text(e1),r1=space$1()},m(o1,i1){insert$1(o1,t1,i1),insert$1(o1,r1,i1)},p:noop$5,d(o1){o1&&detach(t1),o1&&detach(r1)}}}function create_each_block_1$l(n1){let e1,t1;function r1(){return n1[21](n1[27])}return e1=new ActionButton({props:{disabled:n1[5],quiet:!0,selected:n1[6]===n1[27].size,$$slots:{default:[create_default_slot_4$1t]},$$scope:{ctx:n1}}}),e1.$on("click",r1),{c(){create_component(e1.$$.fragment)},m(o1,i1){mount_component(e1,o1,i1),t1=!0},p(o1,i1){n1=o1;const a1={};i1[0]&32&&(a1.disabled=n1[5]),i1[0]&64&&(a1.selected=n1[6]===n1[27].size),i1[1]&2&&(a1.$$scope={dirty:i1,ctx:n1}),e1.$set(a1)},i(o1){t1||(transition_in(e1.$$.fragment,o1),t1=!0)},o(o1){transition_out(e1.$$.fragment,o1),t1=!1},d(o1){destroy_component(e1,o1)}}}function create_default_slot_3$20(n1){let e1;return{c(){e1=text("Column width")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_default_slot_2$2B(n1){let e1=n1[27].label+"",t1;return{c(){t1=text(e1)},m(r1,o1){insert$1(r1,t1,o1)},p(r1,o1){o1[0]&8&&e1!==(e1=r1[27].label+"")&&set_data(t1,e1)},d(r1){r1&&detach(t1)}}}function create_each_block$1j(n1){let e1,t1;function r1(){return n1[22](n1[27])}return e1=new ActionButton({props:{quiet:!0,selected:n1[27].selected,$$slots:{default:[create_default_slot_2$2B]},$$scope:{ctx:n1}}}),e1.$on("click",r1),{c(){create_component(e1.$$.fragment)},m(o1,i1){mount_component(e1,o1,i1),t1=!0},p(o1,i1){n1=o1;const a1={};i1[0]&8&&(a1.selected=n1[27].selected),i1[0]&8|i1[1]&2&&(a1.$$scope={dirty:i1,ctx:n1}),e1.$set(a1)},i(o1){t1||(transition_in(e1.$$.fragment,o1),t1=!0)},o(o1){transition_out(e1.$$.fragment,o1),t1=!1},d(o1){destroy_component(e1,o1)}}}function create_if_block$36(n1){let e1,t1;return e1=new ActionButton({props:{selected:n1[4],quiet:!0,$$slots:{default:[create_default_slot_1$3x]},$$scope:{ctx:n1}}}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},p(r1,o1){const i1={};o1[0]&16&&(i1.selected=r1[4]),o1[1]&2&&(i1.$$scope={dirty:o1,ctx:r1}),e1.$set(i1)},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_default_slot_1$3x(n1){let e1;return{c(){e1=text("Custom")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_default_slot$4O(n1){let e1,t1,r1,o1,i1,a1,s1,l1,c1,u1,f1,p1;r1=new Label({props:{$$slots:{default:[create_default_slot_5$1a]},$$scope:{ctx:n1}}});let d1=n1[12],m1=[];for(let k1=0;k1<d1.length;k1+=1)m1[k1]=create_each_block_1$l(get_each_context_1$l(n1,d1,k1));const _1=k1=>transition_out(m1[k1],1,1,()=>{m1[k1]=null});l1=new Label({props:{$$slots:{default:[create_default_slot_3$20]},$$scope:{ctx:n1}}});let h1=n1[3],b1=[];for(let k1=0;k1<h1.length;k1+=1)b1[k1]=create_each_block$1j(get_each_context$1j(n1,h1,k1));const $1=k1=>transition_out(b1[k1],1,1,()=>{b1[k1]=null});let y1=n1[4]&&create_if_block$36(n1);return{c(){e1=element("div"),t1=element("div"),create_component(r1.$$.fragment),o1=space$1(),i1=element("div");for(let k1=0;k1<m1.length;k1+=1)m1[k1].c();a1=space$1(),s1=element("div"),create_component(l1.$$.fragment),c1=space$1(),u1=element("div");for(let k1=0;k1<b1.length;k1+=1)b1[k1].c();f1=space$1(),y1&&y1.c(),attr(i1,"class","options svelte-bjolao"),attr(t1,"class","size svelte-bjolao"),attr(u1,"class","options svelte-bjolao"),attr(s1,"class","size svelte-bjolao"),attr(e1,"class","content svelte-bjolao")},m(k1,S1){insert$1(k1,e1,S1),append$1(e1,t1),mount_component(r1,t1,null),append$1(t1,o1),append$1(t1,i1);for(let A1=0;A1<m1.length;A1+=1)m1[A1].m(i1,null);append$1(e1,a1),append$1(e1,s1),mount_component(l1,s1,null),append$1(s1,c1),append$1(s1,u1);for(let A1=0;A1<b1.length;A1+=1)b1[A1].m(u1,null);append$1(u1,f1),y1&&y1.m(u1,null),p1=!0},p(k1,S1){const A1={};if(S1[1]&2&&(A1.$$scope={dirty:S1,ctx:k1}),r1.$set(A1),S1[0]&12384){d1=k1[12];let E1;for(E1=0;E1<d1.length;E1+=1){const T1=get_each_context_1$l(k1,d1,E1);m1[E1]?(m1[E1].p(T1,S1),transition_in(m1[E1],1)):(m1[E1]=create_each_block_1$l(T1),m1[E1].c(),transition_in(m1[E1],1),m1[E1].m(i1,null))}for(group_outros(),E1=d1.length;E1<m1.length;E1+=1)_1(E1);check_outros()}const C1={};if(S1[1]&2&&(C1.$$scope={dirty:S1,ctx:k1}),l1.$set(C1),S1[0]&264){h1=k1[3];let E1;for(E1=0;E1<h1.length;E1+=1){const T1=get_each_context$1j(k1,h1,E1);b1[E1]?(b1[E1].p(T1,S1),transition_in(b1[E1],1)):(b1[E1]=create_each_block$1j(T1),b1[E1].c(),transition_in(b1[E1],1),b1[E1].m(u1,f1))}for(group_outros(),E1=h1.length;E1<b1.length;E1+=1)$1(E1);check_outros()}k1[4]?y1?(y1.p(k1,S1),S1[0]&16&&transition_in(y1,1)):(y1=create_if_block$36(k1),y1.c(),transition_in(y1,1),y1.m(u1,null)):y1&&(group_outros(),transition_out(y1,1,1,()=>{y1=null}),check_outros())},i(k1){if(!p1){transition_in(r1.$$.fragment,k1);for(let S1=0;S1<d1.length;S1+=1)transition_in(m1[S1]);transition_in(l1.$$.fragment,k1);for(let S1=0;S1<h1.length;S1+=1)transition_in(b1[S1]);transition_in(y1),p1=!0}},o(k1){transition_out(r1.$$.fragment,k1),m1=m1.filter(Boolean);for(let S1=0;S1<m1.length;S1+=1)transition_out(m1[S1]);transition_out(l1.$$.fragment,k1),b1=b1.filter(Boolean);for(let S1=0;S1<b1.length;S1+=1)transition_out(b1[S1]);transition_out(y1),p1=!1},d(k1){k1&&detach(e1),destroy_component(r1),destroy_each(m1,k1),destroy_component(l1),destroy_each(b1,k1),y1&&y1.d()}}}function create_fragment$76(n1){let e1,t1,r1,o1,i1,a1;t1=new ActionButton({props:{icon:"MoveUpDown",quiet:!0,size:"M",selected:n1[1],disabled:!n1[0].length,$$slots:{default:[create_default_slot_6$W]},$$scope:{ctx:n1}}}),t1.$on("click",n1[19]);function s1(c1){n1[23](c1)}let l1={anchor:n1[2],align:"left",$$slots:{default:[create_default_slot$4O]},$$scope:{ctx:n1}};return n1[1]!==void 0&&(l1.open=n1[1]),o1=new Popover({props:l1}),binding_callbacks.push(()=>bind$3(o1,"open",s1)),{c(){e1=element("div"),create_component(t1.$$.fragment),r1=space$1(),create_component(o1.$$.fragment)},m(c1,u1){insert$1(c1,e1,u1),mount_component(t1,e1,null),n1[20](e1),insert$1(c1,r1,u1),mount_component(o1,c1,u1),a1=!0},p(c1,u1){const f1={};u1[0]&2&&(f1.selected=c1[1]),u1[0]&1&&(f1.disabled=!c1[0].length),u1[1]&2&&(f1.$$scope={dirty:u1,ctx:c1}),t1.$set(f1);const p1={};u1[0]&4&&(p1.anchor=c1[2]),u1[0]&120|u1[1]&2&&(p1.$$scope={dirty:u1,ctx:c1}),!i1&&u1[0]&2&&(i1=!0,p1.open=c1[1],add_flush_callback(()=>i1=!1)),o1.$set(p1)},i(c1){a1||(transition_in(t1.$$.fragment,c1),transition_in(o1.$$.fragment,c1),a1=!0)},o(c1){transition_out(t1.$$.fragment,c1),transition_out(o1.$$.fragment,c1),a1=!1},d(c1){c1&&detach(e1),destroy_component(t1),n1[20](null),c1&&detach(r1),destroy_component(o1,c1)}}}const smallColSize=120;function instance$7f(n1,e1,t1){let r1,o1,i1,a1,s1,l1,c1,u1,f1,p1,d1;const{stickyColumn:m1,columns:_1,rowHeight:h1,table:b1,fixedRowHeight:$1}=getContext("grid");component_subscribe(n1,m1,B1=>t1(17,u1=B1)),component_subscribe(n1,_1,B1=>t1(18,f1=B1)),component_subscribe(n1,h1,B1=>t1(6,d1=B1)),component_subscribe(n1,b1,B1=>t1(24,c1=B1)),component_subscribe(n1,$1,B1=>t1(5,p1=B1));const y1=DefaultColumnWidth,k1=DefaultColumnWidth*1.5,S1=[{label:"Small",size:SmallRowHeight},{label:"Medium",size:MediumRowHeight},{label:"Large",size:LargeRowHeight}];let A1=!1,C1;const E1=B1=>{_1.actions.saveTable({...c1,rowHeight:B1})},T1=()=>t1(1,A1=!A1);function I1(B1){binding_callbacks[B1?"unshift":"push"](()=>{C1=B1,t1(2,C1)})}const N1=B1=>E1(B1.size),j1=B1=>_1.actions.changeAllColumnWidths(B1.size);function V1(B1){A1=B1,t1(1,A1)}return n1.$$.update=()=>{n1.$$.dirty[0]&393216&&t1(0,r1=f1.concat(u1?[u1]:[])),n1.$$.dirty[0]&1&&t1(16,o1=r1.every(B1=>B1.width===smallColSize)),n1.$$.dirty[0]&1&&t1(15,i1=r1.every(B1=>B1.width===y1)),n1.$$.dirty[0]&1&&t1(14,a1=r1.every(B1=>B1.width===k1)),n1.$$.dirty[0]&114688&&t1(4,s1=!o1&&!i1&&!a1),n1.$$.dirty[0]&114688&&t1(3,l1=[{label:"Small",size:smallColSize,selected:o1},{label:"Medium",size:y1,selected:i1},{label:"Large",size:k1,selected:a1}])},[r1,A1,C1,l1,s1,p1,d1,m1,_1,h1,b1,$1,S1,E1,a1,i1,o1,u1,f1,T1,I1,N1,j1,V1]}class SizeButton extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7f,create_fragment$76,safe_not_equal,{},null,[-1,-1])}}const NewRow_svelte_svelte_type_style_lang="";function get_each_context$1i(n1,e1,t1){const r1=n1.slice();r1[48]=e1[t1],r1[51]=t1;const o1=`new-${r1[48].name}`;return r1[49]=o1,r1}function get_if_ctx(n1){const e1=n1.slice(),t1=`${NewRowID}-${e1[1].name}`;return e1[49]=t1,e1}function create_if_block_7$f(n1){let e1,t1,r1,o1,i1,a1;return t1=new Icon({props:{name:"Add",size:"S"}}),{c(){e1=element("div"),create_component(t1.$$.fragment),attr(e1,"class","new-row-fab svelte-11w4ycu"),toggle_class(e1,"offset",!n1[1])},m(s1,l1){insert$1(s1,e1,l1),mount_component(t1,e1,null),o1=!0,i1||(a1=listen(e1,"click",n1[36]),i1=!0)},p(s1,l1){(!o1||l1[0]&2)&&toggle_class(e1,"offset",!s1[1])},i(s1){o1||(transition_in(t1.$$.fragment,s1),s1&&add_render_callback(()=>{r1||(r1=create_bidirectional_transition(e1,fade,{duration:130},!0)),r1.run(1)}),o1=!0)},o(s1){transition_out(t1.$$.fragment,s1),s1&&(r1||(r1=create_bidirectional_transition(e1,fade,{duration:130},!1)),r1.run(0)),o1=!1},d(s1){s1&&detach(e1),destroy_component(t1),s1&&r1&&r1.end(),i1=!1,a1()}}}function create_if_block$35(n1){let e1,t1,r1,o1,i1,a1,s1,l1,c1,u1,f1,p1,d1,m1,_1,h1,b1,$1,y1,k1,S1,A1;c1=new GutterCell({props:{expandable:!0,rowHovered:!0,$$slots:{default:[create_default_slot_5$19]},$$scope:{ctx:n1}}}),c1.$on("expand",n1[31]);let C1=n1[1]&&create_if_block_3$M(get_if_ctx(n1));return m1=new GridScrollWrapper({props:{scrollHorizontally:!0,wheelInteractive:!0,$$slots:{default:[create_default_slot_2$2A]},$$scope:{ctx:n1}}}),$1=new Button({props:{size:"M",cta:!0,disabled:n1[4],$$slots:{default:[create_default_slot_1$3w]},$$scope:{ctx:n1}}}),$1.$on("click",n1[28]),k1=new Button({props:{size:"M",secondary:!0,newStyles:!0,$$slots:{default:[create_default_slot$4N]},$$scope:{ctx:n1}}}),k1.$on("click",n1[29]),{c(){e1=element("div"),t1=element("div"),o1=space$1(),i1=element("div"),s1=space$1(),l1=element("div"),create_component(c1.$$.fragment),u1=space$1(),C1&&C1.c(),p1=space$1(),d1=element("div"),create_component(m1.$$.fragment),h1=space$1(),b1=element("div"),create_component($1.$$.fragment),y1=space$1(),create_component(k1.$$.fragment),attr(t1,"class","underlay sticky svelte-11w4ycu"),attr(i1,"class","underlay svelte-11w4ycu"),attr(l1,"class","sticky-column svelte-11w4ycu"),attr(d1,"class","normal-columns svelte-11w4ycu"),attr(b1,"class","buttons svelte-11w4ycu"),attr(e1,"class","container svelte-11w4ycu"),set_style(e1,"--offset",n1[0]+"px"),set_style(e1,"--sticky-width",n1[9]+"px"),toggle_class(e1,"floating",n1[0]>0)},m(E1,T1){insert$1(E1,e1,T1),append$1(e1,t1),append$1(e1,o1),append$1(e1,i1),append$1(e1,s1),append$1(e1,l1),mount_component(c1,l1,null),append$1(l1,u1),C1&&C1.m(l1,null),append$1(e1,p1),append$1(e1,d1),mount_component(m1,d1,null),append$1(e1,h1),append$1(e1,b1),mount_component($1,b1,null),append$1(b1,y1),mount_component(k1,b1,null),A1=!0},p(E1,T1){const I1={};T1[0]&16|T1[1]&2097152&&(I1.$$scope={dirty:T1,ctx:E1}),c1.$set(I1),E1[1]?C1?(C1.p(get_if_ctx(E1),T1),T1[0]&2&&transition_in(C1,1)):(C1=create_if_block_3$M(get_if_ctx(E1)),C1.c(),transition_in(C1,1),C1.m(l1,null)):C1&&(group_outros(),transition_out(C1,1,1,()=>{C1=null}),check_outros());const N1={};T1[0]&5429|T1[1]&2097152&&(N1.$$scope={dirty:T1,ctx:E1}),m1.$set(N1);const j1={};T1[0]&16&&(j1.disabled=E1[4]),T1[1]&2097152&&(j1.$$scope={dirty:T1,ctx:E1}),$1.$set(j1);const V1={};T1[1]&2097152&&(V1.$$scope={dirty:T1,ctx:E1}),k1.$set(V1),(!A1||T1[0]&1)&&set_style(e1,"--offset",E1[0]+"px"),(!A1||T1[0]&512)&&set_style(e1,"--sticky-width",E1[9]+"px"),(!A1||T1[0]&1)&&toggle_class(e1,"floating",E1[0]>0)},i(E1){A1||(E1&&add_render_callback(()=>{r1||(r1=create_bidirectional_transition(t1,fade,{duration:130},!0)),r1.run(1)}),E1&&add_render_callback(()=>{a1||(a1=create_bidirectional_transition(i1,fade,{duration:130},!0)),a1.run(1)}),transition_in(c1.$$.fragment,E1),transition_in(C1),E1&&add_render_callback(()=>{f1||(f1=create_bidirectional_transition(l1,fade,{duration:130},!0)),f1.run(1)}),transition_in(m1.$$.fragment,E1),E1&&add_render_callback(()=>{_1||(_1=create_bidirectional_transition(d1,fade,{duration:130},!0)),_1.run(1)}),transition_in($1.$$.fragment,E1),transition_in(k1.$$.fragment,E1),E1&&add_render_callback(()=>{S1||(S1=create_bidirectional_transition(b1,fade,{duration:130},!0)),S1.run(1)}),A1=!0)},o(E1){E1&&(r1||(r1=create_bidirectional_transition(t1,fade,{duration:130},!1)),r1.run(0)),E1&&(a1||(a1=create_bidirectional_transition(i1,fade,{duration:130},!1)),a1.run(0)),transition_out(c1.$$.fragment,E1),transition_out(C1),E1&&(f1||(f1=create_bidirectional_transition(l1,fade,{duration:130},!1)),f1.run(0)),transition_out(m1.$$.fragment,E1),E1&&(_1||(_1=create_bidirectional_transition(d1,fade,{duration:130},!1)),_1.run(0)),transition_out($1.$$.fragment,E1),transition_out(k1.$$.fragment,E1),E1&&(S1||(S1=create_bidirectional_transition(b1,fade,{duration:130},!1)),S1.run(0)),A1=!1},d(E1){E1&&detach(e1),E1&&r1&&r1.end(),E1&&a1&&a1.end(),destroy_component(c1),C1&&C1.d(),E1&&f1&&f1.end(),destroy_component(m1),E1&&_1&&_1.end(),destroy_component($1),destroy_component(k1),E1&&S1&&S1.end()}}}function create_if_block_6$h(n1){let e1,t1;return{c(){e1=element("div"),attr(e1,"class","loading-overlay svelte-11w4ycu")},m(r1,o1){insert$1(r1,e1,o1)},i(r1){t1||add_render_callback(()=>{t1=create_in_transition(e1,fade,{duration:130}),t1.start()})},o:noop$5,d(r1){r1&&detach(e1)}}}function create_default_slot_5$19(n1){let e1,t1,r1,o1;e1=new Icon({props:{name:"Add",color:"var(--spectrum-global-color-gray-500)"}});let i1=n1[4]&&create_if_block_6$h();return{c(){create_component(e1.$$.fragment),t1=space$1(),i1&&i1.c(),r1=empty$1()},m(a1,s1){mount_component(e1,a1,s1),insert$1(a1,t1,s1),i1&&i1.m(a1,s1),insert$1(a1,r1,s1),o1=!0},p(a1,s1){a1[4]?i1?s1[0]&16&&transition_in(i1,1):(i1=create_if_block_6$h(),i1.c(),transition_in(i1,1),i1.m(r1.parentNode,r1)):i1&&(i1.d(1),i1=null)},i(a1){o1||(transition_in(e1.$$.fragment,a1),transition_in(i1),o1=!0)},o(a1){transition_out(e1.$$.fragment,a1),o1=!1},d(a1){destroy_component(e1,a1),a1&&detach(t1),i1&&i1.d(a1),a1&&detach(r1)}}}function create_if_block_3$M(n1){let e1,t1;return e1=new DataCell({props:{cellId:n1[49],rowFocused:!0,column:n1[1],row:n1[5],focused:n1[10]===n1[49],width:n1[1].width,updateValue:n1[30],topRow:n1[0]===0,invertY:n1[8],$$slots:{default:[create_default_slot_4$1s]},$$scope:{ctx:n1}}}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},p(r1,o1){const i1={};o1[0]&2&&(i1.cellId=r1[49]),o1[0]&2&&(i1.column=r1[1]),o1[0]&32&&(i1.row=r1[5]),o1[0]&1026&&(i1.focused=r1[10]===r1[49]),o1[0]&2&&(i1.width=r1[1].width),o1[0]&1&&(i1.topRow=r1[0]===0),o1[0]&256&&(i1.invertY=r1[8]),o1[0]&18|o1[1]&2097152&&(i1.$$scope={dirty:o1,ctx:r1}),e1.$set(i1)},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_if_block_5$p(n1){let e1;return{c(){e1=element("div"),e1.textContent="Can't edit auto column",attr(e1,"class","readonly-overlay svelte-11w4ycu")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_if_block_4$A(n1){let e1,t1;return{c(){e1=element("div"),attr(e1,"class","loading-overlay svelte-11w4ycu")},m(r1,o1){insert$1(r1,e1,o1)},i(r1){t1||add_render_callback(()=>{t1=create_in_transition(e1,fade,{duration:130}),t1.start()})},o:noop$5,d(r1){r1&&detach(e1)}}}function create_default_slot_4$1s(n1){var i1,a1;let e1,t1,r1=((a1=(i1=n1[1])==null?void 0:i1.schema)==null?void 0:a1.autocolumn)&&create_if_block_5$p(),o1=n1[4]&&create_if_block_4$A();return{c(){r1&&r1.c(),e1=space$1(),o1&&o1.c(),t1=empty$1()},m(s1,l1){r1&&r1.m(s1,l1),insert$1(s1,e1,l1),o1&&o1.m(s1,l1),insert$1(s1,t1,l1)},p(s1,l1){var c1,u1;(u1=(c1=s1[1])==null?void 0:c1.schema)!=null&&u1.autocolumn?r1||(r1=create_if_block_5$p(),r1.c(),r1.m(e1.parentNode,e1)):r1&&(r1.d(1),r1=null),s1[4]?o1?l1[0]&16&&transition_in(o1,1):(o1=create_if_block_4$A(),o1.c(),transition_in(o1,1),o1.m(t1.parentNode,t1)):o1&&(o1.d(1),o1=null)},i(s1){transition_in(o1)},o:noop$5,d(s1){r1&&r1.d(s1),s1&&detach(e1),o1&&o1.d(s1),s1&&detach(t1)}}}function create_if_block_2$16(n1){let e1;return{c(){e1=element("div"),e1.textContent="Can't edit auto column",attr(e1,"class","readonly-overlay svelte-11w4ycu")},m(t1,r1){insert$1(t1,e1,r1)},d(t1){t1&&detach(e1)}}}function create_if_block_1$1O(n1){let e1,t1;return{c(){e1=element("div"),attr(e1,"class","loading-overlay svelte-11w4ycu")},m(r1,o1){insert$1(r1,e1,o1)},i(r1){t1||add_render_callback(()=>{t1=create_in_transition(e1,fade,{duration:130}),t1.start()})},o:noop$5,d(r1){r1&&detach(e1)}}}function create_default_slot_3$1$(n1){var i1,a1;let e1,t1,r1=((a1=(i1=n1[48])==null?void 0:i1.schema)==null?void 0:a1.autocolumn)&&create_if_block_2$16(),o1=n1[4]&&create_if_block_1$1O();return{c(){r1&&r1.c(),e1=space$1(),o1&&o1.c(),t1=space$1()},m(s1,l1){r1&&r1.m(s1,l1),insert$1(s1,e1,l1),o1&&o1.m(s1,l1),insert$1(s1,t1,l1)},p(s1,l1){var c1,u1;(u1=(c1=s1[48])==null?void 0:c1.schema)!=null&&u1.autocolumn?r1||(r1=create_if_block_2$16(),r1.c(),r1.m(e1.parentNode,e1)):r1&&(r1.d(1),r1=null),s1[4]?o1?l1[0]&16&&transition_in(o1,1):(o1=create_if_block_1$1O(),o1.c(),transition_in(o1,1),o1.m(t1.parentNode,t1)):o1&&(o1.d(1),o1=null)},i(s1){transition_in(o1)},o:noop$5,d(s1){r1&&r1.d(s1),s1&&detach(e1),o1&&o1.d(s1),s1&&detach(t1)}}}function create_key_block$f(n1){let e1,t1;return e1=new DataCell({props:{cellId:n1[49],column:n1[48],updateValue:n1[30],rowFocused:!0,row:n1[5],focused:n1[10]===n1[49],width:n1[48].width,topRow:n1[0]===0,invertX:n1[51]>=n1[12],invertY:n1[8],$$slots:{default:[create_default_slot_3$1$]},$$scope:{ctx:n1}}}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},p(r1,o1){const i1={};o1[0]&4&&(i1.cellId=r1[49]),o1[0]&4&&(i1.column=r1[48]),o1[0]&32&&(i1.row=r1[5]),o1[0]&1028&&(i1.focused=r1[10]===r1[49]),o1[0]&4&&(i1.width=r1[48].width),o1[0]&1&&(i1.topRow=r1[0]===0),o1[0]&4096&&(i1.invertX=r1[51]>=r1[12]),o1[0]&256&&(i1.invertY=r1[8]),o1[0]&20|o1[1]&2097152&&(i1.$$scope={dirty:o1,ctx:r1}),e1.$set(i1)},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_each_block$1i(n1){let e1=n1[49],t1,r1,o1=create_key_block$f(n1);return{c(){o1.c(),t1=empty$1()},m(i1,a1){o1.m(i1,a1),insert$1(i1,t1,a1),r1=!0},p(i1,a1){a1[0]&4&&safe_not_equal(e1,e1=i1[49])?(group_outros(),transition_out(o1,1,1,noop$5),check_outros(),o1=create_key_block$f(i1),o1.c(),transition_in(o1,1),o1.m(t1.parentNode,t1)):o1.p(i1,a1)},i(i1){r1||(transition_in(o1),r1=!0)},o(i1){transition_out(o1),r1=!1},d(i1){i1&&detach(t1),o1.d(i1)}}}function create_default_slot_2$2A(n1){let e1,t1,r1=n1[2],o1=[];for(let a1=0;a1<r1.length;a1+=1)o1[a1]=create_each_block$1i(get_each_context$1i(n1,r1,a1));const i1=a1=>transition_out(o1[a1],1,1,()=>{o1[a1]=null});return{c(){e1=element("div");for(let a1=0;a1<o1.length;a1+=1)o1[a1].c();attr(e1,"class","row svelte-11w4ycu")},m(a1,s1){insert$1(a1,e1,s1);for(let l1=0;l1<o1.length;l1+=1)o1[l1].m(e1,null);t1=!0},p(a1,s1){if(s1[0]&1073747253){r1=a1[2];let l1;for(l1=0;l1<r1.length;l1+=1){const c1=get_each_context$1i(a1,r1,l1);o1[l1]?(o1[l1].p(c1,s1),transition_in(o1[l1],1)):(o1[l1]=create_each_block$1i(c1),o1[l1].c(),transition_in(o1[l1],1),o1[l1].m(e1,null))}for(group_outros(),l1=r1.length;l1<o1.length;l1+=1)i1(l1);check_outros()}},i(a1){if(!t1){for(let s1=0;s1<r1.length;s1+=1)transition_in(o1[s1]);t1=!0}},o(a1){o1=o1.filter(Boolean);for(let s1=0;s1<o1.length;s1+=1)transition_out(o1[s1]);t1=!1},d(a1){a1&&detach(e1),destroy_each(o1,a1)}}}function create_default_slot_1$3w(n1){let e1,t1,r1,o1;return r1=new KeyboardShortcut({props:{overlay:!0,keybind:"Ctrl+Enter"}}),{c(){e1=element("div"),t1=text(`Save
|
|
373
373
|
`),create_component(r1.$$.fragment),attr(e1,"class","button-with-keys svelte-11w4ycu")},m(i1,a1){insert$1(i1,e1,a1),append$1(e1,t1),mount_component(r1,e1,null),o1=!0},p:noop$5,i(i1){o1||(transition_in(r1.$$.fragment,i1),o1=!0)},o(i1){transition_out(r1.$$.fragment,i1),o1=!1},d(i1){i1&&detach(e1),destroy_component(r1)}}}function create_default_slot$4N(n1){let e1,t1,r1,o1;return r1=new KeyboardShortcut({props:{keybind:"Esc"}}),{c(){e1=element("div"),t1=text(`Cancel
|
|
374
|
-
`),create_component(r1.$$.fragment),attr(e1,"class","button-with-keys svelte-11w4ycu")},m(i1,a1){insert$1(i1,e1,a1),append$1(e1,t1),mount_component(r1,e1,null),o1=!0},p:noop$5,i(i1){o1||(transition_in(r1.$$.fragment,i1),o1=!0)},o(i1){transition_out(r1.$$.fragment,i1),o1=!1},d(i1){i1&&detach(e1),destroy_component(r1)}}}function create_fragment$75(n1){let e1,t1,r1,o1=!n1[3]&&!n1[7]&&n1[11].allowAddRows&&n1[6]&&create_if_block_7$f(n1),i1=n1[3]&&create_if_block$35(n1);return{c(){o1&&o1.c(),e1=space$1(),i1&&i1.c(),t1=empty$1()},m(a1,s1){o1&&o1.m(a1,s1),insert$1(a1,e1,s1),i1&&i1.m(a1,s1),insert$1(a1,t1,s1),r1=!0},p(a1,s1){!a1[3]&&!a1[7]&&a1[11].allowAddRows&&a1[6]?o1?(o1.p(a1,s1),s1[0]&2248&&transition_in(o1,1)):(o1=create_if_block_7$f(a1),o1.c(),transition_in(o1,1),o1.m(e1.parentNode,e1)):o1&&(group_outros(),transition_out(o1,1,1,()=>{o1=null}),check_outros()),a1[3]?i1?(i1.p(a1,s1),s1[0]&8&&transition_in(i1,1)):(i1=create_if_block$35(a1),i1.c(),transition_in(i1,1),i1.m(t1.parentNode,t1)):i1&&(group_outros(),transition_out(i1,1,1,()=>{i1=null}),check_outros())},i(a1){r1||(transition_in(o1),transition_in(i1),r1=!0)},o(a1){transition_out(o1),transition_out(i1),r1=!1},d(a1){o1&&o1.d(a1),a1&&detach(e1),i1&&i1.d(a1),a1&&detach(t1)}}}function instance$7e(n1,e1,t1){let r1,o1,i1,a1,s1,l1,c1,u1,f1,p1,d1,m1,_1,h1,b1,$1,y1,k1;const{hoveredRowId:S1,focusedCellId:A1,stickyColumn:C1,scroll:E1,dispatch:T1,rows:I1,focusedCellAPI:N1,tableId:j1,subscribe:V1,renderedRows:B1,renderedColumns:D1,rowHeight:F1,hasNextPage:U1,maxScrollTop:G1,rowVerticalInversionIndex:K1,columnHorizontalInversionIndex:q1,selectedRows:J1,config:X1}=getContext("grid");component_subscribe(n1,S1,J0=>t1(38,c1=J0)),component_subscribe(n1,A1,J0=>t1(10,l1=J0)),component_subscribe(n1,C1,J0=>t1(1,b1=J0)),component_subscribe(n1,N1,J0=>t1(37,s1=J0)),component_subscribe(n1,j1,J0=>t1(35,h1=J0)),component_subscribe(n1,B1,J0=>t1(32,u1=J0)),component_subscribe(n1,D1,J0=>t1(2,$1=J0)),component_subscribe(n1,F1,J0=>t1(39,f1=J0)),component_subscribe(n1,U1,J0=>t1(41,d1=J0)),component_subscribe(n1,G1,J0=>t1(40,p1=J0)),component_subscribe(n1,K1,J0=>t1(34,_1=J0)),component_subscribe(n1,q1,J0=>t1(12,k1=J0)),component_subscribe(n1,J1,J0=>t1(33,m1=J0)),component_subscribe(n1,X1,J0=>t1(11,y1=J0));let W1=!1,a0=!1,f0={},n0=0;const c0=(J0,$2,p2)=>J0===0?!1:p2.length>=$2,e0=async()=>{t1(4,a0=!0),set_store_value(A1,l1=null,l1),await tick();const J0=n0?void 0:0,$2=await I1.actions.addRow(f0,J0);$2&&($0(),r1&&set_store_value(A1,l1=`${$2._id}-${r1.name}`,l1)),t1(4,a0=!1)},$0=()=>{t1(4,a0=!1),t1(3,W1=!1),set_store_value(A1,l1=null,l1),set_store_value(S1,c1=null,c1),document.removeEventListener("keydown",B0)},E0=async()=>{if(W1&&!a0){await e0();return}W1||!r1||(d1?t1(0,n0=0):(E1.update(J0=>({...J0,top:p1})),t1(0,n0=u1.length*f1-p1%f1),u1.length!==0&&t1(0,n0-=1)),t1(5,f0={}),t1(3,W1=!0),set_store_value(S1,c1=NewRowID,c1),r1&&set_store_value(A1,l1=`${NewRowID}-${r1.name}`,l1),document.addEventListener("keydown",B0))},r0=(J0,$2,p2)=>{t1(5,f0[$2]=p2,f0)},w0=()=>{$0(),T1("add-row")},B0=J0=>{!W1||J0.key==="Escape"&&(s1!=null&&s1.isActive()||(J0.preventDefault(),$0()))};onMount(()=>V1("add-row-inline",E0)),onDestroy(()=>{document.removeEventListener("keydown",B0)});const N0=()=>T1("add-row-inline");return n1.$$.update=()=>{n1.$$.dirty[0]&6&&t1(6,r1=b1||$1[0]),n1.$$.dirty[0]&2&&t1(9,o1=GutterWidth+((b1==null?void 0:b1.width)||0)),n1.$$.dirty[1]&16&&t1(3,W1=!1),n1.$$.dirty[0]&1|n1.$$.dirty[1]&10&&t1(8,i1=c0(n0,_1,u1)),n1.$$.dirty[1]&4&&t1(7,a1=Object.values(m1).length)},[n0,b1,$1,W1,a0,f0,r1,a1,i1,o1,l1,y1,k1,S1,A1,C1,T1,N1,j1,B1,D1,F1,U1,G1,K1,q1,J1,X1,e0,$0,r0,w0,u1,m1,_1,h1,N0]}class NewRow extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7e,create_fragment$75,safe_not_equal,{},null,[-1,-1])}}const createGridWebsocket=n1=>{const{rows:e1,tableId:t1,users:r1,focusedCellId:o1,table:i1,API:a1}=n1,s1=createWebsocket("/socket/grid"),l1=c1=>{if(!s1.connected)return;const u1=a1.getAppID();s1.emit(GridSocketEvent.SelectTable,{tableId:c1,appId:u1},({users:f1})=>{r1.set(f1)})};return s1.on("connect",()=>{l1(get_store_value(t1))}),s1.on("connect_error",c1=>{console.log("Failed to connect to grid websocket:",c1.message)}),s1.onOther(SocketEvent.UserUpdate,({user:c1})=>{r1.actions.updateUser(c1)}),s1.onOther(SocketEvent.UserDisconnect,({sessionId:c1})=>{r1.actions.removeUser(c1)}),s1.onOther(GridSocketEvent.RowChange,async({id:c1,row:u1})=>{c1?e1.actions.replaceRow(c1,u1):u1.id&&await e1.actions.refreshRow(u1.id)}),s1.onOther(GridSocketEvent.TableChange,({table:c1})=>{c1&&i1.set(c1)}),t1.subscribe(l1),o1.subscribe(c1=>{s1.emit(GridSocketEvent.SelectCell,{cellId:c1})}),()=>s1==null?void 0:s1.disconnect()},Grid_svelte_svelte_type_style_lang="",get_controls_slot_changes$1=n1=>({}),get_controls_slot_context$1=n1=>({}),get_filter_slot_changes=n1=>({}),get_filter_slot_context=n1=>({});function create_if_block_5$o(n1){let e1,t1,r1,o1,i1,a1,s1,l1,c1,u1,f1,p1;const d1=n1[38].filter,m1=create_slot(d1,n1,n1[37],get_filter_slot_context);o1=new SortButton({}),a1=new HideColumnsButton({}),l1=new SizeButton({});const _1=n1[38].controls,h1=create_slot(_1,n1,n1[37],get_controls_slot_context$1);let b1=n1[3]&&create_if_block_6$g();return{c(){e1=element("div"),t1=element("div"),m1&&m1.c(),r1=space$1(),create_component(o1.$$.fragment),i1=space$1(),create_component(a1.$$.fragment),s1=space$1(),create_component(l1.$$.fragment),c1=space$1(),h1&&h1.c(),u1=space$1(),f1=element("div"),b1&&b1.c(),attr(t1,"class","controls-left svelte-1bm0rxl"),attr(f1,"class","controls-right svelte-1bm0rxl"),attr(e1,"class","controls svelte-1bm0rxl")},m($1,y1){insert$1($1,e1,y1),append$1(e1,t1),m1&&m1.m(t1,null),append$1(t1,r1),mount_component(o1,t1,null),append$1(t1,i1),mount_component(a1,t1,null),append$1(t1,s1),mount_component(l1,t1,null),append$1(t1,c1),h1&&h1.m(t1,null),append$1(e1,u1),append$1(e1,f1),b1&&b1.m(f1,null),p1=!0},p($1,y1){m1&&m1.p&&(!p1||y1[1]&64)&&update_slot_base(m1,d1,$1,$1[37],p1?get_slot_changes(d1,$1[37],y1,get_filter_slot_changes):get_all_dirty_from_scope($1[37]),get_filter_slot_context),h1&&h1.p&&(!p1||y1[1]&64)&&update_slot_base(h1,_1,$1,$1[37],p1?get_slot_changes(_1,$1[37],y1,get_controls_slot_changes$1):get_all_dirty_from_scope($1[37]),get_controls_slot_context$1),$1[3]?b1?y1[0]&8&&transition_in(b1,1):(b1=create_if_block_6$g(),b1.c(),transition_in(b1,1),b1.m(f1,null)):b1&&(group_outros(),transition_out(b1,1,1,()=>{b1=null}),check_outros())},i($1){p1||(transition_in(m1,$1),transition_in(o1.$$.fragment,$1),transition_in(a1.$$.fragment,$1),transition_in(l1.$$.fragment,$1),transition_in(h1,$1),transition_in(b1),p1=!0)},o($1){transition_out(m1,$1),transition_out(o1.$$.fragment,$1),transition_out(a1.$$.fragment,$1),transition_out(l1.$$.fragment,$1),transition_out(h1,$1),transition_out(b1),p1=!1},d($1){$1&&detach(e1),m1&&m1.d($1),destroy_component(o1),destroy_component(a1),destroy_component(l1),h1&&h1.d($1),b1&&b1.d()}}}function create_if_block_6$g(n1){let e1,t1;return e1=new UserAvatars$1({}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_if_block_4$z(n1){let e1,t1,r1,o1,i1;return{c(){e1=element("div"),t1=element("div"),t1.textContent="There was a problem loading your grid",r1=space$1(),o1=element("div"),i1=text(n1[10]),attr(t1,"class","grid-error-title svelte-1bm0rxl"),attr(o1,"class","grid-error-subtitle svelte-1bm0rxl"),attr(e1,"class","grid-error svelte-1bm0rxl")},m(a1,s1){insert$1(a1,e1,s1),append$1(e1,t1),append$1(e1,r1),append$1(e1,o1),append$1(o1,i1)},p(a1,s1){s1[0]&1024&&set_data(i1,a1[10])},i:noop$5,o:noop$5,d(a1){a1&&detach(e1)}}}function create_if_block_2$15(n1){let e1,t1,r1,o1,i1,a1,s1,l1,c1,u1,f1,p1,d1,m1,_1,h1,b1,$1,y1,k1,S1;r1=new StickyColumn({}),a1=new HeaderRow({}),l1=new GridBody({});let A1=n1[0]&&create_if_block_3$L();return p1=new ResizeOverlay({}),m1=new ReorderOverlay({}),h1=new ScrollOverlay({}),$1=new MenuOverlay({}),{c(){e1=element("div"),t1=element("div"),create_component(r1.$$.fragment),o1=space$1(),i1=element("div"),create_component(a1.$$.fragment),s1=space$1(),create_component(l1.$$.fragment),c1=space$1(),A1&&A1.c(),u1=space$1(),f1=element("div"),create_component(p1.$$.fragment),d1=space$1(),create_component(m1.$$.fragment),_1=space$1(),create_component(h1.$$.fragment),b1=space$1(),create_component($1.$$.fragment),attr(i1,"class","grid-data-content svelte-1bm0rxl"),attr(f1,"class","overlays svelte-1bm0rxl"),attr(t1,"class","grid-data-inner svelte-1bm0rxl"),attr(e1,"class","grid-data-outer svelte-1bm0rxl")},m(C1,E1){insert$1(C1,e1,E1),append$1(e1,t1),mount_component(r1,t1,null),append$1(t1,o1),append$1(t1,i1),mount_component(a1,i1,null),append$1(i1,s1),mount_component(l1,i1,null),append$1(t1,c1),A1&&A1.m(t1,null),append$1(t1,u1),append$1(t1,f1),mount_component(p1,f1,null),append$1(f1,d1),mount_component(m1,f1,null),append$1(f1,_1),mount_component(h1,f1,null),append$1(f1,b1),mount_component($1,f1,null),y1=!0,k1||(S1=action_destroyer(clickOutside.call(null,e1,n1[15].actions.blur)),k1=!0)},p(C1,E1){C1[0]?A1?E1[0]&1&&transition_in(A1,1):(A1=create_if_block_3$L(),A1.c(),transition_in(A1,1),A1.m(t1,u1)):A1&&(group_outros(),transition_out(A1,1,1,()=>{A1=null}),check_outros())},i(C1){y1||(transition_in(r1.$$.fragment,C1),transition_in(a1.$$.fragment,C1),transition_in(l1.$$.fragment,C1),transition_in(A1),transition_in(p1.$$.fragment,C1),transition_in(m1.$$.fragment,C1),transition_in(h1.$$.fragment,C1),transition_in($1.$$.fragment,C1),y1=!0)},o(C1){transition_out(r1.$$.fragment,C1),transition_out(a1.$$.fragment,C1),transition_out(l1.$$.fragment,C1),transition_out(A1),transition_out(p1.$$.fragment,C1),transition_out(m1.$$.fragment,C1),transition_out(h1.$$.fragment,C1),transition_out($1.$$.fragment,C1),y1=!1},d(C1){C1&&detach(e1),destroy_component(r1),destroy_component(a1),destroy_component(l1),A1&&A1.d(),destroy_component(p1),destroy_component(m1),destroy_component(h1),destroy_component($1),k1=!1,S1()}}}function create_if_block_3$L(n1){let e1,t1;return e1=new NewRow({}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_if_block_1$1N(n1){let e1,t1,r1,o1;return t1=new ProgressCircle({}),{c(){e1=element("div"),create_component(t1.$$.fragment),attr(e1,"class","grid-loading svelte-1bm0rxl")},m(i1,a1){insert$1(i1,e1,a1),mount_component(t1,e1,null),o1=!0},i(i1){o1||(transition_in(t1.$$.fragment,i1),i1&&(r1||add_render_callback(()=>{r1=create_in_transition(e1,fade,{duration:130}),r1.start()})),o1=!0)},o(i1){transition_out(t1.$$.fragment,i1),o1=!1},d(i1){i1&&detach(e1),destroy_component(t1)}}}function create_if_block$34(n1){let e1,t1;return e1=new BulkDeleteHandler({}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_fragment$74(n1){let e1,t1,r1,o1,i1,a1,s1,l1,c1,u1,f1,p1=n1[4]&&create_if_block_5$o(n1);const d1=[create_if_block_2$15,create_if_block_4$z],m1=[];function _1($1,y1){return $1[9]?0:$1[10]?1:-1}~(r1=_1(n1))&&(o1=m1[r1]=d1[r1](n1));let h1=n1[11]&&!n1[10]&&create_if_block_1$1N(),b1=n1[1]&&create_if_block$34();return l1=new KeyboardManager({}),{c(){e1=element("div"),p1&&p1.c(),t1=space$1(),o1&&o1.c(),i1=space$1(),h1&&h1.c(),a1=space$1(),b1&&b1.c(),s1=space$1(),create_component(l1.$$.fragment),attr(e1,"class","grid svelte-1bm0rxl"),attr(e1,"id","grid-"+n1[12]),set_style(e1,"--row-height",n1[7]+"px"),set_style(e1,"--default-row-height",DefaultRowHeight+"px"),set_style(e1,"--gutter-width",GutterWidth+"px"),set_style(e1,"--max-cell-render-height",MaxCellRenderHeight+"px"),set_style(e1,"--max-cell-render-width-overflow",MaxCellRenderWidthOverflow+"px"),set_style(e1,"--content-lines",n1[8]),toggle_class(e1,"is-resizing",n1[5]),toggle_class(e1,"is-reordering",n1[6]),toggle_class(e1,"stripe",n1[2])},m($1,y1){insert$1($1,e1,y1),p1&&p1.m(e1,null),append$1(e1,t1),~r1&&m1[r1].m(e1,null),append$1(e1,i1),h1&&h1.m(e1,null),append$1(e1,a1),b1&&b1.m(e1,null),append$1(e1,s1),mount_component(l1,e1,null),c1=!0,u1||(f1=[listen(e1,"mouseenter",n1[39]),listen(e1,"mouseleave",n1[40])],u1=!0)},p($1,y1){$1[4]?p1?(p1.p($1,y1),y1[0]&16&&transition_in(p1,1)):(p1=create_if_block_5$o($1),p1.c(),transition_in(p1,1),p1.m(e1,t1)):p1&&(group_outros(),transition_out(p1,1,1,()=>{p1=null}),check_outros());let k1=r1;r1=_1($1),r1===k1?~r1&&m1[r1].p($1,y1):(o1&&(group_outros(),transition_out(m1[k1],1,1,()=>{m1[k1]=null}),check_outros()),~r1?(o1=m1[r1],o1?o1.p($1,y1):(o1=m1[r1]=d1[r1]($1),o1.c()),transition_in(o1,1),o1.m(e1,i1)):o1=null),$1[11]&&!$1[10]?h1?y1[0]&3072&&transition_in(h1,1):(h1=create_if_block_1$1N(),h1.c(),transition_in(h1,1),h1.m(e1,a1)):h1&&(group_outros(),transition_out(h1,1,1,()=>{h1=null}),check_outros()),$1[1]?b1?y1[0]&2&&transition_in(b1,1):(b1=create_if_block$34(),b1.c(),transition_in(b1,1),b1.m(e1,s1)):b1&&(group_outros(),transition_out(b1,1,1,()=>{b1=null}),check_outros()),(!c1||y1[0]&128)&&set_style(e1,"--row-height",$1[7]+"px"),(!c1||y1[0]&256)&&set_style(e1,"--content-lines",$1[8]),(!c1||y1[0]&32)&&toggle_class(e1,"is-resizing",$1[5]),(!c1||y1[0]&64)&&toggle_class(e1,"is-reordering",$1[6]),(!c1||y1[0]&4)&&toggle_class(e1,"stripe",$1[2])},i($1){c1||(transition_in(p1),transition_in(o1),transition_in(h1),transition_in(b1),transition_in(l1.$$.fragment,$1),c1=!0)},o($1){transition_out(p1),transition_out(o1),transition_out(h1),transition_out(b1),transition_out(l1.$$.fragment,$1),c1=!1},d($1){$1&&detach(e1),p1&&p1.d(),~r1&&m1[r1].d(),h1&&h1.d(),b1&&b1.d(),destroy_component(l1),u1=!1,run_all(f1)}}}function instance$7d(n1,e1,t1){let r1,o1,i1,a1,s1,l1,c1,{$$slots:u1={},$$scope:f1}=e1,{API:p1=null}=e1,{tableId:d1=null}=e1,{schemaOverrides:m1=null}=e1,{columnWhitelist:_1=null}=e1,{allowAddRows:h1=!0}=e1,{allowExpandRows:b1=!0}=e1,{allowEditRows:$1=!0}=e1,{allowDeleteRows:y1=!0}=e1,{allowSchemaChanges:k1=!0}=e1,{stripeRows:S1=!1}=e1,{collaboration:A1=!0}=e1,{showAvatars:C1=!0}=e1,{showControls:E1=!0}=e1,{initialFilter:T1=null}=e1,{initialSortColumn:I1=null}=e1,{initialSortOrder:N1=null}=e1,{fixedRowHeight:j1=null}=e1,{notifySuccess:V1=null}=e1,{notifyError:B1=null}=e1;const D1=Math.random();let F1={API:p1||createAPIClient(),rand:D1,props:e1};F1={...F1,...createEventManagers()},F1=attachStores(F1);const{config:U1,isResizing:G1,isReordering:K1,ui:q1,loaded:J1,loading:X1,rowHeight:W1,contentLines:a0,gridFocused:f0,error:n0}=F1;component_subscribe(n1,G1,E0=>t1(5,r1=E0)),component_subscribe(n1,K1,E0=>t1(6,o1=E0)),component_subscribe(n1,J1,E0=>t1(9,s1=E0)),component_subscribe(n1,X1,E0=>t1(11,c1=E0)),component_subscribe(n1,W1,E0=>t1(7,i1=E0)),component_subscribe(n1,a0,E0=>t1(8,a1=E0)),component_subscribe(n1,n0,E0=>t1(10,l1=E0)),setContext("grid",F1);const c0=()=>F1;onMount(()=>{if(A1)return createGridWebsocket(F1)});const e0=()=>f0.set(!0),$0=()=>f0.set(!1);return n1.$$set=E0=>{t1(43,e1=assign$1(assign$1({},e1),exclude_internal_props(E0))),"API"in E0&&t1(22,p1=E0.API),"tableId"in E0&&t1(23,d1=E0.tableId),"schemaOverrides"in E0&&t1(24,m1=E0.schemaOverrides),"columnWhitelist"in E0&&t1(25,_1=E0.columnWhitelist),"allowAddRows"in E0&&t1(0,h1=E0.allowAddRows),"allowExpandRows"in E0&&t1(26,b1=E0.allowExpandRows),"allowEditRows"in E0&&t1(27,$1=E0.allowEditRows),"allowDeleteRows"in E0&&t1(1,y1=E0.allowDeleteRows),"allowSchemaChanges"in E0&&t1(28,k1=E0.allowSchemaChanges),"stripeRows"in E0&&t1(2,S1=E0.stripeRows),"collaboration"in E0&&t1(29,A1=E0.collaboration),"showAvatars"in E0&&t1(3,C1=E0.showAvatars),"showControls"in E0&&t1(4,E1=E0.showControls),"initialFilter"in E0&&t1(30,T1=E0.initialFilter),"initialSortColumn"in E0&&t1(31,I1=E0.initialSortColumn),"initialSortOrder"in E0&&t1(32,N1=E0.initialSortOrder),"fixedRowHeight"in E0&&t1(33,j1=E0.fixedRowHeight),"notifySuccess"in E0&&t1(34,V1=E0.notifySuccess),"notifyError"in E0&&t1(35,B1=E0.notifyError),"$$scope"in E0&&t1(37,f1=E0.$$scope)},n1.$$.update=()=>{n1.$$.dirty[0]&2139095071|n1.$$.dirty[1]&31&&U1.set({tableId:d1,schemaOverrides:m1,columnWhitelist:_1,allowAddRows:h1,allowExpandRows:b1,allowEditRows:$1,allowDeleteRows:y1,allowSchemaChanges:k1,stripeRows:S1,collaboration:A1,showAvatars:C1,showControls:E1,initialFilter:T1,initialSortColumn:I1,initialSortOrder:N1,fixedRowHeight:j1,notifySuccess:V1,notifyError:B1})},e1=exclude_internal_props(e1),[h1,y1,S1,C1,E1,r1,o1,i1,a1,s1,l1,c1,D1,G1,K1,q1,J1,X1,W1,a0,f0,n0,p1,d1,m1,_1,b1,$1,k1,A1,T1,I1,N1,j1,V1,B1,c0,f1,u1,e0,$0]}class Grid extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7d,create_fragment$74,safe_not_equal,{API:22,tableId:23,schemaOverrides:24,columnWhitelist:25,allowAddRows:0,allowExpandRows:26,allowEditRows:27,allowDeleteRows:1,allowSchemaChanges:28,stripeRows:2,collaboration:29,showAvatars:3,showControls:4,initialFilter:30,initialSortColumn:31,initialSortOrder:32,fixedRowHeight:33,notifySuccess:34,notifyError:35,getContext:36},null,[-1,-1])}get getContext(){return this.$$.ctx[36]}}const database=writable({}),FIELDS={STRING:{name:"Text",type:"string",constraints:{type:"string",length:{},presence:!1}},BARCODEQR:{name:"Barcode/QR",type:"barcodeqr",constraints:{type:"string",length:{},presence:!1}},LONGFORM:{name:"Long Form Text",type:"longform",constraints:{type:"string",length:{},presence:!1}},OPTIONS:{name:"Options",type:"options",constraints:{type:"string",presence:!1,inclusion:[]}},ARRAY:{name:"Multi-select",type:"array",constraints:{type:"array",presence:!1,inclusion:[]}},NUMBER:{name:"Number",type:"number",constraints:{type:"number",presence:!1,numericality:{greaterThanOrEqualTo:"",lessThanOrEqualTo:""}}},BOOLEAN:{name:"Boolean",type:"boolean",constraints:{type:"boolean",presence:!1}},DATETIME:{name:"Date/Time",type:"datetime",constraints:{type:"string",length:{},presence:!1,datetime:{latest:"",earliest:""}}},ATTACHMENT:{name:"Attachment",type:"attachment",constraints:{type:"array",presence:!1}},LINK:{name:"Relationship",type:"link",constraints:{type:"array",presence:!1}},FORMULA:{name:"Formula",type:"formula",constraints:{}},JSON:{name:"JSON",type:"json",constraints:{type:"object",presence:!1}}},AUTO_COLUMN_SUB_TYPES={AUTO_ID:"autoID",CREATED_BY:"createdBy",CREATED_AT:"createdAt",UPDATED_BY:"updatedBy",UPDATED_AT:"updatedAt"},AUTO_COLUMN_DISPLAY_NAMES={AUTO_ID:"Auto ID",CREATED_BY:"Created By",CREATED_AT:"Created At",UPDATED_BY:"Updated By",UPDATED_AT:"Updated At"},Roles={ADMIN:"ADMIN",POWER:"POWER",BASIC:"BASIC",PUBLIC:"PUBLIC",BUILDER:"BUILDER"};function isAutoColumnUserRelationship(n1){return n1===AUTO_COLUMN_SUB_TYPES.CREATED_BY||n1===AUTO_COLUMN_SUB_TYPES.UPDATED_BY}const RelationshipTypes={MANY_TO_MANY:"many-to-many",ONE_TO_MANY:"one-to-many",MANY_TO_ONE:"many-to-one"},ALLOWABLE_STRING_OPTIONS=[FIELDS.STRING,FIELDS.OPTIONS,FIELDS.LONGFORM,FIELDS.BARCODEQR],ALLOWABLE_STRING_TYPES=ALLOWABLE_STRING_OPTIONS.map(n1=>n1.type),ALLOWABLE_NUMBER_OPTIONS=[FIELDS.NUMBER,FIELDS.BOOLEAN],ALLOWABLE_NUMBER_TYPES=ALLOWABLE_NUMBER_OPTIONS.map(n1=>n1.type),SWITCHABLE_TYPES=[...ALLOWABLE_STRING_TYPES,...ALLOWABLE_NUMBER_TYPES],BUDIBASE_INTERNAL_DB_ID="bb_internal",DEFAULT_BB_DATASOURCE_ID="datasource_internal_bb_default",BUDIBASE_DATASOURCE_TYPE="budibase",DB_TYPE_INTERNAL="internal",DB_TYPE_EXTERNAL="external",IntegrationTypes={POSTGRES:"POSTGRES",MONGODB:"MONGODB",COUCHDB:"COUCHDB",S3:"S3",MYSQL:"MYSQL",REST:"REST",DYNAMODB:"DYNAMODB",ELASTICSEARCH:"ELASTICSEARCH",SQL_SERVER:"SQL_SERVER",AIRTABLE:"AIRTABLE",ARANGODB:"ARANGODB",ORACLE:"ORACLE",INTERNAL:"INTERNAL",GOOGLE_SHEETS:"GOOGLE_SHEETS",FIRESTORE:"FIRESTORE",REDIS:"REDIS",SNOWFLAKE:"SNOWFLAKE"},SchemaTypeOptions=[{label:"Text",value:"string"},{label:"Number",value:"number"},{label:"Boolean",value:"boolean"},{label:"Datetime",value:"datetime"}],RawRestBodyTypes={NONE:"none",FORM:"form",ENCODED:"encoded",JSON:"json",TEXT:"text",XML:"xml"},RestBodyTypes=[{name:"none",value:"none"},{name:"form-data",value:"form"},{name:"x-www-form-encoded",value:"encoded"},{name:"raw (JSON)",value:"json"},{name:"raw (XML)",value:"xml"},{name:"raw (Text)",value:"text"}],PaginationTypes=[{label:"Page number based",value:"page"},{label:"Cursor based",value:"cursor"}],PaginationLocations=[{label:"Query parameters",value:"query"},{label:"Request body",value:"body"}],BannedSearchTypes=["link","attachment","formula","json","jsonarray"],DatasourceTypes={RELATIONAL:"Relational",NON_RELATIONAL:"Non-relational",SPREADSHEET:"Spreadsheet",OBJECT_STORE:"Object store",GRAPH:"Graph",API:"API"};function createTablesStore(){const n1=writable({list:[],selectedTableId:null}),e1=derived(n1,u1=>{var f1;return{...u1,selected:(f1=u1.list)==null?void 0:f1.find(p1=>p1._id===u1.selectedTableId)}}),t1=async()=>{const u1=await API.getTables();n1.update(f1=>({...f1,list:u1}))},r1=u1=>{n1.update(f1=>({...f1,selectedTableId:u1}))},o1=async u1=>{const f1=fp.cloneDeep(u1),p1=get_store_value(n1).list.filter(_1=>_1._id===u1._id)[0],d1=[];for(let _1 of Object.keys(f1.schema)){if(d1.indexOf(_1.toLowerCase())!==-1){delete f1.schema[_1];continue}const h1=f1.schema[_1],b1=p1==null?void 0:p1.schema[_1];b1!=null&&(b1==null?void 0:b1.type)!==h1.type&&SWITCHABLE_TYPES.indexOf(b1==null?void 0:b1.type)===-1&&(f1.schema[_1]=b1),h1.name&&h1.name!==_1&&(f1.schema[h1.name]=h1,f1._rename={old:_1,updated:h1.name},delete f1.schema[_1]),d1.push(_1.toLowerCase())}const m1=await API.saveTable(f1);return l1(m1._id,m1),r1(m1._id),m1},i1=async u1=>{!(u1!=null&&u1._id)||(await API.deleteTable({tableId:u1._id,tableRev:u1._rev||"rev"}),l1(u1._id,null))},a1=async({originalName:u1,field:f1,primaryDisplay:p1=!1,indexes:d1})=>{let m1=fp.cloneDeep(get_store_value(e1).selected);if(u1!=null&&u1!==f1.name&&(delete m1.schema[u1],m1._rename={old:u1,updated:f1.name}),p1)m1.primaryDisplay=f1.name;else if(m1.primaryDisplay===u1){const _1=Object.keys(m1.schema);m1.primaryDisplay=_1.filter(h1=>h1!==u1||h1!==f1)[0]}d1&&(m1.indexes=d1),m1.schema={...m1.schema,[f1.name]:fp.cloneDeep(f1)},await o1(m1)},s1=async u1=>{let f1=fp.cloneDeep(get_store_value(e1).selected);delete f1.schema[u1.name],await o1(f1)},l1=(u1,f1)=>{if(!u1)return;if(!f1){n1.update(d1=>({...d1,list:d1.list.filter(m1=>m1._id!==u1)}));return}const p1=get_store_value(n1).list.findIndex(d1=>d1._id===f1._id);p1===-1?n1.update(d1=>({...d1,list:[...d1.list,f1]})):f1&&n1.update(d1=>(d1.list[p1]={...f1,type:d1.list[p1].type},d1))},c1=u1=>{n1.update(f1=>({...f1,list:f1.list.filter(p1=>p1.sourceId!==u1)}))};return{...n1,subscribe:e1.subscribe,fetch:t1,init:t1,select:r1,save:o1,delete:i1,saveField:a1,deleteField:s1,replaceTable:l1,removeDatasourceTables:c1}}const tables=createTablesStore();function createViewsStore(){const n1=writable({selectedViewName:null}),e1=derived([n1,tables],([i1,a1])=>{var l1;let s1=[];return(l1=a1.list)==null||l1.forEach(c1=>{s1=s1.concat(Object.values((c1==null?void 0:c1.views)||{}))}),{...i1,list:s1,selected:s1.find(c1=>c1.name===i1.selectedViewName)}}),t1=i1=>{n1.update(a1=>({...a1,selectedViewName:i1}))},r1=async i1=>{await API.deleteView(i1),tables.update(a1=>{const s1=a1.list.find(l1=>l1._id===i1.tableId);return s1&&delete s1.views[i1.name],{...a1}})},o1=async i1=>{const a1=await API.saveView(i1);tables.update(s1=>{const l1=s1.list.find(c1=>c1._id===i1.tableId);return l1&&(i1.originalName&&delete l1.views[i1.originalName],l1.views[i1.name]=a1),{...s1}})};return{subscribe:e1.subscribe,select:t1,delete:r1,save:o1}}const views=createViewsStore();function createPermissionStore(){const{subscribe:n1}=writable([]);return{subscribe:n1,save:async({level:e1,role:t1,resource:r1})=>await API.updatePermissionForResource({resourceId:r1,roleId:t1,level:e1}),forResource:async e1=>await API.getPermissionForResource(e1)}}const permissions=createPermissionStore();function createRolesStore(){const{subscribe:n1,update:e1,set:t1}=writable([]);function r1(i1){t1(i1.sort((a1,s1)=>{const l1=getRolePriority(a1._id),c1=getRolePriority(s1._id);return l1>c1?-1:1}))}const o1={fetch:async()=>{const i1=await API.getRoles();r1(i1)},fetchByAppId:async i1=>{const{roles:a1}=await API.getRolesForApp(i1);r1(a1)},delete:async i1=>{await API.deleteRole({roleId:i1==null?void 0:i1._id,roleRev:i1==null?void 0:i1._rev}),e1(a1=>a1.filter(s1=>s1._id!==i1._id))},save:async i1=>{const a1=await API.saveRole(i1);return await o1.fetch(),a1}};return{subscribe:n1,...o1}}const roles=createRolesStore(),TableNames={USERS:"ta_users"},AppStatus={ALL:"all",DEV:"development",DEPLOYED:"published"},IntegrationNames={POSTGRES:"PostgreSQL",MONGODB:"MongoDB",COUCHDB:"CouchDB",S3:"S3",MYSQL:"MySQL",REST:"REST",DYNAMODB:"DynamoDB",ELASTICSEARCH:"ElasticSearch",SQL_SERVER:"SQL Server",AIRTABLE:"Airtable",ARANGODB:"ArangoDB",ORACLE:"Oracle",GOOGLE_SHEETS:"Google Sheets"},UNEDITABLE_USER_FIELDS=["email","password","roleId","status","firstName","lastName"],UNSORTABLE_TYPES=["formula","attachment","array","link"],APP_NAME_REGEX=/^[\w\s]+$/,APP_URL_REGEX=/^[0-9a-zA-Z-_]+$/,DefaultAppTheme={primaryColor:"var(--spectrum-global-color-blue-600)",primaryColorHover:"var(--spectrum-global-color-blue-500)",buttonBorderRadius:"16px",navBackground:"var(--spectrum-global-color-gray-50)",navTextColor:"var(--spectrum-global-color-gray-800)"},PluginSource={URL:"URL",NPM:"NPM",GITHUB:"Github",FILE:"File Upload"},OnboardingType={EMAIL:"email",PASSWORD:"password"},PlanModel={PER_USER:"perUser",DAY_PASS:"dayPass"};class ImportTableError extends Error{constructor(e1){super(e1);const[t1,r1]=e1.split(" - ");this.name="TableSelectionError",this.title=t1[0].toUpperCase()+t1.substr(1),this.description=r1[0].toUpperCase()+r1.substr(1)}}function createDatasourcesStore(){const n1=writable({list:[],selectedDatasourceId:null,schemaError:null}),e1=derived([n1,tables],([m1,_1])=>{var y1,k1,S1,A1;let h1=(y1=m1.list)==null?void 0:y1.find(C1=>C1._id===BUDIBASE_INTERNAL_DB_ID),b1=(k1=m1.list)==null?void 0:k1.filter(C1=>C1._id!==BUDIBASE_INTERNAL_DB_ID);h1&&(h1={...h1,entities:(S1=_1.list)==null?void 0:S1.filter(C1=>C1.sourceId===BUDIBASE_INTERNAL_DB_ID&&C1._id!==TableNames.USERS)});let $1=[];return(A1=h1==null?void 0:h1.entities)!=null&&A1.length&&$1.push(h1),$1=$1.concat(b1||[]),{...m1,list:$1,selected:$1==null?void 0:$1.find(C1=>C1._id===m1.selectedDatasourceId),hasDefaultData:$1==null?void 0:$1.some(C1=>C1._id===DEFAULT_BB_DATASOURCE_ID),hasData:($1==null?void 0:$1.length)>0}}),t1=async()=>{const m1=await API.getDatasources();n1.update(_1=>({..._1,list:m1}))},r1=m1=>{n1.update(_1=>({..._1,selectedDatasourceId:m1,schemaError:null}))},o1=m1=>{const{datasource:_1,error:h1}=m1;return h1&&n1.update(b1=>({...b1,schemaError:h1})),p1(_1._id,_1),r1(_1._id),_1},i1=async(m1,_1)=>{try{const h1=await API.buildDatasourceSchema({datasourceId:m1==null?void 0:m1._id,tablesFilter:_1});o1(h1)}catch(h1){throw h1.message.split(" - ").length===2?new ImportTableError(h1.message):h1}},a1=m1=>get_store_value(n1).list.filter(_1=>_1.source===m1).length,s1=async(m1,_1)=>{var h1;if((h1=m1.features)!=null&&h1[DatasourceFeature.CONNECTION_CHECKING]){const{connected:b1,error:$1}=await API.validateDatasource(_1);if(b1)return;throw new Error(`Unable to connect: ${$1}`)}},l1=async({integration:m1,config:_1})=>{const h1=a1(m1.name),b1=h1===0?"":` ${h1+1}`,$1={type:"datasource",source:m1.name,config:_1,name:`${m1.friendlyName}${b1}`,plus:m1.plus&&m1.name!==IntegrationTypes.REST};if(await s1(m1,$1))throw new Error("Unable to connect");const y1=await API.createDatasource({datasource:$1,fetchSchema:m1.plus&&m1.name!==IntegrationTypes.GOOGLE_SHEETS});return o1(y1)},c1=async({integration:m1,datasource:_1})=>{if(await s1(m1,_1))throw new Error("Unable to connect");const h1=await API.updateDatasource(_1);return o1(h1)},u1=async m1=>{!(m1!=null&&m1._id)||!(m1!=null&&m1._rev)||(await API.deleteDatasource({datasourceId:m1._id,datasourceRev:m1._rev}),p1(m1._id,null))},f1=()=>{n1.update(m1=>({...m1,schemaError:null}))},p1=(m1,_1)=>{if(!m1)return;if(!_1){n1.update(b1=>({...b1,list:b1.list.filter($1=>$1._id!==m1)})),tables.removeDatasourceTables(m1),queries.removeDatasourceQueries(m1);return}const h1=get_store_value(n1).list.findIndex(b1=>b1._id===_1._id);h1===-1?(n1.update(b1=>({...b1,list:[...b1.list,_1]})),tables.fetch()):_1&&n1.update(b1=>(b1.list[h1]=_1,b1))},d1=async m1=>(await API.fetchInfoForDatasource(m1)).tableNames||[];return{subscribe:e1.subscribe,fetch:t1,init:t1,select:r1,updateSchema:i1,create:l1,update:c1,delete:u1,removeSchemaError:f1,replaceDatasource:p1,getTableNames:d1}}const datasources=createDatasourcesStore(),createIntegrationsStore=()=>{const n1=writable({});return{...n1,init:async()=>{const t1=await API.getIntegrations();n1.set(t1)}}},integrations=createIntegrationsStore(),getIntegrationOrder=n1=>n1===DatasourceTypes.API?1:n1===DatasourceTypes.RELATIONAL?2:n1===DatasourceTypes.NON_RELATIONAL?3:n1.charCodeAt(0)+4,createSortedIntegrationsStore=()=>derived(integrations,n1=>Object.entries(n1).map(([t1,r1])=>({name:t1,...r1})).sort((t1,r1)=>{const o1=getIntegrationOrder(t1.type),i1=getIntegrationOrder(r1.type);return o1===i1?t1.friendlyName.localeCompare(r1.friendlyName):o1<i1?-1:1})),sortedIntegrations=createSortedIntegrationsStore(),duplicateName=(n1,e1)=>{const t1=n1.split(" (")[0],r1=new RegExp(`${t1}\\s\\((\\d+)\\)$`),o1=[];e1.filter(a1=>{if(a1===t1)return!0;const s1=a1.match(r1);return s1?(o1.push(parseInt(s1[1])),!0):!1}),o1.sort((a1,s1)=>a1-s1);let i1;if(o1.length===0)i1=1;else{for(let a1=0;a1<o1.length;a1++)if(o1[a1]!==a1+1){i1=a1+1;break}i1||(i1=o1.length+1)}return`${t1} (${i1})`},sortQueries=n1=>{n1.sort((e1,t1)=>e1.name.localeCompare(t1.name))};function createQueriesStore(){const n1=writable({list:[],selectedQueryId:null}),e1=derived(n1,u1=>{var f1;return{...u1,selected:(f1=u1.list)==null?void 0:f1.find(p1=>p1._id===u1.selectedQueryId)}}),t1=async()=>{const u1=await API.getQueries();sortQueries(u1),n1.update(f1=>({...f1,list:u1}))},r1=async(u1,f1)=>{const p1=get_store_value(integrations),d1=get_store_value(datasources).list.filter(_1=>_1._id===u1);if(d1.length!==0){const h1=p1[d1[0].source].query[f1.queryVerb].readable;h1&&(f1.readable=h1)}f1.datasourceId=u1;const m1=await API.saveQuery(f1);return n1.update(_1=>{const h1=_1.list.findIndex($1=>$1._id===m1._id),b1=_1.list;return h1>=0?b1.splice(h1,1,m1):b1.push(m1),sortQueries(b1),{list:b1,selectedQueryId:m1._id}}),m1},o1=async({data:u1,datasourceId:f1})=>await API.importQueries({datasourceId:f1,data:u1}),i1=u1=>{n1.update(f1=>({...f1,selectedQueryId:u1}))},a1=async u1=>{const f1=u1.parameters.reduce((m1,_1)=>({...m1,[_1.name]:_1.default}),{}),p1=await API.previewQuery({...u1,parameters:f1}),d1={};for(let[m1,_1]of Object.entries(p1.schemaFields))d1[m1]=_1||"string";return{...p1,schema:d1,rows:p1.rows||[]}},s1=async u1=>{await API.deleteQuery({queryId:u1==null?void 0:u1._id,queryRev:u1==null?void 0:u1._rev}),n1.update(f1=>(f1.list=f1.list.filter(p1=>p1._id!==u1._id),f1))},l1=async u1=>{let f1=get_store_value(n1).list;const p1={...u1},d1=u1.datasourceId;return delete p1._id,delete p1._rev,p1.name=duplicateName(u1.name,f1.map(m1=>m1.name)),await r1(d1,p1)},c1=u1=>{n1.update(f1=>({...f1,list:f1.list.filter(p1=>p1.datasourceId!==u1)}))};return{subscribe:e1.subscribe,fetch:t1,init:t1,select:i1,save:r1,import:o1,delete:s1,preview:a1,duplicate:l1,removeDatasourceQueries:c1}}const queries=createQueriesStore();function createFlagsStore(){const{subscribe:n1,set:e1}=writable({}),t1={fetch:async()=>{const r1=await API.getFlags();e1(r1)},updateFlag:async(r1,o1)=>{await API.updateFlag({flag:r1,value:o1}),await t1.fetch()},toggleUiFeature:async r1=>{await API.toggleUiFeature({value:r1})}};return{subscribe:n1,...t1}}const flags=createFlagsStore();function e(n1,e1){var t1=Object.keys(n1);if(Object.getOwnPropertySymbols){var r1=Object.getOwnPropertySymbols(n1);e1&&(r1=r1.filter(function(o1){return Object.getOwnPropertyDescriptor(n1,o1).enumerable})),t1.push.apply(t1,r1)}return t1}function t$1(n1){for(var e1=1;e1<arguments.length;e1++){var t1=arguments[e1]!=null?arguments[e1]:{};e1%2?e(Object(t1),!0).forEach(function(r1){s(n1,r1,t1[r1])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n1,Object.getOwnPropertyDescriptors(t1)):e(Object(t1)).forEach(function(r1){Object.defineProperty(n1,r1,Object.getOwnPropertyDescriptor(t1,r1))})}return n1}function r(n1){return r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e1){return typeof e1}:function(e1){return e1&&typeof Symbol=="function"&&e1.constructor===Symbol&&e1!==Symbol.prototype?"symbol":typeof e1},r(n1)}function n(n1,e1){if(!(n1 instanceof e1))throw new TypeError("Cannot call a class as a function")}function i$1(n1,e1){for(var t1=0;t1<e1.length;t1++){var r1=e1[t1];r1.enumerable=r1.enumerable||!1,r1.configurable=!0,"value"in r1&&(r1.writable=!0),Object.defineProperty(n1,r1.key,r1)}}function o(n1,e1,t1){return e1&&i$1(n1.prototype,e1),t1&&i$1(n1,t1),Object.defineProperty(n1,"prototype",{writable:!1}),n1}function s(n1,e1,t1){return e1 in n1?Object.defineProperty(n1,e1,{value:t1,enumerable:!0,configurable:!0,writable:!0}):n1[e1]=t1,n1}function a(n1,e1){if(typeof e1!="function"&&e1!==null)throw new TypeError("Super expression must either be null or a function");n1.prototype=Object.create(e1&&e1.prototype,{constructor:{value:n1,writable:!0,configurable:!0}}),Object.defineProperty(n1,"prototype",{writable:!1}),e1&&u(n1,e1)}function c(n1){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e1){return e1.__proto__||Object.getPrototypeOf(e1)},c(n1)}function u(n1,e1){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t1,r1){return t1.__proto__=r1,t1},u(n1,e1)}function l(n1,e1){if(n1==null)return{};var t1,r1,o1=function(a1,s1){if(a1==null)return{};var l1,c1,u1={},f1=Object.keys(a1);for(c1=0;c1<f1.length;c1++)l1=f1[c1],s1.indexOf(l1)>=0||(u1[l1]=a1[l1]);return u1}(n1,e1);if(Object.getOwnPropertySymbols){var i1=Object.getOwnPropertySymbols(n1);for(r1=0;r1<i1.length;r1++)t1=i1[r1],e1.indexOf(t1)>=0||Object.prototype.propertyIsEnumerable.call(n1,t1)&&(o1[t1]=n1[t1])}return o1}function d$1(n1,e1){if(e1&&(typeof e1=="object"||typeof e1=="function"))return e1;if(e1!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(t1){if(t1===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t1}(n1)}function p$1(n1){var e1=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var t1,r1=c(n1);if(e1){var o1=c(this).constructor;t1=Reflect.construct(r1,arguments,o1)}else t1=r1.apply(this,arguments);return d$1(this,t1)}}function f(n1,e1){return function(t1){if(Array.isArray(t1))return t1}(n1)||function(t1,r1){var o1=t1==null?null:typeof Symbol<"u"&&t1[Symbol.iterator]||t1["@@iterator"];if(o1!=null){var i1,a1,s1=[],l1=!0,c1=!1;try{for(o1=o1.call(t1);!(l1=(i1=o1.next()).done)&&(s1.push(i1.value),!r1||s1.length!==r1);l1=!0);}catch(u1){c1=!0,a1=u1}finally{try{l1||o1.return==null||o1.return()}finally{if(c1)throw a1}}return s1}}(n1,e1)||_$1(n1,e1)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
374
|
+
`),create_component(r1.$$.fragment),attr(e1,"class","button-with-keys svelte-11w4ycu")},m(i1,a1){insert$1(i1,e1,a1),append$1(e1,t1),mount_component(r1,e1,null),o1=!0},p:noop$5,i(i1){o1||(transition_in(r1.$$.fragment,i1),o1=!0)},o(i1){transition_out(r1.$$.fragment,i1),o1=!1},d(i1){i1&&detach(e1),destroy_component(r1)}}}function create_fragment$75(n1){let e1,t1,r1,o1=!n1[3]&&!n1[7]&&n1[11].allowAddRows&&n1[6]&&create_if_block_7$f(n1),i1=n1[3]&&create_if_block$35(n1);return{c(){o1&&o1.c(),e1=space$1(),i1&&i1.c(),t1=empty$1()},m(a1,s1){o1&&o1.m(a1,s1),insert$1(a1,e1,s1),i1&&i1.m(a1,s1),insert$1(a1,t1,s1),r1=!0},p(a1,s1){!a1[3]&&!a1[7]&&a1[11].allowAddRows&&a1[6]?o1?(o1.p(a1,s1),s1[0]&2248&&transition_in(o1,1)):(o1=create_if_block_7$f(a1),o1.c(),transition_in(o1,1),o1.m(e1.parentNode,e1)):o1&&(group_outros(),transition_out(o1,1,1,()=>{o1=null}),check_outros()),a1[3]?i1?(i1.p(a1,s1),s1[0]&8&&transition_in(i1,1)):(i1=create_if_block$35(a1),i1.c(),transition_in(i1,1),i1.m(t1.parentNode,t1)):i1&&(group_outros(),transition_out(i1,1,1,()=>{i1=null}),check_outros())},i(a1){r1||(transition_in(o1),transition_in(i1),r1=!0)},o(a1){transition_out(o1),transition_out(i1),r1=!1},d(a1){o1&&o1.d(a1),a1&&detach(e1),i1&&i1.d(a1),a1&&detach(t1)}}}function instance$7e(n1,e1,t1){let r1,o1,i1,a1,s1,l1,c1,u1,f1,p1,d1,m1,_1,h1,b1,$1,y1,k1;const{hoveredRowId:S1,focusedCellId:A1,stickyColumn:C1,scroll:E1,dispatch:T1,rows:I1,focusedCellAPI:N1,tableId:j1,subscribe:V1,renderedRows:B1,renderedColumns:D1,rowHeight:F1,hasNextPage:U1,maxScrollTop:G1,rowVerticalInversionIndex:K1,columnHorizontalInversionIndex:q1,selectedRows:J1,config:X1}=getContext("grid");component_subscribe(n1,S1,J0=>t1(38,c1=J0)),component_subscribe(n1,A1,J0=>t1(10,l1=J0)),component_subscribe(n1,C1,J0=>t1(1,b1=J0)),component_subscribe(n1,N1,J0=>t1(37,s1=J0)),component_subscribe(n1,j1,J0=>t1(35,h1=J0)),component_subscribe(n1,B1,J0=>t1(32,u1=J0)),component_subscribe(n1,D1,J0=>t1(2,$1=J0)),component_subscribe(n1,F1,J0=>t1(39,f1=J0)),component_subscribe(n1,U1,J0=>t1(41,d1=J0)),component_subscribe(n1,G1,J0=>t1(40,p1=J0)),component_subscribe(n1,K1,J0=>t1(34,_1=J0)),component_subscribe(n1,q1,J0=>t1(12,k1=J0)),component_subscribe(n1,J1,J0=>t1(33,m1=J0)),component_subscribe(n1,X1,J0=>t1(11,y1=J0));let W1=!1,a0=!1,f0={},n0=0;const c0=(J0,$2,p2)=>J0===0?!1:p2.length>=$2,e0=async()=>{t1(4,a0=!0),set_store_value(A1,l1=null,l1),await tick();const J0=n0?void 0:0,$2=await I1.actions.addRow(f0,J0);$2&&($0(),r1&&set_store_value(A1,l1=`${$2._id}-${r1.name}`,l1)),t1(4,a0=!1)},$0=()=>{t1(4,a0=!1),t1(3,W1=!1),set_store_value(A1,l1=null,l1),set_store_value(S1,c1=null,c1),document.removeEventListener("keydown",B0)},E0=async()=>{if(W1&&!a0){await e0();return}W1||!r1||(d1?t1(0,n0=0):(E1.update(J0=>({...J0,top:p1})),t1(0,n0=u1.length*f1-p1%f1),u1.length!==0&&t1(0,n0-=1)),t1(5,f0={}),t1(3,W1=!0),set_store_value(S1,c1=NewRowID,c1),r1&&set_store_value(A1,l1=`${NewRowID}-${r1.name}`,l1),document.addEventListener("keydown",B0))},r0=(J0,$2,p2)=>{t1(5,f0[$2]=p2,f0)},w0=()=>{$0(),T1("add-row")},B0=J0=>{!W1||J0.key==="Escape"&&(s1!=null&&s1.isActive()||(J0.preventDefault(),$0()))};onMount(()=>V1("add-row-inline",E0)),onDestroy(()=>{document.removeEventListener("keydown",B0)});const N0=()=>T1("add-row-inline");return n1.$$.update=()=>{n1.$$.dirty[0]&6&&t1(6,r1=b1||$1[0]),n1.$$.dirty[0]&2&&t1(9,o1=GutterWidth+((b1==null?void 0:b1.width)||0)),n1.$$.dirty[1]&16&&t1(3,W1=!1),n1.$$.dirty[0]&1|n1.$$.dirty[1]&10&&t1(8,i1=c0(n0,_1,u1)),n1.$$.dirty[1]&4&&t1(7,a1=Object.values(m1).length)},[n0,b1,$1,W1,a0,f0,r1,a1,i1,o1,l1,y1,k1,S1,A1,C1,T1,N1,j1,B1,D1,F1,U1,G1,K1,q1,J1,X1,e0,$0,r0,w0,u1,m1,_1,h1,N0]}class NewRow extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7e,create_fragment$75,safe_not_equal,{},null,[-1,-1])}}const createGridWebsocket=n1=>{const{rows:e1,tableId:t1,users:r1,focusedCellId:o1,table:i1,API:a1}=n1,s1=createWebsocket("/socket/grid"),l1=c1=>{if(!s1.connected)return;const u1=a1.getAppID();s1.emit(GridSocketEvent.SelectTable,{tableId:c1,appId:u1},({users:f1})=>{r1.set(f1)})};return s1.on("connect",()=>{l1(get_store_value(t1))}),s1.on("connect_error",c1=>{console.log("Failed to connect to grid websocket:",c1.message)}),s1.onOther(SocketEvent.UserUpdate,({user:c1})=>{r1.actions.updateUser(c1)}),s1.onOther(SocketEvent.UserDisconnect,({sessionId:c1})=>{r1.actions.removeUser(c1)}),s1.onOther(GridSocketEvent.RowChange,async({id:c1,row:u1})=>{c1?e1.actions.replaceRow(c1,u1):u1.id&&await e1.actions.refreshRow(u1.id)}),s1.onOther(GridSocketEvent.TableChange,({table:c1})=>{c1&&i1.set(c1)}),t1.subscribe(l1),o1.subscribe(c1=>{s1.emit(GridSocketEvent.SelectCell,{cellId:c1})}),()=>s1==null?void 0:s1.disconnect()},Grid_svelte_svelte_type_style_lang="",get_controls_slot_changes$1=n1=>({}),get_controls_slot_context$1=n1=>({}),get_filter_slot_changes=n1=>({}),get_filter_slot_context=n1=>({});function create_if_block_5$o(n1){let e1,t1,r1,o1,i1,a1,s1,l1,c1,u1,f1,p1;const d1=n1[38].filter,m1=create_slot(d1,n1,n1[37],get_filter_slot_context);o1=new SortButton({}),a1=new HideColumnsButton({}),l1=new SizeButton({});const _1=n1[38].controls,h1=create_slot(_1,n1,n1[37],get_controls_slot_context$1);let b1=n1[3]&&create_if_block_6$g();return{c(){e1=element("div"),t1=element("div"),m1&&m1.c(),r1=space$1(),create_component(o1.$$.fragment),i1=space$1(),create_component(a1.$$.fragment),s1=space$1(),create_component(l1.$$.fragment),c1=space$1(),h1&&h1.c(),u1=space$1(),f1=element("div"),b1&&b1.c(),attr(t1,"class","controls-left svelte-1bm0rxl"),attr(f1,"class","controls-right svelte-1bm0rxl"),attr(e1,"class","controls svelte-1bm0rxl")},m($1,y1){insert$1($1,e1,y1),append$1(e1,t1),m1&&m1.m(t1,null),append$1(t1,r1),mount_component(o1,t1,null),append$1(t1,i1),mount_component(a1,t1,null),append$1(t1,s1),mount_component(l1,t1,null),append$1(t1,c1),h1&&h1.m(t1,null),append$1(e1,u1),append$1(e1,f1),b1&&b1.m(f1,null),p1=!0},p($1,y1){m1&&m1.p&&(!p1||y1[1]&64)&&update_slot_base(m1,d1,$1,$1[37],p1?get_slot_changes(d1,$1[37],y1,get_filter_slot_changes):get_all_dirty_from_scope($1[37]),get_filter_slot_context),h1&&h1.p&&(!p1||y1[1]&64)&&update_slot_base(h1,_1,$1,$1[37],p1?get_slot_changes(_1,$1[37],y1,get_controls_slot_changes$1):get_all_dirty_from_scope($1[37]),get_controls_slot_context$1),$1[3]?b1?y1[0]&8&&transition_in(b1,1):(b1=create_if_block_6$g(),b1.c(),transition_in(b1,1),b1.m(f1,null)):b1&&(group_outros(),transition_out(b1,1,1,()=>{b1=null}),check_outros())},i($1){p1||(transition_in(m1,$1),transition_in(o1.$$.fragment,$1),transition_in(a1.$$.fragment,$1),transition_in(l1.$$.fragment,$1),transition_in(h1,$1),transition_in(b1),p1=!0)},o($1){transition_out(m1,$1),transition_out(o1.$$.fragment,$1),transition_out(a1.$$.fragment,$1),transition_out(l1.$$.fragment,$1),transition_out(h1,$1),transition_out(b1),p1=!1},d($1){$1&&detach(e1),m1&&m1.d($1),destroy_component(o1),destroy_component(a1),destroy_component(l1),h1&&h1.d($1),b1&&b1.d()}}}function create_if_block_6$g(n1){let e1,t1;return e1=new UserAvatars$1({}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_if_block_4$z(n1){let e1,t1,r1,o1,i1;return{c(){e1=element("div"),t1=element("div"),t1.textContent="There was a problem loading your grid",r1=space$1(),o1=element("div"),i1=text(n1[10]),attr(t1,"class","grid-error-title svelte-1bm0rxl"),attr(o1,"class","grid-error-subtitle svelte-1bm0rxl"),attr(e1,"class","grid-error svelte-1bm0rxl")},m(a1,s1){insert$1(a1,e1,s1),append$1(e1,t1),append$1(e1,r1),append$1(e1,o1),append$1(o1,i1)},p(a1,s1){s1[0]&1024&&set_data(i1,a1[10])},i:noop$5,o:noop$5,d(a1){a1&&detach(e1)}}}function create_if_block_2$15(n1){let e1,t1,r1,o1,i1,a1,s1,l1,c1,u1,f1,p1,d1,m1,_1,h1,b1,$1,y1,k1,S1;r1=new StickyColumn({}),a1=new HeaderRow({}),l1=new GridBody({});let A1=n1[0]&&create_if_block_3$L();return p1=new ResizeOverlay({}),m1=new ReorderOverlay({}),h1=new ScrollOverlay({}),$1=new MenuOverlay({}),{c(){e1=element("div"),t1=element("div"),create_component(r1.$$.fragment),o1=space$1(),i1=element("div"),create_component(a1.$$.fragment),s1=space$1(),create_component(l1.$$.fragment),c1=space$1(),A1&&A1.c(),u1=space$1(),f1=element("div"),create_component(p1.$$.fragment),d1=space$1(),create_component(m1.$$.fragment),_1=space$1(),create_component(h1.$$.fragment),b1=space$1(),create_component($1.$$.fragment),attr(i1,"class","grid-data-content svelte-1bm0rxl"),attr(f1,"class","overlays svelte-1bm0rxl"),attr(t1,"class","grid-data-inner svelte-1bm0rxl"),attr(e1,"class","grid-data-outer svelte-1bm0rxl")},m(C1,E1){insert$1(C1,e1,E1),append$1(e1,t1),mount_component(r1,t1,null),append$1(t1,o1),append$1(t1,i1),mount_component(a1,i1,null),append$1(i1,s1),mount_component(l1,i1,null),append$1(t1,c1),A1&&A1.m(t1,null),append$1(t1,u1),append$1(t1,f1),mount_component(p1,f1,null),append$1(f1,d1),mount_component(m1,f1,null),append$1(f1,_1),mount_component(h1,f1,null),append$1(f1,b1),mount_component($1,f1,null),y1=!0,k1||(S1=action_destroyer(clickOutside.call(null,e1,n1[15].actions.blur)),k1=!0)},p(C1,E1){C1[0]?A1?E1[0]&1&&transition_in(A1,1):(A1=create_if_block_3$L(),A1.c(),transition_in(A1,1),A1.m(t1,u1)):A1&&(group_outros(),transition_out(A1,1,1,()=>{A1=null}),check_outros())},i(C1){y1||(transition_in(r1.$$.fragment,C1),transition_in(a1.$$.fragment,C1),transition_in(l1.$$.fragment,C1),transition_in(A1),transition_in(p1.$$.fragment,C1),transition_in(m1.$$.fragment,C1),transition_in(h1.$$.fragment,C1),transition_in($1.$$.fragment,C1),y1=!0)},o(C1){transition_out(r1.$$.fragment,C1),transition_out(a1.$$.fragment,C1),transition_out(l1.$$.fragment,C1),transition_out(A1),transition_out(p1.$$.fragment,C1),transition_out(m1.$$.fragment,C1),transition_out(h1.$$.fragment,C1),transition_out($1.$$.fragment,C1),y1=!1},d(C1){C1&&detach(e1),destroy_component(r1),destroy_component(a1),destroy_component(l1),A1&&A1.d(),destroy_component(p1),destroy_component(m1),destroy_component(h1),destroy_component($1),k1=!1,S1()}}}function create_if_block_3$L(n1){let e1,t1;return e1=new NewRow({}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_if_block_1$1N(n1){let e1,t1,r1,o1;return t1=new ProgressCircle({}),{c(){e1=element("div"),create_component(t1.$$.fragment),attr(e1,"class","grid-loading svelte-1bm0rxl")},m(i1,a1){insert$1(i1,e1,a1),mount_component(t1,e1,null),o1=!0},i(i1){o1||(transition_in(t1.$$.fragment,i1),i1&&(r1||add_render_callback(()=>{r1=create_in_transition(e1,fade,{duration:130}),r1.start()})),o1=!0)},o(i1){transition_out(t1.$$.fragment,i1),o1=!1},d(i1){i1&&detach(e1),destroy_component(t1)}}}function create_if_block$34(n1){let e1,t1;return e1=new BulkDeleteHandler({}),{c(){create_component(e1.$$.fragment)},m(r1,o1){mount_component(e1,r1,o1),t1=!0},i(r1){t1||(transition_in(e1.$$.fragment,r1),t1=!0)},o(r1){transition_out(e1.$$.fragment,r1),t1=!1},d(r1){destroy_component(e1,r1)}}}function create_fragment$74(n1){let e1,t1,r1,o1,i1,a1,s1,l1,c1,u1,f1,p1=n1[4]&&create_if_block_5$o(n1);const d1=[create_if_block_2$15,create_if_block_4$z],m1=[];function _1($1,y1){return $1[9]?0:$1[10]?1:-1}~(r1=_1(n1))&&(o1=m1[r1]=d1[r1](n1));let h1=n1[11]&&!n1[10]&&create_if_block_1$1N(),b1=n1[1]&&create_if_block$34();return l1=new KeyboardManager({}),{c(){e1=element("div"),p1&&p1.c(),t1=space$1(),o1&&o1.c(),i1=space$1(),h1&&h1.c(),a1=space$1(),b1&&b1.c(),s1=space$1(),create_component(l1.$$.fragment),attr(e1,"class","grid svelte-1bm0rxl"),attr(e1,"id","grid-"+n1[12]),set_style(e1,"--row-height",n1[7]+"px"),set_style(e1,"--default-row-height",DefaultRowHeight+"px"),set_style(e1,"--gutter-width",GutterWidth+"px"),set_style(e1,"--max-cell-render-height",MaxCellRenderHeight+"px"),set_style(e1,"--max-cell-render-width-overflow",MaxCellRenderWidthOverflow+"px"),set_style(e1,"--content-lines",n1[8]),toggle_class(e1,"is-resizing",n1[5]),toggle_class(e1,"is-reordering",n1[6]),toggle_class(e1,"stripe",n1[2])},m($1,y1){insert$1($1,e1,y1),p1&&p1.m(e1,null),append$1(e1,t1),~r1&&m1[r1].m(e1,null),append$1(e1,i1),h1&&h1.m(e1,null),append$1(e1,a1),b1&&b1.m(e1,null),append$1(e1,s1),mount_component(l1,e1,null),c1=!0,u1||(f1=[listen(e1,"mouseenter",n1[39]),listen(e1,"mouseleave",n1[40])],u1=!0)},p($1,y1){$1[4]?p1?(p1.p($1,y1),y1[0]&16&&transition_in(p1,1)):(p1=create_if_block_5$o($1),p1.c(),transition_in(p1,1),p1.m(e1,t1)):p1&&(group_outros(),transition_out(p1,1,1,()=>{p1=null}),check_outros());let k1=r1;r1=_1($1),r1===k1?~r1&&m1[r1].p($1,y1):(o1&&(group_outros(),transition_out(m1[k1],1,1,()=>{m1[k1]=null}),check_outros()),~r1?(o1=m1[r1],o1?o1.p($1,y1):(o1=m1[r1]=d1[r1]($1),o1.c()),transition_in(o1,1),o1.m(e1,i1)):o1=null),$1[11]&&!$1[10]?h1?y1[0]&3072&&transition_in(h1,1):(h1=create_if_block_1$1N(),h1.c(),transition_in(h1,1),h1.m(e1,a1)):h1&&(group_outros(),transition_out(h1,1,1,()=>{h1=null}),check_outros()),$1[1]?b1?y1[0]&2&&transition_in(b1,1):(b1=create_if_block$34(),b1.c(),transition_in(b1,1),b1.m(e1,s1)):b1&&(group_outros(),transition_out(b1,1,1,()=>{b1=null}),check_outros()),(!c1||y1[0]&128)&&set_style(e1,"--row-height",$1[7]+"px"),(!c1||y1[0]&256)&&set_style(e1,"--content-lines",$1[8]),(!c1||y1[0]&32)&&toggle_class(e1,"is-resizing",$1[5]),(!c1||y1[0]&64)&&toggle_class(e1,"is-reordering",$1[6]),(!c1||y1[0]&4)&&toggle_class(e1,"stripe",$1[2])},i($1){c1||(transition_in(p1),transition_in(o1),transition_in(h1),transition_in(b1),transition_in(l1.$$.fragment,$1),c1=!0)},o($1){transition_out(p1),transition_out(o1),transition_out(h1),transition_out(b1),transition_out(l1.$$.fragment,$1),c1=!1},d($1){$1&&detach(e1),p1&&p1.d(),~r1&&m1[r1].d(),h1&&h1.d(),b1&&b1.d(),destroy_component(l1),u1=!1,run_all(f1)}}}function instance$7d(n1,e1,t1){let r1,o1,i1,a1,s1,l1,c1,{$$slots:u1={},$$scope:f1}=e1,{API:p1=null}=e1,{tableId:d1=null}=e1,{schemaOverrides:m1=null}=e1,{columnWhitelist:_1=null}=e1,{allowAddRows:h1=!0}=e1,{allowExpandRows:b1=!0}=e1,{allowEditRows:$1=!0}=e1,{allowDeleteRows:y1=!0}=e1,{allowSchemaChanges:k1=!0}=e1,{stripeRows:S1=!1}=e1,{collaboration:A1=!0}=e1,{showAvatars:C1=!0}=e1,{showControls:E1=!0}=e1,{initialFilter:T1=null}=e1,{initialSortColumn:I1=null}=e1,{initialSortOrder:N1=null}=e1,{fixedRowHeight:j1=null}=e1,{notifySuccess:V1=null}=e1,{notifyError:B1=null}=e1;const D1=Math.random();let F1={API:p1||createAPIClient(),rand:D1,props:e1};F1={...F1,...createEventManagers()},F1=attachStores(F1);const{config:U1,isResizing:G1,isReordering:K1,ui:q1,loaded:J1,loading:X1,rowHeight:W1,contentLines:a0,gridFocused:f0,error:n0}=F1;component_subscribe(n1,G1,E0=>t1(5,r1=E0)),component_subscribe(n1,K1,E0=>t1(6,o1=E0)),component_subscribe(n1,J1,E0=>t1(9,s1=E0)),component_subscribe(n1,X1,E0=>t1(11,c1=E0)),component_subscribe(n1,W1,E0=>t1(7,i1=E0)),component_subscribe(n1,a0,E0=>t1(8,a1=E0)),component_subscribe(n1,n0,E0=>t1(10,l1=E0)),setContext("grid",F1);const c0=()=>F1;onMount(()=>{if(A1)return createGridWebsocket(F1)});const e0=()=>f0.set(!0),$0=()=>f0.set(!1);return n1.$$set=E0=>{t1(43,e1=assign$1(assign$1({},e1),exclude_internal_props(E0))),"API"in E0&&t1(22,p1=E0.API),"tableId"in E0&&t1(23,d1=E0.tableId),"schemaOverrides"in E0&&t1(24,m1=E0.schemaOverrides),"columnWhitelist"in E0&&t1(25,_1=E0.columnWhitelist),"allowAddRows"in E0&&t1(0,h1=E0.allowAddRows),"allowExpandRows"in E0&&t1(26,b1=E0.allowExpandRows),"allowEditRows"in E0&&t1(27,$1=E0.allowEditRows),"allowDeleteRows"in E0&&t1(1,y1=E0.allowDeleteRows),"allowSchemaChanges"in E0&&t1(28,k1=E0.allowSchemaChanges),"stripeRows"in E0&&t1(2,S1=E0.stripeRows),"collaboration"in E0&&t1(29,A1=E0.collaboration),"showAvatars"in E0&&t1(3,C1=E0.showAvatars),"showControls"in E0&&t1(4,E1=E0.showControls),"initialFilter"in E0&&t1(30,T1=E0.initialFilter),"initialSortColumn"in E0&&t1(31,I1=E0.initialSortColumn),"initialSortOrder"in E0&&t1(32,N1=E0.initialSortOrder),"fixedRowHeight"in E0&&t1(33,j1=E0.fixedRowHeight),"notifySuccess"in E0&&t1(34,V1=E0.notifySuccess),"notifyError"in E0&&t1(35,B1=E0.notifyError),"$$scope"in E0&&t1(37,f1=E0.$$scope)},n1.$$.update=()=>{n1.$$.dirty[0]&2139095071|n1.$$.dirty[1]&31&&U1.set({tableId:d1,schemaOverrides:m1,columnWhitelist:_1,allowAddRows:h1,allowExpandRows:b1,allowEditRows:$1,allowDeleteRows:y1,allowSchemaChanges:k1,stripeRows:S1,collaboration:A1,showAvatars:C1,showControls:E1,initialFilter:T1,initialSortColumn:I1,initialSortOrder:N1,fixedRowHeight:j1,notifySuccess:V1,notifyError:B1})},e1=exclude_internal_props(e1),[h1,y1,S1,C1,E1,r1,o1,i1,a1,s1,l1,c1,D1,G1,K1,q1,J1,X1,W1,a0,f0,n0,p1,d1,m1,_1,b1,$1,k1,A1,T1,I1,N1,j1,V1,B1,c0,f1,u1,e0,$0]}class Grid extends SvelteComponent{constructor(e1){super(),init$2(this,e1,instance$7d,create_fragment$74,safe_not_equal,{API:22,tableId:23,schemaOverrides:24,columnWhitelist:25,allowAddRows:0,allowExpandRows:26,allowEditRows:27,allowDeleteRows:1,allowSchemaChanges:28,stripeRows:2,collaboration:29,showAvatars:3,showControls:4,initialFilter:30,initialSortColumn:31,initialSortOrder:32,fixedRowHeight:33,notifySuccess:34,notifyError:35,getContext:36},null,[-1,-1])}get getContext(){return this.$$.ctx[36]}}const database=writable({}),FIELDS={STRING:{name:"Text",type:"string",constraints:{type:"string",length:{},presence:!1}},BARCODEQR:{name:"Barcode/QR",type:"barcodeqr",constraints:{type:"string",length:{},presence:!1}},LONGFORM:{name:"Long Form Text",type:"longform",constraints:{type:"string",length:{},presence:!1}},OPTIONS:{name:"Options",type:"options",constraints:{type:"string",presence:!1,inclusion:[]}},ARRAY:{name:"Multi-select",type:"array",constraints:{type:"array",presence:!1,inclusion:[]}},NUMBER:{name:"Number",type:"number",constraints:{type:"number",presence:!1,numericality:{greaterThanOrEqualTo:"",lessThanOrEqualTo:""}}},BOOLEAN:{name:"Boolean",type:"boolean",constraints:{type:"boolean",presence:!1}},DATETIME:{name:"Date/Time",type:"datetime",constraints:{type:"string",length:{},presence:!1,datetime:{latest:"",earliest:""}}},ATTACHMENT:{name:"Attachment",type:"attachment",constraints:{type:"array",presence:!1}},LINK:{name:"Relationship",type:"link",constraints:{type:"array",presence:!1}},FORMULA:{name:"Formula",type:"formula",constraints:{}},JSON:{name:"JSON",type:"json",constraints:{type:"object",presence:!1}}},AUTO_COLUMN_SUB_TYPES={AUTO_ID:"autoID",CREATED_BY:"createdBy",CREATED_AT:"createdAt",UPDATED_BY:"updatedBy",UPDATED_AT:"updatedAt"},AUTO_COLUMN_DISPLAY_NAMES={AUTO_ID:"Auto ID",CREATED_BY:"Created By",CREATED_AT:"Created At",UPDATED_BY:"Updated By",UPDATED_AT:"Updated At"},Roles={ADMIN:"ADMIN",POWER:"POWER",BASIC:"BASIC",PUBLIC:"PUBLIC",BUILDER:"BUILDER"};function isAutoColumnUserRelationship(n1){return n1===AUTO_COLUMN_SUB_TYPES.CREATED_BY||n1===AUTO_COLUMN_SUB_TYPES.UPDATED_BY}const RelationshipTypes={MANY_TO_MANY:"many-to-many",ONE_TO_MANY:"one-to-many",MANY_TO_ONE:"many-to-one"},ALLOWABLE_STRING_OPTIONS=[FIELDS.STRING,FIELDS.OPTIONS,FIELDS.LONGFORM,FIELDS.BARCODEQR],ALLOWABLE_STRING_TYPES=ALLOWABLE_STRING_OPTIONS.map(n1=>n1.type),ALLOWABLE_NUMBER_OPTIONS=[FIELDS.NUMBER,FIELDS.BOOLEAN],ALLOWABLE_NUMBER_TYPES=ALLOWABLE_NUMBER_OPTIONS.map(n1=>n1.type),SWITCHABLE_TYPES=[...ALLOWABLE_STRING_TYPES,...ALLOWABLE_NUMBER_TYPES],BUDIBASE_INTERNAL_DB_ID="bb_internal",DEFAULT_BB_DATASOURCE_ID="datasource_internal_bb_default",BUDIBASE_DATASOURCE_TYPE="budibase",DB_TYPE_INTERNAL="internal",DB_TYPE_EXTERNAL="external",IntegrationTypes={POSTGRES:"POSTGRES",MONGODB:"MONGODB",COUCHDB:"COUCHDB",S3:"S3",MYSQL:"MYSQL",REST:"REST",DYNAMODB:"DYNAMODB",ELASTICSEARCH:"ELASTICSEARCH",SQL_SERVER:"SQL_SERVER",AIRTABLE:"AIRTABLE",ARANGODB:"ARANGODB",ORACLE:"ORACLE",INTERNAL:"INTERNAL",GOOGLE_SHEETS:"GOOGLE_SHEETS",FIRESTORE:"FIRESTORE",REDIS:"REDIS",SNOWFLAKE:"SNOWFLAKE"},SchemaTypeOptions=[{label:"Text",value:"string"},{label:"Number",value:"number"},{label:"Boolean",value:"boolean"},{label:"Datetime",value:"datetime"}],RawRestBodyTypes={NONE:"none",FORM:"form",ENCODED:"encoded",JSON:"json",TEXT:"text",XML:"xml"},RestBodyTypes=[{name:"none",value:"none"},{name:"form-data",value:"form"},{name:"x-www-form-encoded",value:"encoded"},{name:"raw (JSON)",value:"json"},{name:"raw (XML)",value:"xml"},{name:"raw (Text)",value:"text"}],PaginationTypes=[{label:"Page number based",value:"page"},{label:"Cursor based",value:"cursor"}],PaginationLocations=[{label:"Query parameters",value:"query"},{label:"Request body",value:"body"}],BannedSearchTypes=["link","attachment","formula","json","jsonarray"],DatasourceTypes={RELATIONAL:"Relational",NON_RELATIONAL:"Non-relational",SPREADSHEET:"Spreadsheet",OBJECT_STORE:"Object store",GRAPH:"Graph",API:"API"};function createTablesStore(){const n1=writable({list:[],selectedTableId:null}),e1=derived(n1,u1=>{var f1;return{...u1,selected:(f1=u1.list)==null?void 0:f1.find(p1=>p1._id===u1.selectedTableId)}}),t1=async()=>{const u1=await API.getTables();n1.update(f1=>({...f1,list:u1}))},r1=u1=>{n1.update(f1=>({...f1,selectedTableId:u1}))},o1=async u1=>{const f1=fp.cloneDeep(u1),p1=get_store_value(n1).list.filter(_1=>_1._id===u1._id)[0],d1=[];for(let _1 of Object.keys(f1.schema)){if(d1.indexOf(_1.toLowerCase())!==-1){delete f1.schema[_1];continue}const h1=f1.schema[_1],b1=p1==null?void 0:p1.schema[_1];b1!=null&&(b1==null?void 0:b1.type)!==h1.type&&SWITCHABLE_TYPES.indexOf(b1==null?void 0:b1.type)===-1&&(f1.schema[_1]=b1),h1.name&&h1.name!==_1&&(f1.schema[h1.name]=h1,f1._rename={old:_1,updated:h1.name},delete f1.schema[_1]),d1.push(_1.toLowerCase())}const m1=await API.saveTable(f1);return l1(m1._id,m1),r1(m1._id),m1},i1=async u1=>{!(u1!=null&&u1._id)||(await API.deleteTable({tableId:u1._id,tableRev:u1._rev||"rev"}),l1(u1._id,null))},a1=async({originalName:u1,field:f1,primaryDisplay:p1=!1,indexes:d1})=>{let m1=fp.cloneDeep(get_store_value(e1).selected);if(u1!=null&&u1!==f1.name&&(delete m1.schema[u1],m1._rename={old:u1,updated:f1.name}),p1)m1.primaryDisplay=f1.name;else if(m1.primaryDisplay===u1){const _1=Object.keys(m1.schema);m1.primaryDisplay=_1.filter(h1=>h1!==u1||h1!==f1)[0]}d1&&(m1.indexes=d1),m1.schema={...m1.schema,[f1.name]:fp.cloneDeep(f1)},await o1(m1)},s1=async u1=>{let f1=fp.cloneDeep(get_store_value(e1).selected);delete f1.schema[u1.name],await o1(f1)},l1=(u1,f1)=>{if(!u1)return;if(!f1){n1.update(d1=>({...d1,list:d1.list.filter(m1=>m1._id!==u1)}));return}const p1=get_store_value(n1).list.findIndex(d1=>d1._id===f1._id);p1===-1?n1.update(d1=>({...d1,list:[...d1.list,f1]})):f1&&n1.update(d1=>(d1.list[p1]={...f1,type:d1.list[p1].type},d1))},c1=u1=>{n1.update(f1=>({...f1,list:f1.list.filter(p1=>p1.sourceId!==u1)}))};return{...n1,subscribe:e1.subscribe,fetch:t1,init:t1,select:r1,save:o1,delete:i1,saveField:a1,deleteField:s1,replaceTable:l1,removeDatasourceTables:c1}}const tables=createTablesStore();function createViewsStore(){const n1=writable({selectedViewName:null}),e1=derived([n1,tables],([i1,a1])=>{var l1;let s1=[];return(l1=a1.list)==null||l1.forEach(c1=>{s1=s1.concat(Object.values((c1==null?void 0:c1.views)||{}))}),{...i1,list:s1,selected:s1.find(c1=>c1.name===i1.selectedViewName)}}),t1=i1=>{n1.update(a1=>({...a1,selectedViewName:i1}))},r1=async i1=>{await API.deleteView(i1),tables.update(a1=>{const s1=a1.list.find(l1=>l1._id===i1.tableId);return s1&&delete s1.views[i1.name],{...a1}})},o1=async i1=>{const a1=await API.saveView(i1);tables.update(s1=>{const l1=s1.list.find(c1=>c1._id===i1.tableId);return l1&&(i1.originalName&&delete l1.views[i1.originalName],l1.views[i1.name]=a1),{...s1}})};return{subscribe:e1.subscribe,select:t1,delete:r1,save:o1}}const views=createViewsStore();function createPermissionStore(){const{subscribe:n1}=writable([]);return{subscribe:n1,save:async({level:e1,role:t1,resource:r1})=>await API.updatePermissionForResource({resourceId:r1,roleId:t1,level:e1}),forResource:async e1=>await API.getPermissionForResource(e1)}}const permissions=createPermissionStore();function createRolesStore(){const{subscribe:n1,update:e1,set:t1}=writable([]);function r1(i1){t1(i1.sort((a1,s1)=>{const l1=getRolePriority(a1._id),c1=getRolePriority(s1._id);return l1>c1?-1:1}))}const o1={fetch:async()=>{const i1=await API.getRoles();r1(i1)},fetchByAppId:async i1=>{const{roles:a1}=await API.getRolesForApp(i1);r1(a1)},delete:async i1=>{await API.deleteRole({roleId:i1==null?void 0:i1._id,roleRev:i1==null?void 0:i1._rev}),e1(a1=>a1.filter(s1=>s1._id!==i1._id))},save:async i1=>{const a1=await API.saveRole(i1);return await o1.fetch(),a1}};return{subscribe:n1,...o1}}const roles=createRolesStore(),TableNames={USERS:"ta_users"},AppStatus={ALL:"all",DEV:"development",DEPLOYED:"published"},IntegrationNames={POSTGRES:"PostgreSQL",MONGODB:"MongoDB",COUCHDB:"CouchDB",S3:"S3",MYSQL:"MySQL",REST:"REST",DYNAMODB:"DynamoDB",ELASTICSEARCH:"ElasticSearch",SQL_SERVER:"SQL Server",AIRTABLE:"Airtable",ARANGODB:"ArangoDB",ORACLE:"Oracle",GOOGLE_SHEETS:"Google Sheets"},UNEDITABLE_USER_FIELDS=["email","password","roleId","status","firstName","lastName"],UNSORTABLE_TYPES=["formula","attachment","array","link"],APP_NAME_REGEX=/^[\w\s]+$/,APP_URL_REGEX=/^[0-9a-zA-Z-_]+$/,DefaultAppTheme={primaryColor:"var(--spectrum-global-color-blue-600)",primaryColorHover:"var(--spectrum-global-color-blue-500)",buttonBorderRadius:"16px",navBackground:"var(--spectrum-global-color-gray-50)",navTextColor:"var(--spectrum-global-color-gray-800)"},PluginSource={URL:"URL",NPM:"NPM",GITHUB:"Github",FILE:"File Upload"},OnboardingType={EMAIL:"email",PASSWORD:"password"},PlanModel={PER_USER:"perUser",DAY_PASS:"dayPass"};class ImportTableError extends Error{constructor(e1){super(e1);const[t1,r1]=e1.split(" - ");this.name="TableSelectionError",this.title=t1[0].toUpperCase()+t1.substr(1),this.description=r1[0].toUpperCase()+r1.substr(1)}}function createDatasourcesStore(){const n1=writable({list:[],selectedDatasourceId:null,schemaError:null}),e1=derived([n1,tables],([m1,_1])=>{var y1,k1,S1,A1;let h1=(y1=m1.list)==null?void 0:y1.find(C1=>C1._id===BUDIBASE_INTERNAL_DB_ID),b1=(k1=m1.list)==null?void 0:k1.filter(C1=>C1._id!==BUDIBASE_INTERNAL_DB_ID);h1&&(h1={...h1,entities:(S1=_1.list)==null?void 0:S1.filter(C1=>C1.sourceId===BUDIBASE_INTERNAL_DB_ID&&C1._id!==TableNames.USERS)});let $1=[];return(A1=h1==null?void 0:h1.entities)!=null&&A1.length&&$1.push(h1),$1=$1.concat(b1||[]),{...m1,list:$1,selected:$1==null?void 0:$1.find(C1=>C1._id===m1.selectedDatasourceId),hasDefaultData:$1==null?void 0:$1.some(C1=>C1._id===DEFAULT_BB_DATASOURCE_ID),hasData:($1==null?void 0:$1.length)>0}}),t1=async()=>{const m1=await API.getDatasources();n1.update(_1=>({..._1,list:m1}))},r1=m1=>{n1.update(_1=>({..._1,selectedDatasourceId:m1,schemaError:null}))},o1=m1=>{const{datasource:_1,error:h1}=m1;return h1&&n1.update(b1=>({...b1,schemaError:h1})),p1(_1._id,_1),r1(_1._id),_1},i1=async(m1,_1)=>{try{const h1=await API.buildDatasourceSchema({datasourceId:m1==null?void 0:m1._id,tablesFilter:_1});o1(h1)}catch(h1){throw h1.message.split(" - ").length===2?new ImportTableError(h1.message):h1}},a1=m1=>get_store_value(n1).list.filter(_1=>_1.source===m1).length,s1=async(m1,_1)=>{var h1;if((h1=m1.features)!=null&&h1[DatasourceFeature.CONNECTION_CHECKING]){const{connected:b1,error:$1}=await API.validateDatasource(_1);if(b1)return;throw new Error(`Unable to connect: ${$1}`)}},l1=async({integration:m1,config:_1})=>{const h1=a1(m1.name),b1=h1===0?"":` ${h1+1}`,$1={type:"datasource",source:m1.name,config:_1,name:`${m1.friendlyName}${b1}`,plus:m1.plus&&m1.name!==IntegrationTypes.REST};if(await s1(m1,$1))throw new Error("Unable to connect");const y1=await API.createDatasource({datasource:$1,fetchSchema:m1.plus});return o1(y1)},c1=async({integration:m1,datasource:_1})=>{if(await s1(m1,_1))throw new Error("Unable to connect");const h1=await API.updateDatasource(_1);return o1(h1)},u1=async m1=>{!(m1!=null&&m1._id)||!(m1!=null&&m1._rev)||(await API.deleteDatasource({datasourceId:m1._id,datasourceRev:m1._rev}),p1(m1._id,null))},f1=()=>{n1.update(m1=>({...m1,schemaError:null}))},p1=(m1,_1)=>{if(!m1)return;if(!_1){n1.update(b1=>({...b1,list:b1.list.filter($1=>$1._id!==m1)})),tables.removeDatasourceTables(m1),queries.removeDatasourceQueries(m1);return}const h1=get_store_value(n1).list.findIndex(b1=>b1._id===_1._id);h1===-1?(n1.update(b1=>({...b1,list:[...b1.list,_1]})),tables.fetch()):_1&&n1.update(b1=>(b1.list[h1]=_1,b1))},d1=async m1=>(await API.fetchInfoForDatasource(m1)).tableNames||[];return{subscribe:e1.subscribe,fetch:t1,init:t1,select:r1,updateSchema:i1,create:l1,update:c1,delete:u1,removeSchemaError:f1,replaceDatasource:p1,getTableNames:d1}}const datasources=createDatasourcesStore(),createIntegrationsStore=()=>{const n1=writable({});return{...n1,init:async()=>{const t1=await API.getIntegrations();n1.set(t1)}}},integrations=createIntegrationsStore(),getIntegrationOrder=n1=>n1===DatasourceTypes.API?1:n1===DatasourceTypes.RELATIONAL?2:n1===DatasourceTypes.NON_RELATIONAL?3:n1.charCodeAt(0)+4,createSortedIntegrationsStore=()=>derived(integrations,n1=>Object.entries(n1).map(([t1,r1])=>({name:t1,...r1})).sort((t1,r1)=>{const o1=getIntegrationOrder(t1.type),i1=getIntegrationOrder(r1.type);return o1===i1?t1.friendlyName.localeCompare(r1.friendlyName):o1<i1?-1:1})),sortedIntegrations=createSortedIntegrationsStore(),duplicateName=(n1,e1)=>{const t1=n1.split(" (")[0],r1=new RegExp(`${t1}\\s\\((\\d+)\\)$`),o1=[];e1.filter(a1=>{if(a1===t1)return!0;const s1=a1.match(r1);return s1?(o1.push(parseInt(s1[1])),!0):!1}),o1.sort((a1,s1)=>a1-s1);let i1;if(o1.length===0)i1=1;else{for(let a1=0;a1<o1.length;a1++)if(o1[a1]!==a1+1){i1=a1+1;break}i1||(i1=o1.length+1)}return`${t1} (${i1})`},sortQueries=n1=>{n1.sort((e1,t1)=>e1.name.localeCompare(t1.name))};function createQueriesStore(){const n1=writable({list:[],selectedQueryId:null}),e1=derived(n1,u1=>{var f1;return{...u1,selected:(f1=u1.list)==null?void 0:f1.find(p1=>p1._id===u1.selectedQueryId)}}),t1=async()=>{const u1=await API.getQueries();sortQueries(u1),n1.update(f1=>({...f1,list:u1}))},r1=async(u1,f1)=>{const p1=get_store_value(integrations),d1=get_store_value(datasources).list.filter(_1=>_1._id===u1);if(d1.length!==0){const h1=p1[d1[0].source].query[f1.queryVerb].readable;h1&&(f1.readable=h1)}f1.datasourceId=u1;const m1=await API.saveQuery(f1);return n1.update(_1=>{const h1=_1.list.findIndex($1=>$1._id===m1._id),b1=_1.list;return h1>=0?b1.splice(h1,1,m1):b1.push(m1),sortQueries(b1),{list:b1,selectedQueryId:m1._id}}),m1},o1=async({data:u1,datasourceId:f1})=>await API.importQueries({datasourceId:f1,data:u1}),i1=u1=>{n1.update(f1=>({...f1,selectedQueryId:u1}))},a1=async u1=>{const f1=u1.parameters.reduce((m1,_1)=>({...m1,[_1.name]:_1.default}),{}),p1=await API.previewQuery({...u1,parameters:f1}),d1={};for(let[m1,_1]of Object.entries(p1.schemaFields))d1[m1]=_1||"string";return{...p1,schema:d1,rows:p1.rows||[]}},s1=async u1=>{await API.deleteQuery({queryId:u1==null?void 0:u1._id,queryRev:u1==null?void 0:u1._rev}),n1.update(f1=>(f1.list=f1.list.filter(p1=>p1._id!==u1._id),f1))},l1=async u1=>{let f1=get_store_value(n1).list;const p1={...u1},d1=u1.datasourceId;return delete p1._id,delete p1._rev,p1.name=duplicateName(u1.name,f1.map(m1=>m1.name)),await r1(d1,p1)},c1=u1=>{n1.update(f1=>({...f1,list:f1.list.filter(p1=>p1.datasourceId!==u1)}))};return{subscribe:e1.subscribe,fetch:t1,init:t1,select:i1,save:r1,import:o1,delete:s1,preview:a1,duplicate:l1,removeDatasourceQueries:c1}}const queries=createQueriesStore();function createFlagsStore(){const{subscribe:n1,set:e1}=writable({}),t1={fetch:async()=>{const r1=await API.getFlags();e1(r1)},updateFlag:async(r1,o1)=>{await API.updateFlag({flag:r1,value:o1}),await t1.fetch()},toggleUiFeature:async r1=>{await API.toggleUiFeature({value:r1})}};return{subscribe:n1,...t1}}const flags=createFlagsStore();function e(n1,e1){var t1=Object.keys(n1);if(Object.getOwnPropertySymbols){var r1=Object.getOwnPropertySymbols(n1);e1&&(r1=r1.filter(function(o1){return Object.getOwnPropertyDescriptor(n1,o1).enumerable})),t1.push.apply(t1,r1)}return t1}function t$1(n1){for(var e1=1;e1<arguments.length;e1++){var t1=arguments[e1]!=null?arguments[e1]:{};e1%2?e(Object(t1),!0).forEach(function(r1){s(n1,r1,t1[r1])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n1,Object.getOwnPropertyDescriptors(t1)):e(Object(t1)).forEach(function(r1){Object.defineProperty(n1,r1,Object.getOwnPropertyDescriptor(t1,r1))})}return n1}function r(n1){return r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e1){return typeof e1}:function(e1){return e1&&typeof Symbol=="function"&&e1.constructor===Symbol&&e1!==Symbol.prototype?"symbol":typeof e1},r(n1)}function n(n1,e1){if(!(n1 instanceof e1))throw new TypeError("Cannot call a class as a function")}function i$1(n1,e1){for(var t1=0;t1<e1.length;t1++){var r1=e1[t1];r1.enumerable=r1.enumerable||!1,r1.configurable=!0,"value"in r1&&(r1.writable=!0),Object.defineProperty(n1,r1.key,r1)}}function o(n1,e1,t1){return e1&&i$1(n1.prototype,e1),t1&&i$1(n1,t1),Object.defineProperty(n1,"prototype",{writable:!1}),n1}function s(n1,e1,t1){return e1 in n1?Object.defineProperty(n1,e1,{value:t1,enumerable:!0,configurable:!0,writable:!0}):n1[e1]=t1,n1}function a(n1,e1){if(typeof e1!="function"&&e1!==null)throw new TypeError("Super expression must either be null or a function");n1.prototype=Object.create(e1&&e1.prototype,{constructor:{value:n1,writable:!0,configurable:!0}}),Object.defineProperty(n1,"prototype",{writable:!1}),e1&&u(n1,e1)}function c(n1){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e1){return e1.__proto__||Object.getPrototypeOf(e1)},c(n1)}function u(n1,e1){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t1,r1){return t1.__proto__=r1,t1},u(n1,e1)}function l(n1,e1){if(n1==null)return{};var t1,r1,o1=function(a1,s1){if(a1==null)return{};var l1,c1,u1={},f1=Object.keys(a1);for(c1=0;c1<f1.length;c1++)l1=f1[c1],s1.indexOf(l1)>=0||(u1[l1]=a1[l1]);return u1}(n1,e1);if(Object.getOwnPropertySymbols){var i1=Object.getOwnPropertySymbols(n1);for(r1=0;r1<i1.length;r1++)t1=i1[r1],e1.indexOf(t1)>=0||Object.prototype.propertyIsEnumerable.call(n1,t1)&&(o1[t1]=n1[t1])}return o1}function d$1(n1,e1){if(e1&&(typeof e1=="object"||typeof e1=="function"))return e1;if(e1!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(t1){if(t1===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t1}(n1)}function p$1(n1){var e1=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var t1,r1=c(n1);if(e1){var o1=c(this).constructor;t1=Reflect.construct(r1,arguments,o1)}else t1=r1.apply(this,arguments);return d$1(this,t1)}}function f(n1,e1){return function(t1){if(Array.isArray(t1))return t1}(n1)||function(t1,r1){var o1=t1==null?null:typeof Symbol<"u"&&t1[Symbol.iterator]||t1["@@iterator"];if(o1!=null){var i1,a1,s1=[],l1=!0,c1=!1;try{for(o1=o1.call(t1);!(l1=(i1=o1.next()).done)&&(s1.push(i1.value),!r1||s1.length!==r1);l1=!0);}catch(u1){c1=!0,a1=u1}finally{try{l1||o1.return==null||o1.return()}finally{if(c1)throw a1}}return s1}}(n1,e1)||_$1(n1,e1)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
375
375
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function h(n1){return function(e1){if(Array.isArray(e1))return g(e1)}(n1)||function(e1){if(typeof Symbol<"u"&&e1[Symbol.iterator]!=null||e1["@@iterator"]!=null)return Array.from(e1)}(n1)||_$1(n1)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
376
376
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function _$1(n1,e1){if(n1){if(typeof n1=="string")return g(n1,e1);var t1=Object.prototype.toString.call(n1).slice(8,-1);return t1==="Object"&&n1.constructor&&(t1=n1.constructor.name),t1==="Map"||t1==="Set"?Array.from(n1):t1==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t1)?g(n1,e1):void 0}}function g(n1,e1){(e1==null||e1>n1.length)&&(e1=n1.length);for(var t1=0,r1=new Array(e1);t1<e1;t1++)r1[t1]=n1[t1];return r1}function v(n1,e1){var t1=typeof Symbol<"u"&&n1[Symbol.iterator]||n1["@@iterator"];if(!t1){if(Array.isArray(n1)||(t1=_$1(n1))||e1&&n1&&typeof n1.length=="number"){t1&&(n1=t1);var r1=0,o1=function(){};return{s:o1,n:function(){return r1>=n1.length?{done:!0}:{done:!1,value:n1[r1++]}},e:function(l1){throw l1},f:o1}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
377
377
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i1,a1=!0,s1=!1;return{s:function(){t1=t1.call(n1)},n:function(){var l1=t1.next();return a1=l1.done,l1},e:function(l1){s1=!0,i1=l1},f:function(){try{a1||t1.return==null||t1.return()}finally{if(s1)throw i1}}}}var y=String.fromCharCode,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",w$1={};function k(n1,e1){if(!w$1[n1]){w$1[n1]={};for(var t1=0;t1<n1.length;t1++)w$1[n1][n1.charAt(t1)]=t1}return w$1[n1][e1]}var S={compressToBase64:function(n1){if(n1==null)return"";var e1=S._compress(n1,6,function(t1){return m.charAt(t1)});switch(e1.length%4){default:case 0:return e1;case 1:return e1+"===";case 2:return e1+"==";case 3:return e1+"="}},decompressFromBase64:function(n1){return n1==null?"":n1==""?null:S._decompress(n1.length,32,function(e1){return k(m,n1.charAt(e1))})},compressToUTF16:function(n1){return n1==null?"":S._compress(n1,15,function(e1){return y(e1+32)})+" "},decompressFromUTF16:function(n1){return n1==null?"":n1==""?null:S._decompress(n1.length,16384,function(e1){return n1.charCodeAt(e1)-32})},compressToUint8Array:function(n1){for(var e1=S.compress(n1),t1=new Uint8Array(2*e1.length),r1=0,o1=e1.length;r1<o1;r1++){var i1=e1.charCodeAt(r1);t1[2*r1]=i1>>>8,t1[2*r1+1]=i1%256}return t1},decompressFromUint8Array:function(n1){if(n1==null)return S.decompress(n1);for(var e1=new Array(n1.length/2),t1=0,r1=e1.length;t1<r1;t1++)e1[t1]=256*n1[2*t1]+n1[2*t1+1];var o1=[];return e1.forEach(function(i1){o1.push(y(i1))}),S.decompress(o1.join(""))},compressToEncodedURIComponent:function(n1){return n1==null?"":S._compress(n1,6,function(e1){return b.charAt(e1)})},decompressFromEncodedURIComponent:function(n1){return n1==null?"":n1==""?null:(n1=n1.replace(/ /g,"+"),S._decompress(n1.length,32,function(e1){return k(b,n1.charAt(e1))}))},compress:function(n1){return S._compress(n1,16,function(e1){return y(e1)})},_compress:function(n1,e1,t1){if(n1==null)return"";var r1,o1,i1,a1="",s1="",l1="",c1=2,u1=3,f1=2,p1=0,d1=0,m1={},_1={},h1=[];for(i1=0;i1<n1.length;i1+=1)if(a1=n1.charAt(i1),Object.prototype.hasOwnProperty.call(m1,a1)||(m1[a1]=u1++,_1[a1]=!0),s1=l1+a1,Object.prototype.hasOwnProperty.call(m1,s1))l1=s1;else{if(Object.prototype.hasOwnProperty.call(_1,l1)){if(l1.charCodeAt(0)<256){for(r1=0;r1<f1;r1++)p1<<=1,d1==e1-1?(d1=0,h1.push(t1(p1)),p1=0):d1++;for(o1=l1.charCodeAt(0),r1=0;r1<8;r1++)p1=p1<<1|1&o1,d1==e1-1?(d1=0,h1.push(t1(p1)),p1=0):d1++,o1>>=1}else{for(o1=1,r1=0;r1<f1;r1++)p1=p1<<1|o1,d1==e1-1?(d1=0,h1.push(t1(p1)),p1=0):d1++,o1=0;for(o1=l1.charCodeAt(0),r1=0;r1<16;r1++)p1=p1<<1|1&o1,d1==e1-1?(d1=0,h1.push(t1(p1)),p1=0):d1++,o1>>=1}--c1==0&&(c1=Math.pow(2,f1),f1++),delete _1[l1]}else for(o1=m1[l1],r1=0;r1<f1;r1++)p1=p1<<1|1&o1,d1==e1-1?(d1=0,h1.push(t1(p1)),p1=0):d1++,o1>>=1;--c1==0&&(c1=Math.pow(2,f1),f1++),m1[s1]=u1++,l1=String(a1)}if(l1!==""){if(Object.prototype.hasOwnProperty.call(_1,l1)){if(l1.charCodeAt(0)<256){for(r1=0;r1<f1;r1++)p1<<=1,d1==e1-1?(d1=0,h1.push(t1(p1)),p1=0):d1++;for(o1=l1.charCodeAt(0),r1=0;r1<8;r1++)p1=p1<<1|1&o1,d1==e1-1?(d1=0,h1.push(t1(p1)),p1=0):d1++,o1>>=1}else{for(o1=1,r1=0;r1<f1;r1++)p1=p1<<1|o1,d1==e1-1?(d1=0,h1.push(t1(p1)),p1=0):d1++,o1=0;for(o1=l1.charCodeAt(0),r1=0;r1<16;r1++)p1=p1<<1|1&o1,d1==e1-1?(d1=0,h1.push(t1(p1)),p1=0):d1++,o1>>=1}--c1==0&&(c1=Math.pow(2,f1),f1++),delete _1[l1]}else for(o1=m1[l1],r1=0;r1<f1;r1++)p1=p1<<1|1&o1,d1==e1-1?(d1=0,h1.push(t1(p1)),p1=0):d1++,o1>>=1;--c1==0&&(c1=Math.pow(2,f1),f1++)}for(o1=2,r1=0;r1<f1;r1++)p1=p1<<1|1&o1,d1==e1-1?(d1=0,h1.push(t1(p1)),p1=0):d1++,o1>>=1;for(;;){if(p1<<=1,d1==e1-1){h1.push(t1(p1));break}d1++}return h1.join("")},decompress:function(n1){return n1==null?"":n1==""?null:S._decompress(n1.length,32768,function(e1){return n1.charCodeAt(e1)})},_decompress:function(n1,e1,t1){var r1,o1,i1,a1,s1,l1,c1,u1=[],f1=[],p1={val:t1(0),position:e1,index:1},d1=4,m1=4,_1=3,h1="";for(r1=0;r1<3;r1+=1)u1[r1]=r1;for(i1=0,s1=Math.pow(2,2),l1=1;l1!=s1;)a1=p1.val&p1.position,p1.position>>=1,p1.position==0&&(p1.position=e1,p1.val=t1(p1.index++)),i1|=(a1>0?1:0)*l1,l1<<=1;switch(i1){case 0:for(i1=0,s1=Math.pow(2,8),l1=1;l1!=s1;)a1=p1.val&p1.position,p1.position>>=1,p1.position==0&&(p1.position=e1,p1.val=t1(p1.index++)),i1|=(a1>0?1:0)*l1,l1<<=1;c1=y(i1);break;case 1:for(i1=0,s1=Math.pow(2,16),l1=1;l1!=s1;)a1=p1.val&p1.position,p1.position>>=1,p1.position==0&&(p1.position=e1,p1.val=t1(p1.index++)),i1|=(a1>0?1:0)*l1,l1<<=1;c1=y(i1);break;case 2:return""}for(u1[3]=c1,o1=c1,f1.push(c1);;){if(p1.index>n1)return"";for(i1=0,s1=Math.pow(2,_1),l1=1;l1!=s1;)a1=p1.val&p1.position,p1.position>>=1,p1.position==0&&(p1.position=e1,p1.val=t1(p1.index++)),i1|=(a1>0?1:0)*l1,l1<<=1;switch(c1=i1){case 0:for(i1=0,s1=Math.pow(2,8),l1=1;l1!=s1;)a1=p1.val&p1.position,p1.position>>=1,p1.position==0&&(p1.position=e1,p1.val=t1(p1.index++)),i1|=(a1>0?1:0)*l1,l1<<=1;u1[m1++]=y(i1),c1=m1-1,d1--;break;case 1:for(i1=0,s1=Math.pow(2,16),l1=1;l1!=s1;)a1=p1.val&p1.position,p1.position>>=1,p1.position==0&&(p1.position=e1,p1.val=t1(p1.index++)),i1|=(a1>0?1:0)*l1,l1<<=1;u1[m1++]=y(i1),c1=m1-1,d1--;break;case 2:return f1.join("")}if(d1==0&&(d1=Math.pow(2,_1),_1++),u1[c1])h1=u1[c1];else{if(c1!==m1)return null;h1=o1+o1.charAt(0)}f1.push(h1),u1[m1++]=o1+h1.charAt(0),o1=h1,--d1==0&&(d1=Math.pow(2,_1),_1++)}}},F={DEBUG:!1,LIB_VERSION:"1.50.3"},I=Array.prototype,O=Object.prototype,P=O.toString,E=O.hasOwnProperty,x$1=typeof window<"u"?window:{},A=x$1.navigator||{userAgent:""},C$1=x$1.document||{},T=A.userAgent,$=I.forEach,R=I.indexOf,M=Array.isArray,j={},q={log:function(){if(F.DEBUG&&!Q(window.console)&&window.console){for(var n1=("__rrweb_original__"in window.console.log)?window.console.log.__rrweb_original__:window.console.log,e1=arguments.length,t1=new Array(e1),r1=0;r1<e1;r1++)t1[r1]=arguments[r1];try{n1.apply(window.console,t1)}catch{B(t1,function(i1){n1(i1)})}}},error:function(){if(F.DEBUG&&!Q(window.console)&&window.console){for(var n1=arguments.length,e1=new Array(n1),t1=0;t1<n1;t1++)e1[t1]=arguments[t1];var r1=["PostHog error:"].concat(e1),o1="__rrweb_original__"in window.console.error?window.console.error.__rrweb_original__:window.console.error;try{o1.apply(window.console,r1)}catch{B(r1,function(a1){o1(a1)})}}},critical:function(){if(!Q(window.console)&&window.console){for(var n1=arguments.length,e1=new Array(n1),t1=0;t1<n1;t1++)e1[t1]=arguments[t1];var r1=["PostHog error:"].concat(e1),o1="__rrweb_original__"in window.console.error?window.console.error.__rrweb_original__:window.console.error;try{o1.apply(window.console,r1)}catch{B(r1,function(a1){o1(a1)})}}}},D=function(n1){return n1.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function N(n1,e1,t1){if(n1!=null){if($&&Array.isArray(n1)&&n1.forEach===$)n1.forEach(e1,t1);else if("length"in n1&&n1.length===+n1.length){for(var r1=0,o1=n1.length;r1<o1;r1++)if(r1 in n1&&e1.call(t1,n1[r1],r1)===j)return}else for(var i1 in n1)if(E.call(n1,i1)&&e1.call(t1,n1[i1],i1)===j)return}}function B(n1,e1,t1){if(Array.isArray(n1)){if($&&n1.forEach===$)n1.forEach(e1,t1);else if("length"in n1&&n1.length===+n1.length){for(var r1=0,o1=n1.length;r1<o1;r1++)if(r1 in n1&&e1.call(t1,n1[r1],r1)===j)return}}}var L=function(n1){for(var e1=arguments.length,t1=new Array(e1>1?e1-1:0),r1=1;r1<e1;r1++)t1[r1-1]=arguments[r1];return B(t1,function(o1){for(var i1 in o1)o1[i1]!==void 0&&(n1[i1]=o1[i1])}),n1},H=M||function(n1){return P.call(n1)==="[object Array]"},U=function(n1){try{return/^\s*\bfunction\b/.test(n1)}catch{return!1}};function V(n1,e1){return n1.indexOf(e1)!==-1}var W=function(n1){return n1===Object(n1)&&!H(n1)},Q=function(n1){return n1===void 0},G=function(n1){return P.call(n1)=="[object String]"},z=function(n1){return P.call(n1)=="[object Number]"},J=function n1(e1){return N(e1,function(t1,r1){(function(o1){return P.call(o1)=="[object Date]"})(t1)?e1[r1]=Z(t1):W(t1)&&(e1[r1]=n1(t1))}),e1},Z=function(n1){function e1(t1){return t1<10?"0"+t1:t1}return n1.getUTCFullYear()+"-"+e1(n1.getUTCMonth()+1)+"-"+e1(n1.getUTCDate())+"T"+e1(n1.getUTCHours())+":"+e1(n1.getUTCMinutes())+":"+e1(n1.getUTCSeconds())},X=function(n1){return function(){try{for(var e1=arguments.length,t1=new Array(e1),r1=0;r1<e1;r1++)t1[r1]=arguments[r1];return n1.apply(this,t1)}catch(o1){q.critical("Implementation error. Please turn on debug and contact support@posthog.com."),q.critical(o1)}}},Y=function(n1){var e1={};return N(n1,function(t1,r1){G(t1)&&t1.length>0&&(e1[r1]=t1)}),e1},K=["$performance_raw"];function ee(n1,e1){return t1=n1,r1=function(i1,a1){return a1&&K.indexOf(a1)>-1?i1:typeof i1=="string"&&e1!==null?i1.slice(0,e1):i1},o1=new Set,function i1(a1,s1){return a1!==Object(a1)?r1?r1(a1,s1):a1:o1.has(a1)?void 0:(o1.add(a1),H(a1)?(l1=[],B(a1,function(c1){l1.push(i1(c1))})):(l1={},N(a1,function(c1,u1){o1.has(c1)||(l1[u1]=i1(c1,u1))})),l1);var l1}(t1);var t1,r1,o1}function te(n1){var e1,t1,r1,o1,i1,a1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s1=0,l1=0,c1="",u1=[];if(!n1)return n1;n1=ne(n1);do e1=(i1=n1.charCodeAt(s1++)<<16|n1.charCodeAt(s1++)<<8|n1.charCodeAt(s1++))>>18&63,t1=i1>>12&63,r1=i1>>6&63,o1=63&i1,u1[l1++]=a1.charAt(e1)+a1.charAt(t1)+a1.charAt(r1)+a1.charAt(o1);while(s1<n1.length);switch(c1=u1.join(""),n1.length%3){case 1:c1=c1.slice(0,-2)+"==";break;case 2:c1=c1.slice(0,-1)+"="}return c1}var re,ne=function(n1){var e1,t1,r1,o1,i1="";for(e1=t1=0,r1=(n1=(n1+"").replace(/\r\n/g,`
|
package/builder/index.html
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<link href="/builder/fonts/source-sans-pro/600.css" rel="stylesheet" />
|
|
10
10
|
<link href="/builder/fonts/source-sans-pro/700.css" rel="stylesheet" />
|
|
11
11
|
<link href="/builder/fonts/remixicon.css" rel="stylesheet" />
|
|
12
|
-
<script type="module" crossorigin src="/builder/assets/index.
|
|
12
|
+
<script type="module" crossorigin src="/builder/assets/index.0d1dc85c.js"></script>
|
|
13
13
|
<link rel="stylesheet" href="/builder/assets/index.dca8ef68.css">
|
|
14
14
|
</head>
|
|
15
15
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.7.37-alpha.
|
|
4
|
+
"version": "2.7.37-alpha.13",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"license": "GPL-3.0",
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@apidevtools/swagger-parser": "10.0.3",
|
|
49
|
-
"@budibase/backend-core": "2.7.37-alpha.
|
|
50
|
-
"@budibase/client": "2.7.37-alpha.
|
|
51
|
-
"@budibase/pro": "2.7.37-alpha.
|
|
52
|
-
"@budibase/shared-core": "2.7.37-alpha.
|
|
53
|
-
"@budibase/string-templates": "2.7.37-alpha.
|
|
54
|
-
"@budibase/types": "2.7.37-alpha.
|
|
49
|
+
"@budibase/backend-core": "2.7.37-alpha.13",
|
|
50
|
+
"@budibase/client": "2.7.37-alpha.13",
|
|
51
|
+
"@budibase/pro": "2.7.37-alpha.13",
|
|
52
|
+
"@budibase/shared-core": "2.7.37-alpha.13",
|
|
53
|
+
"@budibase/string-templates": "2.7.37-alpha.13",
|
|
54
|
+
"@budibase/types": "2.7.37-alpha.13",
|
|
55
55
|
"@bull-board/api": "3.7.0",
|
|
56
56
|
"@bull-board/koa": "3.9.4",
|
|
57
57
|
"@elastic/elasticsearch": "7.10.0",
|
|
@@ -196,5 +196,5 @@
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
},
|
|
199
|
-
"gitHead": "
|
|
199
|
+
"gitHead": "49925cf10bb07e97eafe3eb70bad2a769f6951fc"
|
|
200
200
|
}
|