twenty-sdk 2.1.0 → 2.3.0

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.
Files changed (41) hide show
  1. package/README.md +3 -3
  2. package/dist/billing/index.cjs.map +1 -1
  3. package/dist/billing/index.mjs +9 -9
  4. package/dist/billing/index.mjs.map +1 -1
  5. package/dist/cli/commands/add.d.ts +1 -0
  6. package/dist/cli/operations/deploy.d.ts +2 -0
  7. package/dist/cli/operations/index.d.ts +3 -0
  8. package/dist/cli/operations/server-upgrade.d.ts +12 -0
  9. package/dist/cli/types.d.ts +2 -0
  10. package/dist/cli/utilities/build/manifest/manifest-extract-config.d.ts +6 -2
  11. package/dist/cli/utilities/entity/entity-command-menu-item-template.d.ts +3 -0
  12. package/dist/cli/utilities/entity/entity-connection-provider-template.d.ts +4 -0
  13. package/dist/cli/utilities/file/append-server-variables.util.d.ts +22 -0
  14. package/dist/cli/utilities/server/docker-container.d.ts +5 -0
  15. package/dist/cli.cjs +147 -105
  16. package/dist/cli.mjs +3213 -3023
  17. package/dist/define/index.cjs +16 -16
  18. package/dist/define/index.cjs.map +1 -1
  19. package/dist/define/index.d.ts +73 -35
  20. package/dist/define/index.mjs +3386 -6646
  21. package/dist/define/index.mjs.map +1 -1
  22. package/dist/front-component/index.cjs +15 -15
  23. package/dist/front-component/index.cjs.map +1 -1
  24. package/dist/front-component/index.d.ts +12 -1
  25. package/dist/front-component/index.mjs +3274 -6566
  26. package/dist/front-component/index.mjs.map +1 -1
  27. package/dist/{get-function-input-schema-BZ7_XyUh-D38OurwZ.js → get-function-input-schema-BZ7_XyUh-BXB2AcBE.js} +1 -1
  28. package/dist/{get-function-input-schema-BZ7_XyUh-CKgoFzji.mjs → get-function-input-schema-BZ7_XyUh-PnCntsct.mjs} +1 -1
  29. package/dist/logic-function/index.cjs +1 -1
  30. package/dist/logic-function/index.cjs.map +1 -1
  31. package/dist/logic-function/index.d.ts +91 -20
  32. package/dist/logic-function/index.mjs +52 -1
  33. package/dist/logic-function/index.mjs.map +1 -1
  34. package/dist/operations.cjs +1 -1
  35. package/dist/operations.mjs +24 -18
  36. package/dist/ui/index.cjs +36 -2234
  37. package/dist/ui/index.mjs +11051 -17373
  38. package/dist/uninstall-BiLmSWhb.js +253 -0
  39. package/dist/{uninstall-Bw-TK4rL.mjs → uninstall-DAf2XiS3.mjs} +5064 -8113
  40. package/package.json +6 -2
  41. package/dist/uninstall-CYiYoBPe.js +0 -250
package/dist/cli.cjs CHANGED
@@ -1,59 +1,68 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var qg=Object.create;var Fo=Object.defineProperty;var Hg=Object.getOwnPropertyDescriptor;var zg=Object.getOwnPropertyNames;var Kg=Object.getPrototypeOf,Vg=Object.prototype.hasOwnProperty;var Yg=(f,a,i,l)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of zg(a))!Vg.call(f,d)&&d!==i&&Fo(f,d,{get:()=>a[d],enumerable:!(l=Hg(a,d))||l.enumerable});return f};var Zg=(f,a,i)=>(i=f!=null?qg(Kg(f)):{},Yg(a||!f||!f.__esModule?Fo(i,"default",{value:f,enumerable:!0}):i,f));const z=require("path"),jg=require("chalk"),v=require("./uninstall-CYiYoBPe.js"),Jg=require("inquirer"),Dt=require("node:fs/promises"),re=require("uuid"),Xg=require("chokidar"),Qg=require("crypto"),bn=require("node:child_process"),ev=require("node:path"),P=require("react/jsx-runtime"),Et=require("react"),Wo=require("commander"),tv=require("util"),$t=f=>f&&f.__esModule?f:{default:f},Mo=$t(z),_=$t(jg),Ge=$t(Jg),Bo=$t(Xg),nv=$t(Qg),Ro=$t(ev),ko=$t(Et),ee=process.env.INIT_CWD||process.cwd(),ht=f=>f&&!f?.startsWith("/")?z.join(ee,f):f;var Tn={exports:{}};/**
3
- * @license
4
- * Lodash <https://lodash.com/>
5
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
6
- * Released under MIT license <https://lodash.com/license>
7
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
8
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
9
- */var rv=Tn.exports,Po;function iv(){return Po||(Po=1,function(f,a){(function(){var i,l="4.17.21",d=200,E="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",I="Expected a function",N="Invalid `variable` option passed into `_.template`",q="__lodash_hash_undefined__",te=500,X="__lodash_placeholder__",K=1,Ze=2,k=4,W=1,Pe=2,xe=1,je=2,Cn=4,Le=8,At=16,Ie=32,Ee=64,tt=128,nn=256,Ir=512,Vo=30,Yo="...",Zo=800,jo=16,ji=1,Jo=2,Xo=3,bt=1/0,pt=9007199254740991,Qo=17976931348623157e292,Fn=NaN,Je=4294967295,eu=Je-1,tu=Je>>>1,nu=[["ary",tt],["bind",xe],["bindKey",je],["curry",Le],["curryRight",At],["flip",Ir],["partial",Ie],["partialRight",Ee],["rearg",nn]],Wt="[object Arguments]",Rn="[object Array]",ru="[object AsyncFunction]",rn="[object Boolean]",sn="[object Date]",iu="[object DOMException]",Pn="[object Error]",Ln="[object Function]",Ji="[object GeneratorFunction]",qe="[object Map]",an="[object Number]",su="[object Null]",nt="[object Object]",Xi="[object Promise]",au="[object Proxy]",on="[object RegExp]",He="[object Set]",un="[object String]",On="[object Symbol]",ou="[object Undefined]",ln="[object WeakMap]",uu="[object WeakSet]",cn="[object ArrayBuffer]",Mt="[object DataView]",Er="[object Float32Array]",Ar="[object Float64Array]",br="[object Int8Array]",Tr="[object Int16Array]",Cr="[object Int32Array]",Fr="[object Uint8Array]",Rr="[object Uint8ClampedArray]",Pr="[object Uint16Array]",Lr="[object Uint32Array]",lu=/\b__p \+= '';/g,cu=/\b(__p \+=) '' \+/g,fu=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Qi=/&(?:amp|lt|gt|quot|#39);/g,es=/[&<>"']/g,hu=RegExp(Qi.source),du=RegExp(es.source),pu=/<%-([\s\S]+?)%>/g,gu=/<%([\s\S]+?)%>/g,ts=/<%=([\s\S]+?)%>/g,vu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,mu=/^\w*$/,yu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Or=/[\\^$.*+?()[\]{}|]/g,_u=RegExp(Or.source),Ur=/^\s+/,wu=/\s/,Su=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,xu=/\{\n\/\* \[wrapped with (.+)\] \*/,Iu=/,? & /,Eu=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Au=/[()=,{}\[\]\/\s]/,bu=/\\(\\)?/g,Tu=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ns=/\w*$/,Cu=/^[-+]0x[0-9a-f]+$/i,Fu=/^0b[01]+$/i,Ru=/^\[object .+?Constructor\]$/,Pu=/^0o[0-7]+$/i,Lu=/^(?:0|[1-9]\d*)$/,Ou=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Un=/($^)/,Uu=/['\n\r\u2028\u2029\\]/g,Nn="\\ud800-\\udfff",Nu="\\u0300-\\u036f",Du="\\ufe20-\\ufe2f",$u="\\u20d0-\\u20ff",rs=Nu+Du+$u,is="\\u2700-\\u27bf",ss="a-z\\xdf-\\xf6\\xf8-\\xff",Wu="\\xac\\xb1\\xd7\\xf7",Mu="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Bu="\\u2000-\\u206f",ku=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",as="A-Z\\xc0-\\xd6\\xd8-\\xde",os="\\ufe0e\\ufe0f",us=Wu+Mu+Bu+ku,Nr="['’]",Gu="["+Nn+"]",ls="["+us+"]",Dn="["+rs+"]",cs="\\d+",qu="["+is+"]",fs="["+ss+"]",hs="[^"+Nn+us+cs+is+ss+as+"]",Dr="\\ud83c[\\udffb-\\udfff]",Hu="(?:"+Dn+"|"+Dr+")",ds="[^"+Nn+"]",$r="(?:\\ud83c[\\udde6-\\uddff]){2}",Wr="[\\ud800-\\udbff][\\udc00-\\udfff]",Bt="["+as+"]",ps="\\u200d",gs="(?:"+fs+"|"+hs+")",zu="(?:"+Bt+"|"+hs+")",vs="(?:"+Nr+"(?:d|ll|m|re|s|t|ve))?",ms="(?:"+Nr+"(?:D|LL|M|RE|S|T|VE))?",ys=Hu+"?",_s="["+os+"]?",Ku="(?:"+ps+"(?:"+[ds,$r,Wr].join("|")+")"+_s+ys+")*",Vu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Yu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ws=_s+ys+Ku,Zu="(?:"+[qu,$r,Wr].join("|")+")"+ws,ju="(?:"+[ds+Dn+"?",Dn,$r,Wr,Gu].join("|")+")",Ju=RegExp(Nr,"g"),Xu=RegExp(Dn,"g"),Mr=RegExp(Dr+"(?="+Dr+")|"+ju+ws,"g"),Qu=RegExp([Bt+"?"+fs+"+"+vs+"(?="+[ls,Bt,"$"].join("|")+")",zu+"+"+ms+"(?="+[ls,Bt+gs,"$"].join("|")+")",Bt+"?"+gs+"+"+vs,Bt+"+"+ms,Yu,Vu,cs,Zu].join("|"),"g"),el=RegExp("["+ps+Nn+rs+os+"]"),tl=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nl=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rl=-1,J={};J[Er]=J[Ar]=J[br]=J[Tr]=J[Cr]=J[Fr]=J[Rr]=J[Pr]=J[Lr]=!0,J[Wt]=J[Rn]=J[cn]=J[rn]=J[Mt]=J[sn]=J[Pn]=J[Ln]=J[qe]=J[an]=J[nt]=J[on]=J[He]=J[un]=J[ln]=!1;var j={};j[Wt]=j[Rn]=j[cn]=j[Mt]=j[rn]=j[sn]=j[Er]=j[Ar]=j[br]=j[Tr]=j[Cr]=j[qe]=j[an]=j[nt]=j[on]=j[He]=j[un]=j[On]=j[Fr]=j[Rr]=j[Pr]=j[Lr]=!0,j[Pn]=j[Ln]=j[ln]=!1;var il={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},sl={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},al={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},ol={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ul=parseFloat,ll=parseInt,Ss=typeof v.commonjsGlobal=="object"&&v.commonjsGlobal&&v.commonjsGlobal.Object===Object&&v.commonjsGlobal,cl=typeof self=="object"&&self&&self.Object===Object&&self,ce=Ss||cl||Function("return this")(),Br=a&&!a.nodeType&&a,Tt=Br&&!0&&f&&!f.nodeType&&f,xs=Tt&&Tt.exports===Br,kr=xs&&Ss.process,Oe=function(){try{var p=Tt&&Tt.require&&Tt.require("util").types;return p||kr&&kr.binding&&kr.binding("util")}catch{}}(),Is=Oe&&Oe.isArrayBuffer,Es=Oe&&Oe.isDate,As=Oe&&Oe.isMap,bs=Oe&&Oe.isRegExp,Ts=Oe&&Oe.isSet,Cs=Oe&&Oe.isTypedArray;function Ae(p,y,m){switch(m.length){case 0:return p.call(y);case 1:return p.call(y,m[0]);case 2:return p.call(y,m[0],m[1]);case 3:return p.call(y,m[0],m[1],m[2])}return p.apply(y,m)}function fl(p,y,m,b){for(var L=-1,H=p==null?0:p.length;++L<H;){var oe=p[L];y(b,oe,m(oe),p)}return b}function Ue(p,y){for(var m=-1,b=p==null?0:p.length;++m<b&&y(p[m],m,p)!==!1;);return p}function hl(p,y){for(var m=p==null?0:p.length;m--&&y(p[m],m,p)!==!1;);return p}function Fs(p,y){for(var m=-1,b=p==null?0:p.length;++m<b;)if(!y(p[m],m,p))return!1;return!0}function gt(p,y){for(var m=-1,b=p==null?0:p.length,L=0,H=[];++m<b;){var oe=p[m];y(oe,m,p)&&(H[L++]=oe)}return H}function $n(p,y){var m=p==null?0:p.length;return!!m&&kt(p,y,0)>-1}function Gr(p,y,m){for(var b=-1,L=p==null?0:p.length;++b<L;)if(m(y,p[b]))return!0;return!1}function Q(p,y){for(var m=-1,b=p==null?0:p.length,L=Array(b);++m<b;)L[m]=y(p[m],m,p);return L}function vt(p,y){for(var m=-1,b=y.length,L=p.length;++m<b;)p[L+m]=y[m];return p}function qr(p,y,m,b){var L=-1,H=p==null?0:p.length;for(b&&H&&(m=p[++L]);++L<H;)m=y(m,p[L],L,p);return m}function dl(p,y,m,b){var L=p==null?0:p.length;for(b&&L&&(m=p[--L]);L--;)m=y(m,p[L],L,p);return m}function Hr(p,y){for(var m=-1,b=p==null?0:p.length;++m<b;)if(y(p[m],m,p))return!0;return!1}var pl=zr("length");function gl(p){return p.split("")}function vl(p){return p.match(Eu)||[]}function Rs(p,y,m){var b;return m(p,function(L,H,oe){if(y(L,H,oe))return b=H,!1}),b}function Wn(p,y,m,b){for(var L=p.length,H=m+(b?1:-1);b?H--:++H<L;)if(y(p[H],H,p))return H;return-1}function kt(p,y,m){return y===y?Cl(p,y,m):Wn(p,Ps,m)}function ml(p,y,m,b){for(var L=m-1,H=p.length;++L<H;)if(b(p[L],y))return L;return-1}function Ps(p){return p!==p}function Ls(p,y){var m=p==null?0:p.length;return m?Vr(p,y)/m:Fn}function zr(p){return function(y){return y==null?i:y[p]}}function Kr(p){return function(y){return p==null?i:p[y]}}function Os(p,y,m,b,L){return L(p,function(H,oe,Z){m=b?(b=!1,H):y(m,H,oe,Z)}),m}function yl(p,y){var m=p.length;for(p.sort(y);m--;)p[m]=p[m].value;return p}function Vr(p,y){for(var m,b=-1,L=p.length;++b<L;){var H=y(p[b]);H!==i&&(m=m===i?H:m+H)}return m}function Yr(p,y){for(var m=-1,b=Array(p);++m<p;)b[m]=y(m);return b}function _l(p,y){return Q(y,function(m){return[m,p[m]]})}function Us(p){return p&&p.slice(0,Ws(p)+1).replace(Ur,"")}function be(p){return function(y){return p(y)}}function Zr(p,y){return Q(y,function(m){return p[m]})}function fn(p,y){return p.has(y)}function Ns(p,y){for(var m=-1,b=p.length;++m<b&&kt(y,p[m],0)>-1;);return m}function Ds(p,y){for(var m=p.length;m--&&kt(y,p[m],0)>-1;);return m}function wl(p,y){for(var m=p.length,b=0;m--;)p[m]===y&&++b;return b}var Sl=Kr(il),xl=Kr(sl);function Il(p){return"\\"+ol[p]}function El(p,y){return p==null?i:p[y]}function Gt(p){return el.test(p)}function Al(p){return tl.test(p)}function bl(p){for(var y,m=[];!(y=p.next()).done;)m.push(y.value);return m}function jr(p){var y=-1,m=Array(p.size);return p.forEach(function(b,L){m[++y]=[L,b]}),m}function $s(p,y){return function(m){return p(y(m))}}function mt(p,y){for(var m=-1,b=p.length,L=0,H=[];++m<b;){var oe=p[m];(oe===y||oe===X)&&(p[m]=X,H[L++]=m)}return H}function Mn(p){var y=-1,m=Array(p.size);return p.forEach(function(b){m[++y]=b}),m}function Tl(p){var y=-1,m=Array(p.size);return p.forEach(function(b){m[++y]=[b,b]}),m}function Cl(p,y,m){for(var b=m-1,L=p.length;++b<L;)if(p[b]===y)return b;return-1}function Fl(p,y,m){for(var b=m+1;b--;)if(p[b]===y)return b;return b}function qt(p){return Gt(p)?Pl(p):pl(p)}function ze(p){return Gt(p)?Ll(p):gl(p)}function Ws(p){for(var y=p.length;y--&&wu.test(p.charAt(y)););return y}var Rl=Kr(al);function Pl(p){for(var y=Mr.lastIndex=0;Mr.test(p);)++y;return y}function Ll(p){return p.match(Mr)||[]}function Ol(p){return p.match(Qu)||[]}var Ul=function p(y){y=y==null?ce:Ht.defaults(ce.Object(),y,Ht.pick(ce,nl));var m=y.Array,b=y.Date,L=y.Error,H=y.Function,oe=y.Math,Z=y.Object,Jr=y.RegExp,Nl=y.String,Ne=y.TypeError,Bn=m.prototype,Dl=H.prototype,zt=Z.prototype,kn=y["__core-js_shared__"],Gn=Dl.toString,Y=zt.hasOwnProperty,$l=0,Ms=function(){var e=/[^.]+$/.exec(kn&&kn.keys&&kn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),qn=zt.toString,Wl=Gn.call(Z),Ml=ce._,Bl=Jr("^"+Gn.call(Y).replace(Or,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Hn=xs?y.Buffer:i,yt=y.Symbol,zn=y.Uint8Array,Bs=Hn?Hn.allocUnsafe:i,Kn=$s(Z.getPrototypeOf,Z),ks=Z.create,Gs=zt.propertyIsEnumerable,Vn=Bn.splice,qs=yt?yt.isConcatSpreadable:i,hn=yt?yt.iterator:i,Ct=yt?yt.toStringTag:i,Yn=function(){try{var e=Ot(Z,"defineProperty");return e({},"",{}),e}catch{}}(),kl=y.clearTimeout!==ce.clearTimeout&&y.clearTimeout,Gl=b&&b.now!==ce.Date.now&&b.now,ql=y.setTimeout!==ce.setTimeout&&y.setTimeout,Zn=oe.ceil,jn=oe.floor,Xr=Z.getOwnPropertySymbols,Hl=Hn?Hn.isBuffer:i,Hs=y.isFinite,zl=Bn.join,Kl=$s(Z.keys,Z),ue=oe.max,he=oe.min,Vl=b.now,Yl=y.parseInt,zs=oe.random,Zl=Bn.reverse,Qr=Ot(y,"DataView"),dn=Ot(y,"Map"),ei=Ot(y,"Promise"),Kt=Ot(y,"Set"),pn=Ot(y,"WeakMap"),gn=Ot(Z,"create"),Jn=pn&&new pn,Vt={},jl=Ut(Qr),Jl=Ut(dn),Xl=Ut(ei),Ql=Ut(Kt),ec=Ut(pn),Xn=yt?yt.prototype:i,vn=Xn?Xn.valueOf:i,Ks=Xn?Xn.toString:i;function o(e){if(ie(e)&&!O(e)&&!(e instanceof B)){if(e instanceof De)return e;if(Y.call(e,"__wrapped__"))return Va(e)}return new De(e)}var Yt=function(){function e(){}return function(t){if(!ne(t))return{};if(ks)return ks(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Qn(){}function De(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}o.templateSettings={escape:pu,evaluate:gu,interpolate:ts,variable:"",imports:{_:o}},o.prototype=Qn.prototype,o.prototype.constructor=o,De.prototype=Yt(Qn.prototype),De.prototype.constructor=De;function B(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Je,this.__views__=[]}function tc(){var e=new B(this.__wrapped__);return e.__actions__=ye(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=ye(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=ye(this.__views__),e}function nc(){if(this.__filtered__){var e=new B(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function rc(){var e=this.__wrapped__.value(),t=this.__dir__,n=O(e),r=t<0,s=n?e.length:0,u=vf(0,s,this.__views__),c=u.start,h=u.end,g=h-c,w=r?h:c-1,S=this.__iteratees__,x=S.length,A=0,T=he(g,this.__takeCount__);if(!n||!r&&s==g&&T==g)return va(e,this.__actions__);var F=[];e:for(;g--&&A<T;){w+=t;for(var D=-1,R=e[w];++D<x;){var M=S[D],G=M.iteratee,Fe=M.type,me=G(R);if(Fe==Jo)R=me;else if(!me){if(Fe==ji)continue e;break e}}F[A++]=R}return F}B.prototype=Yt(Qn.prototype),B.prototype.constructor=B;function Ft(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ic(){this.__data__=gn?gn(null):{},this.size=0}function sc(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function ac(e){var t=this.__data__;if(gn){var n=t[e];return n===q?i:n}return Y.call(t,e)?t[e]:i}function oc(e){var t=this.__data__;return gn?t[e]!==i:Y.call(t,e)}function uc(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=gn&&t===i?q:t,this}Ft.prototype.clear=ic,Ft.prototype.delete=sc,Ft.prototype.get=ac,Ft.prototype.has=oc,Ft.prototype.set=uc;function rt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function lc(){this.__data__=[],this.size=0}function cc(e){var t=this.__data__,n=er(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Vn.call(t,n,1),--this.size,!0}function fc(e){var t=this.__data__,n=er(t,e);return n<0?i:t[n][1]}function hc(e){return er(this.__data__,e)>-1}function dc(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}rt.prototype.clear=lc,rt.prototype.delete=cc,rt.prototype.get=fc,rt.prototype.has=hc,rt.prototype.set=dc;function it(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function pc(){this.size=0,this.__data__={hash:new Ft,map:new(dn||rt),string:new Ft}}function gc(e){var t=hr(this,e).delete(e);return this.size-=t?1:0,t}function vc(e){return hr(this,e).get(e)}function mc(e){return hr(this,e).has(e)}function yc(e,t){var n=hr(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}it.prototype.clear=pc,it.prototype.delete=gc,it.prototype.get=vc,it.prototype.has=mc,it.prototype.set=yc;function Rt(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new it;++t<n;)this.add(e[t])}function _c(e){return this.__data__.set(e,q),this}function wc(e){return this.__data__.has(e)}Rt.prototype.add=Rt.prototype.push=_c,Rt.prototype.has=wc;function Ke(e){var t=this.__data__=new rt(e);this.size=t.size}function Sc(){this.__data__=new rt,this.size=0}function xc(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Ic(e){return this.__data__.get(e)}function Ec(e){return this.__data__.has(e)}function Ac(e,t){var n=this.__data__;if(n instanceof rt){var r=n.__data__;if(!dn||r.length<d-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new it(r)}return n.set(e,t),this.size=n.size,this}Ke.prototype.clear=Sc,Ke.prototype.delete=xc,Ke.prototype.get=Ic,Ke.prototype.has=Ec,Ke.prototype.set=Ac;function Vs(e,t){var n=O(e),r=!n&&Nt(e),s=!n&&!r&&It(e),u=!n&&!r&&!s&&Xt(e),c=n||r||s||u,h=c?Yr(e.length,Nl):[],g=h.length;for(var w in e)(t||Y.call(e,w))&&!(c&&(w=="length"||s&&(w=="offset"||w=="parent")||u&&(w=="buffer"||w=="byteLength"||w=="byteOffset")||ut(w,g)))&&h.push(w);return h}function Ys(e){var t=e.length;return t?e[fi(0,t-1)]:i}function bc(e,t){return dr(ye(e),Pt(t,0,e.length))}function Tc(e){return dr(ye(e))}function ti(e,t,n){(n!==i&&!Ve(e[t],n)||n===i&&!(t in e))&&st(e,t,n)}function mn(e,t,n){var r=e[t];(!(Y.call(e,t)&&Ve(r,n))||n===i&&!(t in e))&&st(e,t,n)}function er(e,t){for(var n=e.length;n--;)if(Ve(e[n][0],t))return n;return-1}function Cc(e,t,n,r){return _t(e,function(s,u,c){t(r,s,n(s),c)}),r}function Zs(e,t){return e&&Qe(t,le(t),e)}function Fc(e,t){return e&&Qe(t,we(t),e)}function st(e,t,n){t=="__proto__"&&Yn?Yn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ni(e,t){for(var n=-1,r=t.length,s=m(r),u=e==null;++n<r;)s[n]=u?i:Di(e,t[n]);return s}function Pt(e,t,n){return e===e&&(n!==i&&(e=e<=n?e:n),t!==i&&(e=e>=t?e:t)),e}function $e(e,t,n,r,s,u){var c,h=t&K,g=t&Ze,w=t&k;if(n&&(c=s?n(e,r,s,u):n(e)),c!==i)return c;if(!ne(e))return e;var S=O(e);if(S){if(c=yf(e),!h)return ye(e,c)}else{var x=de(e),A=x==Ln||x==Ji;if(It(e))return _a(e,h);if(x==nt||x==Wt||A&&!s){if(c=g||A?{}:Wa(e),!h)return g?of(e,Fc(c,e)):af(e,Zs(c,e))}else{if(!j[x])return s?e:{};c=_f(e,x,h)}}u||(u=new Ke);var T=u.get(e);if(T)return T;u.set(e,c),po(e)?e.forEach(function(R){c.add($e(R,t,n,R,e,u))}):fo(e)&&e.forEach(function(R,M){c.set(M,$e(R,t,n,M,e,u))});var F=w?g?xi:Si:g?we:le,D=S?i:F(e);return Ue(D||e,function(R,M){D&&(M=R,R=e[M]),mn(c,M,$e(R,t,n,M,e,u))}),c}function Rc(e){var t=le(e);return function(n){return js(n,e,t)}}function js(e,t,n){var r=n.length;if(e==null)return!r;for(e=Z(e);r--;){var s=n[r],u=t[s],c=e[s];if(c===i&&!(s in e)||!u(c))return!1}return!0}function Js(e,t,n){if(typeof e!="function")throw new Ne(I);return En(function(){e.apply(i,n)},t)}function yn(e,t,n,r){var s=-1,u=$n,c=!0,h=e.length,g=[],w=t.length;if(!h)return g;n&&(t=Q(t,be(n))),r?(u=Gr,c=!1):t.length>=d&&(u=fn,c=!1,t=new Rt(t));e:for(;++s<h;){var S=e[s],x=n==null?S:n(S);if(S=r||S!==0?S:0,c&&x===x){for(var A=w;A--;)if(t[A]===x)continue e;g.push(S)}else u(t,x,r)||g.push(S)}return g}var _t=Ea(Xe),Xs=Ea(ii,!0);function Pc(e,t){var n=!0;return _t(e,function(r,s,u){return n=!!t(r,s,u),n}),n}function tr(e,t,n){for(var r=-1,s=e.length;++r<s;){var u=e[r],c=t(u);if(c!=null&&(h===i?c===c&&!Ce(c):n(c,h)))var h=c,g=u}return g}function Lc(e,t,n,r){var s=e.length;for(n=U(n),n<0&&(n=-n>s?0:s+n),r=r===i||r>s?s:U(r),r<0&&(r+=s),r=n>r?0:vo(r);n<r;)e[n++]=t;return e}function Qs(e,t){var n=[];return _t(e,function(r,s,u){t(r,s,u)&&n.push(r)}),n}function fe(e,t,n,r,s){var u=-1,c=e.length;for(n||(n=Sf),s||(s=[]);++u<c;){var h=e[u];t>0&&n(h)?t>1?fe(h,t-1,n,r,s):vt(s,h):r||(s[s.length]=h)}return s}var ri=Aa(),ea=Aa(!0);function Xe(e,t){return e&&ri(e,t,le)}function ii(e,t){return e&&ea(e,t,le)}function nr(e,t){return gt(t,function(n){return lt(e[n])})}function Lt(e,t){t=St(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[et(t[n++])];return n&&n==r?e:i}function ta(e,t,n){var r=t(e);return O(e)?r:vt(r,n(e))}function ge(e){return e==null?e===i?ou:su:Ct&&Ct in Z(e)?gf(e):Cf(e)}function si(e,t){return e>t}function Oc(e,t){return e!=null&&Y.call(e,t)}function Uc(e,t){return e!=null&&t in Z(e)}function Nc(e,t,n){return e>=he(t,n)&&e<ue(t,n)}function ai(e,t,n){for(var r=n?Gr:$n,s=e[0].length,u=e.length,c=u,h=m(u),g=1/0,w=[];c--;){var S=e[c];c&&t&&(S=Q(S,be(t))),g=he(S.length,g),h[c]=!n&&(t||s>=120&&S.length>=120)?new Rt(c&&S):i}S=e[0];var x=-1,A=h[0];e:for(;++x<s&&w.length<g;){var T=S[x],F=t?t(T):T;if(T=n||T!==0?T:0,!(A?fn(A,F):r(w,F,n))){for(c=u;--c;){var D=h[c];if(!(D?fn(D,F):r(e[c],F,n)))continue e}A&&A.push(F),w.push(T)}}return w}function Dc(e,t,n,r){return Xe(e,function(s,u,c){t(r,n(s),u,c)}),r}function _n(e,t,n){t=St(t,e),e=Ga(e,t);var r=e==null?e:e[et(Me(t))];return r==null?i:Ae(r,e,n)}function na(e){return ie(e)&&ge(e)==Wt}function $c(e){return ie(e)&&ge(e)==cn}function Wc(e){return ie(e)&&ge(e)==sn}function wn(e,t,n,r,s){return e===t?!0:e==null||t==null||!ie(e)&&!ie(t)?e!==e&&t!==t:Mc(e,t,n,r,wn,s)}function Mc(e,t,n,r,s,u){var c=O(e),h=O(t),g=c?Rn:de(e),w=h?Rn:de(t);g=g==Wt?nt:g,w=w==Wt?nt:w;var S=g==nt,x=w==nt,A=g==w;if(A&&It(e)){if(!It(t))return!1;c=!0,S=!1}if(A&&!S)return u||(u=new Ke),c||Xt(e)?Na(e,t,n,r,s,u):df(e,t,g,n,r,s,u);if(!(n&W)){var T=S&&Y.call(e,"__wrapped__"),F=x&&Y.call(t,"__wrapped__");if(T||F){var D=T?e.value():e,R=F?t.value():t;return u||(u=new Ke),s(D,R,n,r,u)}}return A?(u||(u=new Ke),pf(e,t,n,r,s,u)):!1}function Bc(e){return ie(e)&&de(e)==qe}function oi(e,t,n,r){var s=n.length,u=s,c=!r;if(e==null)return!u;for(e=Z(e);s--;){var h=n[s];if(c&&h[2]?h[1]!==e[h[0]]:!(h[0]in e))return!1}for(;++s<u;){h=n[s];var g=h[0],w=e[g],S=h[1];if(c&&h[2]){if(w===i&&!(g in e))return!1}else{var x=new Ke;if(r)var A=r(w,S,g,e,t,x);if(!(A===i?wn(S,w,W|Pe,r,x):A))return!1}}return!0}function ra(e){if(!ne(e)||If(e))return!1;var t=lt(e)?Bl:Ru;return t.test(Ut(e))}function kc(e){return ie(e)&&ge(e)==on}function Gc(e){return ie(e)&&de(e)==He}function qc(e){return ie(e)&&_r(e.length)&&!!J[ge(e)]}function ia(e){return typeof e=="function"?e:e==null?Se:typeof e=="object"?O(e)?oa(e[0],e[1]):aa(e):To(e)}function ui(e){if(!In(e))return Kl(e);var t=[];for(var n in Z(e))Y.call(e,n)&&n!="constructor"&&t.push(n);return t}function Hc(e){if(!ne(e))return Tf(e);var t=In(e),n=[];for(var r in e)r=="constructor"&&(t||!Y.call(e,r))||n.push(r);return n}function li(e,t){return e<t}function sa(e,t){var n=-1,r=_e(e)?m(e.length):[];return _t(e,function(s,u,c){r[++n]=t(s,u,c)}),r}function aa(e){var t=Ei(e);return t.length==1&&t[0][2]?Ba(t[0][0],t[0][1]):function(n){return n===e||oi(n,e,t)}}function oa(e,t){return bi(e)&&Ma(t)?Ba(et(e),t):function(n){var r=Di(n,e);return r===i&&r===t?$i(n,e):wn(t,r,W|Pe)}}function rr(e,t,n,r,s){e!==t&&ri(t,function(u,c){if(s||(s=new Ke),ne(u))zc(e,t,c,n,rr,r,s);else{var h=r?r(Ci(e,c),u,c+"",e,t,s):i;h===i&&(h=u),ti(e,c,h)}},we)}function zc(e,t,n,r,s,u,c){var h=Ci(e,n),g=Ci(t,n),w=c.get(g);if(w){ti(e,n,w);return}var S=u?u(h,g,n+"",e,t,c):i,x=S===i;if(x){var A=O(g),T=!A&&It(g),F=!A&&!T&&Xt(g);S=g,A||T||F?O(h)?S=h:se(h)?S=ye(h):T?(x=!1,S=_a(g,!0)):F?(x=!1,S=wa(g,!0)):S=[]:An(g)||Nt(g)?(S=h,Nt(h)?S=mo(h):(!ne(h)||lt(h))&&(S=Wa(g))):x=!1}x&&(c.set(g,S),s(S,g,r,u,c),c.delete(g)),ti(e,n,S)}function ua(e,t){var n=e.length;if(n)return t+=t<0?n:0,ut(t,n)?e[t]:i}function la(e,t,n){t.length?t=Q(t,function(u){return O(u)?function(c){return Lt(c,u.length===1?u[0]:u)}:u}):t=[Se];var r=-1;t=Q(t,be(C()));var s=sa(e,function(u,c,h){var g=Q(t,function(w){return w(u)});return{criteria:g,index:++r,value:u}});return yl(s,function(u,c){return sf(u,c,n)})}function Kc(e,t){return ca(e,t,function(n,r){return $i(e,r)})}function ca(e,t,n){for(var r=-1,s=t.length,u={};++r<s;){var c=t[r],h=Lt(e,c);n(h,c)&&Sn(u,St(c,e),h)}return u}function Vc(e){return function(t){return Lt(t,e)}}function ci(e,t,n,r){var s=r?ml:kt,u=-1,c=t.length,h=e;for(e===t&&(t=ye(t)),n&&(h=Q(e,be(n)));++u<c;)for(var g=0,w=t[u],S=n?n(w):w;(g=s(h,S,g,r))>-1;)h!==e&&Vn.call(h,g,1),Vn.call(e,g,1);return e}function fa(e,t){for(var n=e?t.length:0,r=n-1;n--;){var s=t[n];if(n==r||s!==u){var u=s;ut(s)?Vn.call(e,s,1):pi(e,s)}}return e}function fi(e,t){return e+jn(zs()*(t-e+1))}function Yc(e,t,n,r){for(var s=-1,u=ue(Zn((t-e)/(n||1)),0),c=m(u);u--;)c[r?u:++s]=e,e+=n;return c}function hi(e,t){var n="";if(!e||t<1||t>pt)return n;do t%2&&(n+=e),t=jn(t/2),t&&(e+=e);while(t);return n}function $(e,t){return Fi(ka(e,t,Se),e+"")}function Zc(e){return Ys(Qt(e))}function jc(e,t){var n=Qt(e);return dr(n,Pt(t,0,n.length))}function Sn(e,t,n,r){if(!ne(e))return e;t=St(t,e);for(var s=-1,u=t.length,c=u-1,h=e;h!=null&&++s<u;){var g=et(t[s]),w=n;if(g==="__proto__"||g==="constructor"||g==="prototype")return e;if(s!=c){var S=h[g];w=r?r(S,g,h):i,w===i&&(w=ne(S)?S:ut(t[s+1])?[]:{})}mn(h,g,w),h=h[g]}return e}var ha=Jn?function(e,t){return Jn.set(e,t),e}:Se,Jc=Yn?function(e,t){return Yn(e,"toString",{configurable:!0,enumerable:!1,value:Mi(t),writable:!0})}:Se;function Xc(e){return dr(Qt(e))}function We(e,t,n){var r=-1,s=e.length;t<0&&(t=-t>s?0:s+t),n=n>s?s:n,n<0&&(n+=s),s=t>n?0:n-t>>>0,t>>>=0;for(var u=m(s);++r<s;)u[r]=e[r+t];return u}function Qc(e,t){var n;return _t(e,function(r,s,u){return n=t(r,s,u),!n}),!!n}function ir(e,t,n){var r=0,s=e==null?r:e.length;if(typeof t=="number"&&t===t&&s<=tu){for(;r<s;){var u=r+s>>>1,c=e[u];c!==null&&!Ce(c)&&(n?c<=t:c<t)?r=u+1:s=u}return s}return di(e,t,Se,n)}function di(e,t,n,r){var s=0,u=e==null?0:e.length;if(u===0)return 0;t=n(t);for(var c=t!==t,h=t===null,g=Ce(t),w=t===i;s<u;){var S=jn((s+u)/2),x=n(e[S]),A=x!==i,T=x===null,F=x===x,D=Ce(x);if(c)var R=r||F;else w?R=F&&(r||A):h?R=F&&A&&(r||!T):g?R=F&&A&&!T&&(r||!D):T||D?R=!1:R=r?x<=t:x<t;R?s=S+1:u=S}return he(u,eu)}function da(e,t){for(var n=-1,r=e.length,s=0,u=[];++n<r;){var c=e[n],h=t?t(c):c;if(!n||!Ve(h,g)){var g=h;u[s++]=c===0?0:c}}return u}function pa(e){return typeof e=="number"?e:Ce(e)?Fn:+e}function Te(e){if(typeof e=="string")return e;if(O(e))return Q(e,Te)+"";if(Ce(e))return Ks?Ks.call(e):"";var t=e+"";return t=="0"&&1/e==-bt?"-0":t}function wt(e,t,n){var r=-1,s=$n,u=e.length,c=!0,h=[],g=h;if(n)c=!1,s=Gr;else if(u>=d){var w=t?null:ff(e);if(w)return Mn(w);c=!1,s=fn,g=new Rt}else g=t?[]:h;e:for(;++r<u;){var S=e[r],x=t?t(S):S;if(S=n||S!==0?S:0,c&&x===x){for(var A=g.length;A--;)if(g[A]===x)continue e;t&&g.push(x),h.push(S)}else s(g,x,n)||(g!==h&&g.push(x),h.push(S))}return h}function pi(e,t){return t=St(t,e),e=Ga(e,t),e==null||delete e[et(Me(t))]}function ga(e,t,n,r){return Sn(e,t,n(Lt(e,t)),r)}function sr(e,t,n,r){for(var s=e.length,u=r?s:-1;(r?u--:++u<s)&&t(e[u],u,e););return n?We(e,r?0:u,r?u+1:s):We(e,r?u+1:0,r?s:u)}function va(e,t){var n=e;return n instanceof B&&(n=n.value()),qr(t,function(r,s){return s.func.apply(s.thisArg,vt([r],s.args))},n)}function gi(e,t,n){var r=e.length;if(r<2)return r?wt(e[0]):[];for(var s=-1,u=m(r);++s<r;)for(var c=e[s],h=-1;++h<r;)h!=s&&(u[s]=yn(u[s]||c,e[h],t,n));return wt(fe(u,1),t,n)}function ma(e,t,n){for(var r=-1,s=e.length,u=t.length,c={};++r<s;){var h=r<u?t[r]:i;n(c,e[r],h)}return c}function vi(e){return se(e)?e:[]}function mi(e){return typeof e=="function"?e:Se}function St(e,t){return O(e)?e:bi(e,t)?[e]:Ka(V(e))}var ef=$;function xt(e,t,n){var r=e.length;return n=n===i?r:n,!t&&n>=r?e:We(e,t,n)}var ya=kl||function(e){return ce.clearTimeout(e)};function _a(e,t){if(t)return e.slice();var n=e.length,r=Bs?Bs(n):new e.constructor(n);return e.copy(r),r}function yi(e){var t=new e.constructor(e.byteLength);return new zn(t).set(new zn(e)),t}function tf(e,t){var n=t?yi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function nf(e){var t=new e.constructor(e.source,ns.exec(e));return t.lastIndex=e.lastIndex,t}function rf(e){return vn?Z(vn.call(e)):{}}function wa(e,t){var n=t?yi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Sa(e,t){if(e!==t){var n=e!==i,r=e===null,s=e===e,u=Ce(e),c=t!==i,h=t===null,g=t===t,w=Ce(t);if(!h&&!w&&!u&&e>t||u&&c&&g&&!h&&!w||r&&c&&g||!n&&g||!s)return 1;if(!r&&!u&&!w&&e<t||w&&n&&s&&!r&&!u||h&&n&&s||!c&&s||!g)return-1}return 0}function sf(e,t,n){for(var r=-1,s=e.criteria,u=t.criteria,c=s.length,h=n.length;++r<c;){var g=Sa(s[r],u[r]);if(g){if(r>=h)return g;var w=n[r];return g*(w=="desc"?-1:1)}}return e.index-t.index}function xa(e,t,n,r){for(var s=-1,u=e.length,c=n.length,h=-1,g=t.length,w=ue(u-c,0),S=m(g+w),x=!r;++h<g;)S[h]=t[h];for(;++s<c;)(x||s<u)&&(S[n[s]]=e[s]);for(;w--;)S[h++]=e[s++];return S}function Ia(e,t,n,r){for(var s=-1,u=e.length,c=-1,h=n.length,g=-1,w=t.length,S=ue(u-h,0),x=m(S+w),A=!r;++s<S;)x[s]=e[s];for(var T=s;++g<w;)x[T+g]=t[g];for(;++c<h;)(A||s<u)&&(x[T+n[c]]=e[s++]);return x}function ye(e,t){var n=-1,r=e.length;for(t||(t=m(r));++n<r;)t[n]=e[n];return t}function Qe(e,t,n,r){var s=!n;n||(n={});for(var u=-1,c=t.length;++u<c;){var h=t[u],g=r?r(n[h],e[h],h,n,e):i;g===i&&(g=e[h]),s?st(n,h,g):mn(n,h,g)}return n}function af(e,t){return Qe(e,Ai(e),t)}function of(e,t){return Qe(e,Da(e),t)}function ar(e,t){return function(n,r){var s=O(n)?fl:Cc,u=t?t():{};return s(n,e,C(r,2),u)}}function Zt(e){return $(function(t,n){var r=-1,s=n.length,u=s>1?n[s-1]:i,c=s>2?n[2]:i;for(u=e.length>3&&typeof u=="function"?(s--,u):i,c&&ve(n[0],n[1],c)&&(u=s<3?i:u,s=1),t=Z(t);++r<s;){var h=n[r];h&&e(t,h,r,u)}return t})}function Ea(e,t){return function(n,r){if(n==null)return n;if(!_e(n))return e(n,r);for(var s=n.length,u=t?s:-1,c=Z(n);(t?u--:++u<s)&&r(c[u],u,c)!==!1;);return n}}function Aa(e){return function(t,n,r){for(var s=-1,u=Z(t),c=r(t),h=c.length;h--;){var g=c[e?h:++s];if(n(u[g],g,u)===!1)break}return t}}function uf(e,t,n){var r=t&xe,s=xn(e);function u(){var c=this&&this!==ce&&this instanceof u?s:e;return c.apply(r?n:this,arguments)}return u}function ba(e){return function(t){t=V(t);var n=Gt(t)?ze(t):i,r=n?n[0]:t.charAt(0),s=n?xt(n,1).join(""):t.slice(1);return r[e]()+s}}function jt(e){return function(t){return qr(Ao(Eo(t).replace(Ju,"")),e,"")}}function xn(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Yt(e.prototype),r=e.apply(n,t);return ne(r)?r:n}}function lf(e,t,n){var r=xn(e);function s(){for(var u=arguments.length,c=m(u),h=u,g=Jt(s);h--;)c[h]=arguments[h];var w=u<3&&c[0]!==g&&c[u-1]!==g?[]:mt(c,g);if(u-=w.length,u<n)return Pa(e,t,or,s.placeholder,i,c,w,i,i,n-u);var S=this&&this!==ce&&this instanceof s?r:e;return Ae(S,this,c)}return s}function Ta(e){return function(t,n,r){var s=Z(t);if(!_e(t)){var u=C(n,3);t=le(t),n=function(h){return u(s[h],h,s)}}var c=e(t,n,r);return c>-1?s[u?t[c]:c]:i}}function Ca(e){return ot(function(t){var n=t.length,r=n,s=De.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if(typeof u!="function")throw new Ne(I);if(s&&!c&&fr(u)=="wrapper")var c=new De([],!0)}for(r=c?r:n;++r<n;){u=t[r];var h=fr(u),g=h=="wrapper"?Ii(u):i;g&&Ti(g[0])&&g[1]==(tt|Le|Ie|nn)&&!g[4].length&&g[9]==1?c=c[fr(g[0])].apply(c,g[3]):c=u.length==1&&Ti(u)?c[h]():c.thru(u)}return function(){var w=arguments,S=w[0];if(c&&w.length==1&&O(S))return c.plant(S).value();for(var x=0,A=n?t[x].apply(this,w):S;++x<n;)A=t[x].call(this,A);return A}})}function or(e,t,n,r,s,u,c,h,g,w){var S=t&tt,x=t&xe,A=t&je,T=t&(Le|At),F=t&Ir,D=A?i:xn(e);function R(){for(var M=arguments.length,G=m(M),Fe=M;Fe--;)G[Fe]=arguments[Fe];if(T)var me=Jt(R),Re=wl(G,me);if(r&&(G=xa(G,r,s,T)),u&&(G=Ia(G,u,c,T)),M-=Re,T&&M<w){var ae=mt(G,me);return Pa(e,t,or,R.placeholder,n,G,ae,h,g,w-M)}var Ye=x?n:this,ft=A?Ye[e]:e;return M=G.length,h?G=Ff(G,h):F&&M>1&&G.reverse(),S&&g<M&&(G.length=g),this&&this!==ce&&this instanceof R&&(ft=D||xn(ft)),ft.apply(Ye,G)}return R}function Fa(e,t){return function(n,r){return Dc(n,e,t(r),{})}}function ur(e,t){return function(n,r){var s;if(n===i&&r===i)return t;if(n!==i&&(s=n),r!==i){if(s===i)return r;typeof n=="string"||typeof r=="string"?(n=Te(n),r=Te(r)):(n=pa(n),r=pa(r)),s=e(n,r)}return s}}function _i(e){return ot(function(t){return t=Q(t,be(C())),$(function(n){var r=this;return e(t,function(s){return Ae(s,r,n)})})})}function lr(e,t){t=t===i?" ":Te(t);var n=t.length;if(n<2)return n?hi(t,e):t;var r=hi(t,Zn(e/qt(t)));return Gt(t)?xt(ze(r),0,e).join(""):r.slice(0,e)}function cf(e,t,n,r){var s=t&xe,u=xn(e);function c(){for(var h=-1,g=arguments.length,w=-1,S=r.length,x=m(S+g),A=this&&this!==ce&&this instanceof c?u:e;++w<S;)x[w]=r[w];for(;g--;)x[w++]=arguments[++h];return Ae(A,s?n:this,x)}return c}function Ra(e){return function(t,n,r){return r&&typeof r!="number"&&ve(t,n,r)&&(n=r=i),t=ct(t),n===i?(n=t,t=0):n=ct(n),r=r===i?t<n?1:-1:ct(r),Yc(t,n,r,e)}}function cr(e){return function(t,n){return typeof t=="string"&&typeof n=="string"||(t=Be(t),n=Be(n)),e(t,n)}}function Pa(e,t,n,r,s,u,c,h,g,w){var S=t&Le,x=S?c:i,A=S?i:c,T=S?u:i,F=S?i:u;t|=S?Ie:Ee,t&=~(S?Ee:Ie),t&Cn||(t&=-4);var D=[e,t,s,T,x,F,A,h,g,w],R=n.apply(i,D);return Ti(e)&&qa(R,D),R.placeholder=r,Ha(R,e,t)}function wi(e){var t=oe[e];return function(n,r){if(n=Be(n),r=r==null?0:he(U(r),292),r&&Hs(n)){var s=(V(n)+"e").split("e"),u=t(s[0]+"e"+(+s[1]+r));return s=(V(u)+"e").split("e"),+(s[0]+"e"+(+s[1]-r))}return t(n)}}var ff=Kt&&1/Mn(new Kt([,-0]))[1]==bt?function(e){return new Kt(e)}:Gi;function La(e){return function(t){var n=de(t);return n==qe?jr(t):n==He?Tl(t):_l(t,e(t))}}function at(e,t,n,r,s,u,c,h){var g=t&je;if(!g&&typeof e!="function")throw new Ne(I);var w=r?r.length:0;if(w||(t&=-97,r=s=i),c=c===i?c:ue(U(c),0),h=h===i?h:U(h),w-=s?s.length:0,t&Ee){var S=r,x=s;r=s=i}var A=g?i:Ii(e),T=[e,t,n,r,s,S,x,u,c,h];if(A&&bf(T,A),e=T[0],t=T[1],n=T[2],r=T[3],s=T[4],h=T[9]=T[9]===i?g?0:e.length:ue(T[9]-w,0),!h&&t&(Le|At)&&(t&=-25),!t||t==xe)var F=uf(e,t,n);else t==Le||t==At?F=lf(e,t,h):(t==Ie||t==(xe|Ie))&&!s.length?F=cf(e,t,n,r):F=or.apply(i,T);var D=A?ha:qa;return Ha(D(F,T),e,t)}function Oa(e,t,n,r){return e===i||Ve(e,zt[n])&&!Y.call(r,n)?t:e}function Ua(e,t,n,r,s,u){return ne(e)&&ne(t)&&(u.set(t,e),rr(e,t,i,Ua,u),u.delete(t)),e}function hf(e){return An(e)?i:e}function Na(e,t,n,r,s,u){var c=n&W,h=e.length,g=t.length;if(h!=g&&!(c&&g>h))return!1;var w=u.get(e),S=u.get(t);if(w&&S)return w==t&&S==e;var x=-1,A=!0,T=n&Pe?new Rt:i;for(u.set(e,t),u.set(t,e);++x<h;){var F=e[x],D=t[x];if(r)var R=c?r(D,F,x,t,e,u):r(F,D,x,e,t,u);if(R!==i){if(R)continue;A=!1;break}if(T){if(!Hr(t,function(M,G){if(!fn(T,G)&&(F===M||s(F,M,n,r,u)))return T.push(G)})){A=!1;break}}else if(!(F===D||s(F,D,n,r,u))){A=!1;break}}return u.delete(e),u.delete(t),A}function df(e,t,n,r,s,u,c){switch(n){case Mt:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case cn:return!(e.byteLength!=t.byteLength||!u(new zn(e),new zn(t)));case rn:case sn:case an:return Ve(+e,+t);case Pn:return e.name==t.name&&e.message==t.message;case on:case un:return e==t+"";case qe:var h=jr;case He:var g=r&W;if(h||(h=Mn),e.size!=t.size&&!g)return!1;var w=c.get(e);if(w)return w==t;r|=Pe,c.set(e,t);var S=Na(h(e),h(t),r,s,u,c);return c.delete(e),S;case On:if(vn)return vn.call(e)==vn.call(t)}return!1}function pf(e,t,n,r,s,u){var c=n&W,h=Si(e),g=h.length,w=Si(t),S=w.length;if(g!=S&&!c)return!1;for(var x=g;x--;){var A=h[x];if(!(c?A in t:Y.call(t,A)))return!1}var T=u.get(e),F=u.get(t);if(T&&F)return T==t&&F==e;var D=!0;u.set(e,t),u.set(t,e);for(var R=c;++x<g;){A=h[x];var M=e[A],G=t[A];if(r)var Fe=c?r(G,M,A,t,e,u):r(M,G,A,e,t,u);if(!(Fe===i?M===G||s(M,G,n,r,u):Fe)){D=!1;break}R||(R=A=="constructor")}if(D&&!R){var me=e.constructor,Re=t.constructor;me!=Re&&"constructor"in e&&"constructor"in t&&!(typeof me=="function"&&me instanceof me&&typeof Re=="function"&&Re instanceof Re)&&(D=!1)}return u.delete(e),u.delete(t),D}function ot(e){return Fi(ka(e,i,ja),e+"")}function Si(e){return ta(e,le,Ai)}function xi(e){return ta(e,we,Da)}var Ii=Jn?function(e){return Jn.get(e)}:Gi;function fr(e){for(var t=e.name+"",n=Vt[t],r=Y.call(Vt,t)?n.length:0;r--;){var s=n[r],u=s.func;if(u==null||u==e)return s.name}return t}function Jt(e){var t=Y.call(o,"placeholder")?o:e;return t.placeholder}function C(){var e=o.iteratee||Bi;return e=e===Bi?ia:e,arguments.length?e(arguments[0],arguments[1]):e}function hr(e,t){var n=e.__data__;return xf(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ei(e){for(var t=le(e),n=t.length;n--;){var r=t[n],s=e[r];t[n]=[r,s,Ma(s)]}return t}function Ot(e,t){var n=El(e,t);return ra(n)?n:i}function gf(e){var t=Y.call(e,Ct),n=e[Ct];try{e[Ct]=i;var r=!0}catch{}var s=qn.call(e);return r&&(t?e[Ct]=n:delete e[Ct]),s}var Ai=Xr?function(e){return e==null?[]:(e=Z(e),gt(Xr(e),function(t){return Gs.call(e,t)}))}:qi,Da=Xr?function(e){for(var t=[];e;)vt(t,Ai(e)),e=Kn(e);return t}:qi,de=ge;(Qr&&de(new Qr(new ArrayBuffer(1)))!=Mt||dn&&de(new dn)!=qe||ei&&de(ei.resolve())!=Xi||Kt&&de(new Kt)!=He||pn&&de(new pn)!=ln)&&(de=function(e){var t=ge(e),n=t==nt?e.constructor:i,r=n?Ut(n):"";if(r)switch(r){case jl:return Mt;case Jl:return qe;case Xl:return Xi;case Ql:return He;case ec:return ln}return t});function vf(e,t,n){for(var r=-1,s=n.length;++r<s;){var u=n[r],c=u.size;switch(u.type){case"drop":e+=c;break;case"dropRight":t-=c;break;case"take":t=he(t,e+c);break;case"takeRight":e=ue(e,t-c);break}}return{start:e,end:t}}function mf(e){var t=e.match(xu);return t?t[1].split(Iu):[]}function $a(e,t,n){t=St(t,e);for(var r=-1,s=t.length,u=!1;++r<s;){var c=et(t[r]);if(!(u=e!=null&&n(e,c)))break;e=e[c]}return u||++r!=s?u:(s=e==null?0:e.length,!!s&&_r(s)&&ut(c,s)&&(O(e)||Nt(e)))}function yf(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&Y.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function Wa(e){return typeof e.constructor=="function"&&!In(e)?Yt(Kn(e)):{}}function _f(e,t,n){var r=e.constructor;switch(t){case cn:return yi(e);case rn:case sn:return new r(+e);case Mt:return tf(e,n);case Er:case Ar:case br:case Tr:case Cr:case Fr:case Rr:case Pr:case Lr:return wa(e,n);case qe:return new r;case an:case un:return new r(e);case on:return nf(e);case He:return new r;case On:return rf(e)}}function wf(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(Su,`{
2
+ "use strict";var Hg=Object.create;var Fo=Object.defineProperty;var zg=Object.getOwnPropertyDescriptor;var Kg=Object.getOwnPropertyNames;var jg=Object.getPrototypeOf,Yg=Object.prototype.hasOwnProperty;var Jg=(f,s,r,l)=>{if(s&&typeof s=="object"||typeof s=="function")for(let p of Kg(s))!Yg.call(f,p)&&p!==r&&Fo(f,p,{get:()=>s[p],enumerable:!(l=zg(s,p))||l.enumerable});return f};var Zg=(f,s,r)=>(r=f!=null?Hg(jg(f)):{},Jg(s||!f||!f.__esModule?Fo(r,"default",{value:f,enumerable:!0}):r,f));const q=require("path"),Xg=require("chalk"),v=require("./uninstall-BiLmSWhb.js"),Qg=require("inquirer"),tt=require("node:fs/promises"),te=require("uuid"),ev=require("chokidar"),tv=require("crypto"),bn=require("node:child_process"),nv=require("node:path"),L=require("react/jsx-runtime"),At=require("react"),Bo=require("commander"),rv=require("util"),Dt=f=>f&&f.__esModule?f:{default:f},Yi=Dt(q),y=Dt(Xg),Ge=Dt(Qg),ko=Dt(ev),iv=Dt(tv),Po=Dt(nv),Go=Dt(At),Q=process.env.INIT_CWD||process.cwd(),pt=f=>f&&!f?.startsWith("/")?q.join(Q,f):f;var Cn={exports:{}};var sv=Cn.exports,Lo;function av(){return Lo||(Lo=1,(function(f,s){(function(){var r,l="4.17.21",p=200,I="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",x="Expected a function",P="Invalid `variable` option passed into `_.template`",D="__lodash_hash_undefined__",z=500,Z="__lodash_placeholder__",K=1,Ye=2,G=4,W=1,Pe=2,Ie=1,Je=2,Tn=4,Le=8,bt=16,xe=32,Ee=64,nt=128,nn=256,xr=512,Yo=30,Jo="...",Zo=800,Xo=16,Zi=1,Qo=2,eu=3,Ct=1/0,gt=9007199254740991,tu=17976931348623157e292,Rn=NaN,Ze=4294967295,nu=Ze-1,ru=Ze>>>1,iu=[["ary",nt],["bind",Ie],["bindKey",Je],["curry",Le],["curryRight",bt],["flip",xr],["partial",xe],["partialRight",Ee],["rearg",nn]],Mt="[object Arguments]",Fn="[object Array]",su="[object AsyncFunction]",rn="[object Boolean]",sn="[object Date]",au="[object DOMException]",Pn="[object Error]",Ln="[object Function]",Xi="[object GeneratorFunction]",Ve="[object Map]",an="[object Number]",ou="[object Null]",rt="[object Object]",Qi="[object Promise]",uu="[object Proxy]",on="[object RegExp]",qe="[object Set]",un="[object String]",Nn="[object Symbol]",lu="[object Undefined]",ln="[object WeakMap]",cu="[object WeakSet]",cn="[object ArrayBuffer]",Wt="[object DataView]",Er="[object Float32Array]",Ar="[object Float64Array]",br="[object Int8Array]",Cr="[object Int16Array]",Tr="[object Int32Array]",Rr="[object Uint8Array]",Fr="[object Uint8ClampedArray]",Pr="[object Uint16Array]",Lr="[object Uint32Array]",fu=/\b__p \+= '';/g,du=/\b(__p \+=) '' \+/g,pu=/(__e\(.*?\)|\b__t\)) \+\n'';/g,es=/&(?:amp|lt|gt|quot|#39);/g,ts=/[&<>"']/g,hu=RegExp(es.source),gu=RegExp(ts.source),vu=/<%-([\s\S]+?)%>/g,mu=/<%([\s\S]+?)%>/g,ns=/<%=([\s\S]+?)%>/g,yu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_u=/^\w*$/,wu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Nr=/[\\^$.*+?()[\]{}|]/g,Su=RegExp(Nr.source),Or=/^\s+/,Iu=/\s/,xu=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Eu=/\{\n\/\* \[wrapped with (.+)\] \*/,Au=/,? & /,bu=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Cu=/[()=,{}\[\]\/\s]/,Tu=/\\(\\)?/g,Ru=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,rs=/\w*$/,Fu=/^[-+]0x[0-9a-f]+$/i,Pu=/^0b[01]+$/i,Lu=/^\[object .+?Constructor\]$/,Nu=/^0o[0-7]+$/i,Ou=/^(?:0|[1-9]\d*)$/,$u=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,On=/($^)/,Uu=/['\n\r\u2028\u2029\\]/g,$n="\\ud800-\\udfff",Du="\\u0300-\\u036f",Mu="\\ufe20-\\ufe2f",Wu="\\u20d0-\\u20ff",is=Du+Mu+Wu,ss="\\u2700-\\u27bf",as="a-z\\xdf-\\xf6\\xf8-\\xff",Bu="\\xac\\xb1\\xd7\\xf7",ku="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Gu="\\u2000-\\u206f",Vu=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",os="A-Z\\xc0-\\xd6\\xd8-\\xde",us="\\ufe0e\\ufe0f",ls=Bu+ku+Gu+Vu,$r="['’]",qu="["+$n+"]",cs="["+ls+"]",Un="["+is+"]",fs="\\d+",Hu="["+ss+"]",ds="["+as+"]",ps="[^"+$n+ls+fs+ss+as+os+"]",Ur="\\ud83c[\\udffb-\\udfff]",zu="(?:"+Un+"|"+Ur+")",hs="[^"+$n+"]",Dr="(?:\\ud83c[\\udde6-\\uddff]){2}",Mr="[\\ud800-\\udbff][\\udc00-\\udfff]",Bt="["+os+"]",gs="\\u200d",vs="(?:"+ds+"|"+ps+")",Ku="(?:"+Bt+"|"+ps+")",ms="(?:"+$r+"(?:d|ll|m|re|s|t|ve))?",ys="(?:"+$r+"(?:D|LL|M|RE|S|T|VE))?",_s=zu+"?",ws="["+us+"]?",ju="(?:"+gs+"(?:"+[hs,Dr,Mr].join("|")+")"+ws+_s+")*",Yu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ju="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ss=ws+_s+ju,Zu="(?:"+[Hu,Dr,Mr].join("|")+")"+Ss,Xu="(?:"+[hs+Un+"?",Un,Dr,Mr,qu].join("|")+")",Qu=RegExp($r,"g"),el=RegExp(Un,"g"),Wr=RegExp(Ur+"(?="+Ur+")|"+Xu+Ss,"g"),tl=RegExp([Bt+"?"+ds+"+"+ms+"(?="+[cs,Bt,"$"].join("|")+")",Ku+"+"+ys+"(?="+[cs,Bt+vs,"$"].join("|")+")",Bt+"?"+vs+"+"+ms,Bt+"+"+ys,Ju,Yu,fs,Zu].join("|"),"g"),nl=RegExp("["+gs+$n+is+us+"]"),rl=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,il=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],sl=-1,ee={};ee[Er]=ee[Ar]=ee[br]=ee[Cr]=ee[Tr]=ee[Rr]=ee[Fr]=ee[Pr]=ee[Lr]=!0,ee[Mt]=ee[Fn]=ee[cn]=ee[rn]=ee[Wt]=ee[sn]=ee[Pn]=ee[Ln]=ee[Ve]=ee[an]=ee[rt]=ee[on]=ee[qe]=ee[un]=ee[ln]=!1;var X={};X[Mt]=X[Fn]=X[cn]=X[Wt]=X[rn]=X[sn]=X[Er]=X[Ar]=X[br]=X[Cr]=X[Tr]=X[Ve]=X[an]=X[rt]=X[on]=X[qe]=X[un]=X[Nn]=X[Rr]=X[Fr]=X[Pr]=X[Lr]=!0,X[Pn]=X[Ln]=X[ln]=!1;var al={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},ol={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ul={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},ll={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},cl=parseFloat,fl=parseInt,Is=typeof v.commonjsGlobal=="object"&&v.commonjsGlobal&&v.commonjsGlobal.Object===Object&&v.commonjsGlobal,dl=typeof self=="object"&&self&&self.Object===Object&&self,fe=Is||dl||Function("return this")(),Br=s&&!s.nodeType&&s,Tt=Br&&!0&&f&&!f.nodeType&&f,xs=Tt&&Tt.exports===Br,kr=xs&&Is.process,Ne=(function(){try{var h=Tt&&Tt.require&&Tt.require("util").types;return h||kr&&kr.binding&&kr.binding("util")}catch{}})(),Es=Ne&&Ne.isArrayBuffer,As=Ne&&Ne.isDate,bs=Ne&&Ne.isMap,Cs=Ne&&Ne.isRegExp,Ts=Ne&&Ne.isSet,Rs=Ne&&Ne.isTypedArray;function Ae(h,_,m){switch(m.length){case 0:return h.call(_);case 1:return h.call(_,m[0]);case 2:return h.call(_,m[0],m[1]);case 3:return h.call(_,m[0],m[1],m[2])}return h.apply(_,m)}function pl(h,_,m,b){for(var N=-1,H=h==null?0:h.length;++N<H;){var oe=h[N];_(b,oe,m(oe),h)}return b}function Oe(h,_){for(var m=-1,b=h==null?0:h.length;++m<b&&_(h[m],m,h)!==!1;);return h}function hl(h,_){for(var m=h==null?0:h.length;m--&&_(h[m],m,h)!==!1;);return h}function Fs(h,_){for(var m=-1,b=h==null?0:h.length;++m<b;)if(!_(h[m],m,h))return!1;return!0}function vt(h,_){for(var m=-1,b=h==null?0:h.length,N=0,H=[];++m<b;){var oe=h[m];_(oe,m,h)&&(H[N++]=oe)}return H}function Dn(h,_){var m=h==null?0:h.length;return!!m&&kt(h,_,0)>-1}function Gr(h,_,m){for(var b=-1,N=h==null?0:h.length;++b<N;)if(m(_,h[b]))return!0;return!1}function ne(h,_){for(var m=-1,b=h==null?0:h.length,N=Array(b);++m<b;)N[m]=_(h[m],m,h);return N}function mt(h,_){for(var m=-1,b=_.length,N=h.length;++m<b;)h[N+m]=_[m];return h}function Vr(h,_,m,b){var N=-1,H=h==null?0:h.length;for(b&&H&&(m=h[++N]);++N<H;)m=_(m,h[N],N,h);return m}function gl(h,_,m,b){var N=h==null?0:h.length;for(b&&N&&(m=h[--N]);N--;)m=_(m,h[N],N,h);return m}function qr(h,_){for(var m=-1,b=h==null?0:h.length;++m<b;)if(_(h[m],m,h))return!0;return!1}var vl=Hr("length");function ml(h){return h.split("")}function yl(h){return h.match(bu)||[]}function Ps(h,_,m){var b;return m(h,function(N,H,oe){if(_(N,H,oe))return b=H,!1}),b}function Mn(h,_,m,b){for(var N=h.length,H=m+(b?1:-1);b?H--:++H<N;)if(_(h[H],H,h))return H;return-1}function kt(h,_,m){return _===_?Fl(h,_,m):Mn(h,Ls,m)}function _l(h,_,m,b){for(var N=m-1,H=h.length;++N<H;)if(b(h[N],_))return N;return-1}function Ls(h){return h!==h}function Ns(h,_){var m=h==null?0:h.length;return m?Kr(h,_)/m:Rn}function Hr(h){return function(_){return _==null?r:_[h]}}function zr(h){return function(_){return h==null?r:h[_]}}function Os(h,_,m,b,N){return N(h,function(H,oe,J){m=b?(b=!1,H):_(m,H,oe,J)}),m}function wl(h,_){var m=h.length;for(h.sort(_);m--;)h[m]=h[m].value;return h}function Kr(h,_){for(var m,b=-1,N=h.length;++b<N;){var H=_(h[b]);H!==r&&(m=m===r?H:m+H)}return m}function jr(h,_){for(var m=-1,b=Array(h);++m<h;)b[m]=_(m);return b}function Sl(h,_){return ne(_,function(m){return[m,h[m]]})}function $s(h){return h&&h.slice(0,Ws(h)+1).replace(Or,"")}function be(h){return function(_){return h(_)}}function Yr(h,_){return ne(_,function(m){return h[m]})}function fn(h,_){return h.has(_)}function Us(h,_){for(var m=-1,b=h.length;++m<b&&kt(_,h[m],0)>-1;);return m}function Ds(h,_){for(var m=h.length;m--&&kt(_,h[m],0)>-1;);return m}function Il(h,_){for(var m=h.length,b=0;m--;)h[m]===_&&++b;return b}var xl=zr(al),El=zr(ol);function Al(h){return"\\"+ll[h]}function bl(h,_){return h==null?r:h[_]}function Gt(h){return nl.test(h)}function Cl(h){return rl.test(h)}function Tl(h){for(var _,m=[];!(_=h.next()).done;)m.push(_.value);return m}function Jr(h){var _=-1,m=Array(h.size);return h.forEach(function(b,N){m[++_]=[N,b]}),m}function Ms(h,_){return function(m){return h(_(m))}}function yt(h,_){for(var m=-1,b=h.length,N=0,H=[];++m<b;){var oe=h[m];(oe===_||oe===Z)&&(h[m]=Z,H[N++]=m)}return H}function Wn(h){var _=-1,m=Array(h.size);return h.forEach(function(b){m[++_]=b}),m}function Rl(h){var _=-1,m=Array(h.size);return h.forEach(function(b){m[++_]=[b,b]}),m}function Fl(h,_,m){for(var b=m-1,N=h.length;++b<N;)if(h[b]===_)return b;return-1}function Pl(h,_,m){for(var b=m+1;b--;)if(h[b]===_)return b;return b}function Vt(h){return Gt(h)?Nl(h):vl(h)}function He(h){return Gt(h)?Ol(h):ml(h)}function Ws(h){for(var _=h.length;_--&&Iu.test(h.charAt(_)););return _}var Ll=zr(ul);function Nl(h){for(var _=Wr.lastIndex=0;Wr.test(h);)++_;return _}function Ol(h){return h.match(Wr)||[]}function $l(h){return h.match(tl)||[]}var Ul=(function h(_){_=_==null?fe:qt.defaults(fe.Object(),_,qt.pick(fe,il));var m=_.Array,b=_.Date,N=_.Error,H=_.Function,oe=_.Math,J=_.Object,Zr=_.RegExp,Dl=_.String,$e=_.TypeError,Bn=m.prototype,Ml=H.prototype,Ht=J.prototype,kn=_["__core-js_shared__"],Gn=Ml.toString,Y=Ht.hasOwnProperty,Wl=0,Bs=(function(){var e=/[^.]+$/.exec(kn&&kn.keys&&kn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})(),Vn=Ht.toString,Bl=Gn.call(J),kl=fe._,Gl=Zr("^"+Gn.call(Y).replace(Nr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),qn=xs?_.Buffer:r,_t=_.Symbol,Hn=_.Uint8Array,ks=qn?qn.allocUnsafe:r,zn=Ms(J.getPrototypeOf,J),Gs=J.create,Vs=Ht.propertyIsEnumerable,Kn=Bn.splice,qs=_t?_t.isConcatSpreadable:r,dn=_t?_t.iterator:r,Rt=_t?_t.toStringTag:r,jn=(function(){try{var e=Ot(J,"defineProperty");return e({},"",{}),e}catch{}})(),Vl=_.clearTimeout!==fe.clearTimeout&&_.clearTimeout,ql=b&&b.now!==fe.Date.now&&b.now,Hl=_.setTimeout!==fe.setTimeout&&_.setTimeout,Yn=oe.ceil,Jn=oe.floor,Xr=J.getOwnPropertySymbols,zl=qn?qn.isBuffer:r,Hs=_.isFinite,Kl=Bn.join,jl=Ms(J.keys,J),ue=oe.max,pe=oe.min,Yl=b.now,Jl=_.parseInt,zs=oe.random,Zl=Bn.reverse,Qr=Ot(_,"DataView"),pn=Ot(_,"Map"),ei=Ot(_,"Promise"),zt=Ot(_,"Set"),hn=Ot(_,"WeakMap"),gn=Ot(J,"create"),Zn=hn&&new hn,Kt={},Xl=$t(Qr),Ql=$t(pn),ec=$t(ei),tc=$t(zt),nc=$t(hn),Xn=_t?_t.prototype:r,vn=Xn?Xn.valueOf:r,Ks=Xn?Xn.toString:r;function o(e){if(ie(e)&&!O(e)&&!(e instanceof k)){if(e instanceof Ue)return e;if(Y.call(e,"__wrapped__"))return ja(e)}return new Ue(e)}var jt=(function(){function e(){}return function(t){if(!re(t))return{};if(Gs)return Gs(t);e.prototype=t;var n=new e;return e.prototype=r,n}})();function Qn(){}function Ue(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}o.templateSettings={escape:vu,evaluate:mu,interpolate:ns,variable:"",imports:{_:o}},o.prototype=Qn.prototype,o.prototype.constructor=o,Ue.prototype=jt(Qn.prototype),Ue.prototype.constructor=Ue;function k(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Ze,this.__views__=[]}function rc(){var e=new k(this.__wrapped__);return e.__actions__=ye(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=ye(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=ye(this.__views__),e}function ic(){if(this.__filtered__){var e=new k(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function sc(){var e=this.__wrapped__.value(),t=this.__dir__,n=O(e),i=t<0,a=n?e.length:0,u=yf(0,a,this.__views__),c=u.start,d=u.end,g=d-c,w=i?d:c-1,S=this.__iteratees__,E=S.length,A=0,C=pe(g,this.__takeCount__);if(!n||!i&&a==g&&C==g)return ma(e,this.__actions__);var R=[];e:for(;g--&&A<C;){w+=t;for(var U=-1,F=e[w];++U<E;){var B=S[U],V=B.iteratee,Re=B.type,me=V(F);if(Re==Qo)F=me;else if(!me){if(Re==Zi)continue e;break e}}R[A++]=F}return R}k.prototype=jt(Qn.prototype),k.prototype.constructor=k;function Ft(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function ac(){this.__data__=gn?gn(null):{},this.size=0}function oc(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function uc(e){var t=this.__data__;if(gn){var n=t[e];return n===D?r:n}return Y.call(t,e)?t[e]:r}function lc(e){var t=this.__data__;return gn?t[e]!==r:Y.call(t,e)}function cc(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=gn&&t===r?D:t,this}Ft.prototype.clear=ac,Ft.prototype.delete=oc,Ft.prototype.get=uc,Ft.prototype.has=lc,Ft.prototype.set=cc;function it(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function fc(){this.__data__=[],this.size=0}function dc(e){var t=this.__data__,n=er(t,e);if(n<0)return!1;var i=t.length-1;return n==i?t.pop():Kn.call(t,n,1),--this.size,!0}function pc(e){var t=this.__data__,n=er(t,e);return n<0?r:t[n][1]}function hc(e){return er(this.__data__,e)>-1}function gc(e,t){var n=this.__data__,i=er(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}it.prototype.clear=fc,it.prototype.delete=dc,it.prototype.get=pc,it.prototype.has=hc,it.prototype.set=gc;function st(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function vc(){this.size=0,this.__data__={hash:new Ft,map:new(pn||it),string:new Ft}}function mc(e){var t=dr(this,e).delete(e);return this.size-=t?1:0,t}function yc(e){return dr(this,e).get(e)}function _c(e){return dr(this,e).has(e)}function wc(e,t){var n=dr(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}st.prototype.clear=vc,st.prototype.delete=mc,st.prototype.get=yc,st.prototype.has=_c,st.prototype.set=wc;function Pt(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new st;++t<n;)this.add(e[t])}function Sc(e){return this.__data__.set(e,D),this}function Ic(e){return this.__data__.has(e)}Pt.prototype.add=Pt.prototype.push=Sc,Pt.prototype.has=Ic;function ze(e){var t=this.__data__=new it(e);this.size=t.size}function xc(){this.__data__=new it,this.size=0}function Ec(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Ac(e){return this.__data__.get(e)}function bc(e){return this.__data__.has(e)}function Cc(e,t){var n=this.__data__;if(n instanceof it){var i=n.__data__;if(!pn||i.length<p-1)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new st(i)}return n.set(e,t),this.size=n.size,this}ze.prototype.clear=xc,ze.prototype.delete=Ec,ze.prototype.get=Ac,ze.prototype.has=bc,ze.prototype.set=Cc;function js(e,t){var n=O(e),i=!n&&Ut(e),a=!n&&!i&&Et(e),u=!n&&!i&&!a&&Xt(e),c=n||i||a||u,d=c?jr(e.length,Dl):[],g=d.length;for(var w in e)(t||Y.call(e,w))&&!(c&&(w=="length"||a&&(w=="offset"||w=="parent")||u&&(w=="buffer"||w=="byteLength"||w=="byteOffset")||lt(w,g)))&&d.push(w);return d}function Ys(e){var t=e.length;return t?e[fi(0,t-1)]:r}function Tc(e,t){return pr(ye(e),Lt(t,0,e.length))}function Rc(e){return pr(ye(e))}function ti(e,t,n){(n!==r&&!Ke(e[t],n)||n===r&&!(t in e))&&at(e,t,n)}function mn(e,t,n){var i=e[t];(!(Y.call(e,t)&&Ke(i,n))||n===r&&!(t in e))&&at(e,t,n)}function er(e,t){for(var n=e.length;n--;)if(Ke(e[n][0],t))return n;return-1}function Fc(e,t,n,i){return wt(e,function(a,u,c){t(i,a,n(a),c)}),i}function Js(e,t){return e&&Qe(t,le(t),e)}function Pc(e,t){return e&&Qe(t,we(t),e)}function at(e,t,n){t=="__proto__"&&jn?jn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ni(e,t){for(var n=-1,i=t.length,a=m(i),u=e==null;++n<i;)a[n]=u?r:Ui(e,t[n]);return a}function Lt(e,t,n){return e===e&&(n!==r&&(e=e<=n?e:n),t!==r&&(e=e>=t?e:t)),e}function De(e,t,n,i,a,u){var c,d=t&K,g=t&Ye,w=t&G;if(n&&(c=a?n(e,i,a,u):n(e)),c!==r)return c;if(!re(e))return e;var S=O(e);if(S){if(c=wf(e),!d)return ye(e,c)}else{var E=he(e),A=E==Ln||E==Xi;if(Et(e))return wa(e,d);if(E==rt||E==Mt||A&&!a){if(c=g||A?{}:Wa(e),!d)return g?lf(e,Pc(c,e)):uf(e,Js(c,e))}else{if(!X[E])return a?e:{};c=Sf(e,E,d)}}u||(u=new ze);var C=u.get(e);if(C)return C;u.set(e,c),go(e)?e.forEach(function(F){c.add(De(F,t,n,F,e,u))}):po(e)&&e.forEach(function(F,B){c.set(B,De(F,t,n,B,e,u))});var R=w?g?Ii:Si:g?we:le,U=S?r:R(e);return Oe(U||e,function(F,B){U&&(B=F,F=e[B]),mn(c,B,De(F,t,n,B,e,u))}),c}function Lc(e){var t=le(e);return function(n){return Zs(n,e,t)}}function Zs(e,t,n){var i=n.length;if(e==null)return!i;for(e=J(e);i--;){var a=n[i],u=t[a],c=e[a];if(c===r&&!(a in e)||!u(c))return!1}return!0}function Xs(e,t,n){if(typeof e!="function")throw new $e(x);return En(function(){e.apply(r,n)},t)}function yn(e,t,n,i){var a=-1,u=Dn,c=!0,d=e.length,g=[],w=t.length;if(!d)return g;n&&(t=ne(t,be(n))),i?(u=Gr,c=!1):t.length>=p&&(u=fn,c=!1,t=new Pt(t));e:for(;++a<d;){var S=e[a],E=n==null?S:n(S);if(S=i||S!==0?S:0,c&&E===E){for(var A=w;A--;)if(t[A]===E)continue e;g.push(S)}else u(t,E,i)||g.push(S)}return g}var wt=Aa(Xe),Qs=Aa(ii,!0);function Nc(e,t){var n=!0;return wt(e,function(i,a,u){return n=!!t(i,a,u),n}),n}function tr(e,t,n){for(var i=-1,a=e.length;++i<a;){var u=e[i],c=t(u);if(c!=null&&(d===r?c===c&&!Te(c):n(c,d)))var d=c,g=u}return g}function Oc(e,t,n,i){var a=e.length;for(n=$(n),n<0&&(n=-n>a?0:a+n),i=i===r||i>a?a:$(i),i<0&&(i+=a),i=n>i?0:mo(i);n<i;)e[n++]=t;return e}function ea(e,t){var n=[];return wt(e,function(i,a,u){t(i,a,u)&&n.push(i)}),n}function de(e,t,n,i,a){var u=-1,c=e.length;for(n||(n=xf),a||(a=[]);++u<c;){var d=e[u];t>0&&n(d)?t>1?de(d,t-1,n,i,a):mt(a,d):i||(a[a.length]=d)}return a}var ri=ba(),ta=ba(!0);function Xe(e,t){return e&&ri(e,t,le)}function ii(e,t){return e&&ta(e,t,le)}function nr(e,t){return vt(t,function(n){return ct(e[n])})}function Nt(e,t){t=It(t,e);for(var n=0,i=t.length;e!=null&&n<i;)e=e[et(t[n++])];return n&&n==i?e:r}function na(e,t,n){var i=t(e);return O(e)?i:mt(i,n(e))}function ge(e){return e==null?e===r?lu:ou:Rt&&Rt in J(e)?mf(e):Ff(e)}function si(e,t){return e>t}function $c(e,t){return e!=null&&Y.call(e,t)}function Uc(e,t){return e!=null&&t in J(e)}function Dc(e,t,n){return e>=pe(t,n)&&e<ue(t,n)}function ai(e,t,n){for(var i=n?Gr:Dn,a=e[0].length,u=e.length,c=u,d=m(u),g=1/0,w=[];c--;){var S=e[c];c&&t&&(S=ne(S,be(t))),g=pe(S.length,g),d[c]=!n&&(t||a>=120&&S.length>=120)?new Pt(c&&S):r}S=e[0];var E=-1,A=d[0];e:for(;++E<a&&w.length<g;){var C=S[E],R=t?t(C):C;if(C=n||C!==0?C:0,!(A?fn(A,R):i(w,R,n))){for(c=u;--c;){var U=d[c];if(!(U?fn(U,R):i(e[c],R,n)))continue e}A&&A.push(R),w.push(C)}}return w}function Mc(e,t,n,i){return Xe(e,function(a,u,c){t(i,n(a),u,c)}),i}function _n(e,t,n){t=It(t,e),e=Va(e,t);var i=e==null?e:e[et(We(t))];return i==null?r:Ae(i,e,n)}function ra(e){return ie(e)&&ge(e)==Mt}function Wc(e){return ie(e)&&ge(e)==cn}function Bc(e){return ie(e)&&ge(e)==sn}function wn(e,t,n,i,a){return e===t?!0:e==null||t==null||!ie(e)&&!ie(t)?e!==e&&t!==t:kc(e,t,n,i,wn,a)}function kc(e,t,n,i,a,u){var c=O(e),d=O(t),g=c?Fn:he(e),w=d?Fn:he(t);g=g==Mt?rt:g,w=w==Mt?rt:w;var S=g==rt,E=w==rt,A=g==w;if(A&&Et(e)){if(!Et(t))return!1;c=!0,S=!1}if(A&&!S)return u||(u=new ze),c||Xt(e)?Ua(e,t,n,i,a,u):gf(e,t,g,n,i,a,u);if(!(n&W)){var C=S&&Y.call(e,"__wrapped__"),R=E&&Y.call(t,"__wrapped__");if(C||R){var U=C?e.value():e,F=R?t.value():t;return u||(u=new ze),a(U,F,n,i,u)}}return A?(u||(u=new ze),vf(e,t,n,i,a,u)):!1}function Gc(e){return ie(e)&&he(e)==Ve}function oi(e,t,n,i){var a=n.length,u=a,c=!i;if(e==null)return!u;for(e=J(e);a--;){var d=n[a];if(c&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}for(;++a<u;){d=n[a];var g=d[0],w=e[g],S=d[1];if(c&&d[2]){if(w===r&&!(g in e))return!1}else{var E=new ze;if(i)var A=i(w,S,g,e,t,E);if(!(A===r?wn(S,w,W|Pe,i,E):A))return!1}}return!0}function ia(e){if(!re(e)||Af(e))return!1;var t=ct(e)?Gl:Lu;return t.test($t(e))}function Vc(e){return ie(e)&&ge(e)==on}function qc(e){return ie(e)&&he(e)==qe}function Hc(e){return ie(e)&&_r(e.length)&&!!ee[ge(e)]}function sa(e){return typeof e=="function"?e:e==null?Se:typeof e=="object"?O(e)?ua(e[0],e[1]):oa(e):To(e)}function ui(e){if(!xn(e))return jl(e);var t=[];for(var n in J(e))Y.call(e,n)&&n!="constructor"&&t.push(n);return t}function zc(e){if(!re(e))return Rf(e);var t=xn(e),n=[];for(var i in e)i=="constructor"&&(t||!Y.call(e,i))||n.push(i);return n}function li(e,t){return e<t}function aa(e,t){var n=-1,i=_e(e)?m(e.length):[];return wt(e,function(a,u,c){i[++n]=t(a,u,c)}),i}function oa(e){var t=Ei(e);return t.length==1&&t[0][2]?ka(t[0][0],t[0][1]):function(n){return n===e||oi(n,e,t)}}function ua(e,t){return bi(e)&&Ba(t)?ka(et(e),t):function(n){var i=Ui(n,e);return i===r&&i===t?Di(n,e):wn(t,i,W|Pe)}}function rr(e,t,n,i,a){e!==t&&ri(t,function(u,c){if(a||(a=new ze),re(u))Kc(e,t,c,n,rr,i,a);else{var d=i?i(Ti(e,c),u,c+"",e,t,a):r;d===r&&(d=u),ti(e,c,d)}},we)}function Kc(e,t,n,i,a,u,c){var d=Ti(e,n),g=Ti(t,n),w=c.get(g);if(w){ti(e,n,w);return}var S=u?u(d,g,n+"",e,t,c):r,E=S===r;if(E){var A=O(g),C=!A&&Et(g),R=!A&&!C&&Xt(g);S=g,A||C||R?O(d)?S=d:se(d)?S=ye(d):C?(E=!1,S=wa(g,!0)):R?(E=!1,S=Sa(g,!0)):S=[]:An(g)||Ut(g)?(S=d,Ut(d)?S=yo(d):(!re(d)||ct(d))&&(S=Wa(g))):E=!1}E&&(c.set(g,S),a(S,g,i,u,c),c.delete(g)),ti(e,n,S)}function la(e,t){var n=e.length;if(n)return t+=t<0?n:0,lt(t,n)?e[t]:r}function ca(e,t,n){t.length?t=ne(t,function(u){return O(u)?function(c){return Nt(c,u.length===1?u[0]:u)}:u}):t=[Se];var i=-1;t=ne(t,be(T()));var a=aa(e,function(u,c,d){var g=ne(t,function(w){return w(u)});return{criteria:g,index:++i,value:u}});return wl(a,function(u,c){return of(u,c,n)})}function jc(e,t){return fa(e,t,function(n,i){return Di(e,i)})}function fa(e,t,n){for(var i=-1,a=t.length,u={};++i<a;){var c=t[i],d=Nt(e,c);n(d,c)&&Sn(u,It(c,e),d)}return u}function Yc(e){return function(t){return Nt(t,e)}}function ci(e,t,n,i){var a=i?_l:kt,u=-1,c=t.length,d=e;for(e===t&&(t=ye(t)),n&&(d=ne(e,be(n)));++u<c;)for(var g=0,w=t[u],S=n?n(w):w;(g=a(d,S,g,i))>-1;)d!==e&&Kn.call(d,g,1),Kn.call(e,g,1);return e}function da(e,t){for(var n=e?t.length:0,i=n-1;n--;){var a=t[n];if(n==i||a!==u){var u=a;lt(a)?Kn.call(e,a,1):hi(e,a)}}return e}function fi(e,t){return e+Jn(zs()*(t-e+1))}function Jc(e,t,n,i){for(var a=-1,u=ue(Yn((t-e)/(n||1)),0),c=m(u);u--;)c[i?u:++a]=e,e+=n;return c}function di(e,t){var n="";if(!e||t<1||t>gt)return n;do t%2&&(n+=e),t=Jn(t/2),t&&(e+=e);while(t);return n}function M(e,t){return Ri(Ga(e,t,Se),e+"")}function Zc(e){return Ys(Qt(e))}function Xc(e,t){var n=Qt(e);return pr(n,Lt(t,0,n.length))}function Sn(e,t,n,i){if(!re(e))return e;t=It(t,e);for(var a=-1,u=t.length,c=u-1,d=e;d!=null&&++a<u;){var g=et(t[a]),w=n;if(g==="__proto__"||g==="constructor"||g==="prototype")return e;if(a!=c){var S=d[g];w=i?i(S,g,d):r,w===r&&(w=re(S)?S:lt(t[a+1])?[]:{})}mn(d,g,w),d=d[g]}return e}var pa=Zn?function(e,t){return Zn.set(e,t),e}:Se,Qc=jn?function(e,t){return jn(e,"toString",{configurable:!0,enumerable:!1,value:Wi(t),writable:!0})}:Se;function ef(e){return pr(Qt(e))}function Me(e,t,n){var i=-1,a=e.length;t<0&&(t=-t>a?0:a+t),n=n>a?a:n,n<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var u=m(a);++i<a;)u[i]=e[i+t];return u}function tf(e,t){var n;return wt(e,function(i,a,u){return n=t(i,a,u),!n}),!!n}function ir(e,t,n){var i=0,a=e==null?i:e.length;if(typeof t=="number"&&t===t&&a<=ru){for(;i<a;){var u=i+a>>>1,c=e[u];c!==null&&!Te(c)&&(n?c<=t:c<t)?i=u+1:a=u}return a}return pi(e,t,Se,n)}function pi(e,t,n,i){var a=0,u=e==null?0:e.length;if(u===0)return 0;t=n(t);for(var c=t!==t,d=t===null,g=Te(t),w=t===r;a<u;){var S=Jn((a+u)/2),E=n(e[S]),A=E!==r,C=E===null,R=E===E,U=Te(E);if(c)var F=i||R;else w?F=R&&(i||A):d?F=R&&A&&(i||!C):g?F=R&&A&&!C&&(i||!U):C||U?F=!1:F=i?E<=t:E<t;F?a=S+1:u=S}return pe(u,nu)}function ha(e,t){for(var n=-1,i=e.length,a=0,u=[];++n<i;){var c=e[n],d=t?t(c):c;if(!n||!Ke(d,g)){var g=d;u[a++]=c===0?0:c}}return u}function ga(e){return typeof e=="number"?e:Te(e)?Rn:+e}function Ce(e){if(typeof e=="string")return e;if(O(e))return ne(e,Ce)+"";if(Te(e))return Ks?Ks.call(e):"";var t=e+"";return t=="0"&&1/e==-Ct?"-0":t}function St(e,t,n){var i=-1,a=Dn,u=e.length,c=!0,d=[],g=d;if(n)c=!1,a=Gr;else if(u>=p){var w=t?null:pf(e);if(w)return Wn(w);c=!1,a=fn,g=new Pt}else g=t?[]:d;e:for(;++i<u;){var S=e[i],E=t?t(S):S;if(S=n||S!==0?S:0,c&&E===E){for(var A=g.length;A--;)if(g[A]===E)continue e;t&&g.push(E),d.push(S)}else a(g,E,n)||(g!==d&&g.push(E),d.push(S))}return d}function hi(e,t){return t=It(t,e),e=Va(e,t),e==null||delete e[et(We(t))]}function va(e,t,n,i){return Sn(e,t,n(Nt(e,t)),i)}function sr(e,t,n,i){for(var a=e.length,u=i?a:-1;(i?u--:++u<a)&&t(e[u],u,e););return n?Me(e,i?0:u,i?u+1:a):Me(e,i?u+1:0,i?a:u)}function ma(e,t){var n=e;return n instanceof k&&(n=n.value()),Vr(t,function(i,a){return a.func.apply(a.thisArg,mt([i],a.args))},n)}function gi(e,t,n){var i=e.length;if(i<2)return i?St(e[0]):[];for(var a=-1,u=m(i);++a<i;)for(var c=e[a],d=-1;++d<i;)d!=a&&(u[a]=yn(u[a]||c,e[d],t,n));return St(de(u,1),t,n)}function ya(e,t,n){for(var i=-1,a=e.length,u=t.length,c={};++i<a;){var d=i<u?t[i]:r;n(c,e[i],d)}return c}function vi(e){return se(e)?e:[]}function mi(e){return typeof e=="function"?e:Se}function It(e,t){return O(e)?e:bi(e,t)?[e]:Ka(j(e))}var nf=M;function xt(e,t,n){var i=e.length;return n=n===r?i:n,!t&&n>=i?e:Me(e,t,n)}var _a=Vl||function(e){return fe.clearTimeout(e)};function wa(e,t){if(t)return e.slice();var n=e.length,i=ks?ks(n):new e.constructor(n);return e.copy(i),i}function yi(e){var t=new e.constructor(e.byteLength);return new Hn(t).set(new Hn(e)),t}function rf(e,t){var n=t?yi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function sf(e){var t=new e.constructor(e.source,rs.exec(e));return t.lastIndex=e.lastIndex,t}function af(e){return vn?J(vn.call(e)):{}}function Sa(e,t){var n=t?yi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ia(e,t){if(e!==t){var n=e!==r,i=e===null,a=e===e,u=Te(e),c=t!==r,d=t===null,g=t===t,w=Te(t);if(!d&&!w&&!u&&e>t||u&&c&&g&&!d&&!w||i&&c&&g||!n&&g||!a)return 1;if(!i&&!u&&!w&&e<t||w&&n&&a&&!i&&!u||d&&n&&a||!c&&a||!g)return-1}return 0}function of(e,t,n){for(var i=-1,a=e.criteria,u=t.criteria,c=a.length,d=n.length;++i<c;){var g=Ia(a[i],u[i]);if(g){if(i>=d)return g;var w=n[i];return g*(w=="desc"?-1:1)}}return e.index-t.index}function xa(e,t,n,i){for(var a=-1,u=e.length,c=n.length,d=-1,g=t.length,w=ue(u-c,0),S=m(g+w),E=!i;++d<g;)S[d]=t[d];for(;++a<c;)(E||a<u)&&(S[n[a]]=e[a]);for(;w--;)S[d++]=e[a++];return S}function Ea(e,t,n,i){for(var a=-1,u=e.length,c=-1,d=n.length,g=-1,w=t.length,S=ue(u-d,0),E=m(S+w),A=!i;++a<S;)E[a]=e[a];for(var C=a;++g<w;)E[C+g]=t[g];for(;++c<d;)(A||a<u)&&(E[C+n[c]]=e[a++]);return E}function ye(e,t){var n=-1,i=e.length;for(t||(t=m(i));++n<i;)t[n]=e[n];return t}function Qe(e,t,n,i){var a=!n;n||(n={});for(var u=-1,c=t.length;++u<c;){var d=t[u],g=i?i(n[d],e[d],d,n,e):r;g===r&&(g=e[d]),a?at(n,d,g):mn(n,d,g)}return n}function uf(e,t){return Qe(e,Ai(e),t)}function lf(e,t){return Qe(e,Da(e),t)}function ar(e,t){return function(n,i){var a=O(n)?pl:Fc,u=t?t():{};return a(n,e,T(i,2),u)}}function Yt(e){return M(function(t,n){var i=-1,a=n.length,u=a>1?n[a-1]:r,c=a>2?n[2]:r;for(u=e.length>3&&typeof u=="function"?(a--,u):r,c&&ve(n[0],n[1],c)&&(u=a<3?r:u,a=1),t=J(t);++i<a;){var d=n[i];d&&e(t,d,i,u)}return t})}function Aa(e,t){return function(n,i){if(n==null)return n;if(!_e(n))return e(n,i);for(var a=n.length,u=t?a:-1,c=J(n);(t?u--:++u<a)&&i(c[u],u,c)!==!1;);return n}}function ba(e){return function(t,n,i){for(var a=-1,u=J(t),c=i(t),d=c.length;d--;){var g=c[e?d:++a];if(n(u[g],g,u)===!1)break}return t}}function cf(e,t,n){var i=t&Ie,a=In(e);function u(){var c=this&&this!==fe&&this instanceof u?a:e;return c.apply(i?n:this,arguments)}return u}function Ca(e){return function(t){t=j(t);var n=Gt(t)?He(t):r,i=n?n[0]:t.charAt(0),a=n?xt(n,1).join(""):t.slice(1);return i[e]()+a}}function Jt(e){return function(t){return Vr(bo(Ao(t).replace(Qu,"")),e,"")}}function In(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=jt(e.prototype),i=e.apply(n,t);return re(i)?i:n}}function ff(e,t,n){var i=In(e);function a(){for(var u=arguments.length,c=m(u),d=u,g=Zt(a);d--;)c[d]=arguments[d];var w=u<3&&c[0]!==g&&c[u-1]!==g?[]:yt(c,g);if(u-=w.length,u<n)return La(e,t,or,a.placeholder,r,c,w,r,r,n-u);var S=this&&this!==fe&&this instanceof a?i:e;return Ae(S,this,c)}return a}function Ta(e){return function(t,n,i){var a=J(t);if(!_e(t)){var u=T(n,3);t=le(t),n=function(d){return u(a[d],d,a)}}var c=e(t,n,i);return c>-1?a[u?t[c]:c]:r}}function Ra(e){return ut(function(t){var n=t.length,i=n,a=Ue.prototype.thru;for(e&&t.reverse();i--;){var u=t[i];if(typeof u!="function")throw new $e(x);if(a&&!c&&fr(u)=="wrapper")var c=new Ue([],!0)}for(i=c?i:n;++i<n;){u=t[i];var d=fr(u),g=d=="wrapper"?xi(u):r;g&&Ci(g[0])&&g[1]==(nt|Le|xe|nn)&&!g[4].length&&g[9]==1?c=c[fr(g[0])].apply(c,g[3]):c=u.length==1&&Ci(u)?c[d]():c.thru(u)}return function(){var w=arguments,S=w[0];if(c&&w.length==1&&O(S))return c.plant(S).value();for(var E=0,A=n?t[E].apply(this,w):S;++E<n;)A=t[E].call(this,A);return A}})}function or(e,t,n,i,a,u,c,d,g,w){var S=t&nt,E=t&Ie,A=t&Je,C=t&(Le|bt),R=t&xr,U=A?r:In(e);function F(){for(var B=arguments.length,V=m(B),Re=B;Re--;)V[Re]=arguments[Re];if(C)var me=Zt(F),Fe=Il(V,me);if(i&&(V=xa(V,i,a,C)),u&&(V=Ea(V,u,c,C)),B-=Fe,C&&B<w){var ae=yt(V,me);return La(e,t,or,F.placeholder,n,V,ae,d,g,w-B)}var je=E?n:this,dt=A?je[e]:e;return B=V.length,d?V=Pf(V,d):R&&B>1&&V.reverse(),S&&g<B&&(V.length=g),this&&this!==fe&&this instanceof F&&(dt=U||In(dt)),dt.apply(je,V)}return F}function Fa(e,t){return function(n,i){return Mc(n,e,t(i),{})}}function ur(e,t){return function(n,i){var a;if(n===r&&i===r)return t;if(n!==r&&(a=n),i!==r){if(a===r)return i;typeof n=="string"||typeof i=="string"?(n=Ce(n),i=Ce(i)):(n=ga(n),i=ga(i)),a=e(n,i)}return a}}function _i(e){return ut(function(t){return t=ne(t,be(T())),M(function(n){var i=this;return e(t,function(a){return Ae(a,i,n)})})})}function lr(e,t){t=t===r?" ":Ce(t);var n=t.length;if(n<2)return n?di(t,e):t;var i=di(t,Yn(e/Vt(t)));return Gt(t)?xt(He(i),0,e).join(""):i.slice(0,e)}function df(e,t,n,i){var a=t&Ie,u=In(e);function c(){for(var d=-1,g=arguments.length,w=-1,S=i.length,E=m(S+g),A=this&&this!==fe&&this instanceof c?u:e;++w<S;)E[w]=i[w];for(;g--;)E[w++]=arguments[++d];return Ae(A,a?n:this,E)}return c}function Pa(e){return function(t,n,i){return i&&typeof i!="number"&&ve(t,n,i)&&(n=i=r),t=ft(t),n===r?(n=t,t=0):n=ft(n),i=i===r?t<n?1:-1:ft(i),Jc(t,n,i,e)}}function cr(e){return function(t,n){return typeof t=="string"&&typeof n=="string"||(t=Be(t),n=Be(n)),e(t,n)}}function La(e,t,n,i,a,u,c,d,g,w){var S=t&Le,E=S?c:r,A=S?r:c,C=S?u:r,R=S?r:u;t|=S?xe:Ee,t&=~(S?Ee:xe),t&Tn||(t&=-4);var U=[e,t,a,C,E,R,A,d,g,w],F=n.apply(r,U);return Ci(e)&&qa(F,U),F.placeholder=i,Ha(F,e,t)}function wi(e){var t=oe[e];return function(n,i){if(n=Be(n),i=i==null?0:pe($(i),292),i&&Hs(n)){var a=(j(n)+"e").split("e"),u=t(a[0]+"e"+(+a[1]+i));return a=(j(u)+"e").split("e"),+(a[0]+"e"+(+a[1]-i))}return t(n)}}var pf=zt&&1/Wn(new zt([,-0]))[1]==Ct?function(e){return new zt(e)}:Gi;function Na(e){return function(t){var n=he(t);return n==Ve?Jr(t):n==qe?Rl(t):Sl(t,e(t))}}function ot(e,t,n,i,a,u,c,d){var g=t&Je;if(!g&&typeof e!="function")throw new $e(x);var w=i?i.length:0;if(w||(t&=-97,i=a=r),c=c===r?c:ue($(c),0),d=d===r?d:$(d),w-=a?a.length:0,t&Ee){var S=i,E=a;i=a=r}var A=g?r:xi(e),C=[e,t,n,i,a,S,E,u,c,d];if(A&&Tf(C,A),e=C[0],t=C[1],n=C[2],i=C[3],a=C[4],d=C[9]=C[9]===r?g?0:e.length:ue(C[9]-w,0),!d&&t&(Le|bt)&&(t&=-25),!t||t==Ie)var R=cf(e,t,n);else t==Le||t==bt?R=ff(e,t,d):(t==xe||t==(Ie|xe))&&!a.length?R=df(e,t,n,i):R=or.apply(r,C);var U=A?pa:qa;return Ha(U(R,C),e,t)}function Oa(e,t,n,i){return e===r||Ke(e,Ht[n])&&!Y.call(i,n)?t:e}function $a(e,t,n,i,a,u){return re(e)&&re(t)&&(u.set(t,e),rr(e,t,r,$a,u),u.delete(t)),e}function hf(e){return An(e)?r:e}function Ua(e,t,n,i,a,u){var c=n&W,d=e.length,g=t.length;if(d!=g&&!(c&&g>d))return!1;var w=u.get(e),S=u.get(t);if(w&&S)return w==t&&S==e;var E=-1,A=!0,C=n&Pe?new Pt:r;for(u.set(e,t),u.set(t,e);++E<d;){var R=e[E],U=t[E];if(i)var F=c?i(U,R,E,t,e,u):i(R,U,E,e,t,u);if(F!==r){if(F)continue;A=!1;break}if(C){if(!qr(t,function(B,V){if(!fn(C,V)&&(R===B||a(R,B,n,i,u)))return C.push(V)})){A=!1;break}}else if(!(R===U||a(R,U,n,i,u))){A=!1;break}}return u.delete(e),u.delete(t),A}function gf(e,t,n,i,a,u,c){switch(n){case Wt:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case cn:return!(e.byteLength!=t.byteLength||!u(new Hn(e),new Hn(t)));case rn:case sn:case an:return Ke(+e,+t);case Pn:return e.name==t.name&&e.message==t.message;case on:case un:return e==t+"";case Ve:var d=Jr;case qe:var g=i&W;if(d||(d=Wn),e.size!=t.size&&!g)return!1;var w=c.get(e);if(w)return w==t;i|=Pe,c.set(e,t);var S=Ua(d(e),d(t),i,a,u,c);return c.delete(e),S;case Nn:if(vn)return vn.call(e)==vn.call(t)}return!1}function vf(e,t,n,i,a,u){var c=n&W,d=Si(e),g=d.length,w=Si(t),S=w.length;if(g!=S&&!c)return!1;for(var E=g;E--;){var A=d[E];if(!(c?A in t:Y.call(t,A)))return!1}var C=u.get(e),R=u.get(t);if(C&&R)return C==t&&R==e;var U=!0;u.set(e,t),u.set(t,e);for(var F=c;++E<g;){A=d[E];var B=e[A],V=t[A];if(i)var Re=c?i(V,B,A,t,e,u):i(B,V,A,e,t,u);if(!(Re===r?B===V||a(B,V,n,i,u):Re)){U=!1;break}F||(F=A=="constructor")}if(U&&!F){var me=e.constructor,Fe=t.constructor;me!=Fe&&"constructor"in e&&"constructor"in t&&!(typeof me=="function"&&me instanceof me&&typeof Fe=="function"&&Fe instanceof Fe)&&(U=!1)}return u.delete(e),u.delete(t),U}function ut(e){return Ri(Ga(e,r,Za),e+"")}function Si(e){return na(e,le,Ai)}function Ii(e){return na(e,we,Da)}var xi=Zn?function(e){return Zn.get(e)}:Gi;function fr(e){for(var t=e.name+"",n=Kt[t],i=Y.call(Kt,t)?n.length:0;i--;){var a=n[i],u=a.func;if(u==null||u==e)return a.name}return t}function Zt(e){var t=Y.call(o,"placeholder")?o:e;return t.placeholder}function T(){var e=o.iteratee||Bi;return e=e===Bi?sa:e,arguments.length?e(arguments[0],arguments[1]):e}function dr(e,t){var n=e.__data__;return Ef(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ei(e){for(var t=le(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,Ba(a)]}return t}function Ot(e,t){var n=bl(e,t);return ia(n)?n:r}function mf(e){var t=Y.call(e,Rt),n=e[Rt];try{e[Rt]=r;var i=!0}catch{}var a=Vn.call(e);return i&&(t?e[Rt]=n:delete e[Rt]),a}var Ai=Xr?function(e){return e==null?[]:(e=J(e),vt(Xr(e),function(t){return Vs.call(e,t)}))}:Vi,Da=Xr?function(e){for(var t=[];e;)mt(t,Ai(e)),e=zn(e);return t}:Vi,he=ge;(Qr&&he(new Qr(new ArrayBuffer(1)))!=Wt||pn&&he(new pn)!=Ve||ei&&he(ei.resolve())!=Qi||zt&&he(new zt)!=qe||hn&&he(new hn)!=ln)&&(he=function(e){var t=ge(e),n=t==rt?e.constructor:r,i=n?$t(n):"";if(i)switch(i){case Xl:return Wt;case Ql:return Ve;case ec:return Qi;case tc:return qe;case nc:return ln}return t});function yf(e,t,n){for(var i=-1,a=n.length;++i<a;){var u=n[i],c=u.size;switch(u.type){case"drop":e+=c;break;case"dropRight":t-=c;break;case"take":t=pe(t,e+c);break;case"takeRight":e=ue(e,t-c);break}}return{start:e,end:t}}function _f(e){var t=e.match(Eu);return t?t[1].split(Au):[]}function Ma(e,t,n){t=It(t,e);for(var i=-1,a=t.length,u=!1;++i<a;){var c=et(t[i]);if(!(u=e!=null&&n(e,c)))break;e=e[c]}return u||++i!=a?u:(a=e==null?0:e.length,!!a&&_r(a)&&lt(c,a)&&(O(e)||Ut(e)))}function wf(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&Y.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function Wa(e){return typeof e.constructor=="function"&&!xn(e)?jt(zn(e)):{}}function Sf(e,t,n){var i=e.constructor;switch(t){case cn:return yi(e);case rn:case sn:return new i(+e);case Wt:return rf(e,n);case Er:case Ar:case br:case Cr:case Tr:case Rr:case Fr:case Pr:case Lr:return Sa(e,n);case Ve:return new i;case an:case un:return new i(e);case on:return sf(e);case qe:return new i;case Nn:return af(e)}}function If(e,t){var n=t.length;if(!n)return e;var i=n-1;return t[i]=(n>1?"& ":"")+t[i],t=t.join(n>2?", ":" "),e.replace(xu,`{
10
3
  /* [wrapped with `+t+`] */
11
- `)}function Sf(e){return O(e)||Nt(e)||!!(qs&&e&&e[qs])}function ut(e,t){var n=typeof e;return t=t??pt,!!t&&(n=="number"||n!="symbol"&&Lu.test(e))&&e>-1&&e%1==0&&e<t}function ve(e,t,n){if(!ne(n))return!1;var r=typeof t;return(r=="number"?_e(n)&&ut(t,n.length):r=="string"&&t in n)?Ve(n[t],e):!1}function bi(e,t){if(O(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Ce(e)?!0:mu.test(e)||!vu.test(e)||t!=null&&e in Z(t)}function xf(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Ti(e){var t=fr(e),n=o[t];if(typeof n!="function"||!(t in B.prototype))return!1;if(e===n)return!0;var r=Ii(n);return!!r&&e===r[0]}function If(e){return!!Ms&&Ms in e}var Ef=kn?lt:Hi;function In(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||zt;return e===n}function Ma(e){return e===e&&!ne(e)}function Ba(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==i||e in Z(n))}}function Af(e){var t=mr(e,function(r){return n.size===te&&n.clear(),r}),n=t.cache;return t}function bf(e,t){var n=e[1],r=t[1],s=n|r,u=s<(xe|je|tt),c=r==tt&&n==Le||r==tt&&n==nn&&e[7].length<=t[8]||r==(tt|nn)&&t[7].length<=t[8]&&n==Le;if(!(u||c))return e;r&xe&&(e[2]=t[2],s|=n&xe?0:Cn);var h=t[3];if(h){var g=e[3];e[3]=g?xa(g,h,t[4]):h,e[4]=g?mt(e[3],X):t[4]}return h=t[5],h&&(g=e[5],e[5]=g?Ia(g,h,t[6]):h,e[6]=g?mt(e[5],X):t[6]),h=t[7],h&&(e[7]=h),r&tt&&(e[8]=e[8]==null?t[8]:he(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=s,e}function Tf(e){var t=[];if(e!=null)for(var n in Z(e))t.push(n);return t}function Cf(e){return qn.call(e)}function ka(e,t,n){return t=ue(t===i?e.length-1:t,0),function(){for(var r=arguments,s=-1,u=ue(r.length-t,0),c=m(u);++s<u;)c[s]=r[t+s];s=-1;for(var h=m(t+1);++s<t;)h[s]=r[s];return h[t]=n(c),Ae(e,this,h)}}function Ga(e,t){return t.length<2?e:Lt(e,We(t,0,-1))}function Ff(e,t){for(var n=e.length,r=he(t.length,n),s=ye(e);r--;){var u=t[r];e[r]=ut(u,n)?s[u]:i}return e}function Ci(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var qa=za(ha),En=ql||function(e,t){return ce.setTimeout(e,t)},Fi=za(Jc);function Ha(e,t,n){var r=t+"";return Fi(e,wf(r,Rf(mf(r),n)))}function za(e){var t=0,n=0;return function(){var r=Vl(),s=jo-(r-n);if(n=r,s>0){if(++t>=Zo)return arguments[0]}else t=0;return e.apply(i,arguments)}}function dr(e,t){var n=-1,r=e.length,s=r-1;for(t=t===i?r:t;++n<t;){var u=fi(n,s),c=e[u];e[u]=e[n],e[n]=c}return e.length=t,e}var Ka=Af(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(yu,function(n,r,s,u){t.push(s?u.replace(bu,"$1"):r||n)}),t});function et(e){if(typeof e=="string"||Ce(e))return e;var t=e+"";return t=="0"&&1/e==-bt?"-0":t}function Ut(e){if(e!=null){try{return Gn.call(e)}catch{}try{return e+""}catch{}}return""}function Rf(e,t){return Ue(nu,function(n){var r="_."+n[0];t&n[1]&&!$n(e,r)&&e.push(r)}),e.sort()}function Va(e){if(e instanceof B)return e.clone();var t=new De(e.__wrapped__,e.__chain__);return t.__actions__=ye(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function Pf(e,t,n){(n?ve(e,t,n):t===i)?t=1:t=ue(U(t),0);var r=e==null?0:e.length;if(!r||t<1)return[];for(var s=0,u=0,c=m(Zn(r/t));s<r;)c[u++]=We(e,s,s+=t);return c}function Lf(e){for(var t=-1,n=e==null?0:e.length,r=0,s=[];++t<n;){var u=e[t];u&&(s[r++]=u)}return s}function Of(){var e=arguments.length;if(!e)return[];for(var t=m(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return vt(O(n)?ye(n):[n],fe(t,1))}var Uf=$(function(e,t){return se(e)?yn(e,fe(t,1,se,!0)):[]}),Nf=$(function(e,t){var n=Me(t);return se(n)&&(n=i),se(e)?yn(e,fe(t,1,se,!0),C(n,2)):[]}),Df=$(function(e,t){var n=Me(t);return se(n)&&(n=i),se(e)?yn(e,fe(t,1,se,!0),i,n):[]});function $f(e,t,n){var r=e==null?0:e.length;return r?(t=n||t===i?1:U(t),We(e,t<0?0:t,r)):[]}function Wf(e,t,n){var r=e==null?0:e.length;return r?(t=n||t===i?1:U(t),t=r-t,We(e,0,t<0?0:t)):[]}function Mf(e,t){return e&&e.length?sr(e,C(t,3),!0,!0):[]}function Bf(e,t){return e&&e.length?sr(e,C(t,3),!0):[]}function kf(e,t,n,r){var s=e==null?0:e.length;return s?(n&&typeof n!="number"&&ve(e,t,n)&&(n=0,r=s),Lc(e,t,n,r)):[]}function Ya(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=n==null?0:U(n);return s<0&&(s=ue(r+s,0)),Wn(e,C(t,3),s)}function Za(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=r-1;return n!==i&&(s=U(n),s=n<0?ue(r+s,0):he(s,r-1)),Wn(e,C(t,3),s,!0)}function ja(e){var t=e==null?0:e.length;return t?fe(e,1):[]}function Gf(e){var t=e==null?0:e.length;return t?fe(e,bt):[]}function qf(e,t){var n=e==null?0:e.length;return n?(t=t===i?1:U(t),fe(e,t)):[]}function Hf(e){for(var t=-1,n=e==null?0:e.length,r={};++t<n;){var s=e[t];r[s[0]]=s[1]}return r}function Ja(e){return e&&e.length?e[0]:i}function zf(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=n==null?0:U(n);return s<0&&(s=ue(r+s,0)),kt(e,t,s)}function Kf(e){var t=e==null?0:e.length;return t?We(e,0,-1):[]}var Vf=$(function(e){var t=Q(e,vi);return t.length&&t[0]===e[0]?ai(t):[]}),Yf=$(function(e){var t=Me(e),n=Q(e,vi);return t===Me(n)?t=i:n.pop(),n.length&&n[0]===e[0]?ai(n,C(t,2)):[]}),Zf=$(function(e){var t=Me(e),n=Q(e,vi);return t=typeof t=="function"?t:i,t&&n.pop(),n.length&&n[0]===e[0]?ai(n,i,t):[]});function jf(e,t){return e==null?"":zl.call(e,t)}function Me(e){var t=e==null?0:e.length;return t?e[t-1]:i}function Jf(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=r;return n!==i&&(s=U(n),s=s<0?ue(r+s,0):he(s,r-1)),t===t?Fl(e,t,s):Wn(e,Ps,s,!0)}function Xf(e,t){return e&&e.length?ua(e,U(t)):i}var Qf=$(Xa);function Xa(e,t){return e&&e.length&&t&&t.length?ci(e,t):e}function eh(e,t,n){return e&&e.length&&t&&t.length?ci(e,t,C(n,2)):e}function th(e,t,n){return e&&e.length&&t&&t.length?ci(e,t,i,n):e}var nh=ot(function(e,t){var n=e==null?0:e.length,r=ni(e,t);return fa(e,Q(t,function(s){return ut(s,n)?+s:s}).sort(Sa)),r});function rh(e,t){var n=[];if(!(e&&e.length))return n;var r=-1,s=[],u=e.length;for(t=C(t,3);++r<u;){var c=e[r];t(c,r,e)&&(n.push(c),s.push(r))}return fa(e,s),n}function Ri(e){return e==null?e:Zl.call(e)}function ih(e,t,n){var r=e==null?0:e.length;return r?(n&&typeof n!="number"&&ve(e,t,n)?(t=0,n=r):(t=t==null?0:U(t),n=n===i?r:U(n)),We(e,t,n)):[]}function sh(e,t){return ir(e,t)}function ah(e,t,n){return di(e,t,C(n,2))}function oh(e,t){var n=e==null?0:e.length;if(n){var r=ir(e,t);if(r<n&&Ve(e[r],t))return r}return-1}function uh(e,t){return ir(e,t,!0)}function lh(e,t,n){return di(e,t,C(n,2),!0)}function ch(e,t){var n=e==null?0:e.length;if(n){var r=ir(e,t,!0)-1;if(Ve(e[r],t))return r}return-1}function fh(e){return e&&e.length?da(e):[]}function hh(e,t){return e&&e.length?da(e,C(t,2)):[]}function dh(e){var t=e==null?0:e.length;return t?We(e,1,t):[]}function ph(e,t,n){return e&&e.length?(t=n||t===i?1:U(t),We(e,0,t<0?0:t)):[]}function gh(e,t,n){var r=e==null?0:e.length;return r?(t=n||t===i?1:U(t),t=r-t,We(e,t<0?0:t,r)):[]}function vh(e,t){return e&&e.length?sr(e,C(t,3),!1,!0):[]}function mh(e,t){return e&&e.length?sr(e,C(t,3)):[]}var yh=$(function(e){return wt(fe(e,1,se,!0))}),_h=$(function(e){var t=Me(e);return se(t)&&(t=i),wt(fe(e,1,se,!0),C(t,2))}),wh=$(function(e){var t=Me(e);return t=typeof t=="function"?t:i,wt(fe(e,1,se,!0),i,t)});function Sh(e){return e&&e.length?wt(e):[]}function xh(e,t){return e&&e.length?wt(e,C(t,2)):[]}function Ih(e,t){return t=typeof t=="function"?t:i,e&&e.length?wt(e,i,t):[]}function Pi(e){if(!(e&&e.length))return[];var t=0;return e=gt(e,function(n){if(se(n))return t=ue(n.length,t),!0}),Yr(t,function(n){return Q(e,zr(n))})}function Qa(e,t){if(!(e&&e.length))return[];var n=Pi(e);return t==null?n:Q(n,function(r){return Ae(t,i,r)})}var Eh=$(function(e,t){return se(e)?yn(e,t):[]}),Ah=$(function(e){return gi(gt(e,se))}),bh=$(function(e){var t=Me(e);return se(t)&&(t=i),gi(gt(e,se),C(t,2))}),Th=$(function(e){var t=Me(e);return t=typeof t=="function"?t:i,gi(gt(e,se),i,t)}),Ch=$(Pi);function Fh(e,t){return ma(e||[],t||[],mn)}function Rh(e,t){return ma(e||[],t||[],Sn)}var Ph=$(function(e){var t=e.length,n=t>1?e[t-1]:i;return n=typeof n=="function"?(e.pop(),n):i,Qa(e,n)});function eo(e){var t=o(e);return t.__chain__=!0,t}function Lh(e,t){return t(e),e}function pr(e,t){return t(e)}var Oh=ot(function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,s=function(u){return ni(u,e)};return t>1||this.__actions__.length||!(r instanceof B)||!ut(n)?this.thru(s):(r=r.slice(n,+n+(t?1:0)),r.__actions__.push({func:pr,args:[s],thisArg:i}),new De(r,this.__chain__).thru(function(u){return t&&!u.length&&u.push(i),u}))});function Uh(){return eo(this)}function Nh(){return new De(this.value(),this.__chain__)}function Dh(){this.__values__===i&&(this.__values__=go(this.value()));var e=this.__index__>=this.__values__.length,t=e?i:this.__values__[this.__index__++];return{done:e,value:t}}function $h(){return this}function Wh(e){for(var t,n=this;n instanceof Qn;){var r=Va(n);r.__index__=0,r.__values__=i,t?s.__wrapped__=r:t=r;var s=r;n=n.__wrapped__}return s.__wrapped__=e,t}function Mh(){var e=this.__wrapped__;if(e instanceof B){var t=e;return this.__actions__.length&&(t=new B(this)),t=t.reverse(),t.__actions__.push({func:pr,args:[Ri],thisArg:i}),new De(t,this.__chain__)}return this.thru(Ri)}function Bh(){return va(this.__wrapped__,this.__actions__)}var kh=ar(function(e,t,n){Y.call(e,n)?++e[n]:st(e,n,1)});function Gh(e,t,n){var r=O(e)?Fs:Pc;return n&&ve(e,t,n)&&(t=i),r(e,C(t,3))}function qh(e,t){var n=O(e)?gt:Qs;return n(e,C(t,3))}var Hh=Ta(Ya),zh=Ta(Za);function Kh(e,t){return fe(gr(e,t),1)}function Vh(e,t){return fe(gr(e,t),bt)}function Yh(e,t,n){return n=n===i?1:U(n),fe(gr(e,t),n)}function to(e,t){var n=O(e)?Ue:_t;return n(e,C(t,3))}function no(e,t){var n=O(e)?hl:Xs;return n(e,C(t,3))}var Zh=ar(function(e,t,n){Y.call(e,n)?e[n].push(t):st(e,n,[t])});function jh(e,t,n,r){e=_e(e)?e:Qt(e),n=n&&!r?U(n):0;var s=e.length;return n<0&&(n=ue(s+n,0)),wr(e)?n<=s&&e.indexOf(t,n)>-1:!!s&&kt(e,t,n)>-1}var Jh=$(function(e,t,n){var r=-1,s=typeof t=="function",u=_e(e)?m(e.length):[];return _t(e,function(c){u[++r]=s?Ae(t,c,n):_n(c,t,n)}),u}),Xh=ar(function(e,t,n){st(e,n,t)});function gr(e,t){var n=O(e)?Q:sa;return n(e,C(t,3))}function Qh(e,t,n,r){return e==null?[]:(O(t)||(t=t==null?[]:[t]),n=r?i:n,O(n)||(n=n==null?[]:[n]),la(e,t,n))}var ed=ar(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function td(e,t,n){var r=O(e)?qr:Os,s=arguments.length<3;return r(e,C(t,4),n,s,_t)}function nd(e,t,n){var r=O(e)?dl:Os,s=arguments.length<3;return r(e,C(t,4),n,s,Xs)}function rd(e,t){var n=O(e)?gt:Qs;return n(e,yr(C(t,3)))}function id(e){var t=O(e)?Ys:Zc;return t(e)}function sd(e,t,n){(n?ve(e,t,n):t===i)?t=1:t=U(t);var r=O(e)?bc:jc;return r(e,t)}function ad(e){var t=O(e)?Tc:Xc;return t(e)}function od(e){if(e==null)return 0;if(_e(e))return wr(e)?qt(e):e.length;var t=de(e);return t==qe||t==He?e.size:ui(e).length}function ud(e,t,n){var r=O(e)?Hr:Qc;return n&&ve(e,t,n)&&(t=i),r(e,C(t,3))}var ld=$(function(e,t){if(e==null)return[];var n=t.length;return n>1&&ve(e,t[0],t[1])?t=[]:n>2&&ve(t[0],t[1],t[2])&&(t=[t[0]]),la(e,fe(t,1),[])}),vr=Gl||function(){return ce.Date.now()};function cd(e,t){if(typeof t!="function")throw new Ne(I);return e=U(e),function(){if(--e<1)return t.apply(this,arguments)}}function ro(e,t,n){return t=n?i:t,t=e&&t==null?e.length:t,at(e,tt,i,i,i,i,t)}function io(e,t){var n;if(typeof t!="function")throw new Ne(I);return e=U(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Li=$(function(e,t,n){var r=xe;if(n.length){var s=mt(n,Jt(Li));r|=Ie}return at(e,r,t,n,s)}),so=$(function(e,t,n){var r=xe|je;if(n.length){var s=mt(n,Jt(so));r|=Ie}return at(t,r,e,n,s)});function ao(e,t,n){t=n?i:t;var r=at(e,Le,i,i,i,i,i,t);return r.placeholder=ao.placeholder,r}function oo(e,t,n){t=n?i:t;var r=at(e,At,i,i,i,i,i,t);return r.placeholder=oo.placeholder,r}function uo(e,t,n){var r,s,u,c,h,g,w=0,S=!1,x=!1,A=!0;if(typeof e!="function")throw new Ne(I);t=Be(t)||0,ne(n)&&(S=!!n.leading,x="maxWait"in n,u=x?ue(Be(n.maxWait)||0,t):u,A="trailing"in n?!!n.trailing:A);function T(ae){var Ye=r,ft=s;return r=s=i,w=ae,c=e.apply(ft,Ye),c}function F(ae){return w=ae,h=En(M,t),S?T(ae):c}function D(ae){var Ye=ae-g,ft=ae-w,Co=t-Ye;return x?he(Co,u-ft):Co}function R(ae){var Ye=ae-g,ft=ae-w;return g===i||Ye>=t||Ye<0||x&&ft>=u}function M(){var ae=vr();if(R(ae))return G(ae);h=En(M,D(ae))}function G(ae){return h=i,A&&r?T(ae):(r=s=i,c)}function Fe(){h!==i&&ya(h),w=0,r=g=s=h=i}function me(){return h===i?c:G(vr())}function Re(){var ae=vr(),Ye=R(ae);if(r=arguments,s=this,g=ae,Ye){if(h===i)return F(g);if(x)return ya(h),h=En(M,t),T(g)}return h===i&&(h=En(M,t)),c}return Re.cancel=Fe,Re.flush=me,Re}var fd=$(function(e,t){return Js(e,1,t)}),hd=$(function(e,t,n){return Js(e,Be(t)||0,n)});function dd(e){return at(e,Ir)}function mr(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new Ne(I);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],u=n.cache;if(u.has(s))return u.get(s);var c=e.apply(this,r);return n.cache=u.set(s,c)||u,c};return n.cache=new(mr.Cache||it),n}mr.Cache=it;function yr(e){if(typeof e!="function")throw new Ne(I);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function pd(e){return io(2,e)}var gd=ef(function(e,t){t=t.length==1&&O(t[0])?Q(t[0],be(C())):Q(fe(t,1),be(C()));var n=t.length;return $(function(r){for(var s=-1,u=he(r.length,n);++s<u;)r[s]=t[s].call(this,r[s]);return Ae(e,this,r)})}),Oi=$(function(e,t){var n=mt(t,Jt(Oi));return at(e,Ie,i,t,n)}),lo=$(function(e,t){var n=mt(t,Jt(lo));return at(e,Ee,i,t,n)}),vd=ot(function(e,t){return at(e,nn,i,i,i,t)});function md(e,t){if(typeof e!="function")throw new Ne(I);return t=t===i?t:U(t),$(e,t)}function yd(e,t){if(typeof e!="function")throw new Ne(I);return t=t==null?0:ue(U(t),0),$(function(n){var r=n[t],s=xt(n,0,t);return r&&vt(s,r),Ae(e,this,s)})}function _d(e,t,n){var r=!0,s=!0;if(typeof e!="function")throw new Ne(I);return ne(n)&&(r="leading"in n?!!n.leading:r,s="trailing"in n?!!n.trailing:s),uo(e,t,{leading:r,maxWait:t,trailing:s})}function wd(e){return ro(e,1)}function Sd(e,t){return Oi(mi(t),e)}function xd(){if(!arguments.length)return[];var e=arguments[0];return O(e)?e:[e]}function Id(e){return $e(e,k)}function Ed(e,t){return t=typeof t=="function"?t:i,$e(e,k,t)}function Ad(e){return $e(e,K|k)}function bd(e,t){return t=typeof t=="function"?t:i,$e(e,K|k,t)}function Td(e,t){return t==null||js(e,t,le(t))}function Ve(e,t){return e===t||e!==e&&t!==t}var Cd=cr(si),Fd=cr(function(e,t){return e>=t}),Nt=na(function(){return arguments}())?na:function(e){return ie(e)&&Y.call(e,"callee")&&!Gs.call(e,"callee")},O=m.isArray,Rd=Is?be(Is):$c;function _e(e){return e!=null&&_r(e.length)&&!lt(e)}function se(e){return ie(e)&&_e(e)}function Pd(e){return e===!0||e===!1||ie(e)&&ge(e)==rn}var It=Hl||Hi,Ld=Es?be(Es):Wc;function Od(e){return ie(e)&&e.nodeType===1&&!An(e)}function Ud(e){if(e==null)return!0;if(_e(e)&&(O(e)||typeof e=="string"||typeof e.splice=="function"||It(e)||Xt(e)||Nt(e)))return!e.length;var t=de(e);if(t==qe||t==He)return!e.size;if(In(e))return!ui(e).length;for(var n in e)if(Y.call(e,n))return!1;return!0}function Nd(e,t){return wn(e,t)}function Dd(e,t,n){n=typeof n=="function"?n:i;var r=n?n(e,t):i;return r===i?wn(e,t,i,n):!!r}function Ui(e){if(!ie(e))return!1;var t=ge(e);return t==Pn||t==iu||typeof e.message=="string"&&typeof e.name=="string"&&!An(e)}function $d(e){return typeof e=="number"&&Hs(e)}function lt(e){if(!ne(e))return!1;var t=ge(e);return t==Ln||t==Ji||t==ru||t==au}function co(e){return typeof e=="number"&&e==U(e)}function _r(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=pt}function ne(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function ie(e){return e!=null&&typeof e=="object"}var fo=As?be(As):Bc;function Wd(e,t){return e===t||oi(e,t,Ei(t))}function Md(e,t,n){return n=typeof n=="function"?n:i,oi(e,t,Ei(t),n)}function Bd(e){return ho(e)&&e!=+e}function kd(e){if(Ef(e))throw new L(E);return ra(e)}function Gd(e){return e===null}function qd(e){return e==null}function ho(e){return typeof e=="number"||ie(e)&&ge(e)==an}function An(e){if(!ie(e)||ge(e)!=nt)return!1;var t=Kn(e);if(t===null)return!0;var n=Y.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Gn.call(n)==Wl}var Ni=bs?be(bs):kc;function Hd(e){return co(e)&&e>=-pt&&e<=pt}var po=Ts?be(Ts):Gc;function wr(e){return typeof e=="string"||!O(e)&&ie(e)&&ge(e)==un}function Ce(e){return typeof e=="symbol"||ie(e)&&ge(e)==On}var Xt=Cs?be(Cs):qc;function zd(e){return e===i}function Kd(e){return ie(e)&&de(e)==ln}function Vd(e){return ie(e)&&ge(e)==uu}var Yd=cr(li),Zd=cr(function(e,t){return e<=t});function go(e){if(!e)return[];if(_e(e))return wr(e)?ze(e):ye(e);if(hn&&e[hn])return bl(e[hn]());var t=de(e),n=t==qe?jr:t==He?Mn:Qt;return n(e)}function ct(e){if(!e)return e===0?e:0;if(e=Be(e),e===bt||e===-bt){var t=e<0?-1:1;return t*Qo}return e===e?e:0}function U(e){var t=ct(e),n=t%1;return t===t?n?t-n:t:0}function vo(e){return e?Pt(U(e),0,Je):0}function Be(e){if(typeof e=="number")return e;if(Ce(e))return Fn;if(ne(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ne(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Us(e);var n=Fu.test(e);return n||Pu.test(e)?ll(e.slice(2),n?2:8):Cu.test(e)?Fn:+e}function mo(e){return Qe(e,we(e))}function jd(e){return e?Pt(U(e),-pt,pt):e===0?e:0}function V(e){return e==null?"":Te(e)}var Jd=Zt(function(e,t){if(In(t)||_e(t)){Qe(t,le(t),e);return}for(var n in t)Y.call(t,n)&&mn(e,n,t[n])}),yo=Zt(function(e,t){Qe(t,we(t),e)}),Sr=Zt(function(e,t,n,r){Qe(t,we(t),e,r)}),Xd=Zt(function(e,t,n,r){Qe(t,le(t),e,r)}),Qd=ot(ni);function ep(e,t){var n=Yt(e);return t==null?n:Zs(n,t)}var tp=$(function(e,t){e=Z(e);var n=-1,r=t.length,s=r>2?t[2]:i;for(s&&ve(t[0],t[1],s)&&(r=1);++n<r;)for(var u=t[n],c=we(u),h=-1,g=c.length;++h<g;){var w=c[h],S=e[w];(S===i||Ve(S,zt[w])&&!Y.call(e,w))&&(e[w]=u[w])}return e}),np=$(function(e){return e.push(i,Ua),Ae(_o,i,e)});function rp(e,t){return Rs(e,C(t,3),Xe)}function ip(e,t){return Rs(e,C(t,3),ii)}function sp(e,t){return e==null?e:ri(e,C(t,3),we)}function ap(e,t){return e==null?e:ea(e,C(t,3),we)}function op(e,t){return e&&Xe(e,C(t,3))}function up(e,t){return e&&ii(e,C(t,3))}function lp(e){return e==null?[]:nr(e,le(e))}function cp(e){return e==null?[]:nr(e,we(e))}function Di(e,t,n){var r=e==null?i:Lt(e,t);return r===i?n:r}function fp(e,t){return e!=null&&$a(e,t,Oc)}function $i(e,t){return e!=null&&$a(e,t,Uc)}var hp=Fa(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=qn.call(t)),e[t]=n},Mi(Se)),dp=Fa(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=qn.call(t)),Y.call(e,t)?e[t].push(n):e[t]=[n]},C),pp=$(_n);function le(e){return _e(e)?Vs(e):ui(e)}function we(e){return _e(e)?Vs(e,!0):Hc(e)}function gp(e,t){var n={};return t=C(t,3),Xe(e,function(r,s,u){st(n,t(r,s,u),r)}),n}function vp(e,t){var n={};return t=C(t,3),Xe(e,function(r,s,u){st(n,s,t(r,s,u))}),n}var mp=Zt(function(e,t,n){rr(e,t,n)}),_o=Zt(function(e,t,n,r){rr(e,t,n,r)}),yp=ot(function(e,t){var n={};if(e==null)return n;var r=!1;t=Q(t,function(u){return u=St(u,e),r||(r=u.length>1),u}),Qe(e,xi(e),n),r&&(n=$e(n,K|Ze|k,hf));for(var s=t.length;s--;)pi(n,t[s]);return n});function _p(e,t){return wo(e,yr(C(t)))}var wp=ot(function(e,t){return e==null?{}:Kc(e,t)});function wo(e,t){if(e==null)return{};var n=Q(xi(e),function(r){return[r]});return t=C(t),ca(e,n,function(r,s){return t(r,s[0])})}function Sp(e,t,n){t=St(t,e);var r=-1,s=t.length;for(s||(s=1,e=i);++r<s;){var u=e==null?i:e[et(t[r])];u===i&&(r=s,u=n),e=lt(u)?u.call(e):u}return e}function xp(e,t,n){return e==null?e:Sn(e,t,n)}function Ip(e,t,n,r){return r=typeof r=="function"?r:i,e==null?e:Sn(e,t,n,r)}var So=La(le),xo=La(we);function Ep(e,t,n){var r=O(e),s=r||It(e)||Xt(e);if(t=C(t,4),n==null){var u=e&&e.constructor;s?n=r?new u:[]:ne(e)?n=lt(u)?Yt(Kn(e)):{}:n={}}return(s?Ue:Xe)(e,function(c,h,g){return t(n,c,h,g)}),n}function Ap(e,t){return e==null?!0:pi(e,t)}function bp(e,t,n){return e==null?e:ga(e,t,mi(n))}function Tp(e,t,n,r){return r=typeof r=="function"?r:i,e==null?e:ga(e,t,mi(n),r)}function Qt(e){return e==null?[]:Zr(e,le(e))}function Cp(e){return e==null?[]:Zr(e,we(e))}function Fp(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=Be(n),n=n===n?n:0),t!==i&&(t=Be(t),t=t===t?t:0),Pt(Be(e),t,n)}function Rp(e,t,n){return t=ct(t),n===i?(n=t,t=0):n=ct(n),e=Be(e),Nc(e,t,n)}function Pp(e,t,n){if(n&&typeof n!="boolean"&&ve(e,t,n)&&(t=n=i),n===i&&(typeof t=="boolean"?(n=t,t=i):typeof e=="boolean"&&(n=e,e=i)),e===i&&t===i?(e=0,t=1):(e=ct(e),t===i?(t=e,e=0):t=ct(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var s=zs();return he(e+s*(t-e+ul("1e-"+((s+"").length-1))),t)}return fi(e,t)}var Lp=jt(function(e,t,n){return t=t.toLowerCase(),e+(n?Io(t):t)});function Io(e){return Wi(V(e).toLowerCase())}function Eo(e){return e=V(e),e&&e.replace(Ou,Sl).replace(Xu,"")}function Op(e,t,n){e=V(e),t=Te(t);var r=e.length;n=n===i?r:Pt(U(n),0,r);var s=n;return n-=t.length,n>=0&&e.slice(n,s)==t}function Up(e){return e=V(e),e&&du.test(e)?e.replace(es,xl):e}function Np(e){return e=V(e),e&&_u.test(e)?e.replace(Or,"\\$&"):e}var Dp=jt(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),$p=jt(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Wp=ba("toLowerCase");function Mp(e,t,n){e=V(e),t=U(t);var r=t?qt(e):0;if(!t||r>=t)return e;var s=(t-r)/2;return lr(jn(s),n)+e+lr(Zn(s),n)}function Bp(e,t,n){e=V(e),t=U(t);var r=t?qt(e):0;return t&&r<t?e+lr(t-r,n):e}function kp(e,t,n){e=V(e),t=U(t);var r=t?qt(e):0;return t&&r<t?lr(t-r,n)+e:e}function Gp(e,t,n){return n||t==null?t=0:t&&(t=+t),Yl(V(e).replace(Ur,""),t||0)}function qp(e,t,n){return(n?ve(e,t,n):t===i)?t=1:t=U(t),hi(V(e),t)}function Hp(){var e=arguments,t=V(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var zp=jt(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});function Kp(e,t,n){return n&&typeof n!="number"&&ve(e,t,n)&&(t=n=i),n=n===i?Je:n>>>0,n?(e=V(e),e&&(typeof t=="string"||t!=null&&!Ni(t))&&(t=Te(t),!t&&Gt(e))?xt(ze(e),0,n):e.split(t,n)):[]}var Vp=jt(function(e,t,n){return e+(n?" ":"")+Wi(t)});function Yp(e,t,n){return e=V(e),n=n==null?0:Pt(U(n),0,e.length),t=Te(t),e.slice(n,n+t.length)==t}function Zp(e,t,n){var r=o.templateSettings;n&&ve(e,t,n)&&(t=i),e=V(e),t=Sr({},t,r,Oa);var s=Sr({},t.imports,r.imports,Oa),u=le(s),c=Zr(s,u),h,g,w=0,S=t.interpolate||Un,x="__p += '",A=Jr((t.escape||Un).source+"|"+S.source+"|"+(S===ts?Tu:Un).source+"|"+(t.evaluate||Un).source+"|$","g"),T="//# sourceURL="+(Y.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++rl+"]")+`
12
- `;e.replace(A,function(R,M,G,Fe,me,Re){return G||(G=Fe),x+=e.slice(w,Re).replace(Uu,Il),M&&(h=!0,x+=`' +
13
- __e(`+M+`) +
14
- '`),me&&(g=!0,x+=`';
4
+ `)}function xf(e){return O(e)||Ut(e)||!!(qs&&e&&e[qs])}function lt(e,t){var n=typeof e;return t=t??gt,!!t&&(n=="number"||n!="symbol"&&Ou.test(e))&&e>-1&&e%1==0&&e<t}function ve(e,t,n){if(!re(n))return!1;var i=typeof t;return(i=="number"?_e(n)&&lt(t,n.length):i=="string"&&t in n)?Ke(n[t],e):!1}function bi(e,t){if(O(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Te(e)?!0:_u.test(e)||!yu.test(e)||t!=null&&e in J(t)}function Ef(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Ci(e){var t=fr(e),n=o[t];if(typeof n!="function"||!(t in k.prototype))return!1;if(e===n)return!0;var i=xi(n);return!!i&&e===i[0]}function Af(e){return!!Bs&&Bs in e}var bf=kn?ct:qi;function xn(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Ht;return e===n}function Ba(e){return e===e&&!re(e)}function ka(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==r||e in J(n))}}function Cf(e){var t=mr(e,function(i){return n.size===z&&n.clear(),i}),n=t.cache;return t}function Tf(e,t){var n=e[1],i=t[1],a=n|i,u=a<(Ie|Je|nt),c=i==nt&&n==Le||i==nt&&n==nn&&e[7].length<=t[8]||i==(nt|nn)&&t[7].length<=t[8]&&n==Le;if(!(u||c))return e;i&Ie&&(e[2]=t[2],a|=n&Ie?0:Tn);var d=t[3];if(d){var g=e[3];e[3]=g?xa(g,d,t[4]):d,e[4]=g?yt(e[3],Z):t[4]}return d=t[5],d&&(g=e[5],e[5]=g?Ea(g,d,t[6]):d,e[6]=g?yt(e[5],Z):t[6]),d=t[7],d&&(e[7]=d),i&nt&&(e[8]=e[8]==null?t[8]:pe(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=a,e}function Rf(e){var t=[];if(e!=null)for(var n in J(e))t.push(n);return t}function Ff(e){return Vn.call(e)}function Ga(e,t,n){return t=ue(t===r?e.length-1:t,0),function(){for(var i=arguments,a=-1,u=ue(i.length-t,0),c=m(u);++a<u;)c[a]=i[t+a];a=-1;for(var d=m(t+1);++a<t;)d[a]=i[a];return d[t]=n(c),Ae(e,this,d)}}function Va(e,t){return t.length<2?e:Nt(e,Me(t,0,-1))}function Pf(e,t){for(var n=e.length,i=pe(t.length,n),a=ye(e);i--;){var u=t[i];e[i]=lt(u,n)?a[u]:r}return e}function Ti(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var qa=za(pa),En=Hl||function(e,t){return fe.setTimeout(e,t)},Ri=za(Qc);function Ha(e,t,n){var i=t+"";return Ri(e,If(i,Lf(_f(i),n)))}function za(e){var t=0,n=0;return function(){var i=Yl(),a=Xo-(i-n);if(n=i,a>0){if(++t>=Zo)return arguments[0]}else t=0;return e.apply(r,arguments)}}function pr(e,t){var n=-1,i=e.length,a=i-1;for(t=t===r?i:t;++n<t;){var u=fi(n,a),c=e[u];e[u]=e[n],e[n]=c}return e.length=t,e}var Ka=Cf(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(wu,function(n,i,a,u){t.push(a?u.replace(Tu,"$1"):i||n)}),t});function et(e){if(typeof e=="string"||Te(e))return e;var t=e+"";return t=="0"&&1/e==-Ct?"-0":t}function $t(e){if(e!=null){try{return Gn.call(e)}catch{}try{return e+""}catch{}}return""}function Lf(e,t){return Oe(iu,function(n){var i="_."+n[0];t&n[1]&&!Dn(e,i)&&e.push(i)}),e.sort()}function ja(e){if(e instanceof k)return e.clone();var t=new Ue(e.__wrapped__,e.__chain__);return t.__actions__=ye(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function Nf(e,t,n){(n?ve(e,t,n):t===r)?t=1:t=ue($(t),0);var i=e==null?0:e.length;if(!i||t<1)return[];for(var a=0,u=0,c=m(Yn(i/t));a<i;)c[u++]=Me(e,a,a+=t);return c}function Of(e){for(var t=-1,n=e==null?0:e.length,i=0,a=[];++t<n;){var u=e[t];u&&(a[i++]=u)}return a}function $f(){var e=arguments.length;if(!e)return[];for(var t=m(e-1),n=arguments[0],i=e;i--;)t[i-1]=arguments[i];return mt(O(n)?ye(n):[n],de(t,1))}var Uf=M(function(e,t){return se(e)?yn(e,de(t,1,se,!0)):[]}),Df=M(function(e,t){var n=We(t);return se(n)&&(n=r),se(e)?yn(e,de(t,1,se,!0),T(n,2)):[]}),Mf=M(function(e,t){var n=We(t);return se(n)&&(n=r),se(e)?yn(e,de(t,1,se,!0),r,n):[]});function Wf(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:$(t),Me(e,t<0?0:t,i)):[]}function Bf(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:$(t),t=i-t,Me(e,0,t<0?0:t)):[]}function kf(e,t){return e&&e.length?sr(e,T(t,3),!0,!0):[]}function Gf(e,t){return e&&e.length?sr(e,T(t,3),!0):[]}function Vf(e,t,n,i){var a=e==null?0:e.length;return a?(n&&typeof n!="number"&&ve(e,t,n)&&(n=0,i=a),Oc(e,t,n,i)):[]}function Ya(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=n==null?0:$(n);return a<0&&(a=ue(i+a,0)),Mn(e,T(t,3),a)}function Ja(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=i-1;return n!==r&&(a=$(n),a=n<0?ue(i+a,0):pe(a,i-1)),Mn(e,T(t,3),a,!0)}function Za(e){var t=e==null?0:e.length;return t?de(e,1):[]}function qf(e){var t=e==null?0:e.length;return t?de(e,Ct):[]}function Hf(e,t){var n=e==null?0:e.length;return n?(t=t===r?1:$(t),de(e,t)):[]}function zf(e){for(var t=-1,n=e==null?0:e.length,i={};++t<n;){var a=e[t];i[a[0]]=a[1]}return i}function Xa(e){return e&&e.length?e[0]:r}function Kf(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=n==null?0:$(n);return a<0&&(a=ue(i+a,0)),kt(e,t,a)}function jf(e){var t=e==null?0:e.length;return t?Me(e,0,-1):[]}var Yf=M(function(e){var t=ne(e,vi);return t.length&&t[0]===e[0]?ai(t):[]}),Jf=M(function(e){var t=We(e),n=ne(e,vi);return t===We(n)?t=r:n.pop(),n.length&&n[0]===e[0]?ai(n,T(t,2)):[]}),Zf=M(function(e){var t=We(e),n=ne(e,vi);return t=typeof t=="function"?t:r,t&&n.pop(),n.length&&n[0]===e[0]?ai(n,r,t):[]});function Xf(e,t){return e==null?"":Kl.call(e,t)}function We(e){var t=e==null?0:e.length;return t?e[t-1]:r}function Qf(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=i;return n!==r&&(a=$(n),a=a<0?ue(i+a,0):pe(a,i-1)),t===t?Pl(e,t,a):Mn(e,Ls,a,!0)}function ed(e,t){return e&&e.length?la(e,$(t)):r}var td=M(Qa);function Qa(e,t){return e&&e.length&&t&&t.length?ci(e,t):e}function nd(e,t,n){return e&&e.length&&t&&t.length?ci(e,t,T(n,2)):e}function rd(e,t,n){return e&&e.length&&t&&t.length?ci(e,t,r,n):e}var id=ut(function(e,t){var n=e==null?0:e.length,i=ni(e,t);return da(e,ne(t,function(a){return lt(a,n)?+a:a}).sort(Ia)),i});function sd(e,t){var n=[];if(!(e&&e.length))return n;var i=-1,a=[],u=e.length;for(t=T(t,3);++i<u;){var c=e[i];t(c,i,e)&&(n.push(c),a.push(i))}return da(e,a),n}function Fi(e){return e==null?e:Zl.call(e)}function ad(e,t,n){var i=e==null?0:e.length;return i?(n&&typeof n!="number"&&ve(e,t,n)?(t=0,n=i):(t=t==null?0:$(t),n=n===r?i:$(n)),Me(e,t,n)):[]}function od(e,t){return ir(e,t)}function ud(e,t,n){return pi(e,t,T(n,2))}function ld(e,t){var n=e==null?0:e.length;if(n){var i=ir(e,t);if(i<n&&Ke(e[i],t))return i}return-1}function cd(e,t){return ir(e,t,!0)}function fd(e,t,n){return pi(e,t,T(n,2),!0)}function dd(e,t){var n=e==null?0:e.length;if(n){var i=ir(e,t,!0)-1;if(Ke(e[i],t))return i}return-1}function pd(e){return e&&e.length?ha(e):[]}function hd(e,t){return e&&e.length?ha(e,T(t,2)):[]}function gd(e){var t=e==null?0:e.length;return t?Me(e,1,t):[]}function vd(e,t,n){return e&&e.length?(t=n||t===r?1:$(t),Me(e,0,t<0?0:t)):[]}function md(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:$(t),t=i-t,Me(e,t<0?0:t,i)):[]}function yd(e,t){return e&&e.length?sr(e,T(t,3),!1,!0):[]}function _d(e,t){return e&&e.length?sr(e,T(t,3)):[]}var wd=M(function(e){return St(de(e,1,se,!0))}),Sd=M(function(e){var t=We(e);return se(t)&&(t=r),St(de(e,1,se,!0),T(t,2))}),Id=M(function(e){var t=We(e);return t=typeof t=="function"?t:r,St(de(e,1,se,!0),r,t)});function xd(e){return e&&e.length?St(e):[]}function Ed(e,t){return e&&e.length?St(e,T(t,2)):[]}function Ad(e,t){return t=typeof t=="function"?t:r,e&&e.length?St(e,r,t):[]}function Pi(e){if(!(e&&e.length))return[];var t=0;return e=vt(e,function(n){if(se(n))return t=ue(n.length,t),!0}),jr(t,function(n){return ne(e,Hr(n))})}function eo(e,t){if(!(e&&e.length))return[];var n=Pi(e);return t==null?n:ne(n,function(i){return Ae(t,r,i)})}var bd=M(function(e,t){return se(e)?yn(e,t):[]}),Cd=M(function(e){return gi(vt(e,se))}),Td=M(function(e){var t=We(e);return se(t)&&(t=r),gi(vt(e,se),T(t,2))}),Rd=M(function(e){var t=We(e);return t=typeof t=="function"?t:r,gi(vt(e,se),r,t)}),Fd=M(Pi);function Pd(e,t){return ya(e||[],t||[],mn)}function Ld(e,t){return ya(e||[],t||[],Sn)}var Nd=M(function(e){var t=e.length,n=t>1?e[t-1]:r;return n=typeof n=="function"?(e.pop(),n):r,eo(e,n)});function to(e){var t=o(e);return t.__chain__=!0,t}function Od(e,t){return t(e),e}function hr(e,t){return t(e)}var $d=ut(function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,a=function(u){return ni(u,e)};return t>1||this.__actions__.length||!(i instanceof k)||!lt(n)?this.thru(a):(i=i.slice(n,+n+(t?1:0)),i.__actions__.push({func:hr,args:[a],thisArg:r}),new Ue(i,this.__chain__).thru(function(u){return t&&!u.length&&u.push(r),u}))});function Ud(){return to(this)}function Dd(){return new Ue(this.value(),this.__chain__)}function Md(){this.__values__===r&&(this.__values__=vo(this.value()));var e=this.__index__>=this.__values__.length,t=e?r:this.__values__[this.__index__++];return{done:e,value:t}}function Wd(){return this}function Bd(e){for(var t,n=this;n instanceof Qn;){var i=ja(n);i.__index__=0,i.__values__=r,t?a.__wrapped__=i:t=i;var a=i;n=n.__wrapped__}return a.__wrapped__=e,t}function kd(){var e=this.__wrapped__;if(e instanceof k){var t=e;return this.__actions__.length&&(t=new k(this)),t=t.reverse(),t.__actions__.push({func:hr,args:[Fi],thisArg:r}),new Ue(t,this.__chain__)}return this.thru(Fi)}function Gd(){return ma(this.__wrapped__,this.__actions__)}var Vd=ar(function(e,t,n){Y.call(e,n)?++e[n]:at(e,n,1)});function qd(e,t,n){var i=O(e)?Fs:Nc;return n&&ve(e,t,n)&&(t=r),i(e,T(t,3))}function Hd(e,t){var n=O(e)?vt:ea;return n(e,T(t,3))}var zd=Ta(Ya),Kd=Ta(Ja);function jd(e,t){return de(gr(e,t),1)}function Yd(e,t){return de(gr(e,t),Ct)}function Jd(e,t,n){return n=n===r?1:$(n),de(gr(e,t),n)}function no(e,t){var n=O(e)?Oe:wt;return n(e,T(t,3))}function ro(e,t){var n=O(e)?hl:Qs;return n(e,T(t,3))}var Zd=ar(function(e,t,n){Y.call(e,n)?e[n].push(t):at(e,n,[t])});function Xd(e,t,n,i){e=_e(e)?e:Qt(e),n=n&&!i?$(n):0;var a=e.length;return n<0&&(n=ue(a+n,0)),wr(e)?n<=a&&e.indexOf(t,n)>-1:!!a&&kt(e,t,n)>-1}var Qd=M(function(e,t,n){var i=-1,a=typeof t=="function",u=_e(e)?m(e.length):[];return wt(e,function(c){u[++i]=a?Ae(t,c,n):_n(c,t,n)}),u}),ep=ar(function(e,t,n){at(e,n,t)});function gr(e,t){var n=O(e)?ne:aa;return n(e,T(t,3))}function tp(e,t,n,i){return e==null?[]:(O(t)||(t=t==null?[]:[t]),n=i?r:n,O(n)||(n=n==null?[]:[n]),ca(e,t,n))}var np=ar(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function rp(e,t,n){var i=O(e)?Vr:Os,a=arguments.length<3;return i(e,T(t,4),n,a,wt)}function ip(e,t,n){var i=O(e)?gl:Os,a=arguments.length<3;return i(e,T(t,4),n,a,Qs)}function sp(e,t){var n=O(e)?vt:ea;return n(e,yr(T(t,3)))}function ap(e){var t=O(e)?Ys:Zc;return t(e)}function op(e,t,n){(n?ve(e,t,n):t===r)?t=1:t=$(t);var i=O(e)?Tc:Xc;return i(e,t)}function up(e){var t=O(e)?Rc:ef;return t(e)}function lp(e){if(e==null)return 0;if(_e(e))return wr(e)?Vt(e):e.length;var t=he(e);return t==Ve||t==qe?e.size:ui(e).length}function cp(e,t,n){var i=O(e)?qr:tf;return n&&ve(e,t,n)&&(t=r),i(e,T(t,3))}var fp=M(function(e,t){if(e==null)return[];var n=t.length;return n>1&&ve(e,t[0],t[1])?t=[]:n>2&&ve(t[0],t[1],t[2])&&(t=[t[0]]),ca(e,de(t,1),[])}),vr=ql||function(){return fe.Date.now()};function dp(e,t){if(typeof t!="function")throw new $e(x);return e=$(e),function(){if(--e<1)return t.apply(this,arguments)}}function io(e,t,n){return t=n?r:t,t=e&&t==null?e.length:t,ot(e,nt,r,r,r,r,t)}function so(e,t){var n;if(typeof t!="function")throw new $e(x);return e=$(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=r),n}}var Li=M(function(e,t,n){var i=Ie;if(n.length){var a=yt(n,Zt(Li));i|=xe}return ot(e,i,t,n,a)}),ao=M(function(e,t,n){var i=Ie|Je;if(n.length){var a=yt(n,Zt(ao));i|=xe}return ot(t,i,e,n,a)});function oo(e,t,n){t=n?r:t;var i=ot(e,Le,r,r,r,r,r,t);return i.placeholder=oo.placeholder,i}function uo(e,t,n){t=n?r:t;var i=ot(e,bt,r,r,r,r,r,t);return i.placeholder=uo.placeholder,i}function lo(e,t,n){var i,a,u,c,d,g,w=0,S=!1,E=!1,A=!0;if(typeof e!="function")throw new $e(x);t=Be(t)||0,re(n)&&(S=!!n.leading,E="maxWait"in n,u=E?ue(Be(n.maxWait)||0,t):u,A="trailing"in n?!!n.trailing:A);function C(ae){var je=i,dt=a;return i=a=r,w=ae,c=e.apply(dt,je),c}function R(ae){return w=ae,d=En(B,t),S?C(ae):c}function U(ae){var je=ae-g,dt=ae-w,Ro=t-je;return E?pe(Ro,u-dt):Ro}function F(ae){var je=ae-g,dt=ae-w;return g===r||je>=t||je<0||E&&dt>=u}function B(){var ae=vr();if(F(ae))return V(ae);d=En(B,U(ae))}function V(ae){return d=r,A&&i?C(ae):(i=a=r,c)}function Re(){d!==r&&_a(d),w=0,i=g=a=d=r}function me(){return d===r?c:V(vr())}function Fe(){var ae=vr(),je=F(ae);if(i=arguments,a=this,g=ae,je){if(d===r)return R(g);if(E)return _a(d),d=En(B,t),C(g)}return d===r&&(d=En(B,t)),c}return Fe.cancel=Re,Fe.flush=me,Fe}var pp=M(function(e,t){return Xs(e,1,t)}),hp=M(function(e,t,n){return Xs(e,Be(t)||0,n)});function gp(e){return ot(e,xr)}function mr(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new $e(x);var n=function(){var i=arguments,a=t?t.apply(this,i):i[0],u=n.cache;if(u.has(a))return u.get(a);var c=e.apply(this,i);return n.cache=u.set(a,c)||u,c};return n.cache=new(mr.Cache||st),n}mr.Cache=st;function yr(e){if(typeof e!="function")throw new $e(x);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function vp(e){return so(2,e)}var mp=nf(function(e,t){t=t.length==1&&O(t[0])?ne(t[0],be(T())):ne(de(t,1),be(T()));var n=t.length;return M(function(i){for(var a=-1,u=pe(i.length,n);++a<u;)i[a]=t[a].call(this,i[a]);return Ae(e,this,i)})}),Ni=M(function(e,t){var n=yt(t,Zt(Ni));return ot(e,xe,r,t,n)}),co=M(function(e,t){var n=yt(t,Zt(co));return ot(e,Ee,r,t,n)}),yp=ut(function(e,t){return ot(e,nn,r,r,r,t)});function _p(e,t){if(typeof e!="function")throw new $e(x);return t=t===r?t:$(t),M(e,t)}function wp(e,t){if(typeof e!="function")throw new $e(x);return t=t==null?0:ue($(t),0),M(function(n){var i=n[t],a=xt(n,0,t);return i&&mt(a,i),Ae(e,this,a)})}function Sp(e,t,n){var i=!0,a=!0;if(typeof e!="function")throw new $e(x);return re(n)&&(i="leading"in n?!!n.leading:i,a="trailing"in n?!!n.trailing:a),lo(e,t,{leading:i,maxWait:t,trailing:a})}function Ip(e){return io(e,1)}function xp(e,t){return Ni(mi(t),e)}function Ep(){if(!arguments.length)return[];var e=arguments[0];return O(e)?e:[e]}function Ap(e){return De(e,G)}function bp(e,t){return t=typeof t=="function"?t:r,De(e,G,t)}function Cp(e){return De(e,K|G)}function Tp(e,t){return t=typeof t=="function"?t:r,De(e,K|G,t)}function Rp(e,t){return t==null||Zs(e,t,le(t))}function Ke(e,t){return e===t||e!==e&&t!==t}var Fp=cr(si),Pp=cr(function(e,t){return e>=t}),Ut=ra((function(){return arguments})())?ra:function(e){return ie(e)&&Y.call(e,"callee")&&!Vs.call(e,"callee")},O=m.isArray,Lp=Es?be(Es):Wc;function _e(e){return e!=null&&_r(e.length)&&!ct(e)}function se(e){return ie(e)&&_e(e)}function Np(e){return e===!0||e===!1||ie(e)&&ge(e)==rn}var Et=zl||qi,Op=As?be(As):Bc;function $p(e){return ie(e)&&e.nodeType===1&&!An(e)}function Up(e){if(e==null)return!0;if(_e(e)&&(O(e)||typeof e=="string"||typeof e.splice=="function"||Et(e)||Xt(e)||Ut(e)))return!e.length;var t=he(e);if(t==Ve||t==qe)return!e.size;if(xn(e))return!ui(e).length;for(var n in e)if(Y.call(e,n))return!1;return!0}function Dp(e,t){return wn(e,t)}function Mp(e,t,n){n=typeof n=="function"?n:r;var i=n?n(e,t):r;return i===r?wn(e,t,r,n):!!i}function Oi(e){if(!ie(e))return!1;var t=ge(e);return t==Pn||t==au||typeof e.message=="string"&&typeof e.name=="string"&&!An(e)}function Wp(e){return typeof e=="number"&&Hs(e)}function ct(e){if(!re(e))return!1;var t=ge(e);return t==Ln||t==Xi||t==su||t==uu}function fo(e){return typeof e=="number"&&e==$(e)}function _r(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=gt}function re(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function ie(e){return e!=null&&typeof e=="object"}var po=bs?be(bs):Gc;function Bp(e,t){return e===t||oi(e,t,Ei(t))}function kp(e,t,n){return n=typeof n=="function"?n:r,oi(e,t,Ei(t),n)}function Gp(e){return ho(e)&&e!=+e}function Vp(e){if(bf(e))throw new N(I);return ia(e)}function qp(e){return e===null}function Hp(e){return e==null}function ho(e){return typeof e=="number"||ie(e)&&ge(e)==an}function An(e){if(!ie(e)||ge(e)!=rt)return!1;var t=zn(e);if(t===null)return!0;var n=Y.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Gn.call(n)==Bl}var $i=Cs?be(Cs):Vc;function zp(e){return fo(e)&&e>=-gt&&e<=gt}var go=Ts?be(Ts):qc;function wr(e){return typeof e=="string"||!O(e)&&ie(e)&&ge(e)==un}function Te(e){return typeof e=="symbol"||ie(e)&&ge(e)==Nn}var Xt=Rs?be(Rs):Hc;function Kp(e){return e===r}function jp(e){return ie(e)&&he(e)==ln}function Yp(e){return ie(e)&&ge(e)==cu}var Jp=cr(li),Zp=cr(function(e,t){return e<=t});function vo(e){if(!e)return[];if(_e(e))return wr(e)?He(e):ye(e);if(dn&&e[dn])return Tl(e[dn]());var t=he(e),n=t==Ve?Jr:t==qe?Wn:Qt;return n(e)}function ft(e){if(!e)return e===0?e:0;if(e=Be(e),e===Ct||e===-Ct){var t=e<0?-1:1;return t*tu}return e===e?e:0}function $(e){var t=ft(e),n=t%1;return t===t?n?t-n:t:0}function mo(e){return e?Lt($(e),0,Ze):0}function Be(e){if(typeof e=="number")return e;if(Te(e))return Rn;if(re(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=re(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=$s(e);var n=Pu.test(e);return n||Nu.test(e)?fl(e.slice(2),n?2:8):Fu.test(e)?Rn:+e}function yo(e){return Qe(e,we(e))}function Xp(e){return e?Lt($(e),-gt,gt):e===0?e:0}function j(e){return e==null?"":Ce(e)}var Qp=Yt(function(e,t){if(xn(t)||_e(t)){Qe(t,le(t),e);return}for(var n in t)Y.call(t,n)&&mn(e,n,t[n])}),_o=Yt(function(e,t){Qe(t,we(t),e)}),Sr=Yt(function(e,t,n,i){Qe(t,we(t),e,i)}),eh=Yt(function(e,t,n,i){Qe(t,le(t),e,i)}),th=ut(ni);function nh(e,t){var n=jt(e);return t==null?n:Js(n,t)}var rh=M(function(e,t){e=J(e);var n=-1,i=t.length,a=i>2?t[2]:r;for(a&&ve(t[0],t[1],a)&&(i=1);++n<i;)for(var u=t[n],c=we(u),d=-1,g=c.length;++d<g;){var w=c[d],S=e[w];(S===r||Ke(S,Ht[w])&&!Y.call(e,w))&&(e[w]=u[w])}return e}),ih=M(function(e){return e.push(r,$a),Ae(wo,r,e)});function sh(e,t){return Ps(e,T(t,3),Xe)}function ah(e,t){return Ps(e,T(t,3),ii)}function oh(e,t){return e==null?e:ri(e,T(t,3),we)}function uh(e,t){return e==null?e:ta(e,T(t,3),we)}function lh(e,t){return e&&Xe(e,T(t,3))}function ch(e,t){return e&&ii(e,T(t,3))}function fh(e){return e==null?[]:nr(e,le(e))}function dh(e){return e==null?[]:nr(e,we(e))}function Ui(e,t,n){var i=e==null?r:Nt(e,t);return i===r?n:i}function ph(e,t){return e!=null&&Ma(e,t,$c)}function Di(e,t){return e!=null&&Ma(e,t,Uc)}var hh=Fa(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=Vn.call(t)),e[t]=n},Wi(Se)),gh=Fa(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=Vn.call(t)),Y.call(e,t)?e[t].push(n):e[t]=[n]},T),vh=M(_n);function le(e){return _e(e)?js(e):ui(e)}function we(e){return _e(e)?js(e,!0):zc(e)}function mh(e,t){var n={};return t=T(t,3),Xe(e,function(i,a,u){at(n,t(i,a,u),i)}),n}function yh(e,t){var n={};return t=T(t,3),Xe(e,function(i,a,u){at(n,a,t(i,a,u))}),n}var _h=Yt(function(e,t,n){rr(e,t,n)}),wo=Yt(function(e,t,n,i){rr(e,t,n,i)}),wh=ut(function(e,t){var n={};if(e==null)return n;var i=!1;t=ne(t,function(u){return u=It(u,e),i||(i=u.length>1),u}),Qe(e,Ii(e),n),i&&(n=De(n,K|Ye|G,hf));for(var a=t.length;a--;)hi(n,t[a]);return n});function Sh(e,t){return So(e,yr(T(t)))}var Ih=ut(function(e,t){return e==null?{}:jc(e,t)});function So(e,t){if(e==null)return{};var n=ne(Ii(e),function(i){return[i]});return t=T(t),fa(e,n,function(i,a){return t(i,a[0])})}function xh(e,t,n){t=It(t,e);var i=-1,a=t.length;for(a||(a=1,e=r);++i<a;){var u=e==null?r:e[et(t[i])];u===r&&(i=a,u=n),e=ct(u)?u.call(e):u}return e}function Eh(e,t,n){return e==null?e:Sn(e,t,n)}function Ah(e,t,n,i){return i=typeof i=="function"?i:r,e==null?e:Sn(e,t,n,i)}var Io=Na(le),xo=Na(we);function bh(e,t,n){var i=O(e),a=i||Et(e)||Xt(e);if(t=T(t,4),n==null){var u=e&&e.constructor;a?n=i?new u:[]:re(e)?n=ct(u)?jt(zn(e)):{}:n={}}return(a?Oe:Xe)(e,function(c,d,g){return t(n,c,d,g)}),n}function Ch(e,t){return e==null?!0:hi(e,t)}function Th(e,t,n){return e==null?e:va(e,t,mi(n))}function Rh(e,t,n,i){return i=typeof i=="function"?i:r,e==null?e:va(e,t,mi(n),i)}function Qt(e){return e==null?[]:Yr(e,le(e))}function Fh(e){return e==null?[]:Yr(e,we(e))}function Ph(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=Be(n),n=n===n?n:0),t!==r&&(t=Be(t),t=t===t?t:0),Lt(Be(e),t,n)}function Lh(e,t,n){return t=ft(t),n===r?(n=t,t=0):n=ft(n),e=Be(e),Dc(e,t,n)}function Nh(e,t,n){if(n&&typeof n!="boolean"&&ve(e,t,n)&&(t=n=r),n===r&&(typeof t=="boolean"?(n=t,t=r):typeof e=="boolean"&&(n=e,e=r)),e===r&&t===r?(e=0,t=1):(e=ft(e),t===r?(t=e,e=0):t=ft(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var a=zs();return pe(e+a*(t-e+cl("1e-"+((a+"").length-1))),t)}return fi(e,t)}var Oh=Jt(function(e,t,n){return t=t.toLowerCase(),e+(n?Eo(t):t)});function Eo(e){return Mi(j(e).toLowerCase())}function Ao(e){return e=j(e),e&&e.replace($u,xl).replace(el,"")}function $h(e,t,n){e=j(e),t=Ce(t);var i=e.length;n=n===r?i:Lt($(n),0,i);var a=n;return n-=t.length,n>=0&&e.slice(n,a)==t}function Uh(e){return e=j(e),e&&gu.test(e)?e.replace(ts,El):e}function Dh(e){return e=j(e),e&&Su.test(e)?e.replace(Nr,"\\$&"):e}var Mh=Jt(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Wh=Jt(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Bh=Ca("toLowerCase");function kh(e,t,n){e=j(e),t=$(t);var i=t?Vt(e):0;if(!t||i>=t)return e;var a=(t-i)/2;return lr(Jn(a),n)+e+lr(Yn(a),n)}function Gh(e,t,n){e=j(e),t=$(t);var i=t?Vt(e):0;return t&&i<t?e+lr(t-i,n):e}function Vh(e,t,n){e=j(e),t=$(t);var i=t?Vt(e):0;return t&&i<t?lr(t-i,n)+e:e}function qh(e,t,n){return n||t==null?t=0:t&&(t=+t),Jl(j(e).replace(Or,""),t||0)}function Hh(e,t,n){return(n?ve(e,t,n):t===r)?t=1:t=$(t),di(j(e),t)}function zh(){var e=arguments,t=j(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var Kh=Jt(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});function jh(e,t,n){return n&&typeof n!="number"&&ve(e,t,n)&&(t=n=r),n=n===r?Ze:n>>>0,n?(e=j(e),e&&(typeof t=="string"||t!=null&&!$i(t))&&(t=Ce(t),!t&&Gt(e))?xt(He(e),0,n):e.split(t,n)):[]}var Yh=Jt(function(e,t,n){return e+(n?" ":"")+Mi(t)});function Jh(e,t,n){return e=j(e),n=n==null?0:Lt($(n),0,e.length),t=Ce(t),e.slice(n,n+t.length)==t}function Zh(e,t,n){var i=o.templateSettings;n&&ve(e,t,n)&&(t=r),e=j(e),t=Sr({},t,i,Oa);var a=Sr({},t.imports,i.imports,Oa),u=le(a),c=Yr(a,u),d,g,w=0,S=t.interpolate||On,E="__p += '",A=Zr((t.escape||On).source+"|"+S.source+"|"+(S===ns?Ru:On).source+"|"+(t.evaluate||On).source+"|$","g"),C="//# sourceURL="+(Y.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++sl+"]")+`
5
+ `;e.replace(A,function(F,B,V,Re,me,Fe){return V||(V=Re),E+=e.slice(w,Fe).replace(Uu,Al),B&&(d=!0,E+=`' +
6
+ __e(`+B+`) +
7
+ '`),me&&(g=!0,E+=`';
15
8
  `+me+`;
16
- __p += '`),G&&(x+=`' +
17
- ((__t = (`+G+`)) == null ? '' : __t) +
18
- '`),w=Re+R.length,R}),x+=`';
19
- `;var F=Y.call(t,"variable")&&t.variable;if(!F)x=`with (obj) {
20
- `+x+`
9
+ __p += '`),V&&(E+=`' +
10
+ ((__t = (`+V+`)) == null ? '' : __t) +
11
+ '`),w=Fe+F.length,F}),E+=`';
12
+ `;var R=Y.call(t,"variable")&&t.variable;if(!R)E=`with (obj) {
13
+ `+E+`
21
14
  }
22
- `;else if(Au.test(F))throw new L(N);x=(g?x.replace(lu,""):x).replace(cu,"$1").replace(fu,"$1;"),x="function("+(F||"obj")+`) {
23
- `+(F?"":`obj || (obj = {});
24
- `)+"var __t, __p = ''"+(h?", __e = _.escape":"")+(g?`, __j = Array.prototype.join;
15
+ `;else if(Cu.test(R))throw new N(P);E=(g?E.replace(fu,""):E).replace(du,"$1").replace(pu,"$1;"),E="function("+(R||"obj")+`) {
16
+ `+(R?"":`obj || (obj = {});
17
+ `)+"var __t, __p = ''"+(d?", __e = _.escape":"")+(g?`, __j = Array.prototype.join;
25
18
  function print() { __p += __j.call(arguments, '') }
26
19
  `:`;
27
- `)+x+`return __p
28
- }`;var D=bo(function(){return H(u,T+"return "+x).apply(i,c)});if(D.source=x,Ui(D))throw D;return D}function jp(e){return V(e).toLowerCase()}function Jp(e){return V(e).toUpperCase()}function Xp(e,t,n){if(e=V(e),e&&(n||t===i))return Us(e);if(!e||!(t=Te(t)))return e;var r=ze(e),s=ze(t),u=Ns(r,s),c=Ds(r,s)+1;return xt(r,u,c).join("")}function Qp(e,t,n){if(e=V(e),e&&(n||t===i))return e.slice(0,Ws(e)+1);if(!e||!(t=Te(t)))return e;var r=ze(e),s=Ds(r,ze(t))+1;return xt(r,0,s).join("")}function eg(e,t,n){if(e=V(e),e&&(n||t===i))return e.replace(Ur,"");if(!e||!(t=Te(t)))return e;var r=ze(e),s=Ns(r,ze(t));return xt(r,s).join("")}function tg(e,t){var n=Vo,r=Yo;if(ne(t)){var s="separator"in t?t.separator:s;n="length"in t?U(t.length):n,r="omission"in t?Te(t.omission):r}e=V(e);var u=e.length;if(Gt(e)){var c=ze(e);u=c.length}if(n>=u)return e;var h=n-qt(r);if(h<1)return r;var g=c?xt(c,0,h).join(""):e.slice(0,h);if(s===i)return g+r;if(c&&(h+=g.length-h),Ni(s)){if(e.slice(h).search(s)){var w,S=g;for(s.global||(s=Jr(s.source,V(ns.exec(s))+"g")),s.lastIndex=0;w=s.exec(S);)var x=w.index;g=g.slice(0,x===i?h:x)}}else if(e.indexOf(Te(s),h)!=h){var A=g.lastIndexOf(s);A>-1&&(g=g.slice(0,A))}return g+r}function ng(e){return e=V(e),e&&hu.test(e)?e.replace(Qi,Rl):e}var rg=jt(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Wi=ba("toUpperCase");function Ao(e,t,n){return e=V(e),t=n?i:t,t===i?Al(e)?Ol(e):vl(e):e.match(t)||[]}var bo=$(function(e,t){try{return Ae(e,i,t)}catch(n){return Ui(n)?n:new L(n)}}),ig=ot(function(e,t){return Ue(t,function(n){n=et(n),st(e,n,Li(e[n],e))}),e});function sg(e){var t=e==null?0:e.length,n=C();return e=t?Q(e,function(r){if(typeof r[1]!="function")throw new Ne(I);return[n(r[0]),r[1]]}):[],$(function(r){for(var s=-1;++s<t;){var u=e[s];if(Ae(u[0],this,r))return Ae(u[1],this,r)}})}function ag(e){return Rc($e(e,K))}function Mi(e){return function(){return e}}function og(e,t){return e==null||e!==e?t:e}var ug=Ca(),lg=Ca(!0);function Se(e){return e}function Bi(e){return ia(typeof e=="function"?e:$e(e,K))}function cg(e){return aa($e(e,K))}function fg(e,t){return oa(e,$e(t,K))}var hg=$(function(e,t){return function(n){return _n(n,e,t)}}),dg=$(function(e,t){return function(n){return _n(e,n,t)}});function ki(e,t,n){var r=le(t),s=nr(t,r);n==null&&!(ne(t)&&(s.length||!r.length))&&(n=t,t=e,e=this,s=nr(t,le(t)));var u=!(ne(n)&&"chain"in n)||!!n.chain,c=lt(e);return Ue(s,function(h){var g=t[h];e[h]=g,c&&(e.prototype[h]=function(){var w=this.__chain__;if(u||w){var S=e(this.__wrapped__),x=S.__actions__=ye(this.__actions__);return x.push({func:g,args:arguments,thisArg:e}),S.__chain__=w,S}return g.apply(e,vt([this.value()],arguments))})}),e}function pg(){return ce._===this&&(ce._=Ml),this}function Gi(){}function gg(e){return e=U(e),$(function(t){return ua(t,e)})}var vg=_i(Q),mg=_i(Fs),yg=_i(Hr);function To(e){return bi(e)?zr(et(e)):Vc(e)}function _g(e){return function(t){return e==null?i:Lt(e,t)}}var wg=Ra(),Sg=Ra(!0);function qi(){return[]}function Hi(){return!1}function xg(){return{}}function Ig(){return""}function Eg(){return!0}function Ag(e,t){if(e=U(e),e<1||e>pt)return[];var n=Je,r=he(e,Je);t=C(t),e-=Je;for(var s=Yr(r,t);++n<e;)t(n);return s}function bg(e){return O(e)?Q(e,et):Ce(e)?[e]:ye(Ka(V(e)))}function Tg(e){var t=++$l;return V(e)+t}var Cg=ur(function(e,t){return e+t},0),Fg=wi("ceil"),Rg=ur(function(e,t){return e/t},1),Pg=wi("floor");function Lg(e){return e&&e.length?tr(e,Se,si):i}function Og(e,t){return e&&e.length?tr(e,C(t,2),si):i}function Ug(e){return Ls(e,Se)}function Ng(e,t){return Ls(e,C(t,2))}function Dg(e){return e&&e.length?tr(e,Se,li):i}function $g(e,t){return e&&e.length?tr(e,C(t,2),li):i}var Wg=ur(function(e,t){return e*t},1),Mg=wi("round"),Bg=ur(function(e,t){return e-t},0);function kg(e){return e&&e.length?Vr(e,Se):0}function Gg(e,t){return e&&e.length?Vr(e,C(t,2)):0}return o.after=cd,o.ary=ro,o.assign=Jd,o.assignIn=yo,o.assignInWith=Sr,o.assignWith=Xd,o.at=Qd,o.before=io,o.bind=Li,o.bindAll=ig,o.bindKey=so,o.castArray=xd,o.chain=eo,o.chunk=Pf,o.compact=Lf,o.concat=Of,o.cond=sg,o.conforms=ag,o.constant=Mi,o.countBy=kh,o.create=ep,o.curry=ao,o.curryRight=oo,o.debounce=uo,o.defaults=tp,o.defaultsDeep=np,o.defer=fd,o.delay=hd,o.difference=Uf,o.differenceBy=Nf,o.differenceWith=Df,o.drop=$f,o.dropRight=Wf,o.dropRightWhile=Mf,o.dropWhile=Bf,o.fill=kf,o.filter=qh,o.flatMap=Kh,o.flatMapDeep=Vh,o.flatMapDepth=Yh,o.flatten=ja,o.flattenDeep=Gf,o.flattenDepth=qf,o.flip=dd,o.flow=ug,o.flowRight=lg,o.fromPairs=Hf,o.functions=lp,o.functionsIn=cp,o.groupBy=Zh,o.initial=Kf,o.intersection=Vf,o.intersectionBy=Yf,o.intersectionWith=Zf,o.invert=hp,o.invertBy=dp,o.invokeMap=Jh,o.iteratee=Bi,o.keyBy=Xh,o.keys=le,o.keysIn=we,o.map=gr,o.mapKeys=gp,o.mapValues=vp,o.matches=cg,o.matchesProperty=fg,o.memoize=mr,o.merge=mp,o.mergeWith=_o,o.method=hg,o.methodOf=dg,o.mixin=ki,o.negate=yr,o.nthArg=gg,o.omit=yp,o.omitBy=_p,o.once=pd,o.orderBy=Qh,o.over=vg,o.overArgs=gd,o.overEvery=mg,o.overSome=yg,o.partial=Oi,o.partialRight=lo,o.partition=ed,o.pick=wp,o.pickBy=wo,o.property=To,o.propertyOf=_g,o.pull=Qf,o.pullAll=Xa,o.pullAllBy=eh,o.pullAllWith=th,o.pullAt=nh,o.range=wg,o.rangeRight=Sg,o.rearg=vd,o.reject=rd,o.remove=rh,o.rest=md,o.reverse=Ri,o.sampleSize=sd,o.set=xp,o.setWith=Ip,o.shuffle=ad,o.slice=ih,o.sortBy=ld,o.sortedUniq=fh,o.sortedUniqBy=hh,o.split=Kp,o.spread=yd,o.tail=dh,o.take=ph,o.takeRight=gh,o.takeRightWhile=vh,o.takeWhile=mh,o.tap=Lh,o.throttle=_d,o.thru=pr,o.toArray=go,o.toPairs=So,o.toPairsIn=xo,o.toPath=bg,o.toPlainObject=mo,o.transform=Ep,o.unary=wd,o.union=yh,o.unionBy=_h,o.unionWith=wh,o.uniq=Sh,o.uniqBy=xh,o.uniqWith=Ih,o.unset=Ap,o.unzip=Pi,o.unzipWith=Qa,o.update=bp,o.updateWith=Tp,o.values=Qt,o.valuesIn=Cp,o.without=Eh,o.words=Ao,o.wrap=Sd,o.xor=Ah,o.xorBy=bh,o.xorWith=Th,o.zip=Ch,o.zipObject=Fh,o.zipObjectDeep=Rh,o.zipWith=Ph,o.entries=So,o.entriesIn=xo,o.extend=yo,o.extendWith=Sr,ki(o,o),o.add=Cg,o.attempt=bo,o.camelCase=Lp,o.capitalize=Io,o.ceil=Fg,o.clamp=Fp,o.clone=Id,o.cloneDeep=Ad,o.cloneDeepWith=bd,o.cloneWith=Ed,o.conformsTo=Td,o.deburr=Eo,o.defaultTo=og,o.divide=Rg,o.endsWith=Op,o.eq=Ve,o.escape=Up,o.escapeRegExp=Np,o.every=Gh,o.find=Hh,o.findIndex=Ya,o.findKey=rp,o.findLast=zh,o.findLastIndex=Za,o.findLastKey=ip,o.floor=Pg,o.forEach=to,o.forEachRight=no,o.forIn=sp,o.forInRight=ap,o.forOwn=op,o.forOwnRight=up,o.get=Di,o.gt=Cd,o.gte=Fd,o.has=fp,o.hasIn=$i,o.head=Ja,o.identity=Se,o.includes=jh,o.indexOf=zf,o.inRange=Rp,o.invoke=pp,o.isArguments=Nt,o.isArray=O,o.isArrayBuffer=Rd,o.isArrayLike=_e,o.isArrayLikeObject=se,o.isBoolean=Pd,o.isBuffer=It,o.isDate=Ld,o.isElement=Od,o.isEmpty=Ud,o.isEqual=Nd,o.isEqualWith=Dd,o.isError=Ui,o.isFinite=$d,o.isFunction=lt,o.isInteger=co,o.isLength=_r,o.isMap=fo,o.isMatch=Wd,o.isMatchWith=Md,o.isNaN=Bd,o.isNative=kd,o.isNil=qd,o.isNull=Gd,o.isNumber=ho,o.isObject=ne,o.isObjectLike=ie,o.isPlainObject=An,o.isRegExp=Ni,o.isSafeInteger=Hd,o.isSet=po,o.isString=wr,o.isSymbol=Ce,o.isTypedArray=Xt,o.isUndefined=zd,o.isWeakMap=Kd,o.isWeakSet=Vd,o.join=jf,o.kebabCase=Dp,o.last=Me,o.lastIndexOf=Jf,o.lowerCase=$p,o.lowerFirst=Wp,o.lt=Yd,o.lte=Zd,o.max=Lg,o.maxBy=Og,o.mean=Ug,o.meanBy=Ng,o.min=Dg,o.minBy=$g,o.stubArray=qi,o.stubFalse=Hi,o.stubObject=xg,o.stubString=Ig,o.stubTrue=Eg,o.multiply=Wg,o.nth=Xf,o.noConflict=pg,o.noop=Gi,o.now=vr,o.pad=Mp,o.padEnd=Bp,o.padStart=kp,o.parseInt=Gp,o.random=Pp,o.reduce=td,o.reduceRight=nd,o.repeat=qp,o.replace=Hp,o.result=Sp,o.round=Mg,o.runInContext=p,o.sample=id,o.size=od,o.snakeCase=zp,o.some=ud,o.sortedIndex=sh,o.sortedIndexBy=ah,o.sortedIndexOf=oh,o.sortedLastIndex=uh,o.sortedLastIndexBy=lh,o.sortedLastIndexOf=ch,o.startCase=Vp,o.startsWith=Yp,o.subtract=Bg,o.sum=kg,o.sumBy=Gg,o.template=Zp,o.times=Ag,o.toFinite=ct,o.toInteger=U,o.toLength=vo,o.toLower=jp,o.toNumber=Be,o.toSafeInteger=jd,o.toString=V,o.toUpper=Jp,o.trim=Xp,o.trimEnd=Qp,o.trimStart=eg,o.truncate=tg,o.unescape=ng,o.uniqueId=Tg,o.upperCase=rg,o.upperFirst=Wi,o.each=to,o.eachRight=no,o.first=Ja,ki(o,function(){var e={};return Xe(o,function(t,n){Y.call(o.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),o.VERSION=l,Ue(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){o[e].placeholder=o}),Ue(["drop","take"],function(e,t){B.prototype[e]=function(n){n=n===i?1:ue(U(n),0);var r=this.__filtered__&&!t?new B(this):this.clone();return r.__filtered__?r.__takeCount__=he(n,r.__takeCount__):r.__views__.push({size:he(n,Je),type:e+(r.__dir__<0?"Right":"")}),r},B.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Ue(["filter","map","takeWhile"],function(e,t){var n=t+1,r=n==ji||n==Xo;B.prototype[e]=function(s){var u=this.clone();return u.__iteratees__.push({iteratee:C(s,3),type:n}),u.__filtered__=u.__filtered__||r,u}}),Ue(["head","last"],function(e,t){var n="take"+(t?"Right":"");B.prototype[e]=function(){return this[n](1).value()[0]}}),Ue(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");B.prototype[e]=function(){return this.__filtered__?new B(this):this[n](1)}}),B.prototype.compact=function(){return this.filter(Se)},B.prototype.find=function(e){return this.filter(e).head()},B.prototype.findLast=function(e){return this.reverse().find(e)},B.prototype.invokeMap=$(function(e,t){return typeof e=="function"?new B(this):this.map(function(n){return _n(n,e,t)})}),B.prototype.reject=function(e){return this.filter(yr(C(e)))},B.prototype.slice=function(e,t){e=U(e);var n=this;return n.__filtered__&&(e>0||t<0)?new B(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(t=U(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},B.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},B.prototype.toArray=function(){return this.take(Je)},Xe(B.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),s=o[r?"take"+(t=="last"?"Right":""):t],u=r||/^find/.test(t);s&&(o.prototype[t]=function(){var c=this.__wrapped__,h=r?[1]:arguments,g=c instanceof B,w=h[0],S=g||O(c),x=function(M){var G=s.apply(o,vt([M],h));return r&&A?G[0]:G};S&&n&&typeof w=="function"&&w.length!=1&&(g=S=!1);var A=this.__chain__,T=!!this.__actions__.length,F=u&&!A,D=g&&!T;if(!u&&S){c=D?c:new B(this);var R=e.apply(c,h);return R.__actions__.push({func:pr,args:[x],thisArg:i}),new De(R,A)}return F&&D?e.apply(this,h):(R=this.thru(x),F?r?R.value()[0]:R.value():R)})}),Ue(["pop","push","shift","sort","splice","unshift"],function(e){var t=Bn[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);o.prototype[e]=function(){var s=arguments;if(r&&!this.__chain__){var u=this.value();return t.apply(O(u)?u:[],s)}return this[n](function(c){return t.apply(O(c)?c:[],s)})}}),Xe(B.prototype,function(e,t){var n=o[t];if(n){var r=n.name+"";Y.call(Vt,r)||(Vt[r]=[]),Vt[r].push({name:t,func:n})}}),Vt[or(i,je).name]=[{name:"wrapper",func:i}],B.prototype.clone=tc,B.prototype.reverse=nc,B.prototype.value=rc,o.prototype.at=Oh,o.prototype.chain=Uh,o.prototype.commit=Nh,o.prototype.next=Dh,o.prototype.plant=Wh,o.prototype.reverse=Mh,o.prototype.toJSON=o.prototype.valueOf=o.prototype.value=Bh,o.prototype.first=o.prototype.head,hn&&(o.prototype[hn]=$h),o},Ht=Ul();Tt?((Tt.exports=Ht)._=Ht,Br._=Ht):ce._=Ht}).call(rv)}(Tn,Tn.exports)),Tn.exports}var sv=iv();const zi=f=>{const a=sv.startCase(f).toLowerCase();return a.charAt(0).toUpperCase()+a.slice(1)},av=({data:f})=>{const a=re.v4(),i=f.description?`
20
+ `)+E+`return __p
21
+ }`;var U=Co(function(){return H(u,C+"return "+E).apply(r,c)});if(U.source=E,Oi(U))throw U;return U}function Xh(e){return j(e).toLowerCase()}function Qh(e){return j(e).toUpperCase()}function eg(e,t,n){if(e=j(e),e&&(n||t===r))return $s(e);if(!e||!(t=Ce(t)))return e;var i=He(e),a=He(t),u=Us(i,a),c=Ds(i,a)+1;return xt(i,u,c).join("")}function tg(e,t,n){if(e=j(e),e&&(n||t===r))return e.slice(0,Ws(e)+1);if(!e||!(t=Ce(t)))return e;var i=He(e),a=Ds(i,He(t))+1;return xt(i,0,a).join("")}function ng(e,t,n){if(e=j(e),e&&(n||t===r))return e.replace(Or,"");if(!e||!(t=Ce(t)))return e;var i=He(e),a=Us(i,He(t));return xt(i,a).join("")}function rg(e,t){var n=Yo,i=Jo;if(re(t)){var a="separator"in t?t.separator:a;n="length"in t?$(t.length):n,i="omission"in t?Ce(t.omission):i}e=j(e);var u=e.length;if(Gt(e)){var c=He(e);u=c.length}if(n>=u)return e;var d=n-Vt(i);if(d<1)return i;var g=c?xt(c,0,d).join(""):e.slice(0,d);if(a===r)return g+i;if(c&&(d+=g.length-d),$i(a)){if(e.slice(d).search(a)){var w,S=g;for(a.global||(a=Zr(a.source,j(rs.exec(a))+"g")),a.lastIndex=0;w=a.exec(S);)var E=w.index;g=g.slice(0,E===r?d:E)}}else if(e.indexOf(Ce(a),d)!=d){var A=g.lastIndexOf(a);A>-1&&(g=g.slice(0,A))}return g+i}function ig(e){return e=j(e),e&&hu.test(e)?e.replace(es,Ll):e}var sg=Jt(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Mi=Ca("toUpperCase");function bo(e,t,n){return e=j(e),t=n?r:t,t===r?Cl(e)?$l(e):yl(e):e.match(t)||[]}var Co=M(function(e,t){try{return Ae(e,r,t)}catch(n){return Oi(n)?n:new N(n)}}),ag=ut(function(e,t){return Oe(t,function(n){n=et(n),at(e,n,Li(e[n],e))}),e});function og(e){var t=e==null?0:e.length,n=T();return e=t?ne(e,function(i){if(typeof i[1]!="function")throw new $e(x);return[n(i[0]),i[1]]}):[],M(function(i){for(var a=-1;++a<t;){var u=e[a];if(Ae(u[0],this,i))return Ae(u[1],this,i)}})}function ug(e){return Lc(De(e,K))}function Wi(e){return function(){return e}}function lg(e,t){return e==null||e!==e?t:e}var cg=Ra(),fg=Ra(!0);function Se(e){return e}function Bi(e){return sa(typeof e=="function"?e:De(e,K))}function dg(e){return oa(De(e,K))}function pg(e,t){return ua(e,De(t,K))}var hg=M(function(e,t){return function(n){return _n(n,e,t)}}),gg=M(function(e,t){return function(n){return _n(e,n,t)}});function ki(e,t,n){var i=le(t),a=nr(t,i);n==null&&!(re(t)&&(a.length||!i.length))&&(n=t,t=e,e=this,a=nr(t,le(t)));var u=!(re(n)&&"chain"in n)||!!n.chain,c=ct(e);return Oe(a,function(d){var g=t[d];e[d]=g,c&&(e.prototype[d]=function(){var w=this.__chain__;if(u||w){var S=e(this.__wrapped__),E=S.__actions__=ye(this.__actions__);return E.push({func:g,args:arguments,thisArg:e}),S.__chain__=w,S}return g.apply(e,mt([this.value()],arguments))})}),e}function vg(){return fe._===this&&(fe._=kl),this}function Gi(){}function mg(e){return e=$(e),M(function(t){return la(t,e)})}var yg=_i(ne),_g=_i(Fs),wg=_i(qr);function To(e){return bi(e)?Hr(et(e)):Yc(e)}function Sg(e){return function(t){return e==null?r:Nt(e,t)}}var Ig=Pa(),xg=Pa(!0);function Vi(){return[]}function qi(){return!1}function Eg(){return{}}function Ag(){return""}function bg(){return!0}function Cg(e,t){if(e=$(e),e<1||e>gt)return[];var n=Ze,i=pe(e,Ze);t=T(t),e-=Ze;for(var a=jr(i,t);++n<e;)t(n);return a}function Tg(e){return O(e)?ne(e,et):Te(e)?[e]:ye(Ka(j(e)))}function Rg(e){var t=++Wl;return j(e)+t}var Fg=ur(function(e,t){return e+t},0),Pg=wi("ceil"),Lg=ur(function(e,t){return e/t},1),Ng=wi("floor");function Og(e){return e&&e.length?tr(e,Se,si):r}function $g(e,t){return e&&e.length?tr(e,T(t,2),si):r}function Ug(e){return Ns(e,Se)}function Dg(e,t){return Ns(e,T(t,2))}function Mg(e){return e&&e.length?tr(e,Se,li):r}function Wg(e,t){return e&&e.length?tr(e,T(t,2),li):r}var Bg=ur(function(e,t){return e*t},1),kg=wi("round"),Gg=ur(function(e,t){return e-t},0);function Vg(e){return e&&e.length?Kr(e,Se):0}function qg(e,t){return e&&e.length?Kr(e,T(t,2)):0}return o.after=dp,o.ary=io,o.assign=Qp,o.assignIn=_o,o.assignInWith=Sr,o.assignWith=eh,o.at=th,o.before=so,o.bind=Li,o.bindAll=ag,o.bindKey=ao,o.castArray=Ep,o.chain=to,o.chunk=Nf,o.compact=Of,o.concat=$f,o.cond=og,o.conforms=ug,o.constant=Wi,o.countBy=Vd,o.create=nh,o.curry=oo,o.curryRight=uo,o.debounce=lo,o.defaults=rh,o.defaultsDeep=ih,o.defer=pp,o.delay=hp,o.difference=Uf,o.differenceBy=Df,o.differenceWith=Mf,o.drop=Wf,o.dropRight=Bf,o.dropRightWhile=kf,o.dropWhile=Gf,o.fill=Vf,o.filter=Hd,o.flatMap=jd,o.flatMapDeep=Yd,o.flatMapDepth=Jd,o.flatten=Za,o.flattenDeep=qf,o.flattenDepth=Hf,o.flip=gp,o.flow=cg,o.flowRight=fg,o.fromPairs=zf,o.functions=fh,o.functionsIn=dh,o.groupBy=Zd,o.initial=jf,o.intersection=Yf,o.intersectionBy=Jf,o.intersectionWith=Zf,o.invert=hh,o.invertBy=gh,o.invokeMap=Qd,o.iteratee=Bi,o.keyBy=ep,o.keys=le,o.keysIn=we,o.map=gr,o.mapKeys=mh,o.mapValues=yh,o.matches=dg,o.matchesProperty=pg,o.memoize=mr,o.merge=_h,o.mergeWith=wo,o.method=hg,o.methodOf=gg,o.mixin=ki,o.negate=yr,o.nthArg=mg,o.omit=wh,o.omitBy=Sh,o.once=vp,o.orderBy=tp,o.over=yg,o.overArgs=mp,o.overEvery=_g,o.overSome=wg,o.partial=Ni,o.partialRight=co,o.partition=np,o.pick=Ih,o.pickBy=So,o.property=To,o.propertyOf=Sg,o.pull=td,o.pullAll=Qa,o.pullAllBy=nd,o.pullAllWith=rd,o.pullAt=id,o.range=Ig,o.rangeRight=xg,o.rearg=yp,o.reject=sp,o.remove=sd,o.rest=_p,o.reverse=Fi,o.sampleSize=op,o.set=Eh,o.setWith=Ah,o.shuffle=up,o.slice=ad,o.sortBy=fp,o.sortedUniq=pd,o.sortedUniqBy=hd,o.split=jh,o.spread=wp,o.tail=gd,o.take=vd,o.takeRight=md,o.takeRightWhile=yd,o.takeWhile=_d,o.tap=Od,o.throttle=Sp,o.thru=hr,o.toArray=vo,o.toPairs=Io,o.toPairsIn=xo,o.toPath=Tg,o.toPlainObject=yo,o.transform=bh,o.unary=Ip,o.union=wd,o.unionBy=Sd,o.unionWith=Id,o.uniq=xd,o.uniqBy=Ed,o.uniqWith=Ad,o.unset=Ch,o.unzip=Pi,o.unzipWith=eo,o.update=Th,o.updateWith=Rh,o.values=Qt,o.valuesIn=Fh,o.without=bd,o.words=bo,o.wrap=xp,o.xor=Cd,o.xorBy=Td,o.xorWith=Rd,o.zip=Fd,o.zipObject=Pd,o.zipObjectDeep=Ld,o.zipWith=Nd,o.entries=Io,o.entriesIn=xo,o.extend=_o,o.extendWith=Sr,ki(o,o),o.add=Fg,o.attempt=Co,o.camelCase=Oh,o.capitalize=Eo,o.ceil=Pg,o.clamp=Ph,o.clone=Ap,o.cloneDeep=Cp,o.cloneDeepWith=Tp,o.cloneWith=bp,o.conformsTo=Rp,o.deburr=Ao,o.defaultTo=lg,o.divide=Lg,o.endsWith=$h,o.eq=Ke,o.escape=Uh,o.escapeRegExp=Dh,o.every=qd,o.find=zd,o.findIndex=Ya,o.findKey=sh,o.findLast=Kd,o.findLastIndex=Ja,o.findLastKey=ah,o.floor=Ng,o.forEach=no,o.forEachRight=ro,o.forIn=oh,o.forInRight=uh,o.forOwn=lh,o.forOwnRight=ch,o.get=Ui,o.gt=Fp,o.gte=Pp,o.has=ph,o.hasIn=Di,o.head=Xa,o.identity=Se,o.includes=Xd,o.indexOf=Kf,o.inRange=Lh,o.invoke=vh,o.isArguments=Ut,o.isArray=O,o.isArrayBuffer=Lp,o.isArrayLike=_e,o.isArrayLikeObject=se,o.isBoolean=Np,o.isBuffer=Et,o.isDate=Op,o.isElement=$p,o.isEmpty=Up,o.isEqual=Dp,o.isEqualWith=Mp,o.isError=Oi,o.isFinite=Wp,o.isFunction=ct,o.isInteger=fo,o.isLength=_r,o.isMap=po,o.isMatch=Bp,o.isMatchWith=kp,o.isNaN=Gp,o.isNative=Vp,o.isNil=Hp,o.isNull=qp,o.isNumber=ho,o.isObject=re,o.isObjectLike=ie,o.isPlainObject=An,o.isRegExp=$i,o.isSafeInteger=zp,o.isSet=go,o.isString=wr,o.isSymbol=Te,o.isTypedArray=Xt,o.isUndefined=Kp,o.isWeakMap=jp,o.isWeakSet=Yp,o.join=Xf,o.kebabCase=Mh,o.last=We,o.lastIndexOf=Qf,o.lowerCase=Wh,o.lowerFirst=Bh,o.lt=Jp,o.lte=Zp,o.max=Og,o.maxBy=$g,o.mean=Ug,o.meanBy=Dg,o.min=Mg,o.minBy=Wg,o.stubArray=Vi,o.stubFalse=qi,o.stubObject=Eg,o.stubString=Ag,o.stubTrue=bg,o.multiply=Bg,o.nth=ed,o.noConflict=vg,o.noop=Gi,o.now=vr,o.pad=kh,o.padEnd=Gh,o.padStart=Vh,o.parseInt=qh,o.random=Nh,o.reduce=rp,o.reduceRight=ip,o.repeat=Hh,o.replace=zh,o.result=xh,o.round=kg,o.runInContext=h,o.sample=ap,o.size=lp,o.snakeCase=Kh,o.some=cp,o.sortedIndex=od,o.sortedIndexBy=ud,o.sortedIndexOf=ld,o.sortedLastIndex=cd,o.sortedLastIndexBy=fd,o.sortedLastIndexOf=dd,o.startCase=Yh,o.startsWith=Jh,o.subtract=Gg,o.sum=Vg,o.sumBy=qg,o.template=Zh,o.times=Cg,o.toFinite=ft,o.toInteger=$,o.toLength=mo,o.toLower=Xh,o.toNumber=Be,o.toSafeInteger=Xp,o.toString=j,o.toUpper=Qh,o.trim=eg,o.trimEnd=tg,o.trimStart=ng,o.truncate=rg,o.unescape=ig,o.uniqueId=Rg,o.upperCase=sg,o.upperFirst=Mi,o.each=no,o.eachRight=ro,o.first=Xa,ki(o,(function(){var e={};return Xe(o,function(t,n){Y.call(o.prototype,n)||(e[n]=t)}),e})(),{chain:!1}),o.VERSION=l,Oe(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){o[e].placeholder=o}),Oe(["drop","take"],function(e,t){k.prototype[e]=function(n){n=n===r?1:ue($(n),0);var i=this.__filtered__&&!t?new k(this):this.clone();return i.__filtered__?i.__takeCount__=pe(n,i.__takeCount__):i.__views__.push({size:pe(n,Ze),type:e+(i.__dir__<0?"Right":"")}),i},k.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Oe(["filter","map","takeWhile"],function(e,t){var n=t+1,i=n==Zi||n==eu;k.prototype[e]=function(a){var u=this.clone();return u.__iteratees__.push({iteratee:T(a,3),type:n}),u.__filtered__=u.__filtered__||i,u}}),Oe(["head","last"],function(e,t){var n="take"+(t?"Right":"");k.prototype[e]=function(){return this[n](1).value()[0]}}),Oe(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");k.prototype[e]=function(){return this.__filtered__?new k(this):this[n](1)}}),k.prototype.compact=function(){return this.filter(Se)},k.prototype.find=function(e){return this.filter(e).head()},k.prototype.findLast=function(e){return this.reverse().find(e)},k.prototype.invokeMap=M(function(e,t){return typeof e=="function"?new k(this):this.map(function(n){return _n(n,e,t)})}),k.prototype.reject=function(e){return this.filter(yr(T(e)))},k.prototype.slice=function(e,t){e=$(e);var n=this;return n.__filtered__&&(e>0||t<0)?new k(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(t=$(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},k.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},k.prototype.toArray=function(){return this.take(Ze)},Xe(k.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),a=o[i?"take"+(t=="last"?"Right":""):t],u=i||/^find/.test(t);a&&(o.prototype[t]=function(){var c=this.__wrapped__,d=i?[1]:arguments,g=c instanceof k,w=d[0],S=g||O(c),E=function(B){var V=a.apply(o,mt([B],d));return i&&A?V[0]:V};S&&n&&typeof w=="function"&&w.length!=1&&(g=S=!1);var A=this.__chain__,C=!!this.__actions__.length,R=u&&!A,U=g&&!C;if(!u&&S){c=U?c:new k(this);var F=e.apply(c,d);return F.__actions__.push({func:hr,args:[E],thisArg:r}),new Ue(F,A)}return R&&U?e.apply(this,d):(F=this.thru(E),R?i?F.value()[0]:F.value():F)})}),Oe(["pop","push","shift","sort","splice","unshift"],function(e){var t=Bn[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);o.prototype[e]=function(){var a=arguments;if(i&&!this.__chain__){var u=this.value();return t.apply(O(u)?u:[],a)}return this[n](function(c){return t.apply(O(c)?c:[],a)})}}),Xe(k.prototype,function(e,t){var n=o[t];if(n){var i=n.name+"";Y.call(Kt,i)||(Kt[i]=[]),Kt[i].push({name:t,func:n})}}),Kt[or(r,Je).name]=[{name:"wrapper",func:r}],k.prototype.clone=rc,k.prototype.reverse=ic,k.prototype.value=sc,o.prototype.at=$d,o.prototype.chain=Ud,o.prototype.commit=Dd,o.prototype.next=Md,o.prototype.plant=Bd,o.prototype.reverse=kd,o.prototype.toJSON=o.prototype.valueOf=o.prototype.value=Gd,o.prototype.first=o.prototype.head,dn&&(o.prototype[dn]=Wd),o}),qt=Ul();Tt?((Tt.exports=qt)._=qt,Br._=qt):fe._=qt}).call(sv)})(Cn,Cn.exports)),Cn.exports}var ov=av();const Hi=f=>{const s=ov.startCase(f).toLowerCase();return s.charAt(0).toUpperCase()+s.slice(1)},uv=["src/application.config.ts","src/application-config.ts","src/applicationConfig.ts"],No=/serverVariables\s*:\s*\{/,lv=/defineApplication\s*\(\s*\{/,cv=async({projectRoot:f,variables:s})=>{const r=await fv(f);if(r===null)return{status:"skipped-no-config"};const l=await tt.readFile(r,"utf8"),p=s.filter(P=>!new RegExp(`\\b${P.name}\\s*:`).test(l));if(p.length===0)return{status:"skipped-existing"};const I=dv(p);if(No.test(l)){const P=l.replace(No,D=>`${D}
22
+ ${I}`);return await tt.writeFile(r,P,"utf8"),{status:"appended",file:r}}if(!lv.test(l))return{status:"skipped-no-app-call"};const x=l.replace(/\n(\s*)\}\s*\)\s*;?\s*$/,(P,D)=>{const z=pv(p,D);return`
23
+ ${D}${z}
24
+ ${D}});
25
+ `});return x===l?{status:"skipped-no-app-call"}:(await tt.writeFile(r,x,"utf8"),{status:"created",file:r})},fv=async f=>{for(const s of uv){const r=`${f}/${s}`;if(await v.pathExists(r))return r}return null},dv=f=>f.map(({name:s,description:r,isSecret:l})=>` ${s}: {
26
+ description: ${JSON.stringify(r)},
27
+ isSecret: ${l},
28
+ isRequired: true,
29
+ },`).join(`
30
+ `),pv=(f,s)=>`serverVariables: {
31
+ ${f.map(({name:l,description:p,isSecret:I})=>`${s} ${l}: {
32
+ ${s} description: ${JSON.stringify(p)},
33
+ ${s} isSecret: ${I},
34
+ ${s} isRequired: true,
35
+ ${s} },`).join(`
36
+ `)}
37
+ ${s}},`,hv=({data:f})=>{const s=te.v4(),r=f.description?`
29
38
  description: '${f.description}',`:"";return`import { defineField, FieldType } from 'twenty-sdk/define';
30
39
 
31
40
  export default defineField({
32
- universalIdentifier: '${a}',
41
+ universalIdentifier: '${s}',
33
42
  name: '${f.name}',
34
43
  label: '${f.label}',
35
44
  type: FieldType.${f.type},
36
- objectUniversalIdentifier: '${f.objectUniversalIdentifier}',${i}
45
+ objectUniversalIdentifier: '${f.objectUniversalIdentifier}',${r}
37
46
  });
38
- `},pe=f=>f.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/([A-Z])([A-Z][a-z])/g,"$1-$2").replace(/([a-zA-Z])(\d)/g,"$1-$2").replace(/(\d)([a-zA-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").replace(/[^a-zA-Z0-9-]+/g,"-").toLowerCase(),ov=({name:f,universalIdentifier:a=re.v4()})=>{const i=pe(f);return`import { defineFrontComponent } from 'twenty-sdk/define';
47
+ `},ce=f=>f.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/([A-Z])([A-Z][a-z])/g,"$1-$2").replace(/([a-zA-Z])(\d)/g,"$1-$2").replace(/(\d)([a-zA-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").replace(/[^a-zA-Z0-9-]+/g,"-").toLowerCase(),gv=({name:f,universalIdentifier:s=te.v4()})=>{const r=ce(f);return`import { defineFrontComponent } from 'twenty-sdk/define';
39
48
 
40
49
  // React component - implement your UI here
41
50
  const Component = () => {
42
51
  return (
43
52
  <div style={{ padding: '20px', fontFamily: 'sans-serif' }}>
44
53
  <h1>My new component!</h1>
45
- <p>This is your front component: ${i}</p>
54
+ <p>This is your front component: ${r}</p>
46
55
  </div>
47
56
  );
48
57
  };
49
58
 
50
59
  export default defineFrontComponent({
51
- universalIdentifier: '${a}',
52
- name: '${i}',
60
+ universalIdentifier: '${s}',
61
+ name: '${r}',
53
62
  description: 'Add a description for your front component',
54
63
  component: Component,
55
64
  });
56
- `},uv=({name:f,universalIdentifier:a=re.v4()})=>{const i=pe(f);return`import { defineLogicFunction } from 'twenty-sdk/define';
65
+ `},vv=({name:f,universalIdentifier:s=te.v4()})=>{const r=ce(f);return`import { defineLogicFunction } from 'twenty-sdk/define';
57
66
 
58
67
  // Logic function handler - rename and implement your logic
59
68
  const handler = async (params: {
@@ -69,15 +78,15 @@ const handler = async (params: {
69
78
  };
70
79
 
71
80
  export default defineLogicFunction({
72
- universalIdentifier: '${a}',
73
- name: '${i}',
81
+ universalIdentifier: '${s}',
82
+ name: '${r}',
74
83
  description: 'Add a description for your logic function',
75
84
  timeoutSeconds: 5,
76
85
  handler,
77
86
  // Add your trigger here
78
87
  // Route trigger example:
79
88
  // httpRouteTriggerSettings: {
80
- // path: '/${i}',
89
+ // path: '/${r}',
81
90
  // httpMethod: 'POST',
82
91
  // isAuthRequired: true,
83
92
  // },
@@ -90,26 +99,26 @@ export default defineLogicFunction({
90
99
  // eventName: 'objectName.created',
91
100
  // },
92
101
  });
93
- `},Lo=({name:f,universalIdentifier:a=re.v4(),type:i,viewUniversalIdentifier:l,targetObjectUniversalIdentifier:d})=>{const E=pe(f);let I;return i==="OBJECT"&&d?I=` type: 'OBJECT',
94
- targetObjectUniversalIdentifier: '${d}',`:i==="VIEW"&&l?I=` type: 'VIEW',
95
- viewUniversalIdentifier: '${l}',`:i==="LINK"?I=` type: 'LINK',
96
- link: 'https://example.com',`:i==="FOLDER"?I=" type: 'FOLDER',":I=` type: 'VIEW',
97
- // viewUniversalIdentifier: '...',`,`import { defineNavigationMenuItem } from 'twenty-sdk/define';
102
+ `},Oo=({name:f,universalIdentifier:s=te.v4(),type:r,viewUniversalIdentifier:l,targetObjectUniversalIdentifier:p})=>{const I=ce(f);let x;return r==="OBJECT"&&p?x=` type: NavigationMenuItemType.OBJECT,
103
+ targetObjectUniversalIdentifier: '${p}',`:r==="VIEW"&&l?x=` type: NavigationMenuItemType.VIEW,
104
+ viewUniversalIdentifier: '${l}',`:r==="LINK"?x=` type: NavigationMenuItemType.LINK,
105
+ link: 'https://example.com',`:r==="FOLDER"?x=" type: NavigationMenuItemType.FOLDER,":x=` type: NavigationMenuItemType.VIEW,
106
+ // viewUniversalIdentifier: '...',`,`import { defineNavigationMenuItem, NavigationMenuItemType } from 'twenty-sdk/define';
98
107
 
99
108
  export default defineNavigationMenuItem({
100
- universalIdentifier: '${a}',
101
- name: '${E}',
109
+ universalIdentifier: '${s}',
110
+ name: '${I}',
102
111
  icon: 'IconList',
103
112
  position: 0,
104
- ${I}
113
+ ${x}
105
114
  });
106
- `},lv=({data:f,universalIdentifier:a=re.v4(),nameFieldUniversalIdentifier:i=re.v4()})=>`import { defineObject, FieldType } from 'twenty-sdk/define';
115
+ `},mv=({data:f,universalIdentifier:s=te.v4(),nameFieldUniversalIdentifier:r=te.v4()})=>`import { defineObject, FieldType } from 'twenty-sdk/define';
107
116
 
108
117
  export const NAME_FIELD_UNIVERSAL_IDENTIFIER =
109
- '${i}';
118
+ '${r}';
110
119
 
111
120
  export default defineObject({
112
- universalIdentifier: '${a}',
121
+ universalIdentifier: '${s}',
113
122
  nameSingular: '${f.nameSingular}',
114
123
  namePlural: '${f.namePlural}',
115
124
  labelSingular: '${f.labelSingular}',
@@ -127,23 +136,32 @@ export default defineObject({
127
136
  },
128
137
  ],
129
138
  });
130
- `,cv=({name:f})=>`import { definePageLayout } from 'twenty-sdk/define';
139
+ `,yv=({name:f})=>`import { defineCommandMenuItem } from 'twenty-sdk/define';
140
+
141
+ export default defineCommandMenuItem({
142
+ universalIdentifier: '${te.v4()}',
143
+ frontComponentUniversalIdentifier:
144
+ 'replace-with-existing-front-component-uuid',
145
+ label: '${f}',
146
+ availabilityType: 'GLOBAL',
147
+ });
148
+ `,_v=({name:f})=>`import { definePageLayout } from 'twenty-sdk/define';
131
149
 
132
150
  export default definePageLayout({
133
- universalIdentifier: '${re.v4()}',
151
+ universalIdentifier: '${te.v4()}',
134
152
  name: '${f}',
135
153
  tabs: [
136
154
  {
137
- universalIdentifier: '${re.v4()}',
155
+ universalIdentifier: '${te.v4()}',
138
156
  title: 'Overview',
139
157
  widgets: [],
140
158
  },
141
159
  ],
142
160
  });
143
- `,fv=({name:f})=>`import { definePageLayoutTab, PageLayoutTabLayoutMode } from 'twenty-sdk/define';
161
+ `,wv=({name:f})=>`import { definePageLayoutTab, PageLayoutTabLayoutMode } from 'twenty-sdk/define';
144
162
 
145
163
  export default definePageLayoutTab({
146
- universalIdentifier: '${re.v4()}',
164
+ universalIdentifier: '${te.v4()}',
147
165
  pageLayoutUniversalIdentifier: 'replace-with-existing-page-layout-uuid',
148
166
  title: '${f}',
149
167
  position: 1000,
@@ -151,41 +169,41 @@ export default definePageLayoutTab({
151
169
  layoutMode: PageLayoutTabLayoutMode.CANVAS,
152
170
  widgets: [],
153
171
  });
154
- `,hv=({objectLabelSingular:f,objectUniversalIdentifier:a,fieldsWidgetViewUniversalIdentifier:i})=>`import { definePageLayout, PageLayoutTabLayoutMode } from 'twenty-sdk/define';
172
+ `,Sv=({objectLabelSingular:f,objectUniversalIdentifier:s,fieldsWidgetViewUniversalIdentifier:r})=>`import { definePageLayout, PageLayoutTabLayoutMode } from 'twenty-sdk/define';
155
173
 
156
174
  export default definePageLayout({
157
- universalIdentifier: '${re.v4()}',
175
+ universalIdentifier: '${te.v4()}',
158
176
  name: 'Default ${f} Layout',
159
177
  type: 'RECORD_PAGE',
160
- objectUniversalIdentifier: '${a}',
178
+ objectUniversalIdentifier: '${s}',
161
179
  tabs: [
162
180
  {
163
- universalIdentifier: '${re.v4()}',
181
+ universalIdentifier: '${te.v4()}',
164
182
  title: 'Home',
165
183
  position: 10,
166
184
  icon: 'IconHome',
167
185
  layoutMode: PageLayoutTabLayoutMode.VERTICAL_LIST,
168
186
  widgets: [
169
187
  {
170
- universalIdentifier: '${re.v4()}',
188
+ universalIdentifier: '${te.v4()}',
171
189
  title: 'Fields',
172
190
  type: 'FIELDS',
173
191
  configuration: {
174
192
  configurationType: 'FIELDS',
175
- viewUniversalIdentifier: '${i}',
193
+ viewUniversalIdentifier: '${r}',
176
194
  },
177
195
  },
178
196
  ],
179
197
  },
180
198
  {
181
- universalIdentifier: '${re.v4()}',
199
+ universalIdentifier: '${te.v4()}',
182
200
  title: 'Timeline',
183
201
  position: 20,
184
202
  icon: 'IconTimelineEvent',
185
203
  layoutMode: PageLayoutTabLayoutMode.CANVAS,
186
204
  widgets: [
187
205
  {
188
- universalIdentifier: '${re.v4()}',
206
+ universalIdentifier: '${te.v4()}',
189
207
  title: 'Timeline',
190
208
  type: 'TIMELINE',
191
209
  configuration: {
@@ -196,13 +214,13 @@ export default definePageLayout({
196
214
  },
197
215
  ],
198
216
  });
199
- `,dv=({name:f,universalIdentifier:a=re.v4()})=>{const i=pe(f);return`import { defineRole } from 'twenty-sdk/define';
217
+ `,Iv=({name:f,universalIdentifier:s=te.v4()})=>{const r=ce(f);return`import { defineRole } from 'twenty-sdk/define';
200
218
 
201
- export const ${i.toUpperCase().replace(/-/g,"_")}_ROLE_UNIVERSAL_IDENTIFIER =
202
- '${a}';
219
+ export const ${r.toUpperCase().replace(/-/g,"_")}_ROLE_UNIVERSAL_IDENTIFIER =
220
+ '${s}';
203
221
 
204
222
  export default defineRole({
205
- universalIdentifier: ${i.toUpperCase().replace(/-/g,"_")}_ROLE_UNIVERSAL_IDENTIFIER,
223
+ universalIdentifier: ${r.toUpperCase().replace(/-/g,"_")}_ROLE_UNIVERSAL_IDENTIFIER,
206
224
  label: '${f}',
207
225
  description: 'Add a description for your role',
208
226
  canReadAllObjectRecords: true,
@@ -210,41 +228,61 @@ export default defineRole({
210
228
  canSoftDeleteAllObjectRecords: true,
211
229
  canDestroyAllObjectRecords: false,
212
230
  });
213
- `},pv=({name:f,universalIdentifier:a=re.v4()})=>{const i=pe(f);return`import { defineAgent } from 'twenty-sdk/define';
231
+ `},xv=({name:f,universalIdentifier:s=te.v4()})=>{const r=ce(f);return`import { defineAgent } from 'twenty-sdk/define';
214
232
 
215
- export const ${i.toUpperCase().replace(/-/g,"_")}_AGENT_UNIVERSAL_IDENTIFIER =
216
- '${a}';
233
+ export const ${r.toUpperCase().replace(/-/g,"_")}_AGENT_UNIVERSAL_IDENTIFIER =
234
+ '${s}';
217
235
 
218
236
  export default defineAgent({
219
- universalIdentifier: ${i.toUpperCase().replace(/-/g,"_")}_AGENT_UNIVERSAL_IDENTIFIER,
220
- name: '${i}',
237
+ universalIdentifier: ${r.toUpperCase().replace(/-/g,"_")}_AGENT_UNIVERSAL_IDENTIFIER,
238
+ name: '${r}',
221
239
  label: '${f}',
222
240
  description: 'Add a description for your agent',
223
241
  prompt: 'Add the agent system prompt here',
224
242
  });
225
- `},gv=({name:f,universalIdentifier:a=re.v4()})=>{const i=pe(f);return`import { defineSkill } from 'twenty-sdk/define';
243
+ `},Ev=({name:f,universalIdentifier:s=te.v4()})=>{const r=ce(f),l=r.toUpperCase().replace(/-/g,"_"),p=f.replace(/\\/g,"\\\\").replace(/'/g,"\\'");return`import { defineConnectionProvider } from 'twenty-sdk/define';
244
+
245
+ export const ${l}_CONNECTION_PROVIDER_UNIVERSAL_IDENTIFIER =
246
+ '${s}';
247
+
248
+ export default defineConnectionProvider({
249
+ universalIdentifier: ${l}_CONNECTION_PROVIDER_UNIVERSAL_IDENTIFIER,
250
+ name: '${r}',
251
+ displayName: '${p}',
252
+ type: 'oauth',
253
+ oauth: {
254
+ // Replace with the OAuth provider's endpoints.
255
+ authorizationEndpoint: 'https://example.com/oauth/authorize',
256
+ tokenEndpoint: 'https://example.com/oauth/access_token',
257
+ scopes: [],
258
+ // Names of serverVariables declared on this app's defineApplication.
259
+ clientIdVariable: '${l}_CLIENT_ID',
260
+ clientSecretVariable: '${l}_CLIENT_SECRET',
261
+ },
262
+ });
263
+ `},Av=({name:f,universalIdentifier:s=te.v4()})=>{const r=ce(f);return`import { defineSkill } from 'twenty-sdk/define';
226
264
 
227
- export const ${i.toUpperCase().replace(/-/g,"_")}_SKILL_UNIVERSAL_IDENTIFIER =
228
- '${a}';
265
+ export const ${r.toUpperCase().replace(/-/g,"_")}_SKILL_UNIVERSAL_IDENTIFIER =
266
+ '${s}';
229
267
 
230
268
  export default defineSkill({
231
- universalIdentifier: ${i.toUpperCase().replace(/-/g,"_")}_SKILL_UNIVERSAL_IDENTIFIER,
232
- name: '${i}',
269
+ universalIdentifier: ${r.toUpperCase().replace(/-/g,"_")}_SKILL_UNIVERSAL_IDENTIFIER,
270
+ name: '${r}',
233
271
  label: '${f}',
234
272
  description: 'Add a description for your skill',
235
273
  content: 'Add the skill content here',
236
274
  });
237
- `},vv=({field:f,index:a,objectUniversalIdentifier:i})=>{const l=f.universalIdentifier??re.v4(),d=f.position??a,E=f.isVisible??!0,I=f.size??200,N="defaultFieldName"in f?` fieldMetadataUniversalIdentifier: generateDefaultFieldUniversalIdentifier({
238
- objectUniversalIdentifier: '${i}',
275
+ `},bv=({field:f,index:s,objectUniversalIdentifier:r})=>{const l=f.universalIdentifier??te.v4(),p=f.position??s,I=f.isVisible??!0,x=f.size??200,P="defaultFieldName"in f?` fieldMetadataUniversalIdentifier: generateDefaultFieldUniversalIdentifier({
276
+ objectUniversalIdentifier: '${r}',
239
277
  fieldName: '${f.defaultFieldName}',
240
278
  })`:` fieldMetadataUniversalIdentifier: '${f.fieldMetadataUniversalIdentifier}'`;return` {
241
279
  universalIdentifier: '${l}',
242
- ${N},
243
- position: ${d},
244
- isVisible: ${E},
245
- size: ${I},
246
- }`},Ki=({name:f,universalIdentifier:a=re.v4(),objectUniversalIdentifier:i="fill-later",fields:l=[],type:d})=>{const E=pe(f),I=l.some(K=>"defaultFieldName"in K),q=l.length>0?` fields: [
247
- ${l.map((K,Ze)=>vv({field:K,index:Ze,objectUniversalIdentifier:i})).join(`,
280
+ ${P},
281
+ position: ${p},
282
+ isVisible: ${I},
283
+ size: ${x},
284
+ }`},zi=({name:f,universalIdentifier:s=te.v4(),objectUniversalIdentifier:r="fill-later",fields:l=[],type:p})=>{const I=ce(f),x=l.some(K=>"defaultFieldName"in K),D=l.length>0?` fields: [
285
+ ${l.map((K,Ye)=>bv({field:K,index:Ye,objectUniversalIdentifier:r})).join(`,
248
286
  `)},
249
287
  ],`:` // fields: [
250
288
  // {
@@ -253,19 +291,19 @@ ${l.map((K,Ze)=>vv({field:K,index:Ze,objectUniversalIdentifier:i})).join(`,
253
291
  // position: 0,
254
292
  // isVisible: true,
255
293
  // },
256
- // ],`,te=d!==void 0?` type: '${d}',
257
- `:"";return`${I?`import {
294
+ // ],`,z=p!==void 0?` type: '${p}',
295
+ `:"";return`${x?`import {
258
296
  defineView,
259
297
  generateDefaultFieldUniversalIdentifier,
260
298
  } from 'twenty-sdk/define';`:"import { defineView } from 'twenty-sdk/define';"}
261
299
 
262
300
  export default defineView({
263
- universalIdentifier: '${a}',
264
- name: '${E}',
265
- objectUniversalIdentifier: '${i}',
266
- ${te} icon: 'IconList',
301
+ universalIdentifier: '${s}',
302
+ name: '${I}',
303
+ objectUniversalIdentifier: '${r}',
304
+ ${z} icon: 'IconList',
267
305
  position: 0,
268
- ${q}
306
+ ${D}
269
307
  // filters: [
270
308
  // {
271
309
  // universalIdentifier: '...',
@@ -282,10 +320,14 @@ ${q}
282
320
  // },
283
321
  // ],
284
322
  });
285
- `},xr="src";class mv{async execute(a,i){try{const l=a??await this.getEntity(),d=this.getFolderName(l),E=i?z.join(ee,i):z.join(ee,xr,d);await v.ensureDir(E);const{name:I,file:N}=await this.getEntityData(l),q=z.join(E,this.getFileName(I,l));if(await v.pathExists(q)){const{overwrite:te}=await this.handleFileExist();if(!te)return}await Dt.writeFile(q,N),console.log(_.default.green(`✓ Created ${d}:`),_.default.cyan(z.relative(ee,q))),l===v.e.Object&&await this.promptAndCreateObjectCompanions(I,i)}catch(l){console.error(_.default.red("Add new entity failed:"),l instanceof Error?l.message:l),process.exit(1)}}async getEntityData(a){switch(a){case v.e.Object:{const i=await this.getObjectData(),l=i.nameSingular,d=re.v4(),E=re.v4();this.lastObjectUniversalIdentifier=d,this.lastNameFieldUniversalIdentifier=E,this.lastObjectLabelSingular=i.labelSingular;const I=lv({data:i,universalIdentifier:d,nameFieldUniversalIdentifier:E});return{name:l,file:I}}case v.e.Field:{const i=await this.getFieldData(),l=i.name,d=av({data:i});return{name:l,file:d}}case v.e.LogicFunction:{const i=await this.getEntityName(a),l=uv({name:i});return{name:i,file:l}}case v.e.FrontComponent:{const i=await this.getEntityName(a),l=ov({name:i});return{name:i,file:l}}case v.e.Role:{const i=await this.getEntityName(a),l=dv({name:i});return{name:i,file:l}}case v.e.Skill:{const i=await this.getEntityName(a),l=gv({name:i});return{name:i,file:l}}case v.e.Agent:{const i=await this.getEntityName(a),l=pv({name:i});return{name:i,file:l}}case v.e.View:{const l=(await this.getViewData()).name,d=Ki({name:l});return{name:l,file:d}}case v.e.NavigationMenuItem:{const i=await this.getEntityName(a),l=Lo({name:i});return{name:i,file:l}}case v.e.PageLayout:{const i=await this.getEntityName(a),l=cv({name:i});return{name:i,file:l}}case v.e.PageLayoutTab:{const i=await this.getEntityName(a),l=fv({name:i});return{name:i,file:l}}default:v.Te()}}async promptAndCreateObjectCompanions(a,i){const{createCompanions:l}=await Ge.default.prompt([{type:"confirm",name:"createCompanions",message:"Also create a view, navigation menu item, and record page layout for this object? (recommended)",default:!0}]);if(!l||!this.lastObjectUniversalIdentifier)return;const d=re.v4(),E=re.v4(),I=Ki({name:`all-${pe(a)}`,universalIdentifier:d,objectUniversalIdentifier:this.lastObjectUniversalIdentifier,fields:this.lastNameFieldUniversalIdentifier?[{fieldMetadataUniversalIdentifier:this.lastNameFieldUniversalIdentifier,position:0,isVisible:!0,size:200}]:[]}),N=i?z.join(ee,i):z.join(ee,xr,this.getFolderName(v.e.View));await v.ensureDir(N);const q=`all-${pe(a)}.ts`,te=z.join(N,q);if(await v.pathExists(te)){const{overwrite:Ee}=await this.handleFileExist();if(!Ee)return}await Dt.writeFile(te,I),console.log(_.default.green("✓ Created view:"),_.default.cyan(z.relative(ee,te)));const X=this.buildRecordPageFieldsViewFields(this.lastNameFieldUniversalIdentifier),K=Ki({name:`${pe(a)}-record-page-fields`,universalIdentifier:E,objectUniversalIdentifier:this.lastObjectUniversalIdentifier,type:v.TE.FIELDS_WIDGET,fields:X}),Ze=`${pe(a)}-record-page-fields.ts`,k=z.join(N,Ze);if(await v.pathExists(k)){const{overwrite:Ee}=await this.handleFileExist();if(!Ee)return}await Dt.writeFile(k,K),console.log(_.default.green("✓ Created record-page-fields view:"),_.default.cyan(z.relative(ee,k)));const W=Lo({name:a,type:"OBJECT",targetObjectUniversalIdentifier:this.lastObjectUniversalIdentifier}),Pe=i?z.join(ee,i):z.join(ee,xr,this.getFolderName(v.e.NavigationMenuItem));await v.ensureDir(Pe);const xe=`${pe(a)}.ts`,je=z.join(Pe,xe);if(await v.pathExists(je)){const{overwrite:Ee}=await this.handleFileExist();if(!Ee)return}await Dt.writeFile(je,W),console.log(_.default.green("✓ Created navigation menu item:"),_.default.cyan(z.relative(ee,je)));const Cn=hv({objectLabelSingular:this.lastObjectLabelSingular??a,objectUniversalIdentifier:this.lastObjectUniversalIdentifier,fieldsWidgetViewUniversalIdentifier:E}),Le=i?z.join(ee,i):z.join(ee,xr,this.getFolderName(v.e.PageLayout));await v.ensureDir(Le);const At=`${pe(a)}-record-page-layout.ts`,Ie=z.join(Le,At);if(await v.pathExists(Ie)){const{overwrite:Ee}=await this.handleFileExist();if(!Ee)return}await Dt.writeFile(Ie,Cn),console.log(_.default.green("✓ Created record page layout:"),_.default.cyan(z.relative(ee,Ie)))}buildRecordPageFieldsViewFields(a){const l=["createdAt","updatedAt","createdBy","updatedBy"].map(E=>({defaultFieldName:E,isVisible:!0,size:200}));return(a?[{fieldMetadataUniversalIdentifier:a,isVisible:!0,size:200},...l]:l).map((E,I)=>({...E,position:I}))}async getEntity(){const{entity:a}=await Ge.default.prompt([{type:"select",name:"entity",message:"What entity do you want to create?",default:"",choices:Object.values(v.e)}]);return a}async handleFileExist(){return await Ge.default.prompt([{type:"confirm",name:"overwrite",message:"File already exists. Do you want to overwrite it?",default:!1}])}async getEntityName(a){const{name:i}=await Ge.default.prompt([{type:"input",name:"name",message:`Enter a name for your new ${a}:`,default:"",validate:l=>l.length===0?`${a} name is required`:!0}]);return i}async getFieldData(){return Ge.default.prompt([{type:"input",name:"name",message:"Enter a name for your field:",default:"",validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"label",message:"Enter a label for your field:",default:a=>zi(a.name),validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"select",name:"type",message:"Select the field type:",choices:Object.values(v.R),default:v.R.TEXT},{type:"input",name:"objectUniversalIdentifier",message:"Enter the universalIdentifier of the object this field belongs to:",default:"fill-later",validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"description",message:"Enter a description for your field (optional):",default:""}])}async getObjectData(){return Ge.default.prompt([{type:"input",name:"nameSingular",message:"Enter a name singular for your object (eg: company):",default:"",validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"namePlural",message:"Enter a name plural for your object (eg: companies):",default:"",validate:(a,i)=>a.trim()===i?.nameSingular.trim()?"Name plural must be different from name singular":!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"labelSingular",message:"Enter a label singular for your object:",default:a=>zi(a.nameSingular),validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"labelPlural",message:"Enter a label plural for your object:",default:a=>zi(a.namePlural),validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0}])}async getViewData(){return Ge.default.prompt([{type:"input",name:"name",message:"Enter a name for your view:",default:"",validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"objectUniversalIdentifier",message:"Enter the universalIdentifier of the object this view belongs to:",default:"fill-later",validate:a=>!a||a.trim().length===0?"Please enter a non empty string":!0}])}getFolderName(a){return`${pe(a)}s`}getFileName(a,i){switch(i){case v.e.FrontComponent:return`${pe(a)}.tsx`;default:return`${pe(a)}.ts`}}}const yv="2.1.0",Go={version:yv},_v=async f=>{const a=z.join(f,"package.json");if(await v.pathExists(a))try{const i=await Dt.readFile(a,"utf-8"),l=JSON.parse(i);return l.dependencies?.["twenty-sdk"]??l.devDependencies?.["twenty-sdk"]??void 0}catch{return}},Oo=f=>{const a=f.match(/(\d+)\./);if(a)return parseInt(a[1],10);const i=f.match(/^[~^>=<]*(\d+)$/);return i?parseInt(i[1],10):null},en=async f=>{const a=Go.version,i=await _v(f);if(!i)return;const l=Oo(a),d=Oo(i);l===null||d===null||l!==d&&(console.warn(_.default.yellow(`⚠ Version mismatch: your app requires twenty-sdk@${d}.x but the CLI running is v${a}. Major version mismatches may cause unexpected behavior.
286
- Update with: npm install -g twenty-sdk@${d}`)),console.warn(""))};class wv{async execute(a){const i=a.appPath??ee;await en(i),console.log(_.default.blue("Building application...")),console.log(_.default.gray(`App path: ${i}
287
- `));const l=await v.appBuild({appPath:i,tarball:a.tarball,onProgress:d=>console.log(_.default.gray(d))});l.success||(console.error(_.default.red(l.error.message)),process.exit(1)),console.log(_.default.green(`✓ Build succeeded (${l.data.fileCount} file${l.data.fileCount===1?"":"s"})`)),console.log(_.default.gray(`Output: ${l.data.outputDir}`)),l.data.tarballPath&&console.log(_.default.gray(`Tarball: ${l.data.tarballPath}`))}}class Sv{async execute(a){a.remote&&v.ConfigService.setActiveRemote(a.remote),console.log(_.default.blue("Syncing marketplace catalog..."));const l=await new v.ApiService().syncMarketplaceCatalog();l.success||(console.error(_.default.red(`Catalog sync failed: ${l.error instanceof Error?l.error.message:String(l.error)}`)),process.exit(1)),console.log(_.default.green("✓ Marketplace catalog synced successfully"))}}class xv{async execute(a){const i=a.appPath??ee;await en(i),console.log(_.default.blue("Deploying application...")),console.log(_.default.gray(`App path: ${i}
288
- `));const l=I=>console.log(_.default.gray(I)),d=await v.appBuild({appPath:i,tarball:!0,onProgress:l});d.success||(console.error(_.default.red(d.error.message)),process.exit(1));const E=await v.appDeploy({tarballPath:d.data.tarballPath,remote:a.remote,onProgress:l});E.success||(console.error(_.default.red(E.error.message)),process.exit(1)),console.log(_.default.green("✓ Deployed successfully"))}}class Iv{constructor({state:a,notify:i}){this.state=a,this.notify=i}async execute(a){const i=this.state.steps.buildManifest;i.status="in_progress",this.state.updatePipeline({status:"building"});const l=[{message:"Building manifest",status:"info"}],d=await v.buildAndValidateManifest(a.appPath);if(!d.success){for(const I of d.errors)l.push({message:I,status:"error"});return i.output={result:null},i.status="error",this.state.updatePipeline({status:"error"}),this.state.applyStepEvents(l),null}if(d.warnings.length>0)for(const I of d.warnings)l.push({message:`⚠ ${I}`,status:"warning"});l.push({message:"Successfully built manifest",status:"success"});const E={manifest:d.manifest,filePaths:d.filePaths};return i.output={result:E},i.status="done",this.state.updatePipeline({appName:d.manifest.application.displayName}),this.state.updateEntitiesFromManifest(d.filePaths),this.state.applyStepEvents(l),E}}class Ev{constructor({apiService:a,state:i,notify:l}){this.hasRetried=!1,this.apiService=a,this.state=i,this.notify=l}async execute(){const a=this.state.steps.checkServer,i=await this.apiService.validateAuth();if(!i.serverUp){const d=await v.detectLocalServer();return d&&!this.hasRetried?(this.hasRetried=!0,await new v.ConfigService().setConfig({apiUrl:d}),this.execute()):(a.output.errorLogged||(a.output={isReady:!1,errorLogged:!0},a.status="error",this.state.applyStepEvents([{message:`Cannot reach Twenty server.
323
+ `},Cv="src/application.config.ts",Ir="src";class Tv{async execute(s,r){try{const l=s??await this.getEntity(),p=this.getFolderName(l),I=r?q.join(Q,r):q.join(Q,Ir,p);await v.ensureDir(I);const{name:x,file:P}=await this.getEntityData(l),D=q.join(I,this.getFileName(x,l));if(await v.pathExists(D)){const{overwrite:z}=await this.handleFileExist();if(!z)return}await tt.writeFile(D,P),console.log(y.default.green(`✓ Created ${p}:`),y.default.cyan(q.relative(Q,D))),l===v.e.Object&&await this.promptAndCreateObjectCompanions(x,r),l===v.e.ConnectionProvider&&await this.registerConnectionProviderServerVariables(x)}catch(l){console.error(y.default.red("Add new entity failed:"),l instanceof Error?l.message:l),process.exit(1)}}async getEntityData(s){switch(s){case v.e.Object:{const r=await this.getObjectData(),l=r.nameSingular,p=te.v4(),I=te.v4();this.lastObjectUniversalIdentifier=p,this.lastNameFieldUniversalIdentifier=I,this.lastObjectLabelSingular=r.labelSingular;const x=mv({data:r,universalIdentifier:p,nameFieldUniversalIdentifier:I});return{name:l,file:x}}case v.e.Field:{const r=await this.getFieldData(),l=r.name,p=hv({data:r});return{name:l,file:p}}case v.e.LogicFunction:{const r=await this.getEntityName(s),l=vv({name:r});return{name:r,file:l}}case v.e.FrontComponent:{const r=await this.getEntityName(s),l=gv({name:r});return{name:r,file:l}}case v.e.Role:{const r=await this.getEntityName(s),l=Iv({name:r});return{name:r,file:l}}case v.e.Skill:{const r=await this.getEntityName(s),l=Av({name:r});return{name:r,file:l}}case v.e.Agent:{const r=await this.getEntityName(s),l=xv({name:r});return{name:r,file:l}}case v.e.ConnectionProvider:{const r=await this.getEntityName(s),l=Ev({name:r});return{name:r,file:l}}case v.e.View:{const l=(await this.getViewData()).name,p=zi({name:l});return{name:l,file:p}}case v.e.NavigationMenuItem:{const r=await this.getEntityName(s),l=Oo({name:r});return{name:r,file:l}}case v.e.PageLayout:{const r=await this.getEntityName(s),l=_v({name:r});return{name:r,file:l}}case v.e.PageLayoutTab:{const r=await this.getEntityName(s),l=wv({name:r});return{name:r,file:l}}case v.e.CommandMenuItem:{const r=await this.getEntityName(s),l=yv({name:r});return{name:r,file:l}}default:v.v()}}async promptAndCreateObjectCompanions(s,r){const{createCompanions:l}=await Ge.default.prompt([{type:"confirm",name:"createCompanions",message:"Also create a view, navigation menu item, and record page layout for this object? (recommended)",default:!0}]);if(!l||!this.lastObjectUniversalIdentifier)return;const p=te.v4(),I=te.v4(),x=zi({name:`all-${ce(s)}`,universalIdentifier:p,objectUniversalIdentifier:this.lastObjectUniversalIdentifier,fields:this.lastNameFieldUniversalIdentifier?[{fieldMetadataUniversalIdentifier:this.lastNameFieldUniversalIdentifier,position:0,isVisible:!0,size:200}]:[]}),P=r?q.join(Q,r):q.join(Q,Ir,this.getFolderName(v.e.View));await v.ensureDir(P);const D=`all-${ce(s)}.ts`,z=q.join(P,D);if(await v.pathExists(z)){const{overwrite:Ee}=await this.handleFileExist();if(!Ee)return}await tt.writeFile(z,x),console.log(y.default.green("✓ Created view:"),y.default.cyan(q.relative(Q,z)));const Z=this.buildRecordPageFieldsViewFields(this.lastNameFieldUniversalIdentifier),K=zi({name:`${ce(s)}-record-page-fields`,universalIdentifier:I,objectUniversalIdentifier:this.lastObjectUniversalIdentifier,type:v.rE.FIELDS_WIDGET,fields:Z}),Ye=`${ce(s)}-record-page-fields.ts`,G=q.join(P,Ye);if(await v.pathExists(G)){const{overwrite:Ee}=await this.handleFileExist();if(!Ee)return}await tt.writeFile(G,K),console.log(y.default.green("✓ Created record-page-fields view:"),y.default.cyan(q.relative(Q,G)));const W=Oo({name:s,type:"OBJECT",targetObjectUniversalIdentifier:this.lastObjectUniversalIdentifier}),Pe=r?q.join(Q,r):q.join(Q,Ir,this.getFolderName(v.e.NavigationMenuItem));await v.ensureDir(Pe);const Ie=`${ce(s)}.ts`,Je=q.join(Pe,Ie);if(await v.pathExists(Je)){const{overwrite:Ee}=await this.handleFileExist();if(!Ee)return}await tt.writeFile(Je,W),console.log(y.default.green("✓ Created navigation menu item:"),y.default.cyan(q.relative(Q,Je)));const Tn=Sv({objectLabelSingular:this.lastObjectLabelSingular??s,objectUniversalIdentifier:this.lastObjectUniversalIdentifier,fieldsWidgetViewUniversalIdentifier:I}),Le=r?q.join(Q,r):q.join(Q,Ir,this.getFolderName(v.e.PageLayout));await v.ensureDir(Le);const bt=`${ce(s)}-record-page-layout.ts`,xe=q.join(Le,bt);if(await v.pathExists(xe)){const{overwrite:Ee}=await this.handleFileExist();if(!Ee)return}await tt.writeFile(xe,Tn),console.log(y.default.green("✓ Created record page layout:"),y.default.cyan(q.relative(Q,xe)))}async registerConnectionProviderServerVariables(s){const r=ce(s).toUpperCase().replace(/-/g,"_"),l=[{name:`${r}_CLIENT_ID`,description:"OAuth client ID issued by the third-party provider. Filled in once by the server admin on the application registration.",isSecret:!1},{name:`${r}_CLIENT_SECRET`,description:"OAuth client secret issued by the third-party provider. Stored encrypted; never echoed in API responses.",isSecret:!0}],p=await cv({projectRoot:Q,variables:l});switch(p.status){case"appended":case"created":{console.log(y.default.green(`✓ Added ${l.map(I=>I.name).join(" + ")} to defineApplication.serverVariables:`),y.default.cyan(q.relative(Q,p.file)));break}case"skipped-existing":console.log(y.default.dim(` (${l.map(I=>I.name).join(" / ")} already declared on defineApplication.serverVariables)`));break;case"skipped-no-config":case"skipped-no-app-call":console.log(y.default.yellow(`! Couldn't auto-update ${Cv}. Add these manually to defineApplication.serverVariables:
324
+ `+l.map(I=>` ${I.name}: { description: '...', isSecret: ${I.isSecret}, isRequired: true },`).join(`
325
+ `)));break}}buildRecordPageFieldsViewFields(s){const l=["createdAt","updatedAt","createdBy","updatedBy"].map(I=>({defaultFieldName:I,isVisible:!0,size:200}));return(s?[{fieldMetadataUniversalIdentifier:s,isVisible:!0,size:200},...l]:l).map((I,x)=>({...I,position:x}))}async getEntity(){const{entity:s}=await Ge.default.prompt([{type:"select",name:"entity",message:"What entity do you want to create?",default:"",choices:Object.values(v.e)}]);return s}async handleFileExist(){return await Ge.default.prompt([{type:"confirm",name:"overwrite",message:"File already exists. Do you want to overwrite it?",default:!1}])}async getEntityName(s){const{name:r}=await Ge.default.prompt([{type:"input",name:"name",message:`Enter a name for your new ${s}:`,default:"",validate:l=>l.length===0?`${s} name is required`:!0}]);return r}async getFieldData(){return Ge.default.prompt([{type:"input",name:"name",message:"Enter a name for your field:",default:"",validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"label",message:"Enter a label for your field:",default:s=>Hi(s.name),validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"select",name:"type",message:"Select the field type:",choices:Object.values(v.R),default:v.R.TEXT},{type:"input",name:"objectUniversalIdentifier",message:"Enter the universalIdentifier of the object this field belongs to:",default:"fill-later",validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"description",message:"Enter a description for your field (optional):",default:""}])}async getObjectData(){return Ge.default.prompt([{type:"input",name:"nameSingular",message:"Enter a name singular for your object (eg: company):",default:"",validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"namePlural",message:"Enter a name plural for your object (eg: companies):",default:"",validate:(s,r)=>s.trim()===r?.nameSingular.trim()?"Name plural must be different from name singular":!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"labelSingular",message:"Enter a label singular for your object:",default:s=>Hi(s.nameSingular),validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"labelPlural",message:"Enter a label plural for your object:",default:s=>Hi(s.namePlural),validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0}])}async getViewData(){return Ge.default.prompt([{type:"input",name:"name",message:"Enter a name for your view:",default:"",validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0},{type:"input",name:"objectUniversalIdentifier",message:"Enter the universalIdentifier of the object this view belongs to:",default:"fill-later",validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0}])}getFolderName(s){return`${ce(s)}s`}getFileName(s,r){return r===v.e.FrontComponent?`${ce(s)}.tsx`:`${ce(s)}.ts`}}const Rv="2.3.0",Vo={version:Rv},Fv=async f=>{const s=q.join(f,"package.json");if(await v.pathExists(s))try{const r=await tt.readFile(s,"utf-8"),l=JSON.parse(r);return l.dependencies?.["twenty-sdk"]??l.devDependencies?.["twenty-sdk"]??void 0}catch{return}},$o=f=>{const s=f.match(/(\d+)\./);if(s)return parseInt(s[1],10);const r=f.match(/^[~^>=<]*(\d+)$/);return r?parseInt(r[1],10):null},en=async f=>{const s=Vo.version,r=await Fv(f);if(!r)return;const l=$o(s),p=$o(r);l===null||p===null||l!==p&&(console.warn(y.default.yellow(`⚠ Version mismatch: your app requires twenty-sdk@${p}.x but the CLI running is v${s}. Major version mismatches may cause unexpected behavior.
326
+ Update with: npm install -g twenty-sdk@${p}`)),console.warn(""))};class Pv{async execute(s){const r=s.appPath??Q;await en(r),console.log(y.default.blue("Building application...")),console.log(y.default.gray(`App path: ${r}
327
+ `));const l=await v.appBuild({appPath:r,tarball:s.tarball,onProgress:p=>console.log(y.default.gray(p))});l.success||(console.error(y.default.red(l.error.message)),process.exit(1)),console.log(y.default.green(`✓ Build succeeded (${l.data.fileCount} file${l.data.fileCount===1?"":"s"})`)),console.log(y.default.gray(`Output: ${l.data.outputDir}`)),l.data.tarballPath&&console.log(y.default.gray(`Tarball: ${l.data.tarballPath}`))}}class qo{async execute(s){s.remote&&v.ConfigService.setActiveRemote(s.remote),console.log(y.default.blue("Syncing marketplace catalog..."));const l=await new v.ApiService().syncMarketplaceCatalog();l.success||(console.error(y.default.red(`Catalog sync failed: ${l.error instanceof Error?l.error.message:String(l.error)}`)),process.exit(1)),console.log(y.default.green("✓ Marketplace catalog synced successfully"))}}class Lv{async execute(s){const r=s.appPath??Q;await en(r),console.log(y.default.blue("Deploying application...")),console.log(y.default.gray(`App path: ${r}
328
+ `));const l=Z=>console.log(y.default.gray(Z)),p=await v.appBuild({appPath:r,tarball:!0,onProgress:l});p.success||(console.error(y.default.red(p.error.message)),process.exit(1));const I=await v.appDeploy({tarballPath:p.data.tarballPath,remote:s.remote,onProgress:l});I.success||(console.error(y.default.red(I.error.message)),process.exit(1));const x=await v.readJson(Yi.default.join(r,"package.json")).catch(()=>{}),P=x?.name??I.data.name,D=x?.version??"unknown",z=v.ConfigService.getActiveRemote();console.log(y.default.green(`
329
+ ✓ Published ${P} v${D} to ${z}
330
+ `)),console.log(" To install deployed application: `yarn twenty install`")}}class Nv{constructor({state:s,notify:r}){this.state=s,this.notify=r}async execute(s){const r=this.state.steps.buildManifest;r.status="in_progress",this.state.updatePipeline({status:"building"});const l=[{message:"Building manifest",status:"info"}],p=await v.buildAndValidateManifest(s.appPath);if(!p.success){for(const x of p.errors)l.push({message:x,status:"error"});return r.output={result:null},r.status="error",this.state.updatePipeline({status:"error"}),this.state.applyStepEvents(l),null}if(p.warnings.length>0)for(const x of p.warnings)l.push({message:`⚠ ${x}`,status:"warning"});l.push({message:"Successfully built manifest",status:"success"});const I={manifest:p.manifest,filePaths:p.filePaths};return r.output={result:I},r.status="done",this.state.updatePipeline({appName:p.manifest.application.displayName}),this.state.updateEntitiesFromManifest(p.filePaths),this.state.applyStepEvents(l),I}}class Ov{constructor({apiService:s,state:r,notify:l}){this.hasRetried=!1,this.apiService=s,this.state=r,this.notify=l}async execute(){const s=this.state.steps.checkServer,r=await this.apiService.validateAuth();if(!r.serverUp){const p=await v.detectLocalServer();return p&&!this.hasRetried?(this.hasRetried=!0,await new v.ConfigService().setConfig({apiUrl:p}),this.execute()):(s.output.errorLogged||(s.output={isReady:!1,errorLogged:!0},s.status="error",this.state.applyStepEvents([{message:`Cannot reach Twenty server.
289
331
 
290
332
  Start a local server:
291
333
  yarn twenty server start
@@ -293,19 +335,19 @@ ${q}
293
335
  Check server status:
294
336
  yarn twenty server status
295
337
 
296
- Waiting for server...`,status:"error"}]),this.state.updatePipeline({status:"error"})),!1)}if(!i.authValid)return a.output.errorLogged||(a.output={isReady:!1,errorLogged:!0},a.status="error",this.state.applyStepEvents([{message:"Authentication failed. Run `yarn twenty remote add --local` to authenticate.",status:"error"}]),this.state.updatePipeline({status:"error"})),!1;const l=a.output.isReady;return a.output={isReady:!0,errorLogged:!1},a.status="done",l||this.notify(),!0}}class Av{constructor({clientService:a,configService:i,state:l,notify:d}){this.clientService=a,this.configService=i,this.state=l,this.notify=d}async execute(a){const i=this.state.steps.generateApiClient;i.status="in_progress",this.notify();try{const l=await v.ensureAppAccessTokenIsValidOrRefresh(this.configService,a.credentials);await this.clientService.generateCoreClient({appPath:a.appPath,appAccessToken:l}),i.status="done"}catch(l){this.state.applyStepEvents([{message:`Failed to generate API client: ${l instanceof Error?l.message:String(l)}`,status:"error"}]),i.status="error"}this.notify()}}class bv{constructor({apiService:a,configService:i,state:l,notify:d}){this.apiService=a,this.configService=i,this.state=l,this.notify=d}async execute(a){try{const i=await v.ensureAppRegistration(this.apiService,this.configService,{name:a.manifest.application.displayName,universalIdentifier:a.manifest.application.universalIdentifier});this.registrationCredentials={clientId:i.clientId,clientSecret:i.clientSecret},this.state.applyStepEvents([{message:i.isNewRegistration?`App registration created: ${a.manifest.application.displayName}`:"Existing app registration found",status:i.isNewRegistration?"success":"info"},...i.isNewRegistration?[{message:"Credentials saved to config.",status:"info"}]:[]])}catch(i){throw this.state.applyStepEvents([{message:`Failed to register app: ${i instanceof Error?i.message:String(i)}`,status:"error"}]),i}this.notify()}}class Uo{constructor(a){this.watcher=null,this.appPath=a.appPath,this.fileFolder=a.fileFolder,this.watchPaths=a.watchPaths,this.handleFileBuilt=a.handleFileBuilt}async start(){const a=(await Promise.all(this.watchPaths.map(async i=>{const l=z.join(this.appPath,i);return await v.pathExists(l)?l:null}))).filter(i=>i!==null);a.length!==0&&(this.watcher=Bo.default.watch(a,{awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("all",(i,l)=>{i==="addDir"||i==="unlinkDir"||((i==="add"||i==="change")&&this.copyAndNotify(l),i==="unlink"&&this.handleUnlink(l))}))}async close(){await this.watcher?.close()}async copyAndNotify(a){const i=z.relative(this.appPath,a),l=z.join(v.u,i),d=z.join(this.appPath,l);await v.ensureDir(z.dirname(d)),await v.copy(a,d);const E=await Dt.readFile(d),I=nv.default.createHash("md5").update(E).digest("hex");this.handleFileBuilt({fileFolder:this.fileFolder,builtPath:l,sourcePath:i,checksum:I})}async handleUnlink(a){const i=z.relative(this.appPath,a),l=z.join(v.u,i),d=z.join(this.appPath,l);await v.remove(d)}}class Tv{constructor(a){this.process=null,this.pendingErrors=[],this.buffer="",this.hasErrors=!1,this.appPath=a.appPath,this.onErrors=a.onErrors}async start(){const a=Ro.default.join(this.appPath,"node_modules",".bin","tsc");if(!await v.pathExists(a))return;const i=Ro.default.join(this.appPath,"tsconfig.json");this.process=bn.spawn(a,["--watch","--noEmit","--pretty","false","-p",i],{cwd:this.appPath,stdio:["ignore","pipe","pipe"]}),this.process.on("error",()=>{this.process=null}),this.process.stdout?.on("data",l=>{this.handleOutput(l.toString())}),this.process.stderr?.on("data",l=>{this.handleOutput(l.toString())})}close(){this.process?.kill(),this.process=null}handleOutput(a){this.buffer+=a;const i=this.buffer.split(`
297
- `);this.buffer=i.pop()??"";for(const l of i)this.processLine(l)}processLine(a){if(a.includes("Starting compilation in watch mode...")||a.includes("Starting incremental compilation...")){this.pendingErrors=[];return}if(a.includes("Watching for file changes.")){const l=this.hasErrors;this.hasErrors=this.pendingErrors.length>0,(this.hasErrors||l)&&this.onErrors(this.pendingErrors),this.pendingErrors=[];return}const i=v.parseTscOutputLine(a);i&&this.pendingErrors.push(i)}}const Cv=new Set(["node_modules","dist",".twenty"]);class Fv{constructor(a){this.watcher=null,this.appPath=a.appPath,this.handleChangeDetected=a.handleChangeDetected,this.verbose=a.verbose??!1}async start(){const a=this.appPath;this.watcher=Bo.default.watch(this.appPath,{ignoreInitial:!this.verbose,ignored:i=>{const l=z.relative(a,i);if(l==="")return!1;const d=l.split(Mo.default.sep)[0];return Cv.has(d)||d.startsWith(".")},awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("all",(i,l)=>{if(i==="addDir"||i==="unlinkDir")return;const d=z.relative(this.appPath,l),E=d.startsWith(v._),I=["package.json","yarn.lock"].includes(d);!(d.endsWith(".ts")||d.endsWith(".tsx"))&&!E&&!I||this.handleChangeDetected(d,i)})}async close(){await this.watcher?.close()}}class Rv{constructor(a){this.manifestWatcher=null,this.logicFunctionsWatcher=null,this.frontComponentsWatcher=null,this.assetWatcher=null,this.dependencyWatcher=null,this.tscWatcher=null,this.state=a.state,this.scheduleSync=a.scheduleSync,this.notify=a.notify,this.onFileBuilt=a.onFileBuilt,this.shouldSkipTypecheck=a.shouldSkipTypecheck,this.verbose=a.verbose??!1}async start(){this.state.steps.startWatchers.status="in_progress",this.notify(),this.manifestWatcher=new Fv({appPath:this.state.appPath,handleChangeDetected:this.handleChangeDetected.bind(this),verbose:this.verbose}),await this.manifestWatcher.start()}async handleWatcherRestarts(a){const{logicFunctions:i,frontComponents:l}=a.filePaths;if(!this.state.steps.startWatchers.output.watchersStarted){this.state.steps.startWatchers.output.watchersStarted=!0,this.state.steps.startWatchers.status="done",await this.startFileWatchers(i,l);return}this.logicFunctionsWatcher?.shouldRestart(i)&&await this.logicFunctionsWatcher.restart(i),this.frontComponentsWatcher?.shouldRestart(l)&&await this.frontComponentsWatcher.restart(l)}async close(){this.tscWatcher?.close(),await Promise.all([this.manifestWatcher?.close(),this.logicFunctionsWatcher?.close(),this.frontComponentsWatcher?.close(),this.assetWatcher?.close(),this.dependencyWatcher?.close()])}handleChangeDetected(a,i){this.state.addEvent({message:`Change detected: ${a}`,status:"info"}),i==="unlink"?this.state.removeEntity(a):this.state.updateEntityStatus(a,"building"),this.notify(),this.scheduleSync()}handleFileBuildError(a){this.state.addEvent({message:"Build failed:",status:"error"});for(const i of a)this.state.addEvent({message:i.error,status:"error"});this.notify()}handleFileBuilt(a){this.verbose&&this.state.addEvent({message:`Successfully built ${a.builtPath}`,status:"success"}),this.state.steps.uploadFiles.output.builtFileInfos.set(a.builtPath,{checksum:a.checksum,builtPath:a.builtPath,sourcePath:a.sourcePath,fileFolder:a.fileFolder,usesSdkClient:a.usesSdkClient}),this.onFileBuilt(a),this.notify(),this.scheduleSync()}async startFileWatchers(a,i){await Promise.all([this.startTscWatcher(),this.startLogicFunctionsWatcher(a),this.startFrontComponentsWatcher(i),this.startAssetWatcher(),this.startDependencyWatcher()])}async startLogicFunctionsWatcher(a){this.logicFunctionsWatcher=v.createLogicFunctionsWatcher({appPath:this.state.appPath,sourcePaths:a,shouldSkipTypecheck:this.shouldSkipTypecheck,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.logicFunctionsWatcher.start()}async startFrontComponentsWatcher(a){this.frontComponentsWatcher=v.createFrontComponentsWatcher({appPath:this.state.appPath,sourcePaths:a,shouldSkipTypecheck:this.shouldSkipTypecheck,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.frontComponentsWatcher.start()}async startAssetWatcher(){this.assetWatcher=new Uo({appPath:this.state.appPath,fileFolder:v.b.PublicAsset,watchPaths:[v._],handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.assetWatcher.start()}async startDependencyWatcher(){this.dependencyWatcher=new Uo({appPath:this.state.appPath,fileFolder:v.b.Dependencies,watchPaths:["package.json","yarn.lock"],handleFileBuilt:this.handleFileBuilt.bind(this)}),this.dependencyWatcher.start()}async startTscWatcher(){this.tscWatcher=new Tv({appPath:this.state.appPath,onErrors:this.handleTypecheckErrors.bind(this)}),await this.tscWatcher.start()}handleTypecheckErrors(a){a.length===0?this.state.addEvent({message:"Typecheck passed",status:"success"}):this.state.applyStepEvents(a.map(i=>({message:`Type error in ${i.file}(${i.line},${i.column}): ${i.text}`,status:"error"}))),this.notify()}}class Pv{constructor({apiService:a,state:i,notify:l,verbose:d}){this.apiService=a,this.state=i,this.notify=l,this.verbose=d??!1}async execute(a){const i=this.state.steps.syncApplication;i.status="in_progress",this.state.updatePipeline({status:"syncing"});const l=[],d=v.manifestUpdateChecksums({manifest:a.manifest,builtFileInfos:a.builtFileInfos});l.push({message:"Manifest checksums set",status:"info"}),await v.writeManifestToOutput(a.appPath,d),l.push({message:"Manifest saved to output directory",status:"info"}),l.push({message:"Syncing manifest",status:"info"});const E=await this.apiService.syncApplication(d);if(E.success){l.push({message:"✓ Synced",status:"success"}),i.output={syncStatus:"synced",error:null},i.status="done",this.state.updatePipeline({status:"synced",error:null}),this.state.updateAllEntitiesStatus("success"),this.state.applyStepEvents(l);return}const I=this.verbose?null:v.formatManifestValidationErrors(E.error);I?(l.push(...I),l.push({message:"Add --verbose to see full error log",status:"info"})):l.push({message:`Sync failed with error: ${v.serializeError(E.error)}`,status:"error"});const N=I?I[0].message:"Sync failed";i.output={syncStatus:"error",error:N},i.status="error",this.state.updatePipeline({status:"error",error:N}),this.state.updateAllEntitiesStatus("error"),this.state.applyStepEvents(l)}}class Lv{constructor({state:a,notify:i,verbose:l}){this.uploadedCount=0,this.failedCount=0,this.totalQueued=0,this.state=a,this.notify=i,this.verbose=l??!1}get isInitialized(){return v.o(this.state.steps.uploadFiles.output.fileUploader)}initialize(a){const i=this.state.steps.uploadFiles;i.output={...i.output,fileUploader:new v.FileUploader({appPath:a.appPath,applicationUniversalIdentifier:a.universalIdentifier})},i.status="in_progress",this.notify(),this.uploadPendingFiles()}uploadFile(a,i,l){const d=this.state.steps.uploadFiles;if(!d.output.fileUploader)return;d.status="in_progress",this.totalQueued++,this.verbose&&this.state.addEvent({message:`Uploading ${a}`,status:"info"}),this.state.updateEntityStatus(i,"uploading"),this.notify();const E=d.output.fileUploader.uploadFile({builtPath:a,fileFolder:l}).then(I=>{I.success?(this.uploadedCount++,this.verbose&&this.state.addEvent({message:`Successfully uploaded ${a}`,status:"success"}),this.state.updateEntityStatus(i,"success")):(this.failedCount++,this.state.addEvent({message:`Failed to upload ${a}: ${I.error}`,status:"error"}))}).catch(I=>{this.failedCount++,this.state.addEvent({message:`Upload failed for ${a}: ${I}`,status:"error"})}).finally(()=>{d.output.activeUploads.delete(E),d.output.activeUploads.size===0&&(this.logUploadSummary(),d.status="done",this.notify())});d.output.activeUploads.add(E)}async waitForUploads(){const a=this.state.steps.uploadFiles;for(;a.output.activeUploads.size>0;)await Promise.all(a.output.activeUploads);a.status="done",this.notify()}logUploadSummary(){if(this.totalQueued===0){this.resetCounters();return}this.failedCount>0&&this.state.addEvent({message:`Uploaded ${this.uploadedCount}/${this.totalQueued} files (${this.failedCount} failed)`,status:"error"}),this.state.addEvent({message:`Successfully uploaded ${this.uploadedCount} file${this.uploadedCount!==1?"s":""}`,status:"success"}),this.resetCounters()}resetCounters(){this.uploadedCount=0,this.failedCount=0,this.totalQueued=0}uploadPendingFiles(){for(const[a,{fileFolder:i,sourcePath:l}]of this.state.steps.uploadFiles.output.builtFileInfos.entries())this.uploadFile(a,l,i)}}class Ov{constructor(a){this.syncTimer=null,this.serverCheckInterval=null,this.skipTypecheck=!0,this.debounceMs=a.debounceMs??200,this.state=a.state,this.verbose=a.verbose??!1,this.apiService=new v.ApiService({disableInterceptors:!0});const i=this.apiService,l=new v.ConfigService;this.clientService=new v.ClientService;const d={state:this.state,notify:()=>this.state.notify()};this.checkServerStep=new Ev({...d,apiService:i}),this.buildManifestStep=new Iv(d),this.registerAppStep=new bv({...d,apiService:i,configService:l}),this.uploadFilesStep=new Lv({...d,verbose:this.verbose}),this.generateApiClientStep=new Av({...d,clientService:this.clientService,configService:l}),this.syncApplicationStep=new Pv({...d,apiService:i,verbose:this.verbose}),this.startWatchersStep=new Rv({...d,scheduleSync:this.scheduleSync.bind(this),onFileBuilt:this.handleFileBuilt.bind(this),shouldSkipTypecheck:()=>this.skipTypecheck,verbose:this.verbose})}async start(){const a=Mo.default.join(this.state.appPath,v.u);await v.ensureDir(a),await v.emptyDir(a),this.verbose||(this.state.addEvent({message:"Add --verbose to see fully detailed logs",status:"info"}),this.state.notify()),await this.startWatchersStep.start(),this.serverCheckInterval=setInterval(()=>{this.checkServerHealth()},2e3)}async close(){this.serverCheckInterval&&clearInterval(this.serverCheckInterval),await this.startWatchersStep.close()}getState(){return this.state}handleFileBuilt(a){this.state.steps.uploadFiles.output.fileUploader&&this.uploadFilesStep.uploadFile(a.builtPath,a.sourcePath,a.fileFolder)}async checkServerHealth(){const a=this.state.steps.checkServer.output.isReady;await this.checkServerStep.execute()&&!a&&this.scheduleSync()}scheduleSync(){this.syncTimer&&clearTimeout(this.syncTimer),this.syncTimer=setTimeout(()=>{this.syncTimer=null,this.performSync()},this.debounceMs)}async performSync(){if(!this.state.pipeline.isSyncing){this.state.updatePipeline({isSyncing:!0});try{await this.runSyncPipeline()}catch(a){this.state.addEvent({message:`Sync failed with error: ${v.serializeError(a)}`,status:"error"}),this.state.updatePipeline({status:"error"}),this.state.updateAllEntitiesStatus("error")}finally{this.state.updatePipeline({isSyncing:!1})}}}async runSyncPipeline(){if(!await this.checkServerStep.execute())return;this.state.steps.ensureValidTokens.status="done";const i=await this.buildManifestStep.execute({appPath:this.state.appPath});if(!i||(await this.startWatchersStep.handleWatcherRestarts(i),!this.uploadFilesStep.isInitialized&&!await this.initializePipeline(i.manifest)))return;const l=this.state.hasObjectsOrFieldsChanged(i.manifest);await this.uploadFilesStep.waitForUploads(),await this.syncApplicationStep.execute({manifest:i.manifest,builtFileInfos:this.state.steps.uploadFiles.output.builtFileInfos,appPath:this.state.appPath}),this.state.steps.syncApplication.status!=="error"&&l&&(await this.generateApiClientStep.execute({appPath:this.state.appPath,credentials:this.registerAppStep.registrationCredentials}),this.skipTypecheck=!1)}async initializePipeline(a){await this.registerAppStep.execute({manifest:a});const i=await this.apiService.createDevelopmentApplication({universalIdentifier:a.application.universalIdentifier,name:a.application.displayName});return!i.success||!i.data?(this.state.applyStepEvents([{message:"Failed to install development application",status:"error"},{message:JSON.stringify(i,null,2),status:"error"}]),this.state.updatePipeline({status:"error"}),!1):(this.state.steps.resolveApplication.output={applicationId:i.data.id,universalIdentifier:i.data.universalIdentifier},this.state.steps.resolveApplication.status="done",this.state.applyStepEvents([{message:"Application installed",status:"success"}]),this.uploadFilesStep.initialize({appPath:this.state.appPath,universalIdentifier:a.application.universalIdentifier}),!0)}}const Uv={objects:v.e.Object,fields:v.e.Field,logicFunctions:v.e.LogicFunction,frontComponents:v.e.FrontComponent,roles:v.e.Role,skills:v.e.Skill,views:v.e.View,navigationMenuItems:v.e.NavigationMenuItem,pageLayouts:v.e.PageLayout,pageLayoutTabs:v.e.PageLayoutTab},Nv=200,Dv={pending:["building","uploading","success","error"],building:["pending","uploading","success","error"],uploading:["pending","success","error"],success:["pending","building","uploading","error"],error:["pending","building","uploading","success"]};class $v{constructor(a){this.eventIdCounter=0,this.appPath=a.appPath,this.frontendUrl=a.frontendUrl,this.previousObjectsFieldsFingerprint=null,this.steps={checkServer:{output:{isReady:!1,errorLogged:!1},status:"idle"},ensureValidTokens:{output:{},status:"idle"},resolveApplication:{output:{applicationId:null,universalIdentifier:null},status:"idle"},buildManifest:{output:{result:null},status:"idle"},uploadFiles:{output:{fileUploader:null,builtFileInfos:new Map,activeUploads:new Set},status:"idle"},generateApiClient:{output:{},status:"idle"},syncApplication:{output:{syncStatus:"idle",error:null},status:"idle"},startWatchers:{output:{watchersStarted:!1},status:"idle"}},this.pipeline={status:"idle",isSyncing:!1,error:null,appName:null},this.entities=new Map,this.events=[]}notify(){this.onChange?.()}updatePipeline(a){Object.assign(this.pipeline,a),this.notify()}applyStepEvents(a){const i=a.map(l=>(this.eventIdCounter+=1,{...l,id:this.eventIdCounter,timestamp:new Date,message:l.message.slice(0,5e3)}));this.events=[...this.events.slice(-(Nv-i.length)),...i]}addEvent(a){this.applyStepEvents([a])}updateEntityStatus(a,i){const l=new Map(this.entities),d=l.get(a);d?.status&&!Dv[d.status].includes(i)||(l.set(a,d?{...d,status:i}:{name:a,path:a,status:i}),this.entities=l)}removeEntity(a){const i=new Map(this.entities);i.delete(a),this.entities=i}updateAllEntitiesStatus(a){const i=new Map(this.entities);for(const[l,d]of i)i.set(l,{...d,status:a});this.entities=i}updateEntitiesFromManifest(a){const i=new Map;for(const[d,E]of Object.entries(a)){const I=Uv[d];if(I)for(const N of E)i.set(N,I)}const l=new Map(this.entities);for(const[d,E]of l)l.set(d,{...E,type:i.get(d)});for(const[d,E]of i)l.has(d)||l.set(d,{name:d,path:d,type:E,status:"pending"});this.entities=l}hasObjectsOrFieldsChanged(a){const i=JSON.stringify({objects:a.objects,fields:a.fields}),l=i!==this.previousObjectsFieldsFingerprint;return this.previousObjectsFieldsFingerprint=i,l}}const ke={idle:{color:"gray",icon:"○"},in_progress:{color:"yellow",icon:"spinner"},uploading:{color:"cyan",icon:"upload"},done:{color:"green",icon:"✓"},error:{color:"red",icon:"✗"}},Wv=f=>({idle:"idle",in_progress:"in_progress",done:"done",error:"error"})[f],Mv=f=>({pending:"idle",building:"in_progress",uploading:"uploading",success:"done",error:"error"})[f],Bv=f=>({idle:"idle",building:"in_progress",syncing:"in_progress",synced:"done",error:"error"})[f],kv={idle:"Idle",building:"Building...",syncing:"Syncing...",synced:"Synced",error:"Error"},Vi=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],Yi=["↑","⇡","↟","⤒"],qo={[v.e.Object]:"Objects",[v.e.Field]:"Fields",[v.e.LogicFunction]:"Logic functions",[v.e.FrontComponent]:"Front components",[v.e.Role]:"Roles",[v.e.Skill]:"Skills",[v.e.View]:"Views",[v.e.NavigationMenuItem]:"Navigation menu items",[v.e.PageLayout]:"Page layouts",[v.e.PageLayoutTab]:"Page layout tabs",[v.e.Agent]:"Agents"},Ho=Object.keys(qo),Gv={info:"gray",success:"green",error:"red",warning:"yellow"},qv=f=>f.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),Hv=(f,a=40)=>{if(f.length<=a)return f;const i=f.split("/");return i.length<=2?f:`.../${i.slice(-2).join("/")}`},zv=f=>{const a=new Map;for(const i of Ho)a.set(i,[]);for(const i of f.values()){if(!i.type)continue;const l=a.get(i.type)??[];l.push(i),a.set(i.type,l)}return a},Kv=f=>!f.frontendUrl||!f.steps.resolveApplication.output.universalIdentifier?null:`${f.frontendUrl}/settings/applications`,Vv=f=>f.some(a=>a==="error")?"error":f.some(a=>a==="in_progress")?"in_progress":f.every(a=>a==="done")?"done":"idle",Yv=f=>{const a=[...f.entities.values()],i=a.some(I=>I.status==="error"),l=a.some(I=>I.status==="building"),d=a.length>0&&a.every(I=>I.status==="uploading"||I.status==="success"),E=i?"error":l?"in_progress":d?"done":"idle";return[{label:"Application Initialization",status:Vv([f.steps.checkServer.status,f.steps.ensureValidTokens.status,f.steps.resolveApplication.status])},{label:"Resources Build",status:E},{label:"Resources Upload",status:f.steps.uploadFiles.status},{label:"Manifest Build",status:f.steps.buildManifest.status},{label:"Application Synchronization",status:f.steps.syncApplication.status},{label:"Api Client Generation",status:f.steps.generateApiClient.status}]},zo=120,Zv=Math.round(200/zo),No=()=>{const f=Math.floor(Date.now()/zo);return{spinnerFrame:Vi[f%Vi.length],uploadFrame:Yi[Math.floor(f/Zv)%Yi.length]}},Zi=f=>{const a=ke[f];return a.icon==="spinner"?No().spinnerFrame:a.icon==="upload"?No().uploadFrame:a.icon},Ko=ko.default.createContext(null),jv=Ko.Provider,dt=()=>{const f=ko.default.useContext(Ko);if(!f)throw new Error("useInk must be used within InkProvider");return f},Jv=({uiStatus:f})=>{const{Text:a}=dt(),i=Zi(f),l=ke[f];return P.jsxs(a,{color:l.color,children:[i," "]})},Xv=({entity:f})=>{const{Box:a,Text:i}=dt();return P.jsxs(a,{children:[P.jsx(Jv,{uiStatus:Mv(f.status)}),P.jsx(i,{children:f.name}),f.path!==f.name&&P.jsxs(i,{dimColor:!0,children:[" (",Hv(f.path),")"]})]})},Qv=({type:f,entities:a})=>{const{Box:i,Text:l}=dt();return a.length===0?null:P.jsxs(i,{flexDirection:"column",marginTop:1,children:[P.jsx(l,{bold:!0,dimColor:!0,children:qo[f]}),a.map(d=>P.jsx(Xv,{entity:d},d.path))]})},em=()=>{const{Box:f,Text:a}=dt();return P.jsx(f,{marginTop:1,children:P.jsxs(a,{dimColor:!0,children:[P.jsx(a,{color:ke.idle.color,children:ke.idle.icon})," ","pending"," ",P.jsx(a,{color:ke.in_progress.color,children:Vi[0]})," ","building"," ",P.jsx(a,{color:ke.uploading.color,children:Yi[0]})," ","uploading"," ",P.jsx(a,{color:ke.done.color,children:ke.done.icon})," ","success"," ",P.jsx(a,{color:ke.error.color,children:ke.error.icon})," ","error"]})})},tm=({state:f})=>{const{Text:a}=dt(),i=Bv(f.pipeline.status),l=Zi(i),d=ke[i],E=kv[f.pipeline.status];return P.jsxs(a,{color:d.color,children:[l," ",E]})},nm=({label:f,status:a})=>{const{Box:i,Text:l}=dt(),d=Wv(a),E=Zi(d),I=ke[d];return P.jsxs(i,{children:[P.jsxs(l,{dimColor:!0,children:[f,": "]}),P.jsxs(l,{color:I.color,children:[E," ",a.replace("_"," ")]})]})},rm=({state:f})=>{const{Box:a,Text:i}=dt(),l=zv(f.entities),d=Kv(f);return P.jsxs(a,{flexDirection:"column",borderStyle:"classic",borderColor:"gray",paddingX:1,children:[P.jsx(i,{bold:!0,color:"cyan",children:"Application"}),P.jsxs(a,{marginLeft:2,flexDirection:"column",children:[P.jsxs(a,{children:[P.jsx(i,{dimColor:!0,children:"Name: "}),P.jsx(i,{bold:!0,children:f.pipeline.appName??"Loading..."})]}),P.jsxs(a,{children:[P.jsx(i,{dimColor:!0,children:"Overall Status: "}),P.jsx(tm,{state:f})]}),d&&P.jsxs(a,{children:[P.jsx(i,{dimColor:!0,children:"Open:"}),P.jsxs(i,{bold:!0,color:"cyan",children:[" ",d]})]})]}),P.jsx(a,{marginLeft:2,flexDirection:"column",marginTop:1,children:Yv(f).map(E=>P.jsx(nm,{label:E.label,status:E.status},E.label))}),P.jsx(a,{marginLeft:2,flexDirection:"column",children:Ho.map(E=>{const I=l.get(E)??[];return P.jsx(Qv,{type:E,entities:I},E)})})]})},im=({event:f})=>{const{Box:a,Text:i}=dt(),l=Gv[f.status],d=qv(f.timestamp);return P.jsxs(a,{children:[P.jsxs(i,{dimColor:!0,children:[d," "]}),P.jsx(i,{color:l,children:f.message})]})},sm=new Set(["building","syncing"]),Do=120,am=80,om=({uiStateManager:f})=>{const{Box:a,Static:i}=dt(),[,l]=Et.useReducer(q=>q+1,0),d=Et.useRef(null),E=Et.useRef(0),I=Et.useCallback(()=>{d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{d.current=null,E.current=Date.now(),l()},am)},[]);Et.useEffect(()=>f.subscribe(()=>{I()}),[f,I]),Et.useEffect(()=>{const q=setInterval(()=>{const te=f.getSnapshot();sm.has(te.pipeline.status)&&(Date.now()-E.current<Do||l())},Do);return()=>clearInterval(q)},[f]),Et.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]);const N=f.getSnapshot();return P.jsxs(P.Fragment,{children:[P.jsx(i,{items:N.events,children:q=>P.jsx(im,{event:q},q.id)}),P.jsxs(a,{marginTop:1,flexDirection:"column",children:[P.jsx(rm,{state:N}),P.jsx(em,{})]})]})},um=async f=>{const a=await import("ink"),{render:i,Box:l,Text:d,Static:E}=a,{unmount:I}=i(P.jsx(jv,{value:{Box:l,Text:d,Static:E},children:P.jsx(om,{uiStateManager:f})}),{incrementalRendering:!0});return{unmount:I}};class lm{constructor(a){this.listeners=new Set,this.pendingNotify=!1,this.orchestratorState=a}getSnapshot(){return this.orchestratorState}subscribe(a){return this.listeners.add(a),a(this.orchestratorState),()=>this.listeners.delete(a)}notify(){this.pendingNotify||(this.pendingNotify=!0,queueMicrotask(()=>{this.pendingNotify=!1;for(const a of this.listeners)a(this.orchestratorState)}))}}class cm{constructor(){this.orchestrator=null,this.unmountUI=null}async close(){this.unmountUI?.(),await this.orchestrator?.close()}getOrchestrator(){return this.orchestrator}async execute(a){const i=a.appPath??ee;await en(i);const l=await new v.ConfigService().getConfig(),d=new $v({appPath:i,frontendUrl:l.apiUrl});if(!a.headless){const E=new lm(d);d.onChange=()=>E.notify();const{unmount:I}=await um(E);this.unmountUI=I}this.orchestrator=new Ov({state:d,verbose:a.verbose}),await this.orchestrator.start(),a.headless||this.setupGracefulShutdown()}setupGracefulShutdown(){const a=()=>void this.close().then(()=>process.exit(0));process.on("SIGINT",a),process.on("SIGTERM",a)}}class fm{async execute({appPath:a=ee,postInstall:i=!1,preInstall:l=!1,functionUniversalIdentifier:d,functionName:E,payload:I="{}"}){let N;try{N=JSON.parse(I)}catch{console.error(_.default.red("Invalid JSON payload. Please provide valid JSON.")),process.exit(1)}const q=i?"post install":l?"pre install":d??E;console.log(_.default.blue(`🚀 Executing function "${q}"...`)),console.log(_.default.gray(` Payload: ${JSON.stringify(N)}
298
- `));const te=i?{appPath:a,postInstall:!0,payload:N}:l?{appPath:a,preInstall:!0,payload:N}:d?{appPath:a,functionUniversalIdentifier:d,payload:N}:{appPath:a,functionName:E,payload:N},X=await v.functionExecute(te);if(!X.success){switch(X.error.code){case v.APP_ERROR_CODES.MANIFEST_NOT_FOUND:{console.error(_.default.red("Failed to build manifest."));break}case v.FUNCTION_ERROR_CODES.FETCH_FUNCTIONS_FAILED:{console.error(_.default.red("Failed to fetch functions:"),X.error.message);break}case v.FUNCTION_ERROR_CODES.FUNCTION_NOT_FOUND:{console.error(_.default.red(X.error.message),`
299
- `);const k=X.error.details?.availableFunctions??[];k.length>0?(console.log(_.default.cyan("Available functions:")),k.forEach(W=>{console.log(` - ${_.default.white(W.name)} (${W.universalIdentifier})`)})):console.log(_.default.yellow("No functions found for this application. Have you synced your app with `twenty dev`?"));break}case v.FUNCTION_ERROR_CODES.EXECUTION_FAILED:{console.error(_.default.red("Execution failed:"),X.error.message);break}default:console.error(_.default.red(X.error.message))}process.exit(1)}const K=X.data;console.log(_.default.cyan("─".repeat(60))),console.log(_.default.cyan("Execution Result")),console.log(_.default.cyan("─".repeat(60)));const Ze=K.status==="SUCCESS"?_.default.green:_.default.red;console.log(`${_.default.bold("Status:")} ${Ze(K.status)}`),console.log(`${_.default.bold("Duration:")} ${K.duration}ms
300
- `),v.o(K.data)&&(console.log(_.default.bold("Data:")),console.log(_.default.white(JSON.stringify(K.data,null,2)))),K.error&&(console.log(_.default.bold.red("Error:")),console.log(_.default.red(` Type: ${K.error.errorType}`)),console.log(_.default.red(` Message: ${K.error.errorMessage}
301
- `)),K.error.stackTrace&&(console.log(_.default.gray("Stack trace:")),console.log(_.default.gray(K.error.stackTrace)))),K.logs&&(console.log(_.default.bold("Logs:")),console.log(_.default.gray(K.logs))),console.log(_.default.cyan("─".repeat(60))),K.status!=="SUCCESS"&&process.exit(1)}}class hm{async execute(a){const i=a.appPath??ee;await en(i),console.log(_.default.blue("Installing application...")),console.log(_.default.gray(`App path: ${i}
302
- `));const l=await v.appInstall({appPath:i,remote:a.remote});l.success||(console.error(_.default.red(l.error.message)),process.exit(1)),console.log(_.default.green("✓ Application installed"))}}class dm{constructor(){this.apiService=new v.ApiService}async execute({appPath:a=ee,functionUniversalIdentifier:i,functionName:l}){try{const d=await v.readManifestFromFile(a);d||process.exit(1),this.logWatchInfo({appName:d.application.displayName,functionUniversalIdentifier:i,functionName:l}),await this.apiService.subscribeToLogs({applicationUniversalIdentifier:d.application.universalIdentifier,functionUniversalIdentifier:i,functionName:l})}catch(d){console.error(_.default.red("Watch logs failed:"),d instanceof Error?d.message:d),process.exit(1)}}logWatchInfo({appName:a,functionUniversalIdentifier:i,functionName:l}){const d=a??"Twenty Application",E=i||l?`function "${i||l}"`:"functions";console.log(_.default.blue(`🚀 Watching ${d} ${E} logs:
303
- `))}}class pm{async execute(a){const i=a.appPath??ee;await en(i),console.log(_.default.blue("Publishing to npm...")),console.log(_.default.gray(`App path: ${i}
304
- `));const l=await v.appPublish({appPath:i,npmTag:a.tag,onProgress:d=>console.log(_.default.gray(d))});l.success||(console.error(_.default.red(l.error.message)),process.exit(1)),console.log(_.default.green("✓ Published to npm successfully"))}}const gm=f=>{try{return new URL(f).hostname.replace(/\./g,"-")}catch{return"remote"}},$o=async(f,a)=>a?((await v.authLogin({apiKey:a,apiUrl:f})).success||(console.error(_.default.red("✗ Authentication failed.")),process.exit(1)),"API key"):vm(f),vm=async f=>{await Ge.default.prompt([{type:"input",name:"confirm",message:"Press Enter to open the browser for authentication..."}]);const a=await v.authLoginOAuth({apiUrl:f});if(a.success)return"OAuth";console.log(_.default.yellow(a.error.message));const i=await Ge.default.prompt([{type:"password",name:"apiKey",message:"API Key:",mask:"*",validate:d=>d.length>0||"API key is required"}]);return(await v.authLogin({apiKey:i.apiKey,apiUrl:f})).success||(console.error(_.default.red("✗ Authentication failed.")),process.exit(1)),"API key"},mm=f=>{const a=f.command("remote").description("Manage remote Twenty servers");a.command("add").description("Add a new remote or re-authenticate an existing one").option("--as <name>","Name for this remote").option("--api-key <apiKey>","API key for non-interactive auth").option("--api-url <apiUrl>","Server URL").option("--local","Connect to a local Twenty server (auto-detect)").option("--test","Write to config.test.json (for integration tests)").action(async i=>{const l=i.test?v.getConfigPath(!0):void 0,d=new v.ConfigService(l?{configPath:l}:void 0),E=await d.getRemotes();if(i.as!==void 0&&E.includes(i.as)){const te=await d.getConfigForRemote(i.as);v.ConfigService.setActiveRemote(i.as);const X=await $o(te.apiUrl,i.apiKey);console.log(_.default.green(`✓ Re-authenticated "${i.as}" via ${X}.`)),await d.setDefaultRemote(i.as),console.log(_.default.green(`✓ Default remote set to "${i.as}".`));return}let I=i.apiUrl;if(!I){const te=await v.detectLocalServer();i.local?(te||(console.error(_.default.red(`No local Twenty server found.
305
- Start one with: yarn twenty server start`)),process.exit(1)),console.log(_.default.gray(`Found local server at ${te}`)),I=te):I=(await Ge.default.prompt([{type:"input",name:"apiUrl",message:"Twenty server URL:",validate:X=>{try{return new URL(X),!0}catch{return"Please enter a valid URL"}}}])).apiUrl}const N=i.as??gm(I);v.ConfigService.setActiveRemote(N);const q=await $o(I,i.apiKey);console.log(_.default.green(`✓ Remote "${N}" added (${I}) via ${q}.`)),await d.setDefaultRemote(N),console.log(_.default.green(`✓ Default remote set to "${N}".`))}),a.command("list").description("List all configured remotes").action(async()=>{const i=new v.ConfigService,l=await i.getRemotes(),d=await i.getDefaultRemote();if(l.length===0){console.log("No remotes configured."),console.log("Use 'twenty remote add' to add one.");return}console.log("");for(const E of l){const I=await i.getConfigForRemote(E),N=I.twentyCLIAccessToken?"oauth":I.apiKey?"api-key":"none",q=E===d,te=q?"* ":" ",X=q?_.default.bold(E):E;console.log(`${te}${X} ${_.default.gray(I.apiUrl)} [${N}]`)}console.log(`
306
- `,_.default.gray("Use 'twenty remote switch <name>' to change default"))}),a.command("switch [name]").description("Set the default remote").action(async i=>{const l=new v.ConfigService,d=i??(await Ge.default.prompt([{type:"list",name:"remote",message:"Select default remote:",choices:await l.getRemotes()}])).remote;(await l.getRemotes()).includes(d)||(console.error(_.default.red(`Remote "${d}" not found.`)),process.exit(1)),await l.setDefaultRemote(d),console.log(_.default.green(`✓ Default remote set to "${d}".`))}),a.command("status").description("Show active remote and authentication status").action(async()=>{const i=new v.ConfigService,l=new v.ApiService,d=v.ConfigService.getActiveRemote(),E=await i.getConfig(),I=E.twentyCLIAccessToken?"oauth":E.apiKey?"api-key":"none";if(console.log(` Remote: ${_.default.bold(d)}`),console.log(` Server: ${E.apiUrl}`),I==="none"){console.log(` Auth: ${_.default.yellow("not configured")}`);return}const{authValid:N}=await l.validateAuth(),q=N?_.default.green(`${I} (valid)`):_.default.red(`${I} (invalid)`);console.log(` Auth: ${q}`)}),a.command("remove <name>").description("Remove a remote").action(async i=>{const l=new v.ConfigService;(await l.getRemotes()).includes(i)||(console.error(_.default.red(`Remote "${i}" not found.`)),process.exit(1)),v.ConfigService.setActiveRemote(i),await l.clearConfig(),console.log(_.default.green(`✓ Remote "${i}" removed.`))})},ym=f=>{const a=f.command("server").description("Manage a local Twenty server instance");a.command("start").description("Start a local Twenty server").option("-p, --port <port>","HTTP port").option("--test","Start a separate test instance (port 2021)").action(async i=>{const l=i.test?v.DEFAULT_TEST_PORT:v.DEFAULT_PORT,d=i.port?parseInt(i.port,10):l;(isNaN(d)||d<1||d>65535)&&(console.error(_.default.red("Invalid port number.")),process.exit(1));const E=await v.serverStart({port:d,test:i.test,onProgress:I=>console.log(_.default.gray(I))});E.success||(console.error(_.default.red(E.error.message)),process.exit(1))}),a.command("stop").description("Stop the local Twenty server").option("--test","Stop the test instance").action(i=>{const l=i.test?v.TEST_CONTAINER_NAME:v.CONTAINER_NAME;if(!v.containerExists(l)){console.log(_.default.yellow("No Twenty server container found."));return}bn.execSync(`docker stop ${l}`,{stdio:"ignore"}),console.log(_.default.green("Twenty server stopped."))}),a.command("logs").description("Stream Twenty server logs").option("-n, --lines <lines>","Number of lines to show","50").option("--test","Show logs for the test instance").action(i=>{const l=i.test?v.TEST_CONTAINER_NAME:v.CONTAINER_NAME;if(!v.containerExists(l)){console.log(_.default.yellow("No Twenty server container found."));return}try{bn.spawnSync("docker",["logs","-f","--tail",i.lines,l],{stdio:"inherit"})}catch{}}),a.command("status").description("Show Twenty server status").option("--test","Show status of the test instance").action(async i=>{const l=i.test?v.TEST_CONTAINER_NAME:v.CONTAINER_NAME,d=i.test?v.DEFAULT_TEST_PORT:v.DEFAULT_PORT;if(!v.containerExists(l)){console.log(` Status: ${_.default.gray("not created")}`),console.log(_.default.gray(` Run 'yarn twenty server start${i.test?" --test":""}' to create one.`));return}const E=v.isContainerRunning(l),I=E?v.getContainerPort(l):d,N=E?await v.checkServerHealth(I):!1,q=N?_.default.green("running (healthy)"):E?_.default.yellow("running (starting...)"):_.default.gray("stopped");console.log(` Status: ${q}`),console.log(` URL: http://localhost:${I}`),N&&console.log(_.default.gray(" Login: tim@apple.dev / tim@apple.dev"))}),a.command("reset").description("Delete all data and start fresh").option("--test","Reset the test instance").action(i=>{const l=i.test?v.TEST_CONTAINER_NAME:v.CONTAINER_NAME,d=i.test?"twenty-app-dev-test-data":"twenty-app-dev-data",E=i.test?"twenty-app-dev-test-storage":"twenty-app-dev-storage";v.containerExists(l)&&bn.execSync(`docker rm -f ${l}`,{stdio:"ignore"});try{bn.execSync(`docker volume rm ${d} ${E}`,{stdio:"ignore"})}catch{}console.log(_.default.green("Twenty server data reset.")),console.log(_.default.gray(`Run 'yarn twenty server start${i.test?" --test":""}' to start a fresh instance.`))})};class _m{async execute(a){const i=a.appPath??ee;await en(i),console.log(_.default.blue("Syncing application...")),console.log(_.default.gray(`App path: ${i}
307
- `));const l=await v.appDevOnce({appPath:i,verbose:a.verbose,onProgress:d=>console.log(_.default.gray(d))});l.success||(console.error(_.default.red(l.error.message)),process.exit(1)),console.log(_.default.green(`
308
- ✓ Synced ${l.data.applicationDisplayName} (${l.data.fileCount} file${l.data.fileCount===1?"":"s"})`)),console.log(_.default.gray(`Output: ${l.data.outputDir}`))}}const wm=f=>`${_.default.cyan(f.file)}:${_.default.yellow(String(f.line))}:${_.default.yellow(String(f.column+1))} - ${_.default.red("error")} ${f.text}`;class Sm{async execute(a){const i=a.appPath??ee;console.log(_.default.blue("Running type check...")),console.log(_.default.gray(`App path: ${i}
309
- `));const l=await v.runTypecheck(i);l.length===0&&(console.log(_.default.green("✓ No type errors found")),process.exit(0));for(const d of l)console.log(wm(d));console.log(`
310
- `,_.default.red(`✗ Found ${l.length} type error${l.length===1?"":"s"}`)),process.exit(1)}}class xm{async execute({appPath:a=ee,askForConfirmation:i}){console.log(_.default.blue("🚀 Uninstall Twenty Application")),console.log(_.default.gray(`📁 App Path: ${a}
311
- `)),i&&!await this.confirmationPrompt()&&(console.error(_.default.red("⛔️ Aborting uninstall")),process.exit(1));const l=await v.appUninstall({appPath:a});return l.success?(console.log(_.default.green("✅ Application uninstalled successfully")),{success:!0,data:void 0}):(console.error(_.default.red("❌ Uninstall failed:"),l.error.message),{success:!1,error:l.error.message})}async confirmationPrompt(){const{confirmation:a}=await Ge.default.prompt([{type:"confirm",name:"confirmation",message:"Are you sure you want to uninstall this application?",default:!1}]);return a}}const Im=f=>{const a=new wv,i=new cm,l=new _m,d=new hm,E=new pm,I=new Sm,N=new xm,q=new Sv,te=new xv,X=new mv,K=new dm,Ze=new fm;f.command("dev [appPath]").description("Build and sync local application changes (watches by default; use --once for a one-shot sync)").option("-w, --watch","Watch source files and re-sync on every change (default behavior)").option("-o, --once","Build and sync once, then exit (useful for CI, scripts, and pre-commit hooks)").option("-v, --verbose","Show detailed logs").option("-d, --debug","Show detailed logs (alias for --verbose)").action(async(k,W)=>{W.once&&W.watch&&(console.error(_.default.red("Error: --once and --watch are mutually exclusive. Watch mode is the default.")),process.exit(1));const Pe={appPath:ht(k),verbose:W.verbose||W.debug};if(W.once){await l.execute(Pe);return}await i.execute(Pe)}),f.command("build [appPath]").description("Build, sync, and generate API client into .twenty/output/").option("--tarball","Also pack into a .tgz tarball").action(async(k,W)=>{await a.execute({appPath:ht(k),tarball:W.tarball})}),f.command("install [appPath]").description("Install a deployed application on the connected server").option("-r, --remote <name>","Install on a specific remote").action(async(k,W)=>{await d.execute({appPath:ht(k),remote:W.remote})}),f.command("deploy [appPath]").description("Build and upload application to a Twenty server").option("-r, --remote <name>","Deploy to a specific remote").action(async(k,W)=>{await te.execute({appPath:ht(k),remote:W.remote})}),f.command("publish [appPath]").description("Build and publish to npm").option("--tag <tag>","npm dist-tag (e.g. beta, next)").action(async(k,W)=>{await E.execute({appPath:ht(k),tag:W.tag})}),f.command("catalog-sync").description("Trigger marketplace catalog sync on the server").option("-r, --remote <name>","Sync on a specific remote").action(async k=>{await q.execute({remote:k.remote})}),f.command("typecheck [appPath]").description("Run TypeScript type checking on the application").action(async k=>{await I.execute({appPath:ht(k)})}),f.command("uninstall [appPath]").description("Uninstall application from Twenty").option("-y, --yes","Skip confirmation prompt").action(async(k,W)=>{try{const Pe=await N.execute({appPath:ht(k),askForConfirmation:!W?.yes});process.exit(Pe.success?0:1)}catch{process.exit(1)}}),mm(f),ym(f),f.command("add [entityType]").option("--path <path>","Path in which the entity should be created.").description(`Add a new entity to your application (${Object.values(v.e).join("|")})`).action(async(k,W)=>{await X.execute(k,W?.path)}),f.command("exec [appPath]").option("--postInstall","Execute post-install logic function if defined").option("--preInstall","Execute pre-install logic function if defined").option("-p, --payload <payload>","JSON payload to send to the function","{}").option("-u, --functionUniversalIdentifier <functionUniversalIdentifier>","Universal ID of the function to execute").option("-n, --functionName <functionName>","Name of the function to execute").description("Execute a logic function with a JSON payload").action(async(k,W)=>{!W?.postInstall&&!W?.preInstall&&!W?.functionUniversalIdentifier&&!W?.functionName&&(console.error(_.default.red("Error: Either --postInstall, --preInstall, --functionName (-n), or --functionUniversalIdentifier (-u) is required.")),process.exit(1)),await Ze.execute({...W,payload:W?.payload??"{}",appPath:ht(k)})}),f.command("logs [appPath]").option("-u, --functionUniversalIdentifier <functionUniversalIdentifier>","Only show logs for the function with this universal ID").option("-n, --functionName <functionName>","Only show logs for the function with this name").description("Watch application function logs").action(async(k,W)=>{await K.execute({...W,appPath:ht(k)})})};tv.inspect.defaultOptions.depth=10;const tn=new Wo.Command;tn.name("twenty").description("CLI for Twenty application development").version(Go.version);tn.option("-r, --remote <name>","Use a specific remote (overrides the default set by remote switch)");tn.hook("preAction",async f=>{let i=(f.optsWithGlobals?f.optsWithGlobals():f.opts()).remote;i?console.log(_.default.gray(`Using remote: ${i}`)):i=await new v.ConfigService().getDefaultRemote(),v.ConfigService.setActiveRemote(i)});Im(tn);tn.exitOverride();try{tn.parse()}catch(f){f instanceof Wo.CommanderError&&process.exit(f.exitCode),f instanceof Error&&(console.error(_.default.red("Error:"),f.message),process.exit(1))}
338
+ Waiting for server...`,status:"error"}]),this.state.updatePipeline({status:"error"})),!1)}if(!r.authValid)return s.output.errorLogged||(s.output={isReady:!1,errorLogged:!0},s.status="error",this.state.applyStepEvents([{message:"Authentication failed. Run `yarn twenty remote add --local` to authenticate.",status:"error"}]),this.state.updatePipeline({status:"error"})),!1;const l=s.output.isReady;return s.output={isReady:!0,errorLogged:!1},s.status="done",l||this.notify(),!0}}class $v{constructor({clientService:s,configService:r,state:l,notify:p}){this.clientService=s,this.configService=r,this.state=l,this.notify=p}async execute(s){const r=this.state.steps.generateApiClient;r.status="in_progress",this.notify();try{const l=await v.ensureAppAccessTokenIsValidOrRefresh(this.configService,s.credentials);await this.clientService.generateCoreClient({appPath:s.appPath,appAccessToken:l}),r.status="done"}catch(l){this.state.applyStepEvents([{message:`Failed to generate API client: ${l instanceof Error?l.message:String(l)}`,status:"error"}]),r.status="error"}this.notify()}}class Uv{constructor({apiService:s,configService:r,state:l,notify:p}){this.apiService=s,this.configService=r,this.state=l,this.notify=p}async execute(s){try{const r=await v.ensureAppRegistration(this.apiService,this.configService,{name:s.manifest.application.displayName,universalIdentifier:s.manifest.application.universalIdentifier});this.registrationCredentials={clientId:r.clientId,clientSecret:r.clientSecret},this.state.applyStepEvents([{message:r.isNewRegistration?`App registration created: ${s.manifest.application.displayName}`:"Existing app registration found",status:r.isNewRegistration?"success":"info"},...r.isNewRegistration?[{message:"Credentials saved to config.",status:"info"}]:[]])}catch(r){throw this.state.applyStepEvents([{message:`Failed to register app: ${r instanceof Error?r.message:String(r)}`,status:"error"}]),r}this.notify()}}class Uo{constructor(s){this.watcher=null,this.appPath=s.appPath,this.fileFolder=s.fileFolder,this.watchPaths=s.watchPaths,this.handleFileBuilt=s.handleFileBuilt}async start(){const s=(await Promise.all(this.watchPaths.map(async r=>{const l=q.join(this.appPath,r);return await v.pathExists(l)?l:null}))).filter(r=>r!==null);s.length!==0&&(this.watcher=ko.default.watch(s,{awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("all",(r,l)=>{r==="addDir"||r==="unlinkDir"||((r==="add"||r==="change")&&this.copyAndNotify(l),r==="unlink"&&this.handleUnlink(l))}))}async close(){await this.watcher?.close()}async copyAndNotify(s){const r=q.relative(this.appPath,s),l=q.join(v.u,r),p=q.join(this.appPath,l);await v.ensureDir(q.dirname(p)),await v.copy(s,p);const I=await tt.readFile(p),x=iv.default.createHash("md5").update(I).digest("hex");this.handleFileBuilt({fileFolder:this.fileFolder,builtPath:l,sourcePath:r,checksum:x})}async handleUnlink(s){const r=q.relative(this.appPath,s),l=q.join(v.u,r),p=q.join(this.appPath,l);await v.remove(p)}}class Dv{constructor(s){this.process=null,this.pendingErrors=[],this.buffer="",this.hasErrors=!1,this.appPath=s.appPath,this.onErrors=s.onErrors}async start(){const s=Po.default.join(this.appPath,"node_modules",".bin","tsc");if(!await v.pathExists(s))return;const r=Po.default.join(this.appPath,"tsconfig.json");this.process=bn.spawn(s,["--watch","--noEmit","--pretty","false","-p",r],{cwd:this.appPath,stdio:["ignore","pipe","pipe"]}),this.process.on("error",()=>{this.process=null}),this.process.stdout?.on("data",l=>{this.handleOutput(l.toString())}),this.process.stderr?.on("data",l=>{this.handleOutput(l.toString())})}close(){this.process?.kill(),this.process=null}handleOutput(s){this.buffer+=s;const r=this.buffer.split(`
339
+ `);this.buffer=r.pop()??"";for(const l of r)this.processLine(l)}processLine(s){if(s.includes("Starting compilation in watch mode...")||s.includes("Starting incremental compilation...")){this.pendingErrors=[];return}if(s.includes("Watching for file changes.")){const l=this.hasErrors;this.hasErrors=this.pendingErrors.length>0,(this.hasErrors||l)&&this.onErrors(this.pendingErrors),this.pendingErrors=[];return}const r=v.parseTscOutputLine(s);r&&this.pendingErrors.push(r)}}const Mv=new Set(["node_modules","dist",".twenty"]);class Wv{constructor(s){this.watcher=null,this.appPath=s.appPath,this.handleChangeDetected=s.handleChangeDetected,this.verbose=s.verbose??!1}async start(){const s=this.appPath;this.watcher=ko.default.watch(this.appPath,{ignoreInitial:!this.verbose,ignored:r=>{const l=q.relative(s,r);if(l==="")return!1;const p=l.split(Yi.default.sep)[0];return Mv.has(p)||p.startsWith(".")},awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("all",(r,l)=>{if(r==="addDir"||r==="unlinkDir")return;const p=q.relative(this.appPath,l),I=p.startsWith(v._),x=["package.json","yarn.lock"].includes(p);!(p.endsWith(".ts")||p.endsWith(".tsx"))&&!I&&!x||this.handleChangeDetected(p,r)})}async close(){await this.watcher?.close()}}class Bv{constructor(s){this.manifestWatcher=null,this.logicFunctionsWatcher=null,this.frontComponentsWatcher=null,this.assetWatcher=null,this.dependencyWatcher=null,this.tscWatcher=null,this.state=s.state,this.scheduleSync=s.scheduleSync,this.notify=s.notify,this.onFileBuilt=s.onFileBuilt,this.shouldSkipTypecheck=s.shouldSkipTypecheck,this.verbose=s.verbose??!1}async start(){this.state.steps.startWatchers.status="in_progress",this.notify(),this.manifestWatcher=new Wv({appPath:this.state.appPath,handleChangeDetected:this.handleChangeDetected.bind(this),verbose:this.verbose}),await this.manifestWatcher.start()}async handleWatcherRestarts(s){const{logicFunctions:r,frontComponents:l}=s.filePaths;if(!this.state.steps.startWatchers.output.watchersStarted){this.state.steps.startWatchers.output.watchersStarted=!0,this.state.steps.startWatchers.status="done",await this.startFileWatchers(r,l);return}this.logicFunctionsWatcher?.shouldRestart(r)&&await this.logicFunctionsWatcher.restart(r),this.frontComponentsWatcher?.shouldRestart(l)&&await this.frontComponentsWatcher.restart(l)}async close(){this.tscWatcher?.close(),await Promise.all([this.manifestWatcher?.close(),this.logicFunctionsWatcher?.close(),this.frontComponentsWatcher?.close(),this.assetWatcher?.close(),this.dependencyWatcher?.close()])}handleChangeDetected(s,r){this.state.addEvent({message:`Change detected: ${s}`,status:"info"}),r==="unlink"?this.state.removeEntity(s):this.state.updateEntityStatus(s,"building"),this.notify(),this.scheduleSync()}handleFileBuildError(s){this.state.addEvent({message:"Build failed:",status:"error"});for(const r of s)this.state.addEvent({message:r.error,status:"error"});this.notify()}handleFileBuilt(s){this.verbose&&this.state.addEvent({message:`Successfully built ${s.builtPath}`,status:"success"}),this.state.steps.uploadFiles.output.builtFileInfos.set(s.builtPath,{checksum:s.checksum,builtPath:s.builtPath,sourcePath:s.sourcePath,fileFolder:s.fileFolder,usesSdkClient:s.usesSdkClient}),this.onFileBuilt(s),this.notify(),this.scheduleSync()}async startFileWatchers(s,r){await Promise.all([this.startTscWatcher(),this.startLogicFunctionsWatcher(s),this.startFrontComponentsWatcher(r),this.startAssetWatcher(),this.startDependencyWatcher()])}async startLogicFunctionsWatcher(s){this.logicFunctionsWatcher=v.createLogicFunctionsWatcher({appPath:this.state.appPath,sourcePaths:s,shouldSkipTypecheck:this.shouldSkipTypecheck,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.logicFunctionsWatcher.start()}async startFrontComponentsWatcher(s){this.frontComponentsWatcher=v.createFrontComponentsWatcher({appPath:this.state.appPath,sourcePaths:s,shouldSkipTypecheck:this.shouldSkipTypecheck,handleBuildError:this.handleFileBuildError.bind(this),handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.frontComponentsWatcher.start()}async startAssetWatcher(){this.assetWatcher=new Uo({appPath:this.state.appPath,fileFolder:v.V.PublicAsset,watchPaths:[v._],handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.assetWatcher.start()}async startDependencyWatcher(){this.dependencyWatcher=new Uo({appPath:this.state.appPath,fileFolder:v.V.Dependencies,watchPaths:["package.json","yarn.lock"],handleFileBuilt:this.handleFileBuilt.bind(this)}),this.dependencyWatcher.start()}async startTscWatcher(){this.tscWatcher=new Dv({appPath:this.state.appPath,onErrors:this.handleTypecheckErrors.bind(this)}),await this.tscWatcher.start()}handleTypecheckErrors(s){s.length===0?this.state.addEvent({message:"Typecheck passed",status:"success"}):this.state.applyStepEvents(s.map(r=>({message:`Type error in ${r.file}(${r.line},${r.column}): ${r.text}`,status:"error"}))),this.notify()}}class kv{constructor({apiService:s,state:r,notify:l,verbose:p}){this.apiService=s,this.state=r,this.notify=l,this.verbose=p??!1}async execute(s){const r=this.state.steps.syncApplication;r.status="in_progress",this.state.updatePipeline({status:"syncing"});const l=[],p=v.manifestUpdateChecksums({manifest:s.manifest,builtFileInfos:s.builtFileInfos});l.push({message:"Manifest checksums set",status:"info"}),await v.writeManifestToOutput(s.appPath,p),l.push({message:"Manifest saved to output directory",status:"info"}),l.push({message:"Syncing manifest",status:"info"});const I=await this.apiService.syncApplication(p);if(I.success){l.push({message:"✓ Synced",status:"success"}),r.output={syncStatus:"synced",error:null},r.status="done",this.state.updatePipeline({status:"synced",error:null}),this.state.updateAllEntitiesStatus("success"),this.state.applyStepEvents(l);return}const x=this.verbose?null:v.formatManifestValidationErrors(I.error);x?(l.push(...x),l.push({message:"Add --verbose to see full error log",status:"info"})):l.push({message:`Sync failed with error: ${v.serializeError(I.error)}`,status:"error"});const P=x?x[0].message:"Sync failed";r.output={syncStatus:"error",error:P},r.status="error",this.state.updatePipeline({status:"error",error:P}),this.state.updateAllEntitiesStatus("error"),this.state.applyStepEvents(l)}}class Gv{constructor({state:s,notify:r,verbose:l}){this.uploadedCount=0,this.failedCount=0,this.totalQueued=0,this.state=s,this.notify=r,this.verbose=l??!1}get isInitialized(){return v.o(this.state.steps.uploadFiles.output.fileUploader)}initialize(s){const r=this.state.steps.uploadFiles;r.output={...r.output,fileUploader:new v.FileUploader({appPath:s.appPath,applicationUniversalIdentifier:s.universalIdentifier})},r.status="in_progress",this.notify(),this.uploadPendingFiles()}uploadFile(s,r,l){const p=this.state.steps.uploadFiles;if(!p.output.fileUploader)return;p.status="in_progress",this.totalQueued++,this.verbose&&this.state.addEvent({message:`Uploading ${s}`,status:"info"}),this.state.updateEntityStatus(r,"uploading"),this.notify();const I=p.output.fileUploader.uploadFile({builtPath:s,fileFolder:l}).then(x=>{x.success?(this.uploadedCount++,this.verbose&&this.state.addEvent({message:`Successfully uploaded ${s}`,status:"success"}),this.state.updateEntityStatus(r,"success")):(this.failedCount++,this.state.addEvent({message:`Failed to upload ${s}: ${x.error}`,status:"error"}))}).catch(x=>{this.failedCount++,this.state.addEvent({message:`Upload failed for ${s}: ${x}`,status:"error"})}).finally(()=>{p.output.activeUploads.delete(I),p.output.activeUploads.size===0&&(this.logUploadSummary(),p.status="done",this.notify())});p.output.activeUploads.add(I)}async waitForUploads(){const s=this.state.steps.uploadFiles;for(;s.output.activeUploads.size>0;)await Promise.all(s.output.activeUploads);s.status="done",this.notify()}logUploadSummary(){if(this.totalQueued===0){this.resetCounters();return}this.failedCount>0&&this.state.addEvent({message:`Uploaded ${this.uploadedCount}/${this.totalQueued} files (${this.failedCount} failed)`,status:"error"}),this.state.addEvent({message:`Successfully uploaded ${this.uploadedCount} file${this.uploadedCount!==1?"s":""}`,status:"success"}),this.resetCounters()}resetCounters(){this.uploadedCount=0,this.failedCount=0,this.totalQueued=0}uploadPendingFiles(){for(const[s,{fileFolder:r,sourcePath:l}]of this.state.steps.uploadFiles.output.builtFileInfos.entries())this.uploadFile(s,l,r)}}class Vv{constructor(s){this.syncTimer=null,this.serverCheckInterval=null,this.skipTypecheck=!0,this.debounceMs=s.debounceMs??200,this.state=s.state,this.verbose=s.verbose??!1,this.apiService=new v.ApiService({disableInterceptors:!0});const r=this.apiService,l=new v.ConfigService;this.clientService=new v.ClientService;const p={state:this.state,notify:()=>this.state.notify()};this.checkServerStep=new Ov({...p,apiService:r}),this.buildManifestStep=new Nv(p),this.registerAppStep=new Uv({...p,apiService:r,configService:l}),this.uploadFilesStep=new Gv({...p,verbose:this.verbose}),this.generateApiClientStep=new $v({...p,clientService:this.clientService,configService:l}),this.syncApplicationStep=new kv({...p,apiService:r,verbose:this.verbose}),this.startWatchersStep=new Bv({...p,scheduleSync:this.scheduleSync.bind(this),onFileBuilt:this.handleFileBuilt.bind(this),shouldSkipTypecheck:()=>this.skipTypecheck,verbose:this.verbose})}async start(){const s=Yi.default.join(this.state.appPath,v.u);await v.ensureDir(s),await v.emptyDir(s),this.verbose||(this.state.addEvent({message:"Add --verbose to see fully detailed logs",status:"info"}),this.state.notify()),await this.startWatchersStep.start(),this.serverCheckInterval=setInterval(()=>{this.checkServerHealth()},2e3)}async close(){this.serverCheckInterval&&clearInterval(this.serverCheckInterval),await this.startWatchersStep.close()}getState(){return this.state}handleFileBuilt(s){this.state.steps.uploadFiles.output.fileUploader&&this.uploadFilesStep.uploadFile(s.builtPath,s.sourcePath,s.fileFolder)}async checkServerHealth(){const s=this.state.steps.checkServer.output.isReady;await this.checkServerStep.execute()&&!s&&this.scheduleSync()}scheduleSync(){this.syncTimer&&clearTimeout(this.syncTimer),this.syncTimer=setTimeout(()=>{this.syncTimer=null,this.performSync()},this.debounceMs)}async performSync(){if(!this.state.pipeline.isSyncing){this.state.updatePipeline({isSyncing:!0});try{await this.runSyncPipeline()}catch(s){this.state.addEvent({message:`Sync failed with error: ${v.serializeError(s)}`,status:"error"}),this.state.updatePipeline({status:"error"}),this.state.updateAllEntitiesStatus("error")}finally{this.state.updatePipeline({isSyncing:!1})}}}async runSyncPipeline(){if(!await this.checkServerStep.execute())return;this.state.steps.ensureValidTokens.status="done";const r=await this.buildManifestStep.execute({appPath:this.state.appPath});if(!r||(await this.startWatchersStep.handleWatcherRestarts(r),!this.uploadFilesStep.isInitialized&&!await this.initializePipeline(r.manifest)))return;const l=this.state.hasObjectsOrFieldsChanged(r.manifest);await this.uploadFilesStep.waitForUploads(),await this.syncApplicationStep.execute({manifest:r.manifest,builtFileInfos:this.state.steps.uploadFiles.output.builtFileInfos,appPath:this.state.appPath}),this.state.steps.syncApplication.status!=="error"&&l&&(await this.generateApiClientStep.execute({appPath:this.state.appPath,credentials:this.registerAppStep.registrationCredentials}),this.skipTypecheck=!1)}async initializePipeline(s){await this.registerAppStep.execute({manifest:s});const r=await this.apiService.createDevelopmentApplication({universalIdentifier:s.application.universalIdentifier,name:s.application.displayName});return!r.success||!r.data?(this.state.applyStepEvents([{message:"Failed to install development application",status:"error"},{message:JSON.stringify(r,null,2),status:"error"}]),this.state.updatePipeline({status:"error"}),!1):(this.state.steps.resolveApplication.output={applicationId:r.data.id,universalIdentifier:r.data.universalIdentifier},this.state.steps.resolveApplication.status="done",this.state.applyStepEvents([{message:"Application installed",status:"success"}]),this.uploadFilesStep.initialize({appPath:this.state.appPath,universalIdentifier:s.application.universalIdentifier}),!0)}}const qv={objects:v.e.Object,fields:v.e.Field,logicFunctions:v.e.LogicFunction,frontComponents:v.e.FrontComponent,roles:v.e.Role,skills:v.e.Skill,connectionProviders:v.e.ConnectionProvider,views:v.e.View,navigationMenuItems:v.e.NavigationMenuItem,pageLayouts:v.e.PageLayout,pageLayoutTabs:v.e.PageLayoutTab,commandMenuItems:v.e.CommandMenuItem},Hv=200,zv={pending:["building","uploading","success","error"],building:["pending","uploading","success","error"],uploading:["pending","success","error"],success:["pending","building","uploading","error"],error:["pending","building","uploading","success"]};class Kv{constructor(s){this.eventIdCounter=0,this.appPath=s.appPath,this.frontendUrl=s.frontendUrl,this.previousObjectsFieldsFingerprint=null,this.steps={checkServer:{output:{isReady:!1,errorLogged:!1},status:"idle"},ensureValidTokens:{output:{},status:"idle"},resolveApplication:{output:{applicationId:null,universalIdentifier:null},status:"idle"},buildManifest:{output:{result:null},status:"idle"},uploadFiles:{output:{fileUploader:null,builtFileInfos:new Map,activeUploads:new Set},status:"idle"},generateApiClient:{output:{},status:"idle"},syncApplication:{output:{syncStatus:"idle",error:null},status:"idle"},startWatchers:{output:{watchersStarted:!1},status:"idle"}},this.pipeline={status:"idle",isSyncing:!1,error:null,appName:null},this.entities=new Map,this.events=[]}notify(){this.onChange?.()}updatePipeline(s){Object.assign(this.pipeline,s),this.notify()}applyStepEvents(s){const r=s.map(l=>(this.eventIdCounter+=1,{...l,id:this.eventIdCounter,timestamp:new Date,message:l.message.slice(0,5e3)}));this.events=[...this.events.slice(-(Hv-r.length)),...r]}addEvent(s){this.applyStepEvents([s])}updateEntityStatus(s,r){const l=new Map(this.entities),p=l.get(s);p?.status&&!zv[p.status].includes(r)||(l.set(s,p?{...p,status:r}:{name:s,path:s,status:r}),this.entities=l)}removeEntity(s){const r=new Map(this.entities);r.delete(s),this.entities=r}updateAllEntitiesStatus(s){const r=new Map(this.entities);for(const[l,p]of r)r.set(l,{...p,status:s});this.entities=r}updateEntitiesFromManifest(s){const r=new Map;for(const[p,I]of Object.entries(s)){const x=qv[p];if(x)for(const P of I)r.set(P,x)}const l=new Map(this.entities);for(const[p,I]of l)l.set(p,{...I,type:r.get(p)});for(const[p,I]of r)l.has(p)||l.set(p,{name:p,path:p,type:I,status:"pending"});this.entities=l}hasObjectsOrFieldsChanged(s){const r=JSON.stringify({objects:s.objects,fields:s.fields}),l=r!==this.previousObjectsFieldsFingerprint;return this.previousObjectsFieldsFingerprint=r,l}}const ke={idle:{color:"gray",icon:"○"},in_progress:{color:"yellow",icon:"spinner"},uploading:{color:"cyan",icon:"upload"},done:{color:"green",icon:"✓"},error:{color:"red",icon:"✗"}},jv=f=>({idle:"idle",in_progress:"in_progress",done:"done",error:"error"})[f],Yv=f=>({pending:"idle",building:"in_progress",uploading:"uploading",success:"done",error:"error"})[f],Jv=f=>({idle:"idle",building:"in_progress",syncing:"in_progress",synced:"done",error:"error"})[f],Zv={idle:"Idle",building:"Building...",syncing:"Syncing...",synced:"Synced",error:"Error"},Ki=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],ji=["↑","⇡","↟","⤒"],Ho={[v.e.Object]:"Objects",[v.e.Field]:"Fields",[v.e.LogicFunction]:"Logic functions",[v.e.FrontComponent]:"Front components",[v.e.CommandMenuItem]:"Command menu items",[v.e.Role]:"Roles",[v.e.Skill]:"Skills",[v.e.View]:"Views",[v.e.NavigationMenuItem]:"Navigation menu items",[v.e.PageLayout]:"Page layouts",[v.e.PageLayoutTab]:"Page layout tabs",[v.e.Agent]:"Agents",[v.e.ConnectionProvider]:"Connection providers"},zo=Object.keys(Ho),Xv={info:"gray",success:"green",error:"red",warning:"yellow"},Qv=f=>f.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),em=(f,s=40)=>{if(f.length<=s)return f;const r=f.split("/");return r.length<=2?f:`.../${r.slice(-2).join("/")}`},tm=f=>{const s=new Map;for(const r of zo)s.set(r,[]);for(const r of f.values()){if(!r.type)continue;const l=s.get(r.type)??[];l.push(r),s.set(r.type,l)}return s},nm=f=>!f.frontendUrl||!f.steps.resolveApplication.output.universalIdentifier?null:`${f.frontendUrl}/settings/applications`,rm=f=>f.some(s=>s==="error")?"error":f.some(s=>s==="in_progress")?"in_progress":f.every(s=>s==="done")?"done":"idle",im=f=>{const s=[...f.entities.values()],r=s.some(x=>x.status==="error"),l=s.some(x=>x.status==="building"),p=s.length>0&&s.every(x=>x.status==="uploading"||x.status==="success"),I=r?"error":l?"in_progress":p?"done":"idle";return[{label:"Application Initialization",status:rm([f.steps.checkServer.status,f.steps.ensureValidTokens.status,f.steps.resolveApplication.status])},{label:"Resources Build",status:I},{label:"Resources Upload",status:f.steps.uploadFiles.status},{label:"Manifest Build",status:f.steps.buildManifest.status},{label:"Application Synchronization",status:f.steps.syncApplication.status},{label:"Api Client Generation",status:f.steps.generateApiClient.status}]},Ko=120,sm=Math.round(200/Ko),Do=()=>{const f=Math.floor(Date.now()/Ko);return{spinnerFrame:Ki[f%Ki.length],uploadFrame:ji[Math.floor(f/sm)%ji.length]}},Ji=f=>{const s=ke[f];return s.icon==="spinner"?Do().spinnerFrame:s.icon==="upload"?Do().uploadFrame:s.icon},jo=Go.default.createContext(null),am=jo.Provider,ht=()=>{const f=Go.default.useContext(jo);if(!f)throw new Error("useInk must be used within InkProvider");return f},om=({uiStatus:f})=>{const{Text:s}=ht(),r=Ji(f),l=ke[f];return L.jsxs(s,{color:l.color,children:[r," "]})},um=({entity:f})=>{const{Box:s,Text:r}=ht();return L.jsxs(s,{children:[L.jsx(om,{uiStatus:Yv(f.status)}),L.jsx(r,{children:f.name}),f.path!==f.name&&L.jsxs(r,{dimColor:!0,children:[" (",em(f.path),")"]})]})},lm=({type:f,entities:s})=>{const{Box:r,Text:l}=ht();return s.length===0?null:L.jsxs(r,{flexDirection:"column",marginTop:1,children:[L.jsx(l,{bold:!0,dimColor:!0,children:Ho[f]}),s.map(p=>L.jsx(um,{entity:p},p.path))]})},cm=()=>{const{Box:f,Text:s}=ht();return L.jsx(f,{marginTop:1,children:L.jsxs(s,{dimColor:!0,children:[L.jsx(s,{color:ke.idle.color,children:ke.idle.icon})," ","pending"," ",L.jsx(s,{color:ke.in_progress.color,children:Ki[0]})," ","building"," ",L.jsx(s,{color:ke.uploading.color,children:ji[0]})," ","uploading"," ",L.jsx(s,{color:ke.done.color,children:ke.done.icon})," ","success"," ",L.jsx(s,{color:ke.error.color,children:ke.error.icon})," ","error"]})})},fm=({state:f})=>{const{Text:s}=ht(),r=Jv(f.pipeline.status),l=Ji(r),p=ke[r],I=Zv[f.pipeline.status];return L.jsxs(s,{color:p.color,children:[l," ",I]})},dm=({label:f,status:s})=>{const{Box:r,Text:l}=ht(),p=jv(s),I=Ji(p),x=ke[p];return L.jsxs(r,{children:[L.jsxs(l,{dimColor:!0,children:[f,": "]}),L.jsxs(l,{color:x.color,children:[I," ",s.replace("_"," ")]})]})},pm=({state:f})=>{const{Box:s,Text:r}=ht(),l=tm(f.entities),p=nm(f);return L.jsxs(s,{flexDirection:"column",borderStyle:"classic",borderColor:"gray",paddingX:1,children:[L.jsx(r,{bold:!0,color:"cyan",children:"Application"}),L.jsxs(s,{marginLeft:2,flexDirection:"column",children:[L.jsxs(s,{children:[L.jsx(r,{dimColor:!0,children:"Name: "}),L.jsx(r,{bold:!0,children:f.pipeline.appName??"Loading..."})]}),L.jsxs(s,{children:[L.jsx(r,{dimColor:!0,children:"Overall Status: "}),L.jsx(fm,{state:f})]}),p&&L.jsxs(s,{children:[L.jsx(r,{dimColor:!0,children:"Open:"}),L.jsxs(r,{bold:!0,color:"cyan",children:[" ",p]})]})]}),L.jsx(s,{marginLeft:2,flexDirection:"column",marginTop:1,children:im(f).map(I=>L.jsx(dm,{label:I.label,status:I.status},I.label))}),L.jsx(s,{marginLeft:2,flexDirection:"column",children:zo.map(I=>{const x=l.get(I)??[];return L.jsx(lm,{type:I,entities:x},I)})})]})},hm=({event:f})=>{const{Box:s,Text:r}=ht(),l=Xv[f.status],p=Qv(f.timestamp);return L.jsxs(s,{children:[L.jsxs(r,{dimColor:!0,children:[p," "]}),L.jsx(r,{color:l,children:f.message})]})},gm=new Set(["building","syncing"]),Mo=120,vm=80,mm=({uiStateManager:f})=>{const{Box:s,Static:r}=ht(),[,l]=At.useReducer(D=>D+1,0),p=At.useRef(null),I=At.useRef(0),x=At.useCallback(()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{p.current=null,I.current=Date.now(),l()},vm)},[]);At.useEffect(()=>f.subscribe(()=>{x()}),[f,x]),At.useEffect(()=>{const D=setInterval(()=>{const z=f.getSnapshot();gm.has(z.pipeline.status)&&(Date.now()-I.current<Mo||l())},Mo);return()=>clearInterval(D)},[f]),At.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const P=f.getSnapshot();return L.jsxs(L.Fragment,{children:[L.jsx(r,{items:P.events,children:D=>L.jsx(hm,{event:D},D.id)}),L.jsxs(s,{marginTop:1,flexDirection:"column",children:[L.jsx(pm,{state:P}),L.jsx(cm,{})]})]})},ym=async f=>{const s=await import("ink"),{render:r,Box:l,Text:p,Static:I}=s,{unmount:x}=r(L.jsx(am,{value:{Box:l,Text:p,Static:I},children:L.jsx(mm,{uiStateManager:f})}),{incrementalRendering:!0});return{unmount:x}};class _m{constructor(s){this.listeners=new Set,this.pendingNotify=!1,this.orchestratorState=s}getSnapshot(){return this.orchestratorState}subscribe(s){return this.listeners.add(s),s(this.orchestratorState),()=>this.listeners.delete(s)}notify(){this.pendingNotify||(this.pendingNotify=!0,queueMicrotask(()=>{this.pendingNotify=!1;for(const s of this.listeners)s(this.orchestratorState)}))}}class wm{constructor(){this.orchestrator=null,this.unmountUI=null}async close(){this.unmountUI?.(),await this.orchestrator?.close()}getOrchestrator(){return this.orchestrator}async execute(s){const r=s.appPath??Q;await en(r);const l=await new v.ConfigService().getConfig(),p=new Kv({appPath:r,frontendUrl:l.apiUrl});if(!s.headless){const I=new _m(p);p.onChange=()=>I.notify();const{unmount:x}=await ym(I);this.unmountUI=x}this.orchestrator=new Vv({state:p,verbose:s.verbose}),await this.orchestrator.start(),s.headless||this.setupGracefulShutdown()}setupGracefulShutdown(){const s=()=>{this.close().then(()=>process.exit(0))};process.on("SIGINT",s),process.on("SIGTERM",s)}}class Sm{async execute({appPath:s=Q,postInstall:r=!1,preInstall:l=!1,functionUniversalIdentifier:p,functionName:I,payload:x="{}"}){let P;try{P=JSON.parse(x)}catch{console.error(y.default.red("Invalid JSON payload. Please provide valid JSON.")),process.exit(1)}const D=r?"post install":l?"pre install":p??I;console.log(y.default.blue(`🚀 Executing function "${D}"...`)),console.log(y.default.gray(` Payload: ${JSON.stringify(P)}
340
+ `));const z=r?{appPath:s,postInstall:!0,payload:P}:l?{appPath:s,preInstall:!0,payload:P}:p?{appPath:s,functionUniversalIdentifier:p,payload:P}:{appPath:s,functionName:I,payload:P},Z=await v.functionExecute(z);if(!Z.success){switch(Z.error.code){case v.APP_ERROR_CODES.MANIFEST_NOT_FOUND:{console.error(y.default.red("Failed to build manifest."));break}case v.FUNCTION_ERROR_CODES.FETCH_FUNCTIONS_FAILED:{console.error(y.default.red("Failed to fetch functions:"),Z.error.message);break}case v.FUNCTION_ERROR_CODES.FUNCTION_NOT_FOUND:{console.error(y.default.red(Z.error.message),`
341
+ `);const G=Z.error.details?.availableFunctions??[];G.length>0?(console.log(y.default.cyan("Available functions:")),G.forEach(W=>{console.log(` - ${y.default.white(W.name)} (${W.universalIdentifier})`)})):console.log(y.default.yellow("No functions found for this application. Have you synced your app with `twenty dev`?"));break}case v.FUNCTION_ERROR_CODES.EXECUTION_FAILED:{console.error(y.default.red("Execution failed:"),Z.error.message);break}default:console.error(y.default.red(Z.error.message))}process.exit(1)}const K=Z.data;console.log(y.default.cyan("─".repeat(60))),console.log(y.default.cyan("Execution Result")),console.log(y.default.cyan("─".repeat(60)));const Ye=K.status==="SUCCESS"?y.default.green:y.default.red;console.log(`${y.default.bold("Status:")} ${Ye(K.status)}`),console.log(`${y.default.bold("Duration:")} ${K.duration}ms
342
+ `),v.o(K.data)&&(console.log(y.default.bold("Data:")),console.log(y.default.white(JSON.stringify(K.data,null,2)))),K.error&&(console.log(y.default.bold.red("Error:")),console.log(y.default.red(` Type: ${K.error.errorType}`)),console.log(y.default.red(` Message: ${K.error.errorMessage}
343
+ `)),K.error.stackTrace&&(console.log(y.default.gray("Stack trace:")),console.log(y.default.gray(K.error.stackTrace)))),K.logs&&(console.log(y.default.bold("Logs:")),console.log(y.default.gray(K.logs))),console.log(y.default.cyan("─".repeat(60))),K.status!=="SUCCESS"&&process.exit(1)}}class Im{async execute(s){const r=s.appPath??Q;await en(r),console.log(y.default.blue("Installing application...")),console.log(y.default.gray(`App path: ${r}
344
+ `));const l=await v.appInstall({appPath:r,remote:s.remote});l.success||(console.error(y.default.red(l.error.message)),process.exit(1)),console.log(y.default.green("✓ Application installed"))}}class xm{constructor(){this.apiService=new v.ApiService}async execute({appPath:s=Q,functionUniversalIdentifier:r,functionName:l}){try{const p=await v.readManifestFromFile(s);p||process.exit(1),this.logWatchInfo({appName:p.application.displayName,functionUniversalIdentifier:r,functionName:l}),await this.apiService.subscribeToLogs({applicationUniversalIdentifier:p.application.universalIdentifier,functionUniversalIdentifier:r,functionName:l})}catch(p){console.error(y.default.red("Watch logs failed:"),p instanceof Error?p.message:p),process.exit(1)}}logWatchInfo({appName:s,functionUniversalIdentifier:r,functionName:l}){const p=s??"Twenty Application",I=r||l?`function "${r||l}"`:"functions";console.log(y.default.blue(`🚀 Watching ${p} ${I} logs:
345
+ `))}}class Em{async execute(s){const r=s.appPath??Q;await en(r),console.log(y.default.blue("Publishing to npm...")),console.log(y.default.gray(`App path: ${r}
346
+ `));const l=await v.appPublish({appPath:r,npmTag:s.tag,onProgress:p=>console.log(y.default.gray(p))});l.success||(console.error(y.default.red(l.error.message)),process.exit(1)),console.log(y.default.green("✓ Published to npm successfully"))}}const Am=f=>{try{return new URL(f).hostname.replace(/\./g,"-")}catch{return"remote"}},Wo=async(f,s)=>s?((await v.authLogin({apiKey:s,apiUrl:f})).success||(console.error(y.default.red("✗ Authentication failed.")),process.exit(1)),"API key"):bm(f),bm=async f=>{await Ge.default.prompt([{type:"input",name:"confirm",message:"Press Enter to open the browser for authentication..."}]);const s=await v.authLoginOAuth({apiUrl:f});if(s.success)return"OAuth";console.log(y.default.yellow(s.error.message));const r=await Ge.default.prompt([{type:"password",name:"apiKey",message:"API Key:",mask:"*",validate:p=>p.length>0||"API key is required"}]);return(await v.authLogin({apiKey:r.apiKey,apiUrl:f})).success||(console.error(y.default.red("✗ Authentication failed.")),process.exit(1)),"API key"},Cm=f=>{const s=f.command("remote").description("Manage remote Twenty servers");s.command("add").description("Add a new remote or re-authenticate an existing one").option("--as <name>","Name for this remote").option("--api-key <apiKey>","API key for non-interactive auth").option("--api-url <apiUrl>","Server URL").option("--local","Connect to a local Twenty server (auto-detect)").option("--test","Write to config.test.json (for integration tests)").action(async r=>{const l=r.test?v.getConfigPath(!0):void 0,p=new v.ConfigService(l?{configPath:l}:void 0),I=await p.getRemotes();if(r.as!==void 0&&I.includes(r.as)){const z=await p.getConfigForRemote(r.as);v.ConfigService.setActiveRemote(r.as);const Z=await Wo(z.apiUrl,r.apiKey);console.log(y.default.green(`✓ Re-authenticated "${r.as}" via ${Z}.`)),await p.setDefaultRemote(r.as),console.log(y.default.green(`✓ Default remote set to "${r.as}".`));return}let x=r.apiUrl;if(!x){const z=await v.detectLocalServer();r.local?(z||(console.error(y.default.red(`No local Twenty server found.
347
+ Start one with: yarn twenty server start`)),process.exit(1)),console.log(y.default.gray(`Found local server at ${z}`)),x=z):x=(await Ge.default.prompt([{type:"input",name:"apiUrl",message:"Twenty server URL:",validate:Z=>{try{return new URL(Z),!0}catch{return"Please enter a valid URL"}}}])).apiUrl}const P=r.as??Am(x);v.ConfigService.setActiveRemote(P);const D=await Wo(x,r.apiKey);console.log(y.default.green(`✓ Remote "${P}" added (${x}) via ${D}.`)),await p.setDefaultRemote(P),console.log(y.default.green(`✓ Default remote set to "${P}".`))}),s.command("list").description("List all configured remotes").action(async()=>{const r=new v.ConfigService,l=await r.getRemotes(),p=await r.getDefaultRemote();if(l.length===0){console.log("No remotes configured."),console.log("Use 'twenty remote add' to add one.");return}console.log("");for(const I of l){const x=await r.getConfigForRemote(I),P=x.twentyCLIAccessToken?"oauth":x.apiKey?"api-key":"none",D=I===p,z=D?"* ":" ",Z=D?y.default.bold(I):I;console.log(`${z}${Z} ${y.default.gray(x.apiUrl)} [${P}]`)}console.log(`
348
+ `,y.default.gray("Use 'twenty remote switch <name>' to change default"))}),s.command("switch [name]").description("Set the default remote").action(async r=>{const l=new v.ConfigService,p=r??(await Ge.default.prompt([{type:"list",name:"remote",message:"Select default remote:",choices:await l.getRemotes()}])).remote;(await l.getRemotes()).includes(p)||(console.error(y.default.red(`Remote "${p}" not found.`)),process.exit(1)),await l.setDefaultRemote(p),console.log(y.default.green(`✓ Default remote set to "${p}".`))}),s.command("status").description("Show active remote and authentication status").action(async()=>{const r=new v.ConfigService,l=new v.ApiService,p=v.ConfigService.getActiveRemote(),I=await r.getConfig(),x=I.twentyCLIAccessToken?"oauth":I.apiKey?"api-key":"none";if(console.log(` Remote: ${y.default.bold(p)}`),console.log(` Server: ${I.apiUrl}`),x==="none"){console.log(` Auth: ${y.default.yellow("not configured")}`);return}const{authValid:P}=await l.validateAuth(),D=P?y.default.green(`${x} (valid)`):y.default.red(`${x} (invalid)`);console.log(` Auth: ${D}`)}),s.command("remove <name>").description("Remove a remote").action(async r=>{const l=new v.ConfigService;(await l.getRemotes()).includes(r)||(console.error(y.default.red(`Remote "${r}" not found.`)),process.exit(1)),v.ConfigService.setActiveRemote(r),await l.clearConfig(),console.log(y.default.green(`✓ Remote "${r}" removed.`))})},Tm=f=>{const s=f.command("server").description("Manage a Twenty server (local instance and server-side actions)");s.command("start").description("Start a local Twenty server").option("-p, --port <port>","HTTP port").option("--test","Start a separate test instance (port 2021)").action(async r=>{const l=r.test?v.DEFAULT_TEST_PORT:v.DEFAULT_PORT,p=r.port?parseInt(r.port,10):l;(isNaN(p)||p<1||p>65535)&&(console.error(y.default.red("Invalid port number.")),process.exit(1));const I=await v.serverStart({port:p,test:r.test,onProgress:x=>console.log(y.default.gray(x))});I.success||(console.error(y.default.red(I.error.message)),process.exit(1))}),s.command("stop").description("Stop the local Twenty server").option("--test","Stop the test instance").action(r=>{const l=r.test?v.TEST_CONTAINER_NAME:v.CONTAINER_NAME;if(!v.containerExists(l)){console.log(y.default.yellow("No Twenty server container found."));return}bn.execSync(`docker stop ${l}`,{stdio:"ignore"}),console.log(y.default.green("Twenty server stopped."))}),s.command("logs").description("Stream Twenty server logs").option("-n, --lines <lines>","Number of lines to show","50").option("--test","Show logs for the test instance").action(r=>{const l=r.test?v.TEST_CONTAINER_NAME:v.CONTAINER_NAME;if(!v.containerExists(l)){console.log(y.default.yellow("No Twenty server container found."));return}try{bn.spawnSync("docker",["logs","-f","--tail",r.lines,l],{stdio:"inherit"})}catch{}}),s.command("status").description("Show Twenty server status").option("--test","Show status of the test instance").action(async r=>{const l=r.test?v.TEST_CONTAINER_NAME:v.CONTAINER_NAME,p=r.test?v.DEFAULT_TEST_PORT:v.DEFAULT_PORT;if(!v.containerExists(l)){console.log(` Status: ${y.default.gray("not created")}`),console.log(y.default.gray(` Run 'yarn twenty server start${r.test?" --test":""}' to create one.`));return}const I=v.isContainerRunning(l),x=I?v.getContainerPort(l):p,P=I?await v.checkServerHealth(x):!1,D=P?y.default.green("running (healthy)"):I?y.default.yellow("running (starting...)"):y.default.gray("stopped"),z=v.getContainerEnvVar("APP_VERSION",l);console.log(` Status: ${D}`),console.log(` URL: http://localhost:${x}`),z&&console.log(` Version: ${y.default.gray(z)}`),P&&console.log(y.default.gray(" Login: tim@apple.dev / tim@apple.dev"))}),s.command("reset").description("Delete all data and start fresh").option("--test","Reset the test instance").action(r=>{const l=r.test?v.TEST_CONTAINER_NAME:v.CONTAINER_NAME,p=r.test?"twenty-app-dev-test-data":"twenty-app-dev-data",I=r.test?"twenty-app-dev-test-storage":"twenty-app-dev-storage";v.containerExists(l)&&bn.execSync(`docker rm -f ${l}`,{stdio:"ignore"});try{bn.execSync(`docker volume rm ${p} ${I}`,{stdio:"ignore"})}catch{}console.log(y.default.green("Twenty server data reset.")),console.log(y.default.gray(`Run 'yarn twenty server start${r.test?" --test":""}' to start a fresh instance.`))}),s.command("upgrade [version]").description("Upgrade the twenty-app-dev Docker image").option("--test","Upgrade the test instance").action(async(r,l)=>{const p=await v.serverUpgrade({version:r??"latest",test:l.test,onProgress:x=>console.log(y.default.gray(x))});p.success||(console.error(y.default.red(p.error.message)),process.exit(1));const{data:I}=p;if(!I.imageUpdated){console.log(y.default.green(` Already up to date (${I.image}).`));return}console.log(y.default.green(` Upgraded to: ${I.image}`)),I.containerRecreated&&console.log(y.default.gray(` Run 'yarn twenty server start${l.test?" --test":""}' to wait for the server to be ready.`))}),s.command("catalog-sync").description("Trigger a marketplace catalog sync on the server").option("-r, --remote <name>","Sync on a specific remote").action(async r=>{await new qo().execute({remote:r.remote})})};class Rm{async execute(s){const r=s.appPath??Q;await en(r),console.log(y.default.blue("Syncing application...")),console.log(y.default.gray(`App path: ${r}
349
+ `));const l=await v.appDevOnce({appPath:r,verbose:s.verbose,onProgress:p=>console.log(y.default.gray(p))});l.success||(console.error(y.default.red(l.error.message)),process.exit(1)),console.log(y.default.green(`
350
+ ✓ Synced ${l.data.applicationDisplayName} (${l.data.fileCount} file${l.data.fileCount===1?"":"s"})`)),console.log(y.default.gray(`Output: ${l.data.outputDir}`))}}const Fm=f=>`${y.default.cyan(f.file)}:${y.default.yellow(String(f.line))}:${y.default.yellow(String(f.column+1))} - ${y.default.red("error")} ${f.text}`;class Pm{async execute(s){const r=s.appPath??Q;console.log(y.default.blue("Running type check...")),console.log(y.default.gray(`App path: ${r}
351
+ `));const l=await v.runTypecheck(r);l.length===0&&(console.log(y.default.green("✓ No type errors found")),process.exit(0));for(const p of l)console.log(Fm(p));console.log(`
352
+ `,y.default.red(`✗ Found ${l.length} type error${l.length===1?"":"s"}`)),process.exit(1)}}class Lm{async execute({appPath:s=Q,askForConfirmation:r}){console.log(y.default.blue("🚀 Uninstall Twenty Application")),console.log(y.default.gray(`📁 App Path: ${s}
353
+ `)),r&&!await this.confirmationPrompt()&&(console.error(y.default.red("⛔️ Aborting uninstall")),process.exit(1));const l=await v.appUninstall({appPath:s});return l.success?(console.log(y.default.green("✅ Application uninstalled successfully")),{success:!0,data:void 0}):(console.error(y.default.red("❌ Uninstall failed:"),l.error.message),{success:!1,error:l.error.message})}async confirmationPrompt(){const{confirmation:s}=await Ge.default.prompt([{type:"confirm",name:"confirmation",message:"Are you sure you want to uninstall this application?",default:!1}]);return s}}const Nm=f=>{const s=new Pv,r=new wm,l=new Rm,p=new Im,I=new Em,x=new Pm,P=new Lm,D=new qo,z=new Lv,Z=new Tv,K=new xm,Ye=new Sm;f.command("dev [appPath]").description("Build and sync local application changes (watches by default; use --once for a one-shot sync)").option("-w, --watch","Watch source files and re-sync on every change (default behavior)").option("-o, --once","Build and sync once, then exit (useful for CI, scripts, and pre-commit hooks)").option("-v, --verbose","Show detailed logs").option("-d, --debug","Show detailed logs (alias for --verbose)").action(async(G,W)=>{W.once&&W.watch&&(console.error(y.default.red("Error: --once and --watch are mutually exclusive. Watch mode is the default.")),process.exit(1));const Pe={appPath:pt(G),verbose:W.verbose||W.debug};if(W.once){await l.execute(Pe);return}await r.execute(Pe)}),f.command("build [appPath]").description("Build, sync, and generate API client into .twenty/output/").option("--tarball","Also pack into a .tgz tarball").action(async(G,W)=>{await s.execute({appPath:pt(G),tarball:W.tarball})}),f.command("install [appPath]").description("Install a deployed application on the connected server").option("-r, --remote <name>","Install on a specific remote").action(async(G,W)=>{await p.execute({appPath:pt(G),remote:W.remote})}),f.command("deploy [appPath]").description("Publish a new version to a Twenty server's registry").option("-r, --remote <name>","Deploy to a specific remote").action(async(G,W)=>{await z.execute({appPath:pt(G),remote:W.remote})}),f.command("publish [appPath]").description("Build and publish to npm").option("--tag <tag>","npm dist-tag (e.g. beta, next)").action(async(G,W)=>{await I.execute({appPath:pt(G),tag:W.tag})}),f.command("catalog-sync").description("[Deprecated] Moved under server. Use `yarn twenty server catalog-sync`.").option("-r, --remote <name>","Sync on a specific remote").action(async G=>{console.warn(y.default.yellow("`yarn twenty catalog-sync` is deprecated and will be removed in a future release.\nUse `yarn twenty server catalog-sync` instead.\n")),await D.execute({remote:G.remote})}),f.command("typecheck [appPath]").description("Run TypeScript type checking on the application").action(async G=>{await x.execute({appPath:pt(G)})}),f.command("uninstall [appPath]").description("Uninstall application from Twenty").option("-y, --yes","Skip confirmation prompt").action(async(G,W)=>{try{const Pe=await P.execute({appPath:pt(G),askForConfirmation:!W?.yes});process.exit(Pe.success?0:1)}catch{process.exit(1)}}),Cm(f),Tm(f),f.command("add [entityType]").option("--path <path>","Path in which the entity should be created.").description(`Add a new entity to your application (${Object.values(v.e).join("|")})`).action(async(G,W)=>{await Z.execute(G,W?.path)}),f.command("exec [appPath]").option("--postInstall","Execute post-install logic function if defined").option("--preInstall","Execute pre-install logic function if defined").option("-p, --payload <payload>","JSON payload to send to the function","{}").option("-u, --functionUniversalIdentifier <functionUniversalIdentifier>","Universal ID of the function to execute").option("-n, --functionName <functionName>","Name of the function to execute").description("Execute a logic function with a JSON payload").action(async(G,W)=>{!W?.postInstall&&!W?.preInstall&&!W?.functionUniversalIdentifier&&!W?.functionName&&(console.error(y.default.red("Error: Either --postInstall, --preInstall, --functionName (-n), or --functionUniversalIdentifier (-u) is required.")),process.exit(1)),await Ye.execute({...W,payload:W?.payload??"{}",appPath:pt(G)})}),f.command("logs [appPath]").option("-u, --functionUniversalIdentifier <functionUniversalIdentifier>","Only show logs for the function with this universal ID").option("-n, --functionName <functionName>","Only show logs for the function with this name").description("Watch application function logs").action(async(G,W)=>{await K.execute({...W,appPath:pt(G)})})};rv.inspect.defaultOptions.depth=10;const tn=new Bo.Command;tn.name("twenty").description("CLI for Twenty application development").version(Vo.version);tn.option("-r, --remote <name>","Use a specific remote (overrides the default set by remote switch)");tn.hook("preAction",async f=>{let r=(f.optsWithGlobals?f.optsWithGlobals():f.opts()).remote;r?console.log(y.default.gray(`Using remote: ${r}`)):r=await new v.ConfigService().getDefaultRemote(),v.ConfigService.setActiveRemote(r)});Nm(tn);tn.exitOverride();try{tn.parse()}catch(f){f instanceof Bo.CommanderError&&process.exit(f.exitCode),f instanceof Error&&(console.error(y.default.red("Error:"),f.message),process.exit(1))}