twenty-sdk 0.6.2 → 0.6.3
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.
- package/dist/{AllIcons-CGPKtPQS-CBzLmrUd.mjs → AllIcons-CGPKtPQS-DJFNbeMc.mjs} +4316 -4344
- package/dist/{AllIcons-CGPKtPQS-CoHKEEHb.js → AllIcons-CGPKtPQS-Dd8IM9mm.js} +2549 -2569
- package/dist/{HtmlTagToRemoteComponent-D_EW5OLu.mjs → HtmlTagToRemoteComponent-CKDJQf1M.mjs} +3 -3
- package/dist/{HtmlTagToRemoteComponent-CgtwxDeH.js → HtmlTagToRemoteComponent-Ch6F8pMT.js} +1 -1
- package/dist/cli/commands/app/app-dev.d.ts +2 -0
- package/dist/cli/utilities/api/api-service.d.ts +22 -2
- package/dist/cli/utilities/config/config-service.d.ts +2 -0
- package/dist/cli/utilities/dev/orchestrator/dev-mode-orchestrator.d.ts +1 -0
- package/dist/cli/utilities/dev/orchestrator/steps/register-app-orchestrator-step.d.ts +23 -0
- package/dist/cli/utilities/dev/orchestrator/steps/resolve-application-orchestrator-step.d.ts +1 -0
- package/dist/cli.cjs +80 -60
- package/dist/cli.mjs +1394 -1243
- package/dist/front-component-renderer/index.cjs +1 -1
- package/dist/front-component-renderer/index.mjs +1 -1
- package/dist/{get-function-input-schema-BZ7_XyUh-DAPandzB.mjs → get-function-input-schema-BZ7_XyUh-BggxZXtl.mjs} +1 -1
- package/dist/{get-function-input-schema-BZ7_XyUh-CCSi0u_q.js → get-function-input-schema-BZ7_XyUh-dHQTco6b.js} +1 -1
- package/dist/index-CGU9V37s.js +2200 -0
- package/dist/{index-DeMzdViF.mjs → index-CaKvLIGl.mjs} +18027 -17832
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +2 -2
- package/dist/ui/index.cjs +1 -1
- package/dist/ui/index.mjs +624 -614
- package/package.json +4 -4
- package/dist/index-CicdakVv.js +0 -2430
- package/generated/core/index.ts +0 -406
- package/generated/core/runtime/batcher.ts +0 -265
- package/generated/core/runtime/createClient.ts +0 -68
- package/generated/core/runtime/error.ts +0 -29
- package/generated/core/runtime/fetcher.ts +0 -98
- package/generated/core/runtime/generateGraphqlOperation.ts +0 -225
- package/generated/core/runtime/index.ts +0 -13
- package/generated/core/runtime/linkTypeMap.ts +0 -139
- package/generated/core/runtime/typeSelection.ts +0 -98
- package/generated/core/runtime/types.ts +0 -69
- package/generated/core/schema.graphql +0 -36745
- package/generated/core/schema.ts +0 -39341
- package/generated/core/types.ts +0 -45860
- package/generated/index.ts +0 -2
- package/generated/metadata/index.ts +0 -469
- package/generated/metadata/runtime/batcher.ts +0 -265
- package/generated/metadata/runtime/createClient.ts +0 -68
- package/generated/metadata/runtime/error.ts +0 -29
- package/generated/metadata/runtime/fetcher.ts +0 -98
- package/generated/metadata/runtime/generateGraphqlOperation.ts +0 -225
- package/generated/metadata/runtime/index.ts +0 -13
- package/generated/metadata/runtime/linkTypeMap.ts +0 -139
- package/generated/metadata/runtime/typeSelection.ts +0 -98
- package/generated/metadata/runtime/types.ts +0 -69
- package/generated/metadata/schema.graphql +0 -3971
- package/generated/metadata/schema.ts +0 -8357
- package/generated/metadata/types.ts +0 -10044
package/dist/cli.cjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var Tm=Object.create;var sl=Object.defineProperty;var Em=Object.getOwnPropertyDescriptor;var Fm=Object.getOwnPropertyNames;var Cm=Object.getPrototypeOf,
|
|
3
|
-
const require = __createRequire(import.meta.url);`},et=".twenty/output";var K=(
|
|
2
|
+
"use strict";var Tm=Object.create;var sl=Object.defineProperty;var Em=Object.getOwnPropertyDescriptor;var Fm=Object.getOwnPropertyNames;var Cm=Object.getPrototypeOf,Rm=Object.prototype.hasOwnProperty;var Pm=(l,s,r,o)=>{if(s&&typeof s=="object"||typeof s=="function")for(let f of Fm(s))!Rm.call(l,f)&&f!==r&&sl(l,f,{get:()=>s[f],enumerable:!(o=Em(s,f))||o.enumerable});return l};var bm=(l,s,r)=>(r=l!=null?Tm(Cm(l)):{},Pm(s||!l||!l.__esModule?sl(r,"default",{value:l,enumerable:!0}):r,l));const b=require("path"),km=require("chalk"),N=require("react/jsx-runtime"),Kn=require("react"),_l=require("fs-extra"),Om=require("os"),Lm=require("axios"),Nm=require("fs"),ys=require("graphql"),Um=require("graphql-sse"),k=require("./HtmlTagToRemoteComponent-Ch6F8pMT.js"),al=require("@genql/cli"),Dm=require("typescript"),$m=require("esbuild"),Wm=require("module"),wl=require("fast-glob");require("@sniptt/guards");const Ue=require("uuid"),Mm=require("crypto"),Bm=require("node:fs/promises"),qm=require("fs/promises"),xl=require("node:child_process"),jm=require("node:path"),Hm=require("chokidar"),Gm=require("inquirer"),zm=require("lodash.kebabcase"),Il=require("commander"),Jm=require("util"),Bt=l=>l&&l.__esModule?l:{default:l};function qt(l){if(l&&l.__esModule)return l;const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const r in l)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(l,r);Object.defineProperty(s,r,o.get?o:{enumerable:!0,get:()=>l[r]})}}return s.default=l,Object.freeze(s)}const Y=qt(b),A=Bt(km),Al=Bt(Kn),R=qt(_l),xs=qt(Om),yn=Bt(Lm),ol=qt(Nm),_n=qt(Dm),Sl=qt($m),Kr=Bt(Mm),Km=qt(Bm),ll=qt(qm),Gr=Bt(jm),Tl=Bt(Hm),lt=Bt(Gm),Qe=Bt(zm);var jr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};const Ae=process.env.INIT_CWD||process.cwd(),Gn=l=>l&&!l?.startsWith("/")?b.join(Ae,l):l,Hr="api-client",Is="public",cl="TWENTY_API_URL",Vr="generated",Vm={js:`import { createRequire as __createRequire } from 'module';
|
|
3
|
+
const require = __createRequire(import.meta.url);`},et=".twenty/output";var K=(l=>(l.Object="object",l.Field="field",l.LogicFunction="logicFunction",l.FrontComponent="frontComponent",l.Role="role",l.Skill="skill",l.View="view",l.NavigationMenuItem="navigationMenuItem",l.PageLayout="pageLayout",l))(K||{});const Ze={idle:{color:"gray",icon:"○"},in_progress:{color:"yellow",icon:"spinner"},uploading:{color:"cyan",icon:"upload"},done:{color:"green",icon:"✓"},error:{color:"red",icon:"✗"}},Ym=l=>({idle:"idle",in_progress:"in_progress",done:"done",error:"error"})[l],Xm=l=>({pending:"idle",building:"in_progress",uploading:"uploading",success:"done",error:"error"})[l],Zm=l=>({idle:"idle",building:"in_progress",syncing:"in_progress",synced:"done",error:"error"})[l],Qm={idle:"Idle",building:"Building...",syncing:"Syncing...",synced:"Synced",error:"Error"},El=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],Fl=["↑","⇡","↟","⤒"],Cl={[K.Object]:"Objects",[K.Field]:"Fields",[K.LogicFunction]:"Logic functions",[K.FrontComponent]:"Front components",[K.Role]:"Roles",[K.Skill]:"Skills",[K.View]:"Views",[K.NavigationMenuItem]:"Navigation menu items",[K.PageLayout]:"Page layouts"},Rl=Object.keys(Cl),ev={info:"gray",success:"green",error:"red",warning:"yellow"},tv=l=>l.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),nv=(l,s=40)=>{if(l.length<=s)return l;const r=l.split("/");return r.length<=2?l:`.../${r.slice(-2).join("/")}`},rv=l=>{const s=new Map;for(const r of Rl)s.set(r,[]);for(const r of l.values()){if(!r.type)continue;const o=s.get(r.type)??[];o.push(r),s.set(r.type,o)}return s},iv=l=>!l.frontendUrl||!l.steps.resolveApplication.output.universalIdentifier?null:`${l.frontendUrl}/settings/applications`,sv=l=>l.some(s=>s==="error")?"error":l.some(s=>s==="in_progress")?"in_progress":l.every(s=>s==="done")?"done":"idle",av=l=>{const s=[...l.entities.values()],r=s.some(v=>v.status==="error"),o=s.some(v=>v.status==="building"),f=s.length>0&&s.every(v=>v.status==="uploading"||v.status==="success"),m=r?"error":o?"in_progress":f?"done":"idle";return[{label:"Application Initialization",status:sv([l.steps.checkServer.status,l.steps.ensureValidTokens.status,l.steps.resolveApplication.status])},{label:"Resources Build",status:m},{label:"Resources Upload",status:l.steps.uploadFiles.status},{label:"Manifest Build",status:l.steps.buildManifest.status},{label:"Application Synchronization",status:l.steps.syncApplication.status},{label:"Api Client Generation",status:l.steps.generateApiClient.status}]},ul=(l,s=80,r=!0)=>{const[o,f]=Kn.useState(0);return Kn.useEffect(()=>{if(!r)return;const m=setInterval(()=>{f(v=>(v+1)%l.length)},s);return()=>clearInterval(m)},[l,s,r]),l[o]},As=l=>{const s=Ze[l],r=ul(El,80,s.icon==="spinner"),o=ul(Fl,200,s.icon==="upload");return s.icon==="spinner"?r:s.icon==="upload"?o:s.icon},Pl=Al.default.createContext(null),ov=Pl.Provider,Ft=()=>{const l=Al.default.useContext(Pl);if(!l)throw new Error("useInk must be used within InkProvider");return l},lv=({uiStatus:l})=>{const{Text:s}=Ft(),r=As(l),o=Ze[l];return N.jsxs(s,{color:o.color,children:[r," "]})},cv=({entity:l})=>{const{Box:s,Text:r}=Ft();return N.jsxs(s,{children:[N.jsx(lv,{uiStatus:Xm(l.status)}),N.jsx(r,{children:l.name}),l.path!==l.name&&N.jsxs(r,{dimColor:!0,children:[" (",nv(l.path),")"]})]})},uv=({type:l,entities:s})=>{const{Box:r,Text:o}=Ft();return s.length===0?null:N.jsxs(r,{flexDirection:"column",marginTop:1,children:[N.jsx(o,{bold:!0,dimColor:!0,children:Cl[l]}),s.map(f=>N.jsx(cv,{entity:f},f.path))]})},fv=()=>{const{Box:l,Text:s}=Ft();return N.jsx(l,{marginTop:1,children:N.jsxs(s,{dimColor:!0,children:[N.jsx(s,{color:Ze.idle.color,children:Ze.idle.icon})," ","pending"," ",N.jsx(s,{color:Ze.in_progress.color,children:El[0]})," ","building"," ",N.jsx(s,{color:Ze.uploading.color,children:Fl[0]})," ","uploading"," ",N.jsx(s,{color:Ze.done.color,children:Ze.done.icon})," ","success"," ",N.jsx(s,{color:Ze.error.color,children:Ze.error.icon})," ","error"]})})},pv=({state:l})=>{const{Text:s}=Ft(),r=Zm(l.pipeline.status),o=As(r),f=Ze[r],m=Qm[l.pipeline.status];return N.jsxs(s,{color:f.color,children:[o," ",m,l.pipeline.error&&`: ${l.pipeline.error}`]})},dv=({label:l,status:s})=>{const{Box:r,Text:o}=Ft(),f=Ym(s),m=As(f),v=Ze[f];return N.jsxs(r,{children:[N.jsxs(o,{dimColor:!0,children:[l,": "]}),N.jsxs(o,{color:v.color,children:[m," ",s.replace("_"," ")]})]})},hv=({state:l})=>{const{Box:s,Text:r}=Ft(),o=rv(l.entities),f=iv(l);return N.jsxs(s,{flexDirection:"column",borderStyle:"classic",borderColor:"gray",paddingX:1,children:[N.jsx(r,{bold:!0,color:"cyan",children:"Application"}),N.jsxs(s,{marginLeft:2,flexDirection:"column",children:[N.jsxs(s,{children:[N.jsx(r,{dimColor:!0,children:"Name: "}),N.jsx(r,{bold:!0,children:l.pipeline.appName??"Loading..."})]}),N.jsxs(s,{children:[N.jsx(r,{dimColor:!0,children:"Overall Status: "}),N.jsx(pv,{state:l})]}),f&&N.jsxs(s,{children:[N.jsx(r,{dimColor:!0,children:"Open:"}),N.jsxs(r,{bold:!0,color:"cyan",children:[" ",f]})]})]}),N.jsx(s,{marginLeft:2,flexDirection:"column",marginTop:1,children:av(l).map(m=>N.jsx(dv,{label:m.label,status:m.status},m.label))}),N.jsx(s,{marginLeft:2,flexDirection:"column",children:Rl.map(m=>{const v=o.get(m)??[];return N.jsx(uv,{type:m,entities:v},m)})})]})},gv=({event:l})=>{const{Box:s,Text:r}=Ft(),o=ev[l.status],f=tv(l.timestamp);return N.jsxs(s,{children:[N.jsxs(r,{dimColor:!0,children:[f," "]}),N.jsx(r,{color:o,children:l.message})]})},mv=({uiStateManager:l})=>{const{Box:s,Static:r}=Ft(),[,o]=Kn.useReducer(m=>m+1,0);Kn.useEffect(()=>l.subscribe(()=>o()),[l]);const f=l.getSnapshot();return N.jsxs(N.Fragment,{children:[N.jsx(r,{items:f.events,children:m=>N.jsx(gv,{event:m},m.id)}),N.jsxs(s,{marginTop:1,flexDirection:"column",children:[N.jsx(hv,{state:f}),N.jsx(fv,{})]})]})},vv=async l=>{const s=await import("ink"),{render:r,Box:o,Text:f,Static:m}=s,{unmount:v}=r(N.jsx(ov,{value:{Box:o,Text:f,Static:m},children:N.jsx(mv,{uiStateManager:l})}));return{unmount:v}};class yv{constructor(s){this.listeners=new Set,this.orchestratorState=s}getSnapshot(){return this.orchestratorState}subscribe(s){return this.listeners.add(s),s(this.orchestratorState),()=>this.listeners.delete(s)}notify(){for(const s of this.listeners)s(this.orchestratorState)}}const _v=Y.join(xs.tmpdir(),".twenty-sdk-test"),wv=()=>process.env.NODE_ENV==="test"?Y.join(_v,"config.json"):Y.join(xs.homedir(),".twenty","config.json"),Et="default",Jr=class Jr{constructor(){this.configPath=wv()}static setActiveWorkspace(s){this.activeWorkspace=s??Et}static getActiveWorkspace(){return this.activeWorkspace}getActiveWorkspaceName(){return Jr.getActiveWorkspace()}async readRawConfig(){await R.ensureFile(this.configPath);const s=await R.readFile(this.configPath,"utf8");return JSON.parse(s||"{}")}async getConfig(){return this.getConfigForWorkspace(this.getActiveWorkspaceName())}async getConfigForWorkspace(s){const r=this.getDefaultConfig();try{const o=await this.readRawConfig(),f=s===Et&&!o.profiles?.[Et]?o:o.profiles?.[s],m=f?.apiUrl??r.apiUrl,v=f?.apiKey,E=f?.applicationAccessToken,C=f?.applicationRefreshToken;return{apiUrl:m,apiKey:v,applicationAccessToken:E,applicationRefreshToken:C}}catch{return r}}async setConfig(s){const r=await this.readRawConfig(),o=this.getActiveWorkspaceName();r.profiles||(r.profiles={});const f=r.profiles[o]||{apiUrl:""};r.profiles[o]={...f,...s},await R.ensureDir(Y.dirname(this.configPath)),await R.writeFile(this.configPath,JSON.stringify(r,null,2))}async clearConfig(){const s=await this.readRawConfig(),r=this.getActiveWorkspaceName();if(s.profiles||(s.profiles={}),s.profiles[r]&&delete s.profiles[r],r===Et){const o=this.getDefaultConfig();delete s.apiKey,s.apiUrl=o.apiUrl}await R.ensureDir(Y.dirname(this.configPath)),await R.writeFile(this.configPath,JSON.stringify(s,null,2))}getDefaultConfig(){return{apiUrl:"http://localhost:3000"}}async getAvailableWorkspaces(){try{const s=await this.readRawConfig(),r=new Set;return r.add(Et),s.profiles&&Object.keys(s.profiles).forEach(o=>r.add(o)),Array.from(r).sort()}catch{return[Et]}}async getDefaultWorkspace(){try{return(await this.readRawConfig()).defaultWorkspace??Et}catch{return Et}}async setDefaultWorkspace(s){const r=await this.readRawConfig();r.defaultWorkspace=s,await R.ensureDir(Y.dirname(this.configPath)),await R.writeFile(this.configPath,JSON.stringify(r,null,2))}};Jr.activeWorkspace=Et;let _e=Jr;class Ct{constructor(s){const{disableInterceptors:r=!1}=s||{};this.configService=new _e,this.client=yn.default.create(),this.client.interceptors.request.use(async o=>{const f=await this.configService.getConfig();return o.baseURL=f.apiUrl,!o.headers.Authorization&&f.apiKey&&(o.headers.Authorization=`Bearer ${f.apiKey}`),o}),!r&&this.client.interceptors.response.use(o=>o,o=>{throw o.response?.status===401?console.error(A.default.red("Authentication failed. Please run `twenty auth:login` first.")):o.response?.status===403?console.error(A.default.red("Access denied. Check your API key and workspace permissions.")):o.code==="ECONNREFUSED"&&console.error(A.default.red("Cannot connect to Twenty server. Is it running?")),o})}async validateAuth(){try{const r=await this.client.post("/metadata",{query:`
|
|
4
4
|
query CurrentWorkspace {
|
|
5
5
|
currentWorkspace {
|
|
6
6
|
id
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
`},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return{authValid:r.status===200&&!r.data.errors,serverUp:r.status===200}}catch{return{authValid:!1,serverUp:!1}}}async findOneApplication(s){try{const
|
|
9
|
+
`},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return{authValid:r.status===200&&!r.data.errors,serverUp:r.status===200}}catch{return{authValid:!1,serverUp:!1}}}async findOneApplication(s){try{const o=await this.client.post("/metadata",{query:`
|
|
10
10
|
query FindOneApplication($universalIdentifier: UUID!) {
|
|
11
11
|
findOneApplication(universalIdentifier: $universalIdentifier) {
|
|
12
12
|
id
|
|
13
13
|
universalIdentifier
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
`,variables:{universalIdentifier:s}},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return
|
|
16
|
+
`,variables:{universalIdentifier:s}},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return o.data.errors?o.data.errors.some(m=>m.extensions?.code==="NOT_FOUND")?{success:!0,data:null}:{success:!1,error:o.data.errors[0]}:{success:!0,data:o.data.data.findOneApplication}}catch(r){return{success:!1,error:r}}}async generateApplicationToken(s){try{const o=await this.client.post("/metadata",{query:`
|
|
17
17
|
mutation GenerateApplicationToken($applicationId: UUID!) {
|
|
18
18
|
generateApplicationToken(applicationId: $applicationId) {
|
|
19
19
|
applicationAccessToken {
|
|
@@ -26,7 +26,7 @@ const require = __createRequire(import.meta.url);`},et=".twenty/output";var K=(o
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
`,variables:{applicationId:s}},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return
|
|
29
|
+
`,variables:{applicationId:s}},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return o.data.errors?{success:!1,error:o.data.errors[0]}:{success:!0,data:o.data.data.generateApplicationToken}}catch(r){return{success:!1,error:r}}}async renewApplicationToken(s){try{const o=await this.client.post("/metadata",{query:`
|
|
30
30
|
mutation RenewApplicationToken($applicationRefreshToken: String!) {
|
|
31
31
|
renewApplicationToken(applicationRefreshToken: $applicationRefreshToken) {
|
|
32
32
|
applicationAccessToken {
|
|
@@ -39,25 +39,45 @@ const require = __createRequire(import.meta.url);`},et=".twenty/output";var K=(o
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
`,variables:{applicationRefreshToken:s}},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return
|
|
42
|
+
`,variables:{applicationRefreshToken:s}},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return o.data.errors?{success:!1,error:o.data.errors[0]}:{success:!0,data:o.data.data.renewApplicationToken}}catch(r){return{success:!1,error:r}}}async findApplicationRegistrationByUniversalIdentifier(s){try{const o=await this.client.post("/metadata",{query:`
|
|
43
|
+
query FindApplicationRegistrationByUniversalIdentifier($universalIdentifier: String!) {
|
|
44
|
+
findApplicationRegistrationByUniversalIdentifier(universalIdentifier: $universalIdentifier) {
|
|
45
|
+
id
|
|
46
|
+
universalIdentifier
|
|
47
|
+
name
|
|
48
|
+
oAuthClientId
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
`,variables:{universalIdentifier:s}},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return o.data.errors?{success:!1,error:o.data.errors[0]}:{success:!0,data:o.data.data.findApplicationRegistrationByUniversalIdentifier}}catch(r){return{success:!1,error:r}}}async createApplicationRegistration(s){try{const o=await this.client.post("/metadata",{query:`
|
|
52
|
+
mutation CreateApplicationRegistration($input: CreateApplicationRegistrationInput!) {
|
|
53
|
+
createApplicationRegistration(input: $input) {
|
|
54
|
+
applicationRegistration {
|
|
55
|
+
id
|
|
56
|
+
universalIdentifier
|
|
57
|
+
oAuthClientId
|
|
58
|
+
}
|
|
59
|
+
clientSecret
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
`,variables:{input:s}},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return o.data.errors?{success:!1,error:o.data.errors[0]}:{success:!0,data:o.data.data.createApplicationRegistration}}catch(r){return{success:!1,error:r}}}async createApplication(s,r){try{const o=`
|
|
43
63
|
mutation CreateOneApplication($input: CreateApplicationInput!) {
|
|
44
64
|
createOneApplication(input: $input) {
|
|
45
65
|
id
|
|
46
66
|
universalIdentifier
|
|
47
67
|
}
|
|
48
68
|
}
|
|
49
|
-
`,
|
|
69
|
+
`,f={universalIdentifier:s.application.universalIdentifier,name:s.application.displayName,version:"0.0.1",sourcePath:"cli-sync"};r?.applicationRegistrationId&&(f.applicationRegistrationId=r.applicationRegistrationId);const m={input:f},v=await this.client.post("/metadata",{query:o,variables:m},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return v.data.errors?{success:!1,error:v.data.errors[0]}:{success:!0,data:v.data.data.createOneApplication,message:`Successfully create application: ${s.application.displayName}`}}catch(o){return{success:!1,error:o}}}async syncApplication(s){try{const r=`
|
|
50
70
|
mutation SyncApplication($manifest: JSON!) {
|
|
51
71
|
syncApplication(manifest: $manifest) {
|
|
52
72
|
applicationUniversalIdentifier
|
|
53
73
|
actions
|
|
54
74
|
}
|
|
55
75
|
}
|
|
56
|
-
`,
|
|
76
|
+
`,o={manifest:s},f=await this.client.post("/metadata",{query:r,variables:o},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return f.data.errors?{success:!1,error:f.data.errors[0]}:{success:!0,data:f.data.data.syncApplication,message:`Successfully synced application: ${s.application.displayName}`}}catch(r){if(yn.default.isAxiosError(r)&&r.response){const o=r.response.data?.errors;return Array.isArray(o)&&o.length>0?{success:!1,error:o[0]?.message||r.message}:{success:!1,error:r.response.data?.message||`HTTP ${r.response.status}: ${r.message}`}}return{success:!1,error:r instanceof Error?r.message:r}}}async uninstallApplication(s){try{const r=`
|
|
57
77
|
mutation UninstallApplication($universalIdentifier: String!) {
|
|
58
78
|
uninstallApplication(universalIdentifier: $universalIdentifier)
|
|
59
79
|
}
|
|
60
|
-
`,
|
|
80
|
+
`,o={universalIdentifier:s},f=await this.client.post("/metadata",{query:r,variables:o},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return f.data.errors?{success:!1,error:f.data.errors[0]?.message||"Failed to delete application"}:{success:!0,data:f.data.data.uninstallApplication,message:"Successfully uninstalled application"}}catch(r){if(yn.default.isAxiosError(r)&&r.response)return{success:!1,error:r.response.data?.errors?.[0]?.message||r.message};throw r}}async getSchema(s){return this.introspectEndpoint("/graphql",s)}async getMetadataSchema(s){return this.introspectEndpoint("/metadata",s)}async introspectEndpoint(s,r){try{const o=ys.getIntrospectionQuery(),f={"Content-Type":"application/json",Accept:"*/*"};r?.authToken&&(f.Authorization=`Bearer ${r.authToken}`);const m=await this.client.post(s,{query:o},{headers:f});if(m.data.errors)return{success:!1,error:`GraphQL introspection errors: ${JSON.stringify(m.data.errors)}`};const v=ys.buildClientSchema(m.data.data);return{success:!0,data:ys.printSchema(v),message:`Successfully loaded schema from ${s}`}}catch(o){if(yn.default.isAxiosError(o)&&o.response)return{success:!1,error:o.response.data.errors[0]?.message||`Failed to load schema from ${s}`};throw o}}async findLogicFunctions(){try{const r=await this.client.post("/metadata",{query:`
|
|
61
81
|
query FindManyLogicFunctions {
|
|
62
82
|
findManyLogicFunctions {
|
|
63
83
|
id
|
|
@@ -66,7 +86,7 @@ const require = __createRequire(import.meta.url);`},et=".twenty/output";var K=(o
|
|
|
66
86
|
applicationId
|
|
67
87
|
}
|
|
68
88
|
}
|
|
69
|
-
`},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return r.data.errors?{success:!1,error:r.data.errors[0]?.message||"Failed to fetch functions"}:{success:!0,data:r.data.data.findManyLogicFunctions}}catch(s){return{success:!1,error:s}}}async executeLogicFunction({functionId:s,payload:r}){try{const
|
|
89
|
+
`},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return r.data.errors?{success:!1,error:r.data.errors[0]?.message||"Failed to fetch functions"}:{success:!0,data:r.data.data.findManyLogicFunctions}}catch(s){return{success:!1,error:s}}}async executeLogicFunction({functionId:s,payload:r}){try{const o=`
|
|
70
90
|
mutation ExecuteOneLogicFunction($input: ExecuteOneLogicFunctionInput!) {
|
|
71
91
|
executeOneLogicFunction(input: $input) {
|
|
72
92
|
data
|
|
@@ -76,18 +96,18 @@ const require = __createRequire(import.meta.url);`},et=".twenty/output";var K=(o
|
|
|
76
96
|
error
|
|
77
97
|
}
|
|
78
98
|
}
|
|
79
|
-
`,f={input:{id:s,payload:r}},m=await this.client.post("/metadata",{query:
|
|
99
|
+
`,f={input:{id:s,payload:r}},m=await this.client.post("/metadata",{query:o,variables:f},{headers:{"Content-Type":"application/json",Accept:"*/*"}});return m.data.errors?{success:!1,error:m.data.errors[0]?.message||"Failed to execute logic function"}:{success:!0,data:m.data.data.executeOneLogicFunction}}catch(o){return{success:!1,error:o}}}async subscribeToLogs({applicationUniversalIdentifier:s,functionUniversalIdentifier:r,functionName:o}){const f=await this.configService.getConfig(),m=Um.createClient({url:f.apiUrl+"/metadata",headers:{Authorization:`Bearer ${f.apiKey}`,"Content-Type":"application/json",Accept:"text/event-stream"}}),v=`
|
|
80
100
|
subscription SubscribeToLogs($input: LogicFunctionLogsInput!) {
|
|
81
101
|
logicFunctionLogs(input: $input) {
|
|
82
102
|
logs
|
|
83
103
|
}
|
|
84
104
|
}
|
|
85
|
-
`,E={input:{applicationUniversalIdentifier:s,universalIdentifier:r,name:
|
|
105
|
+
`,E={input:{applicationUniversalIdentifier:s,universalIdentifier:r,name:o}};m.subscribe({query:v,variables:E},{next:({data:C})=>console.log(C?.logicFunctionLogs.logs),error:C=>console.error(C),complete:()=>console.log("Completed")})}async uploadFile({filePath:s,builtHandlerPath:r,fileFolder:o,applicationUniversalIdentifier:f}){try{const m=Y.resolve(s);if(!ol.existsSync(m))return{success:!1,error:`File not found: ${m}`};const v=Y.basename(m),E=ol.readFileSync(m),C=this.getMimeType(v),M=`
|
|
86
106
|
mutation UploadApplicationFile($file: Upload!, $applicationUniversalIdentifier: String!, $fileFolder: FileFolder!, $filePath: String!) {
|
|
87
107
|
uploadApplicationFile(file: $file, applicationUniversalIdentifier: $applicationUniversalIdentifier, fileFolder: $fileFolder, filePath: $filePath)
|
|
88
108
|
{ path }
|
|
89
109
|
}
|
|
90
|
-
`,
|
|
110
|
+
`,j=k.TO(o),X=JSON.stringify({query:M,variables:{file:null,applicationUniversalIdentifier:f,filePath:r,fileFolder:j}}),U=JSON.stringify({0:["variables.file"]}),V=new FormData;V.append("operations",X),V.append("map",U),V.append("0",new Blob([new Uint8Array(E)],{type:C}),v);const ne=await this.client.post("/metadata",V);return ne.data.errors?{success:!1,error:ne.data.errors[0]?.message||"Failed to upload file"}:{success:!0,data:ne.data.data.uploadApplicationFile,message:`Successfully uploaded ${v}`}}catch(m){return yn.default.isAxiosError(m)&&m.response?{success:!1,error:m.response.data?.errors?.[0]?.message||m.message}:{success:!1,error:m}}}getMimeType(s){const r=Y.extname(s).toLowerCase();return{".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".svg":"image/svg+xml",".bmp":"image/bmp",".ico":"image/x-icon",".pdf":"application/pdf",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".ppt":"application/vnd.ms-powerpoint",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".txt":"text/plain",".csv":"text/csv",".json":"application/json",".xml":"application/xml",".zip":"application/zip",".tar":"application/x-tar",".gz":"application/gzip",".mp3":"audio/mpeg",".mp4":"video/mp4",".avi":"video/x-msvideo",".mov":"video/quicktime",".js":"application/javascript",".ts":"application/typescript",".jsx":"application/javascript",".tsx":"application/typescript",".html":"text/html",".css":"text/css"}[r]||"application/octet-stream"}}const xv=`// Ambient type stubs for the genql-generated code this template gets
|
|
91
111
|
// injected into. They enable full typecheck/lint on this file.
|
|
92
112
|
// __STRIPPED_DURING_INJECTION_START__
|
|
93
113
|
type QueryGenqlSelection = Record<string, unknown>;
|
|
@@ -521,16 +541,16 @@ export class TwentyGeneratedClient {
|
|
|
521
541
|
processEnvironment[APP_ACCESS_TOKEN_ENV_KEY] = token;
|
|
522
542
|
}
|
|
523
543
|
}
|
|
524
|
-
`,fl={DateTime:"string",JSON:"Record<string, unknown>",UUID:"string"},
|
|
544
|
+
`,fl={DateTime:"string",JSON:"Record<string, unknown>",UUID:"string"},Iv="// __STRIPPED_DURING_INJECTION_START__",Av="// __STRIPPED_DURING_INJECTION_END__",pl="// __UPLOAD_FILE_START__",dl="// __UPLOAD_FILE_END__",Sv=l=>{let s=xv;return s=s.replace(new RegExp(`${vn(Iv)}[\\s\\S]*?${vn(Av)}\\n?`),""),s=s.replace("'__TWENTY_DEFAULT_URL__'",l.defaultUrl),s=s.replace(/TwentyGeneratedClient/g,l.apiClientName),l.includeUploadFile?(s=s.replace(new RegExp(`\\s*${vn(pl)}\\n`),`
|
|
525
545
|
`),s=s.replace(new RegExp(`\\s*${vn(dl)}\\n`),`
|
|
526
546
|
`)):s=s.replace(new RegExp(`\\s*${vn(pl)}[\\s\\S]*?${vn(dl)}\\n?`),`
|
|
527
547
|
`),`
|
|
528
|
-
// ${
|
|
529
|
-
${s}`},vn=
|
|
530
|
-
`),await
|
|
531
|
-
`),await this.writeBarrelIndex(r))}resolveGeneratedPath(s){return
|
|
548
|
+
// ${l.apiClientName} (auto-injected by twenty-sdk)
|
|
549
|
+
${s}`},vn=l=>l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");class Tv{constructor(){this.apiService=new Ct({disableInterceptors:!0})}async generate({appPath:s,authToken:r}){const o=this.resolveGeneratedPath(s),f=`${o}.tmp`,[m,v]=await Promise.all([this.apiService.getSchema({authToken:r}),this.apiService.getMetadataSchema({authToken:r})]);if(!m.success)throw new Error(`Failed to introspect core schema: ${JSON.stringify(m.error)}`);if(!v.success)throw new Error(`Failed to introspect metadata schema: ${JSON.stringify(v.error)}`);await R.ensureDir(f),await R.emptyDir(f),await Promise.all([al.generate({schema:m.data,output:b.join(f,"core"),scalarTypes:fl}),al.generate({schema:v.data,output:b.join(f,"metadata"),scalarTypes:{...fl,Upload:"File"}})]),await this.injectClientWrapper(b.join(f,"core"),{apiClientName:"CoreApiClient",defaultUrl:`\`\${process.env.${cl}}/graphql\``,includeUploadFile:!1}),await this.injectClientWrapper(b.join(f,"metadata"),{apiClientName:"MetadataApiClient",defaultUrl:`\`\${process.env.${cl}}/metadata\``,includeUploadFile:!0}),await this.writeBarrelIndex(f),await R.remove(o),await R.move(f,o)}async ensureGeneratedClientStub({appPath:s}){const r=this.resolveGeneratedPath(s);await R.pathExists(b.join(r,"index.ts"))||(await R.ensureDir(b.join(r,"core")),await R.ensureDir(b.join(r,"metadata")),await R.writeFile(b.join(r,"core","index.ts"),`export class CoreApiClient {}
|
|
550
|
+
`),await R.writeFile(b.join(r,"metadata","index.ts"),`export class MetadataApiClient {}
|
|
551
|
+
`),await this.writeBarrelIndex(r))}resolveGeneratedPath(s){return b.join(s,"node_modules","twenty-sdk",Vr)}async writeBarrelIndex(s){await R.writeFile(b.join(s,"index.ts"),`export { CoreApiClient } from './core/index';
|
|
532
552
|
export { MetadataApiClient } from './metadata/index';
|
|
533
|
-
`)}async injectClientWrapper(s,r){const l=Iv(r);await P.appendFile(R.join(s,"index.ts"),l)}}var zr=(o=>(o.DefineApplication="defineApplication",o.DefineField="defineField",o.DefineLogicFunction="defineLogicFunction",o.DefinePreInstallLogicFunction="definePreInstallLogicFunction",o.DefinePostInstallLogicFunction="definePostInstallLogicFunction",o.DefineObject="defineObject",o.DefineRole="defineRole",o.DefineSkill="defineSkill",o.DefineFrontComponent="defineFrontComponent",o.DefineView="defineView",o.DefineNavigationMenuItem="defineNavigationMenuItem",o.DefinePageLayout="definePageLayout",o))(zr||{}),Xe=(o=>(o.Application="application",o.Fields="fields",o.LogicFunctions="logicFunctions",o.Objects="objects",o.Roles="roles",o.Skills="skills",o.FrontComponents="frontComponents",o.PublicAssets="publicAssets",o.Views="views",o.NavigationMenuItems="navigationMenuItems",o.PageLayouts="pageLayouts",o))(Xe||{});const Ev={defineApplication:"application",defineField:"fields",defineLogicFunction:"logicFunctions",definePreInstallLogicFunction:"logicFunctions",definePostInstallLogicFunction:"logicFunctions",defineObject:"objects",defineRole:"roles",defineSkill:"skills",defineFrontComponent:"frontComponents",defineView:"views",defineNavigationMenuItem:"navigationMenuItems",definePageLayout:"pageLayouts"},Fv=o=>{if(!_n.isCallExpression(o))return;const s=o.expression;if(_n.isIdentifier(s)&&Object.values(zr).includes(s.text))return s.text},Cv=o=>{const s=_n.createSourceFile("temp.ts",o,_n.ScriptTarget.Latest,!0),r=[];_n.forEachChild(s,l=>{r.push(l)});for(const l of r)if(_n.isExportAssignment(l)){if(l.isExportEquals||!l.expression)return;const f=Fv(l.expression);if(f)return f}},Pv=["twenty-sdk/ui"],bv={name:"manifest-mock",setup:o=>{const s=new RegExp(`^(${Pv.map(r=>r.replace("/","\\/")).join("|")})$`);o.onResolve({filter:s},({path:r})=>({path:r,namespace:"manifest-mock"})),o.onLoad({filter:/.*/,namespace:"manifest-mock"},()=>({contents:"module.exports = new Proxy({}, { get: () => () => {} });",loader:"js"}))}},dt=async({filePath:o,appPath:s})=>{const r=await Rv({filePath:o,appPath:s});return kv(r,o)},Rv=async({filePath:o,appPath:s})=>{const r=Y.default.join(s,"tsconfig.json"),l=await P.pathExists(r),f=Wm.createRequire(Y.default.join(s,"package.json"));let m,v;try{m=Y.default.dirname(f.resolve("react/package.json")),v=Y.default.dirname(f.resolve("react-dom/package.json"))}catch{}const C=(await Il.build({entryPoints:[o],bundle:!0,write:!1,format:"cjs",platform:"node",target:"node18",jsx:"automatic",tsconfig:l?r:void 0,alias:{...m&&{react:m},...v&&{"react-dom":v}},plugins:[bv],logLevel:"silent"})).outputFiles[0].text,M=await P.mkdtemp(Y.default.join(xs.default.tmpdir(),"twenty-manifest-")),q=Y.default.join(M,"module.cjs");try{return await P.writeFile(q,C),require(q)}finally{await P.remove(M)}},kv=(o,s)=>{if(k.o(o.default)&&k.AN(o.default))return o.default;throw new Error(`Config file ${s} must export a config object default export`)},Ov={type:"object",properties:{}},Lv=async o=>{const{getFunctionInputSchema:s}=await Promise.resolve().then(()=>require("./get-function-input-schema-BZ7_XyUh-CCSi0u_q.js")),r=s(o)[0];return r?.type==="object"&&k.o(r.properties)?{type:"object",properties:r.properties}:Ov},Nv="142046f0-4d80-48b5-ad56-26ad410e895c",ot=({objectConfig:o,fieldName:s})=>{const r=`${o.universalIdentifier}-${s}`;return Ue.v5(r,Nv)},Uv=o=>{const s={name:"id",label:"Id",description:"Id",icon:"Icon123",isNullable:!1,defaultValue:"uuid",type:k.R.UUID,universalIdentifier:ot({objectConfig:o,fieldName:"id"})},r={name:"name",label:"Name",description:"Name",icon:"IconAbc",isNullable:!0,defaultValue:null,type:k.R.TEXT,universalIdentifier:ot({objectConfig:o,fieldName:"name"})},l={name:"createdAt",label:"Creation date",description:"Creation date",icon:"IconCalendar",isNullable:!1,defaultValue:"now",type:k.R.DATE_TIME,universalIdentifier:ot({objectConfig:o,fieldName:"createdAt"})},f={name:"updatedAt",label:"Last update",description:"Last time the record was changed",icon:"IconCalendarClock",isNullable:!1,defaultValue:"now",type:k.R.DATE_TIME,universalIdentifier:ot({objectConfig:o,fieldName:"updatedAt"})},m={name:"deletedAt",label:"Deleted at",description:"Deletion date",icon:"IconCalendarClock",isNullable:!0,defaultValue:null,type:k.R.DATE_TIME,universalIdentifier:ot({objectConfig:o,fieldName:"deletedAt"})},v={name:"createdBy",label:"Created by",description:"The creator of the record",icon:"IconCreativeCommonsSa",isNullable:!1,defaultValue:{name:"''",source:"'MANUAL'"},type:k.R.ACTOR,universalIdentifier:ot({objectConfig:o,fieldName:"createdBy"})},E={name:"updatedBy",label:"Updated by",description:"The workspace member who last updated the record",icon:"IconUserCircle",isNullable:!1,defaultValue:{name:"''",source:"'MANUAL'"},type:k.R.ACTOR,universalIdentifier:ot({objectConfig:o,fieldName:"updatedBy"})},C={name:"position",label:"Position",description:"Position",icon:"IconHierarchy2",isNullable:!1,defaultValue:0,type:k.R.POSITION,universalIdentifier:ot({objectConfig:o,fieldName:"position"})},M={name:"searchVector",label:"Search vector",icon:"IconSearch",description:"Search vector",isNullable:!0,defaultValue:null,type:k.R.TS_VECTOR,universalIdentifier:ot({objectConfig:o,fieldName:"searchVector"})};return[s,r,l,f,m,v,E,C,M]},zn={targetFieldName:o=>`target${k.cs(o.nameSingular)}`,targetLabel:o=>k.cs(o.nameSingular),icon:"IconBuildingSkyscraper"},Dv=[{...zn,fieldName:"timelineActivities",label:"Timeline Activities",targetIcon:"IconTimelineEvent",targetFieldType:k.R.MORPH_RELATION,standardObjectKey:"timelineActivity",morphId:k.y.timelineActivity.morphIds.targetMorphId.morphId},{...zn,fieldName:"favorites",label:"Favorites",icon:"IconBuildingSkyscraper",targetIcon:"IconHeart",targetFieldType:k.R.RELATION,standardObjectKey:"favorite"},{...zn,fieldName:"attachments",label:"Attachments",icon:"IconBuildingSkyscraper",targetIcon:"IconFileImport",targetFieldType:k.R.MORPH_RELATION,standardObjectKey:"attachment",morphId:k.y.attachment.morphIds.targetMorphId.morphId},{...zn,fieldName:"noteTargets",label:"Note Targets",icon:"IconBuildingSkyscraper",targetIcon:"IconCheckbox",targetFieldType:k.R.MORPH_RELATION,standardObjectKey:"noteTarget",morphId:k.y.noteTarget.morphIds.targetMorphId.morphId},{...zn,fieldName:"taskTargets",label:"Task Targets",icon:"IconBuildingSkyscraper",targetIcon:"IconCheckbox",targetFieldType:k.R.MORPH_RELATION,standardObjectKey:"taskTarget",morphId:k.y.taskTarget.morphIds.targetMorphId.morphId}],$v=({config:o,forwardFieldUniversalIdentifier:s,objectConfig:r,universalIdentifier:l})=>{const f=k.y[o.standardObjectKey],m={name:o.targetFieldName(r),label:o.targetLabel(r),description:`${o.targetLabel(r)} ${r.labelSingular}`,icon:o.targetIcon,isNullable:!0,universalSettings:{relationType:k.V.MANY_TO_ONE,onDelete:k.W.SET_NULL,joinColumnName:`target${k.cs(r.nameSingular)}Id`},universalIdentifier:l,objectUniversalIdentifier:f.universalIdentifier,relationTargetFieldMetadataUniversalIdentifier:s,relationTargetObjectMetadataUniversalIdentifier:r.universalIdentifier};return o.targetFieldType===k.R.MORPH_RELATION?{...m,type:o.targetFieldType,morphId:o.morphId}:{...m,type:o.targetFieldType}},Wv=o=>{const s=[],r=[];for(const l of Dv){const f=k.y[l.standardObjectKey],m=ot({objectConfig:o,fieldName:l.fieldName}),v=ot({objectConfig:o,fieldName:`${l.fieldName}Inverse`}),E={name:l.fieldName,label:l.label,description:`${o.labelPlural} tied to the ${l.targetLabel(o)}`,icon:l.icon,isNullable:!1,type:k.R.RELATION,universalSettings:{relationType:k.V.ONE_TO_MANY},universalIdentifier:m,relationTargetFieldMetadataUniversalIdentifier:v,relationTargetObjectMetadataUniversalIdentifier:f.universalIdentifier},C=$v({config:l,objectConfig:o,universalIdentifier:v,forwardFieldUniversalIdentifier:m});s.push(E),r.push(C)}return{objectFields:s,fields:r}},Mv=o=>{const s=Uv(o),{objectFields:r,fields:l}=Wv(o),f=(o.fields??[]).map(v=>v.name),m=[...o.fields];for(const v of s)f.includes(v.name)||m.push(v);for(const v of r)f.includes(v.name)||m.push(v);return{objectFields:m,fields:l}},Bv=async o=>await wl.glob(["**/*.ts","**/*.tsx"],{cwd:o,absolute:!0,ignore:["**/node_modules/**","**/*.d.ts","**/dist/**","**/.twenty/**"],onlyFiles:!0}),jv=async o=>await wl.glob([`${As}/**/*`],{cwd:o,onlyFiles:!0}),Rl=async o=>{const s=await Bv(o),r=[];let l;const f=[],m=[],v=[],E=[],C=[],M=[],q=[],X=[],U=[],V=[],ne=[],De=[],Ie=[],ht=[],xn=[],$e=[],Pt=[],We=[],bt=[],Me=[],Rt=[],Qt=[],Vn=[];for(const oe of s){const Yn=await _l.readFile(oe,"utf-8"),Be=R.relative(o,oe),je=Cv(Yn);if(!je)continue;switch(Ev[je]){case Xe.Application:{const G=await dt({appPath:o,filePath:oe});l={...G.config,yarnLockChecksum:null,packageJsonChecksum:null,apiClientChecksum:null},r.push(...G.errors),Ie.push(Be);break}case Xe.Objects:{const G=await dt({appPath:o,filePath:oe}),{objectFields:Te,fields:de}=Mv(G.config),ut=G.config.labelIdentifierFieldMetadataUniversalIdentifier??Te.find(An=>An.name==="name")?.universalIdentifier;if(!ut){r.push(`No label identifier field found for object ${G.config.nameSingular}. Please add a field with name "name" to your object.`);break}const qt={...G.config,fields:Te,labelIdentifierFieldMetadataUniversalIdentifier:ut};f.push(qt),m.push(...de),r.push(...G.errors),ht.push(Be);break}case Xe.Fields:{const G=await dt({appPath:o,filePath:oe});m.push(G.config),r.push(...G.errors),xn.push(Be);break}case Xe.Roles:{const G=await dt({appPath:o,filePath:oe});v.push(G.config),r.push(...G.errors),$e.push(Be);break}case Xe.Skills:{const G=await dt({appPath:o,filePath:oe});E.push(G.config),r.push(...G.errors),Pt.push(Be);break}case Xe.LogicFunctions:{const G=await dt({appPath:o,filePath:oe});r.push(...G.errors);const{handler:Te,...de}=G.config,ut=R.relative(o,oe),qt=de.toolInputSchema??await Lv(Yn),An={...de,toolInputSchema:qt,handlerName:"default.config.handler",sourceHandlerPath:ut,builtHandlerPath:ut.replace(/\.tsx?$/,".mjs"),builtHandlerChecksum:"[default-checksum]"};C.push(An),We.push(Be),je===zr.DefinePreInstallLogicFunction&&ne.push(G.config.universalIdentifier),je===zr.DefinePostInstallLogicFunction&&De.push(G.config.universalIdentifier);break}case Xe.FrontComponents:{const G=await dt({appPath:o,filePath:oe});r.push(...G.errors);const{component:Te,...de}=G.config,ut=R.relative(o,oe),qt={...de,componentName:Te.name,sourceComponentPath:ut,builtComponentPath:ut.replace(/\.tsx?$/,".mjs"),builtComponentChecksum:"",isHeadless:de.isHeadless??!1};M.push(qt),bt.push(Be);break}case Xe.Views:{const G=await dt({appPath:o,filePath:oe}),Te={...G.config};X.push(Te),r.push(...G.errors),Rt.push(Be);break}case Xe.NavigationMenuItems:{const G=await dt({appPath:o,filePath:oe});U.push(G.config),r.push(...G.errors),Qt.push(Be);break}case Xe.PageLayouts:{const G=await dt({appPath:o,filePath:oe}),Te={...G.config};V.push(Te),r.push(...G.errors),Vn.push(Be);break}case Xe.PublicAssets:break;default:k.dt()}}const Yr=await jv(o);for(const oe of Yr)q.push({filePath:oe,fileName:R.basename(oe),fileType:R.extname(oe).replace(/^\./,""),checksum:null}),Me.push(R.relative(o,oe));return l||r.push("Cannot build application, please export default defineApplication() to define an application"),ne.length>1&&r.push("Only one pre install logic function is allowed per application"),De.length>1&&r.push("Only one post install logic function is allowed per application"),l&&ne.length>=1&&(l={...l,preInstallLogicFunctionUniversalIdentifier:ne[0]}),l&&De.length>=1&&(l={...l,postInstallLogicFunctionUniversalIdentifier:De[0]}),{manifest:l?{application:l,objects:f,fields:m,roles:v,skills:E,logicFunctions:C,frontComponents:M,publicAssets:q,views:X,navigationMenuItems:U,pageLayouts:V}:null,filePaths:{application:Ie,objects:ht,fields:xn,roles:$e,skills:Pt,logicFunctions:We,frontComponents:bt,publicAssets:Me,views:Rt,navigationMenuItems:Qt,pageLayouts:Vn},errors:r}},qv=o=>{const s=new Set,r=new Set;for(const l of o)s.has(l)?r.add(l):s.add(l);return Array.from(r)},kl=o=>{const s=[];if(!o)return[];for(const[r,l]of Object.entries(o))r==="universalIdentifier"&&typeof l=="string"&&s.push(l),typeof l=="object"&&s.push(...kl(l));return s},Hv=o=>{const s=[],r=[],l=qv(kl(o));return l.length>0&&s.push(`Duplicate universal identifiers: ${l.join(", ")}`),k.na(o.objects)||r.push("No object defined"),k.na(o.logicFunctions)||r.push("No logic function defined"),k.na(o.frontComponents)||r.push("No front component defined"),{errors:s,warnings:r,isValid:s.length===0}};class Gv{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"}],f=await Rl(s.appPath);if(f.errors.length>0||!f.manifest){for(const v of f.errors)l.push({message:v,status:"error"});return r.output={result:null},r.status="error",this.state.updatePipeline({status:"error"}),this.state.applyStepEvents(l),null}const m=Hv(f.manifest);if(!m.isValid){for(const v of m.errors)l.push({message:v,status:"error"});return r.output={result:null},r.status="error",this.state.updatePipeline({status:"error"}),this.state.applyStepEvents(l),null}if(m.warnings.length>0)for(const v of m.warnings)l.push({message:`⚠ ${v}`,status:"warning"});return l.push({message:"Successfully built manifest",status:"success"}),r.output={result:f},r.status="done",this.state.updatePipeline({appName:f.manifest.application.displayName}),this.state.updateEntitiesFromManifest(f.filePaths),this.state.applyStepEvents(l),f}}class zv{constructor({apiService:s,state:r,notify:l}){this.apiService=s,this.state=r,this.notify=l}async execute(){const s=this.state.steps.checkServer,r=await this.apiService.validateAuth();return r.serverUp?r.authValid?(s.output={isReady:!0,errorLogged:!1},s.status="done",this.notify(),!0):(s.output.errorLogged||(s.output={isReady:!1,errorLogged:!0},s.status="error",this.state.applyStepEvents([{message:"Authentication failed",status:"error"}]),this.state.updatePipeline({status:"error"})),!1):(s.output.errorLogged||(s.output={isReady:!1,errorLogged:!0},s.status="error",this.state.applyStepEvents([{message:"Cannot reach server",status:"error"}]),this.state.updatePipeline({status:"error"})),!1)}}class Jv{constructor({apiService:s,configService:r,state:l,notify:f}){this.apiService=s,this.configService=r,this.state=l,this.notify=f}async execute(s){if(!s.applicationId)return;const r=this.state.steps.ensureValidTokens;r.status="in_progress",this.notify();const l=await this.configService.getConfig();if(l.applicationAccessToken&&!this.isTokenExpired(l.applicationAccessToken)){r.status="done",this.notify();return}if(l.applicationRefreshToken&&!this.isTokenExpired(l.applicationRefreshToken)){const f=await this.apiService.renewApplicationToken(l.applicationRefreshToken);if(f.success){await this.configService.setConfig({applicationAccessToken:f.data.applicationAccessToken.token,applicationRefreshToken:f.data.applicationRefreshToken.token}),this.state.applyStepEvents([{message:"Renewing application tokens",status:"info"},{message:"Application tokens renewed",status:"success"}]),r.status="done",this.notify();return}this.state.applyStepEvents([{message:"Renewing application tokens",status:"info"},{message:`Failed to renew application tokens: ${JSON.stringify(f.error,null,2)}`,status:"error"}]),await this.exchangeTokens({applicationId:s.applicationId});return}await this.exchangeTokens({applicationId:s.applicationId})}async exchangeTokens(s){const r=await this.apiService.generateApplicationToken(s.applicationId);if(!r.success){this.state.applyStepEvents([{message:"Generating application tokens",status:"info"},{message:`Failed to generate application tokens: ${JSON.stringify(r.error,null,2)}`,status:"error"}]),this.state.steps.ensureValidTokens.status="error",this.notify();return}await this.configService.setConfig({applicationAccessToken:r.data.applicationAccessToken.token,applicationRefreshToken:r.data.applicationRefreshToken.token}),this.state.applyStepEvents([{message:"Generating application tokens",status:"info"},{message:"Application tokens stored in config",status:"success"}]),this.state.steps.ensureValidTokens.status="done",this.notify()}isTokenExpired(s){try{const r=JSON.parse(Buffer.from(s.split(".")[1],"base64").toString());return Date.now()>=r.exp*1e3-6e4}catch{return!0}}}class Kv{constructor({clientService:s,configService:r,state:l,notify:f}){this.clientService=s,this.configService=r,this.state=l,this.notify=f}async execute(s){const r=this.state.steps.generateApiClient;r.status="in_progress",this.notify();try{const l=await this.configService.getConfig();await this.clientService.generate({appPath:s.appPath,authToken:l.applicationAccessToken}),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 Vv{constructor({apiService:s,state:r,notify:l}){this.apiService=s,this.state=r,this.notify=l}async execute(s){const r=this.state.steps.resolveApplication;r.status="in_progress",this.notify();const l=s.manifest.application.universalIdentifier,f=await this.apiService.findOneApplication(l);if(!f.success)return this.state.applyStepEvents([{message:`Failed to find application ${l}`,status:"error"}]),r.status="error",this.state.updatePipeline({status:"error"}),r.output;if(f.data)return r.output={applicationId:f.data.id,universalIdentifier:f.data.universalIdentifier},r.status="done",this.notify(),r.output;const m=await this.apiService.createApplication(s.manifest);return m.success?(r.output={applicationId:m.data.id,universalIdentifier:m.data.universalIdentifier},this.state.applyStepEvents([{message:"Creating application",status:"info"},{message:"Application created",status:"success"}]),r.status="done",this.notify(),r.output):(this.state.applyStepEvents([{message:"Creating application",status:"info"},{message:`Application creation failed with error ${JSON.stringify(m.error,null,2)}`,status:"error"}]),r.status="error",this.state.updatePipeline({status:"error"}),r.output)}}const Yv=async(o,s,r)=>{const l=new Set(r),f=s.filter(m=>!l.has(m));for(const m of f){const v=m.replace(/\.tsx?$/,".mjs"),E=Y.default.join(o,v),C=`${E}.map`;await P.remove(E),await P.remove(C)}},Xv=async({result:o,appPath:s,fileFolder:r,lastChecksums:l,onFileBuilt:f})=>{const m=Object.keys(o.metafile?.outputs??{}).filter(v=>v.endsWith(".mjs"));for(const v of m){const E=Y.default.resolve(v),C=Y.default.relative(s,E),M=o.metafile?.outputs?.[v]?.entryPoint||"",q=Y.default.relative(s,M),X=await P.readFile(E),U=Kr.default.createHash("md5").update(X).digest("hex");l.get(C)!==U&&(l.set(C,U),f&&await f({fileFolder:r,builtPath:C,sourcePath:q,checksum:U}))}},Zv=[],Qv=`
|
|
553
|
+
`)}async injectClientWrapper(s,r){const o=Sv(r);await R.appendFile(b.join(s,"index.ts"),o)}}var zr=(l=>(l.DefineApplication="defineApplication",l.DefineField="defineField",l.DefineLogicFunction="defineLogicFunction",l.DefinePreInstallLogicFunction="definePreInstallLogicFunction",l.DefinePostInstallLogicFunction="definePostInstallLogicFunction",l.DefineObject="defineObject",l.DefineRole="defineRole",l.DefineSkill="defineSkill",l.DefineFrontComponent="defineFrontComponent",l.DefineView="defineView",l.DefineNavigationMenuItem="defineNavigationMenuItem",l.DefinePageLayout="definePageLayout",l))(zr||{}),Xe=(l=>(l.Application="application",l.Fields="fields",l.LogicFunctions="logicFunctions",l.Objects="objects",l.Roles="roles",l.Skills="skills",l.FrontComponents="frontComponents",l.PublicAssets="publicAssets",l.Views="views",l.NavigationMenuItems="navigationMenuItems",l.PageLayouts="pageLayouts",l))(Xe||{});const Ev={defineApplication:"application",defineField:"fields",defineLogicFunction:"logicFunctions",definePreInstallLogicFunction:"logicFunctions",definePostInstallLogicFunction:"logicFunctions",defineObject:"objects",defineRole:"roles",defineSkill:"skills",defineFrontComponent:"frontComponents",defineView:"views",defineNavigationMenuItem:"navigationMenuItems",definePageLayout:"pageLayouts"},Fv=l=>{if(!_n.isCallExpression(l))return;const s=l.expression;if(_n.isIdentifier(s)&&Object.values(zr).includes(s.text))return s.text},Cv=l=>{const s=_n.createSourceFile("temp.ts",l,_n.ScriptTarget.Latest,!0),r=[];_n.forEachChild(s,o=>{r.push(o)});for(const o of r)if(_n.isExportAssignment(o)){if(o.isExportEquals||!o.expression)return;const f=Fv(o.expression);if(f)return f}},Rv=["twenty-sdk/ui"],Pv={name:"manifest-mock",setup:l=>{const s=new RegExp(`^(${Rv.map(r=>r.replace("/","\\/")).join("|")})$`);l.onResolve({filter:s},({path:r})=>({path:r,namespace:"manifest-mock"})),l.onLoad({filter:/.*/,namespace:"manifest-mock"},()=>({contents:"module.exports = new Proxy({}, { get: () => () => {} });",loader:"js"}))}},dt=async({filePath:l,appPath:s})=>{const r=await bv({filePath:l,appPath:s});return kv(r,l)},bv=async({filePath:l,appPath:s})=>{const r=Y.default.join(s,"tsconfig.json"),o=await R.pathExists(r),f=Wm.createRequire(Y.default.join(s,"package.json"));let m,v;try{m=Y.default.dirname(f.resolve("react/package.json")),v=Y.default.dirname(f.resolve("react-dom/package.json"))}catch{}const C=(await Sl.build({entryPoints:[l],bundle:!0,write:!1,format:"cjs",platform:"node",target:"node18",jsx:"automatic",tsconfig:o?r:void 0,alias:{...m&&{react:m},...v&&{"react-dom":v}},plugins:[Pv],logLevel:"silent"})).outputFiles[0].text,M=await R.mkdtemp(Y.default.join(xs.default.tmpdir(),"twenty-manifest-")),j=Y.default.join(M,"module.cjs");try{return await R.writeFile(j,C),require(j)}finally{await R.remove(M)}},kv=(l,s)=>{if(k.o(l.default)&&k.RN(l.default))return l.default;throw new Error(`Config file ${s} must export a config object default export`)},Ov={type:"object",properties:{}},Lv=async l=>{const{getFunctionInputSchema:s}=await Promise.resolve().then(()=>require("./get-function-input-schema-BZ7_XyUh-dHQTco6b.js")),r=s(l)[0];return r?.type==="object"&&k.o(r.properties)?{type:"object",properties:r.properties}:Ov},Nv="142046f0-4d80-48b5-ad56-26ad410e895c",ot=({objectConfig:l,fieldName:s})=>{const r=`${l.universalIdentifier}-${s}`;return Ue.v5(r,Nv)},Uv=l=>{const s={name:"id",label:"Id",description:"Id",icon:"Icon123",isNullable:!1,defaultValue:"uuid",type:k.R.UUID,universalIdentifier:ot({objectConfig:l,fieldName:"id"})},r={name:"name",label:"Name",description:"Name",icon:"IconAbc",isNullable:!0,defaultValue:null,type:k.R.TEXT,universalIdentifier:ot({objectConfig:l,fieldName:"name"})},o={name:"createdAt",label:"Creation date",description:"Creation date",icon:"IconCalendar",isNullable:!1,defaultValue:"now",type:k.R.DATE_TIME,universalIdentifier:ot({objectConfig:l,fieldName:"createdAt"})},f={name:"updatedAt",label:"Last update",description:"Last time the record was changed",icon:"IconCalendarClock",isNullable:!1,defaultValue:"now",type:k.R.DATE_TIME,universalIdentifier:ot({objectConfig:l,fieldName:"updatedAt"})},m={name:"deletedAt",label:"Deleted at",description:"Deletion date",icon:"IconCalendarClock",isNullable:!0,defaultValue:null,type:k.R.DATE_TIME,universalIdentifier:ot({objectConfig:l,fieldName:"deletedAt"})},v={name:"createdBy",label:"Created by",description:"The creator of the record",icon:"IconCreativeCommonsSa",isNullable:!1,defaultValue:{name:"''",source:"'MANUAL'"},type:k.R.ACTOR,universalIdentifier:ot({objectConfig:l,fieldName:"createdBy"})},E={name:"updatedBy",label:"Updated by",description:"The workspace member who last updated the record",icon:"IconUserCircle",isNullable:!1,defaultValue:{name:"''",source:"'MANUAL'"},type:k.R.ACTOR,universalIdentifier:ot({objectConfig:l,fieldName:"updatedBy"})},C={name:"position",label:"Position",description:"Position",icon:"IconHierarchy2",isNullable:!1,defaultValue:0,type:k.R.POSITION,universalIdentifier:ot({objectConfig:l,fieldName:"position"})},M={name:"searchVector",label:"Search vector",icon:"IconSearch",description:"Search vector",isNullable:!0,defaultValue:null,type:k.R.TS_VECTOR,universalIdentifier:ot({objectConfig:l,fieldName:"searchVector"})};return[s,r,o,f,m,v,E,C,M]},zn={targetFieldName:l=>`target${k.cs(l.nameSingular)}`,targetLabel:l=>k.cs(l.nameSingular),icon:"IconBuildingSkyscraper"},Dv=[{...zn,fieldName:"timelineActivities",label:"Timeline Activities",targetIcon:"IconTimelineEvent",targetFieldType:k.R.MORPH_RELATION,standardObjectKey:"timelineActivity",morphId:k.y.timelineActivity.morphIds.targetMorphId.morphId},{...zn,fieldName:"favorites",label:"Favorites",icon:"IconBuildingSkyscraper",targetIcon:"IconHeart",targetFieldType:k.R.RELATION,standardObjectKey:"favorite"},{...zn,fieldName:"attachments",label:"Attachments",icon:"IconBuildingSkyscraper",targetIcon:"IconFileImport",targetFieldType:k.R.MORPH_RELATION,standardObjectKey:"attachment",morphId:k.y.attachment.morphIds.targetMorphId.morphId},{...zn,fieldName:"noteTargets",label:"Note Targets",icon:"IconBuildingSkyscraper",targetIcon:"IconCheckbox",targetFieldType:k.R.MORPH_RELATION,standardObjectKey:"noteTarget",morphId:k.y.noteTarget.morphIds.targetMorphId.morphId},{...zn,fieldName:"taskTargets",label:"Task Targets",icon:"IconBuildingSkyscraper",targetIcon:"IconCheckbox",targetFieldType:k.R.MORPH_RELATION,standardObjectKey:"taskTarget",morphId:k.y.taskTarget.morphIds.targetMorphId.morphId}],$v=({config:l,forwardFieldUniversalIdentifier:s,objectConfig:r,universalIdentifier:o})=>{const f=k.y[l.standardObjectKey],m={name:l.targetFieldName(r),label:l.targetLabel(r),description:`${l.targetLabel(r)} ${r.labelSingular}`,icon:l.targetIcon,isNullable:!0,universalSettings:{relationType:k.V.MANY_TO_ONE,onDelete:k.W.SET_NULL,joinColumnName:`target${k.cs(r.nameSingular)}Id`},universalIdentifier:o,objectUniversalIdentifier:f.universalIdentifier,relationTargetFieldMetadataUniversalIdentifier:s,relationTargetObjectMetadataUniversalIdentifier:r.universalIdentifier};return l.targetFieldType===k.R.MORPH_RELATION?{...m,type:l.targetFieldType,morphId:l.morphId}:{...m,type:l.targetFieldType}},Wv=l=>{const s=[],r=[];for(const o of Dv){const f=k.y[o.standardObjectKey],m=ot({objectConfig:l,fieldName:o.fieldName}),v=ot({objectConfig:l,fieldName:`${o.fieldName}Inverse`}),E={name:o.fieldName,label:o.label,description:`${l.labelPlural} tied to the ${o.targetLabel(l)}`,icon:o.icon,isNullable:!1,type:k.R.RELATION,universalSettings:{relationType:k.V.ONE_TO_MANY},universalIdentifier:m,relationTargetFieldMetadataUniversalIdentifier:v,relationTargetObjectMetadataUniversalIdentifier:f.universalIdentifier},C=$v({config:o,objectConfig:l,universalIdentifier:v,forwardFieldUniversalIdentifier:m});s.push(E),r.push(C)}return{objectFields:s,fields:r}},Mv=l=>{const s=Uv(l),{objectFields:r,fields:o}=Wv(l),f=(l.fields??[]).map(v=>v.name),m=[...l.fields];for(const v of s)f.includes(v.name)||m.push(v);for(const v of r)f.includes(v.name)||m.push(v);return{objectFields:m,fields:o}},Bv=async l=>await wl.glob(["**/*.ts","**/*.tsx"],{cwd:l,absolute:!0,ignore:["**/node_modules/**","**/*.d.ts","**/dist/**","**/.twenty/**"],onlyFiles:!0}),qv=async l=>await wl.glob([`${Is}/**/*`],{cwd:l,onlyFiles:!0}),bl=async l=>{const s=await Bv(l),r=[];let o;const f=[],m=[],v=[],E=[],C=[],M=[],j=[],X=[],U=[],V=[],ne=[],De=[],Se=[],ht=[],xn=[],$e=[],Rt=[],We=[],Pt=[],Me=[],bt=[],Qt=[],Vn=[];for(const oe of s){const Yn=await _l.readFile(oe,"utf-8"),Be=b.relative(l,oe),qe=Cv(Yn);if(!qe)continue;switch(Ev[qe]){case Xe.Application:{const G=await dt({appPath:l,filePath:oe});o={...G.config,yarnLockChecksum:null,packageJsonChecksum:null,apiClientChecksum:null},r.push(...G.errors),Se.push(Be);break}case Xe.Objects:{const G=await dt({appPath:l,filePath:oe}),{objectFields:Te,fields:de}=Mv(G.config),ct=G.config.labelIdentifierFieldMetadataUniversalIdentifier??Te.find(In=>In.name==="name")?.universalIdentifier;if(!ct){r.push(`No label identifier field found for object ${G.config.nameSingular}. Please add a field with name "name" to your object.`);break}const jt={...G.config,fields:Te,labelIdentifierFieldMetadataUniversalIdentifier:ct};f.push(jt),m.push(...de),r.push(...G.errors),ht.push(Be);break}case Xe.Fields:{const G=await dt({appPath:l,filePath:oe});m.push(G.config),r.push(...G.errors),xn.push(Be);break}case Xe.Roles:{const G=await dt({appPath:l,filePath:oe});v.push(G.config),r.push(...G.errors),$e.push(Be);break}case Xe.Skills:{const G=await dt({appPath:l,filePath:oe});E.push(G.config),r.push(...G.errors),Rt.push(Be);break}case Xe.LogicFunctions:{const G=await dt({appPath:l,filePath:oe});r.push(...G.errors);const{handler:Te,...de}=G.config,ct=b.relative(l,oe),jt=de.toolInputSchema??await Lv(Yn),In={...de,toolInputSchema:jt,handlerName:"default.config.handler",sourceHandlerPath:ct,builtHandlerPath:ct.replace(/\.tsx?$/,".mjs"),builtHandlerChecksum:"[default-checksum]"};C.push(In),We.push(Be),qe===zr.DefinePreInstallLogicFunction&&ne.push(G.config.universalIdentifier),qe===zr.DefinePostInstallLogicFunction&&De.push(G.config.universalIdentifier);break}case Xe.FrontComponents:{const G=await dt({appPath:l,filePath:oe});r.push(...G.errors);const{component:Te,...de}=G.config,ct=b.relative(l,oe),jt={...de,componentName:Te.name,sourceComponentPath:ct,builtComponentPath:ct.replace(/\.tsx?$/,".mjs"),builtComponentChecksum:"",isHeadless:de.isHeadless??!1};M.push(jt),Pt.push(Be);break}case Xe.Views:{const G=await dt({appPath:l,filePath:oe}),Te={...G.config};X.push(Te),r.push(...G.errors),bt.push(Be);break}case Xe.NavigationMenuItems:{const G=await dt({appPath:l,filePath:oe});U.push(G.config),r.push(...G.errors),Qt.push(Be);break}case Xe.PageLayouts:{const G=await dt({appPath:l,filePath:oe}),Te={...G.config};V.push(Te),r.push(...G.errors),Vn.push(Be);break}case Xe.PublicAssets:break;default:k.dt()}}const Yr=await qv(l);for(const oe of Yr)j.push({filePath:oe,fileName:b.basename(oe),fileType:b.extname(oe).replace(/^\./,""),checksum:null}),Me.push(b.relative(l,oe));return o||r.push("Cannot build application, please export default defineApplication() to define an application"),ne.length>1&&r.push("Only one pre install logic function is allowed per application"),De.length>1&&r.push("Only one post install logic function is allowed per application"),o&&ne.length>=1&&(o={...o,preInstallLogicFunctionUniversalIdentifier:ne[0]}),o&&De.length>=1&&(o={...o,postInstallLogicFunctionUniversalIdentifier:De[0]}),{manifest:o?{application:o,objects:f,fields:m,roles:v,skills:E,logicFunctions:C,frontComponents:M,publicAssets:j,views:X,navigationMenuItems:U,pageLayouts:V}:null,filePaths:{application:Se,objects:ht,fields:xn,roles:$e,skills:Rt,logicFunctions:We,frontComponents:Pt,publicAssets:Me,views:bt,navigationMenuItems:Qt,pageLayouts:Vn},errors:r}},jv=l=>{const s=new Set,r=new Set;for(const o of l)s.has(o)?r.add(o):s.add(o);return Array.from(r)},kl=l=>{const s=[];if(!l)return[];for(const[r,o]of Object.entries(l))r==="universalIdentifier"&&typeof o=="string"&&s.push(o),typeof o=="object"&&s.push(...kl(o));return s},Hv=l=>{const s=[],r=[],o=jv(kl(l));return o.length>0&&s.push(`Duplicate universal identifiers: ${o.join(", ")}`),k.na(l.objects)||r.push("No object defined"),k.na(l.logicFunctions)||r.push("No logic function defined"),k.na(l.frontComponents)||r.push("No front component defined"),{errors:s,warnings:r,isValid:s.length===0}};class Gv{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 o=[{message:"Building manifest",status:"info"}],f=await bl(s.appPath);if(f.errors.length>0||!f.manifest){for(const v of f.errors)o.push({message:v,status:"error"});return r.output={result:null},r.status="error",this.state.updatePipeline({status:"error"}),this.state.applyStepEvents(o),null}const m=Hv(f.manifest);if(!m.isValid){for(const v of m.errors)o.push({message:v,status:"error"});return r.output={result:null},r.status="error",this.state.updatePipeline({status:"error"}),this.state.applyStepEvents(o),null}if(m.warnings.length>0)for(const v of m.warnings)o.push({message:`⚠ ${v}`,status:"warning"});return o.push({message:"Successfully built manifest",status:"success"}),r.output={result:f},r.status="done",this.state.updatePipeline({appName:f.manifest.application.displayName}),this.state.updateEntitiesFromManifest(f.filePaths),this.state.applyStepEvents(o),f}}class zv{constructor({apiService:s,state:r,notify:o}){this.apiService=s,this.state=r,this.notify=o}async execute(){const s=this.state.steps.checkServer,r=await this.apiService.validateAuth();return r.serverUp?r.authValid?(s.output={isReady:!0,errorLogged:!1},s.status="done",this.notify(),!0):(s.output.errorLogged||(s.output={isReady:!1,errorLogged:!0},s.status="error",this.state.applyStepEvents([{message:"Authentication failed",status:"error"}]),this.state.updatePipeline({status:"error"})),!1):(s.output.errorLogged||(s.output={isReady:!1,errorLogged:!0},s.status="error",this.state.applyStepEvents([{message:"Cannot reach server",status:"error"}]),this.state.updatePipeline({status:"error"})),!1)}}class Jv{constructor({apiService:s,configService:r,state:o,notify:f}){this.apiService=s,this.configService=r,this.state=o,this.notify=f}async execute(s){if(!s.applicationId)return;const r=this.state.steps.ensureValidTokens;r.status="in_progress",this.notify();const o=await this.configService.getConfig();if(o.applicationAccessToken&&!this.isTokenExpired(o.applicationAccessToken)){r.status="done",this.notify();return}if(o.applicationRefreshToken&&!this.isTokenExpired(o.applicationRefreshToken)){const f=await this.apiService.renewApplicationToken(o.applicationRefreshToken);if(f.success){await this.configService.setConfig({applicationAccessToken:f.data.applicationAccessToken.token,applicationRefreshToken:f.data.applicationRefreshToken.token}),this.state.applyStepEvents([{message:"Renewing application tokens",status:"info"},{message:"Application tokens renewed",status:"success"}]),r.status="done",this.notify();return}this.state.applyStepEvents([{message:"Renewing application tokens",status:"info"},{message:`Failed to renew application tokens: ${JSON.stringify(f.error,null,2)}`,status:"error"}]),await this.exchangeTokens({applicationId:s.applicationId});return}await this.exchangeTokens({applicationId:s.applicationId})}async exchangeTokens(s){const r=await this.apiService.generateApplicationToken(s.applicationId);if(!r.success){this.state.applyStepEvents([{message:"Generating application tokens",status:"info"},{message:`Failed to generate application tokens: ${JSON.stringify(r.error,null,2)}`,status:"error"}]),this.state.steps.ensureValidTokens.status="error",this.notify();return}await this.configService.setConfig({applicationAccessToken:r.data.applicationAccessToken.token,applicationRefreshToken:r.data.applicationRefreshToken.token}),this.state.applyStepEvents([{message:"Generating application tokens",status:"info"},{message:"Application tokens stored in config",status:"success"}]),this.state.steps.ensureValidTokens.status="done",this.notify()}isTokenExpired(s){try{const r=JSON.parse(Buffer.from(s.split(".")[1],"base64").toString());return Date.now()>=r.exp*1e3-6e4}catch{return!0}}}class Kv{constructor({clientService:s,configService:r,state:o,notify:f}){this.clientService=s,this.configService=r,this.state=o,this.notify=f}async execute(s){const r=this.state.steps.generateApiClient;r.status="in_progress",this.notify();try{const o=await this.configService.getConfig();await this.clientService.generate({appPath:s.appPath,authToken:o.applicationAccessToken}),r.status="done"}catch(o){this.state.applyStepEvents([{message:`Failed to generate API client: ${o instanceof Error?o.message:String(o)}`,status:"error"}]),r.status="error"}this.notify()}}class Vv{constructor({apiService:s,configService:r,state:o,notify:f}){this.apiService=s,this.configService=r,this.state=o,this.notify=f}async execute(s){const r=s.manifest.application.universalIdentifier,o=await this.apiService.findApplicationRegistrationByUniversalIdentifier(r);if(!o.success)return this.state.applyStepEvents([{message:"Failed to check app registration",status:"warning"}]),this.notify(),{applicationRegistrationId:null,clientId:null};if(o.data)return this.state.applyStepEvents([{message:`App registration found: ${o.data.name}`,status:"info"}]),this.notify(),{applicationRegistrationId:o.data.id,clientId:o.data.oAuthClientId};const f=await this.apiService.createApplicationRegistration({name:s.manifest.application.displayName,description:s.manifest.application.description,universalIdentifier:r});return!f.success||!f.data?(this.state.applyStepEvents([{message:"Failed to create app registration",status:"warning"}]),this.notify(),{applicationRegistrationId:null,clientId:null}):(await this.configService.setConfig({oauthClientId:f.data.applicationRegistration.oAuthClientId,oauthClientSecret:f.data.clientSecret}),this.state.applyStepEvents([{message:`App registration created: ${s.manifest.application.displayName}`,status:"success"},{message:`Client ID: ${f.data.applicationRegistration.oAuthClientId}`,status:"info"},{message:`Client Secret: ${f.data.clientSecret}`,status:"warning"},{message:"Credentials saved to config. The secret will not be shown again.",status:"warning"}]),this.notify(),{applicationRegistrationId:f.data.applicationRegistration.id,clientId:f.data.applicationRegistration.oAuthClientId})}}class Yv{constructor({apiService:s,state:r,notify:o}){this.apiService=s,this.state=r,this.notify=o}async execute(s){const r=this.state.steps.resolveApplication;r.status="in_progress",this.notify();const o=s.manifest.application.universalIdentifier,f=await this.apiService.findOneApplication(o);if(!f.success)return this.state.applyStepEvents([{message:`Failed to find application ${o}`,status:"error"}]),r.status="error",this.state.updatePipeline({status:"error"}),r.output;if(f.data)return r.output={applicationId:f.data.id,universalIdentifier:f.data.universalIdentifier},r.status="done",this.notify(),r.output;const m=await this.apiService.createApplication(s.manifest,{applicationRegistrationId:s.applicationRegistrationId});return m.success?(r.output={applicationId:m.data.id,universalIdentifier:m.data.universalIdentifier},this.state.applyStepEvents([{message:"Creating application",status:"info"},{message:"Application created",status:"success"}]),r.status="done",this.notify(),r.output):(this.state.applyStepEvents([{message:"Creating application",status:"info"},{message:`Application creation failed with error ${JSON.stringify(m.error,null,2)}`,status:"error"}]),r.status="error",this.state.updatePipeline({status:"error"}),r.output)}}const Xv=async(l,s,r)=>{const o=new Set(r),f=s.filter(m=>!o.has(m));for(const m of f){const v=m.replace(/\.tsx?$/,".mjs"),E=Y.default.join(l,v),C=`${E}.map`;await R.remove(E),await R.remove(C)}},Zv=async({result:l,appPath:s,fileFolder:r,lastChecksums:o,onFileBuilt:f})=>{const m=Object.keys(l.metafile?.outputs??{}).filter(v=>v.endsWith(".mjs"));for(const v of m){const E=Y.default.resolve(v),C=Y.default.relative(s,E),M=l.metafile?.outputs?.[v]?.entryPoint||"",j=Y.default.relative(s,M),X=await R.readFile(E),U=Kr.default.createHash("md5").update(X).digest("hex");o.get(C)!==U&&(o.set(C,U),f&&await f({fileFolder:r,builtPath:C,sourcePath:j,checksum:U}))}},Qv=[],ey=`
|
|
534
554
|
export var customElementMap = globalThis.__HTML_TAG_TO_CUSTOM_ELEMENT_TAG__ || {};
|
|
535
555
|
|
|
536
556
|
var _injectedStyleKeys = {};
|
|
@@ -607,7 +627,7 @@ export function makeEventRef(events, userRef) {
|
|
|
607
627
|
else if (userRef != null && typeof userRef === 'object') userRef.current = el;
|
|
608
628
|
};
|
|
609
629
|
}
|
|
610
|
-
`.trim(),
|
|
630
|
+
`.trim(),ty=`
|
|
611
631
|
import {
|
|
612
632
|
jsx as _originalJsx,
|
|
613
633
|
jsxs as _originalJsxs,
|
|
@@ -652,7 +672,7 @@ function _wrapJsxFactory(originalFactory) {
|
|
|
652
672
|
export var jsx = _wrapJsxFactory(_originalJsx);
|
|
653
673
|
export var jsxs = _wrapJsxFactory(_originalJsxs);
|
|
654
674
|
export { Fragment };
|
|
655
|
-
`.trim(),
|
|
675
|
+
`.trim(),ny=`
|
|
656
676
|
export * from '__real_react__';
|
|
657
677
|
import _React from '__real_react__';
|
|
658
678
|
|
|
@@ -701,12 +721,12 @@ function createElement(type) {
|
|
|
701
721
|
|
|
702
722
|
export { createElement };
|
|
703
723
|
export default Object.assign({}, _React, { createElement: createElement });
|
|
704
|
-
`.trim(),
|
|
724
|
+
`.trim(),ry=l=>{const s="react/jsx-runtime",r="react";return{name:"jsx-runtime-remote-wrapper",setup:o=>{let f,m;o.onResolve({filter:/^__jsx_shared_helpers__$/},()=>({path:"__jsx_shared_helpers__",namespace:"jsx-shared-helpers"})),o.onLoad({filter:/.*/,namespace:"jsx-shared-helpers"},()=>({contents:ey,loader:"js"})),o.onResolve({filter:/^react\/jsx-runtime$/},async v=>{if(!v.pluginData?.skipJsxWrapper)return f||(f=(await o.resolve(s,{kind:v.kind,resolveDir:v.resolveDir,pluginData:{skipJsxWrapper:!0}})).path),{path:"react/jsx-runtime",namespace:"jsx-runtime-wrapper"}}),o.onResolve({filter:/^__real_react_jsx_runtime__$/},()=>{if(!f)throw new Error("jsx-runtime-remote-wrapper: real jsx-runtime path not resolved yet");return{path:f}}),o.onLoad({filter:/.*/,namespace:"jsx-runtime-wrapper"},()=>({contents:ty,loader:"js"})),o.onResolve({filter:/^react$/},async v=>{if(!v.pluginData?.skipJsxWrapper)return m||(m=(await o.resolve(r,{kind:v.kind,resolveDir:v.resolveDir,pluginData:{skipJsxWrapper:!0}})).path),{path:"react",namespace:"react-wrapper"}}),o.onResolve({filter:/^__real_react__$/},()=>{if(!m)throw new Error("jsx-runtime-remote-wrapper: real react path not resolved yet");return{path:m}}),o.onLoad({filter:/.*/,namespace:"react-wrapper"},()=>({contents:ny,loader:"js"}))}}},iy=/import\s*\{\s*defineFrontComponent\s*\}\s*from\s*['"][^'"]+['"];?\n?/g,hl=/export\s+default\s+defineFrontComponent\s*\(\s*\{[\s\S]*?component\s*:\s*(\w+)[\s\S]*?\}\s*\)\s*;?/s,sy=l=>{let s=l.replace(iy,"");const r=s.match(hl);if(r){const o=r[1],f=new RegExp(`export\\s+(const|function)\\s+${o}\\b`);s=s.replace(f,`$1 ${o}`),s=`import { createRoot as __createRoot } from 'react-dom/client';
|
|
705
725
|
import { jsx as __frontComponentJsx } from 'react/jsx-runtime';
|
|
706
|
-
`+s,s=s.replace(hl,`export default function __renderFrontComponent(__container) { __createRoot(__container).render(__frontComponentJsx(${
|
|
707
|
-
`)){const
|
|
708
|
-
`);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=Ol(s);r&&this.pendingErrors.push(r)}}const my=new Set(["node_modules",Vr,"dist",".twenty"]);class vy{constructor(s){this.watcher=null,this.appPath=s.appPath,this.handleChangeDetected=s.handleChangeDetected}async start(){const s=this.appPath;this.watcher=Tl.default.watch(this.appPath,{ignored:r=>{const l=R.relative(s,r);if(l==="")return!1;const f=l.split(Y.default.sep)[0];return my.has(f)||f.startsWith(".")},awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("all",(r,l)=>{if(r==="addDir"||r==="unlinkDir")return;const f=R.relative(this.appPath,l),m=f.startsWith(As),v=["package.json","yarn.lock"].includes(f);!(f.endsWith(".ts")||f.endsWith(".tsx"))&&!m&&!v||this.handleChangeDetected(f,r)})}async close(){await this.watcher?.close()}}class yy{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}async start(){this.state.steps.startWatchers.status="in_progress",this.notify(),this.manifestWatcher=new vy({appPath:this.state.appPath,handleChangeDetected:this.handleChangeDetected.bind(this)}),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.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}),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=dy({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=hy({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 gl({appPath:this.state.appPath,fileFolder:k.U.PublicAsset,watchPaths:[As],handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.assetWatcher.start()}async startDependencyWatcher(){this.dependencyWatcher=new gl({appPath:this.state.appPath,fileFolder:k.U.Dependencies,watchPaths:["package.json","yarn.lock"],handleFileBuilt:this.handleFileBuilt.bind(this)}),this.dependencyWatcher.start()}async startTscWatcher(){this.tscWatcher=new gy({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()}}const _y=({manifest:o,builtFileInfos:s})=>{let r=structuredClone(o);for(const[f,{fileFolder:m,checksum:v}]of s.entries()){const E=R.relative(et,f);if(m===k.U.BuiltLogicFunction){const C=r.logicFunctions,M=C.findIndex(q=>q.builtHandlerPath===E);if(M===-1)continue;r={...r,logicFunctions:C.map((q,X)=>X===M?{...q,builtHandlerChecksum:v}:q)}}if(m===k.U.PublicAsset){const C=r.publicAssets,M=C.findIndex(q=>q.filePath===E);if(M===-1)continue;r={...r,publicAssets:C.map((q,X)=>X===M?{...q,checksum:v}:q)};continue}if(m===k.U.BuiltFrontComponent){const C=r.frontComponents,M=C.findIndex(q=>q.builtComponentPath===E)??-1;if(M===-1)continue;r={...r,frontComponents:C.map((q,X)=>X===M?{...q,builtComponentChecksum:v}:q)}}m===k.U.Dependencies&&(E==="package.json"&&(r.application.packageJsonChecksum=v),E==="yarn.lock"&&(r.application.yarnLockChecksum=v))}const l=[];for(const[f,{fileFolder:m}]of s.entries()){const v=R.relative(et,f);if(m===k.U.Dependencies&&v.startsWith(`${Hr}/`)){const E=s.get(f);E&&l.push(E.checksum)}}return l.length>0&&(r.application.apiClientChecksum=Kr.default.createHash("md5").update(l.sort().join("")).digest("hex")),r},wy=async(o,s)=>{const r=Y.default.join(o,et);await P.ensureDir(r);const l=Y.default.join(r,"manifest.json");return await P.writeJSON(l,s,{spaces:2}),l},$l=o=>{if(typeof o=="string")return o;if(yn.default.isAxiosError(o)){const r=[],l=o.response?.status,f=o.response?.statusText;l&&r.push(`HTTP ${l}${f?` ${f}`:""}`);const m=o.response?.data?.errors;if(Array.isArray(m)&&m.length>0){const v=m.map(E=>E.message??"Unknown GraphQL error").join("; ");r.push(v)}else o.response?.data?.message?r.push(o.response.data.message):o.message&&r.push(o.message);return o.code&&r.push(`(${o.code})`),r.join(" - ")||"Unknown Axios error"}if(o instanceof Error)return o.message||o.toString();const s=JSON.stringify(o,null,2);return s==="{}"||s===void 0?String(o):s};class xy{constructor({apiService:s,state:r,notify:l}){this.apiService=s,this.state=r,this.notify=l}async execute(s){const r=this.state.steps.syncApplication;r.status="in_progress",this.state.updatePipeline({status:"syncing"});const l=[],f=_y({manifest:s.manifest,builtFileInfos:s.builtFileInfos});l.push({message:"Manifest checksums set",status:"info"}),await wy(s.appPath,f),l.push({message:"Manifest saved to output directory",status:"info"}),l.push({message:"Syncing manifest",status:"info"});const m=await this.apiService.syncApplication(f);if(m.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 v=`Sync failed with error: ${$l(m.error)}`;l.push({message:v,status:"error"}),r.output={syncStatus:"error",error:v},r.status="error",this.state.updatePipeline({status:"error",error:v}),this.state.updateAllEntitiesStatus("error"),this.state.applyStepEvents(l)}}class Ay{constructor(s){this.apiService=new Ct,this.applicationUniversalIdentifier=s.applicationUniversalIdentifier,this.appPath=s.appPath}async uploadFile({builtPath:s,fileFolder:r}){const l=R.relative(et,s);return await this.apiService.uploadFile({filePath:Y.default.join(this.appPath,s),builtHandlerPath:l,fileFolder:r,applicationUniversalIdentifier:this.applicationUniversalIdentifier})}}const Sy=["core/types.ts","core/schema.ts","metadata/types.ts","metadata/schema.ts"];class Iy{constructor({state:s,notify:r}){this.state=s,this.notify=r}get isInitialized(){return this.state.steps.uploadFiles.output.fileUploader!==null}initialize(s){const r=this.state.steps.uploadFiles;r.output={...r.output,fileUploader:new Ay({appPath:s.appPath,applicationUniversalIdentifier:s.universalIdentifier})},r.status="in_progress",this.notify(),this.uploadPendingFiles()}uploadFile(s,r,l){const f=this.state.steps.uploadFiles;if(!f.output.fileUploader)return;this.state.addEvent({message:`Uploading ${s}`,status:"info"}),this.state.updateEntityStatus(r,"uploading");const m=f.output.fileUploader.uploadFile({builtPath:s,fileFolder:l}).then(v=>{v.success?(this.state.addEvent({message:`Successfully uploaded ${s}`,status:"success"}),this.state.updateEntityStatus(r,"success")):this.state.addEvent({message:`Failed to upload ${s}: ${v.error}`,status:"error"})}).catch(v=>{this.state.addEvent({message:`Upload failed for ${s}: ${v}`,status:"error"})}).finally(()=>{f.output.activeUploads.delete(m)});f.output.activeUploads.add(m)}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()}async copyAndUploadApiClientFiles(s){const r=R.join(s,"node_modules","twenty-sdk",Vr);if(!await P.pathExists(r))return;const l=R.join(s,et,Hr);await P.ensureDir(l);for(const f of Sy){const m=R.join(r,f);if(!await P.pathExists(m))continue;await P.copy(m,R.join(l,f));const v=await P.readFile(m),E=Kr.default.createHash("md5").update(v).digest("hex"),C=R.join(et,Hr,f),M=R.join(Hr,f);this.state.steps.uploadFiles.output.builtFileInfos.set(C,{checksum:E,builtPath:C,sourcePath:M,fileFolder:k.U.Dependencies}),this.uploadFile(C,M,k.U.Dependencies)}}uploadPendingFiles(){for(const[s,{fileFolder:r,sourcePath:l}]of this.state.steps.uploadFiles.output.builtFileInfos.entries())this.uploadFile(s,l,r)}}class Ty{constructor(s){this.syncTimer=null,this.serverCheckInterval=null,this.skipTypecheck=!0,this.debounceMs=s.debounceMs??200,this.state=s.state;const r=new Ct({disableInterceptors:!0}),l=new _e;this.clientService=new Tv;const f={state:this.state,notify:()=>this.state.notify()};this.checkServerStep=new zv({...f,apiService:r}),this.ensureValidTokensStep=new Jv({...f,apiService:r,configService:l}),this.buildManifestStep=new Gv(f),this.resolveApplicationStep=new Vv({...f,apiService:r}),this.uploadFilesStep=new Iy(f),this.generateApiClientStep=new Kv({...f,clientService:this.clientService,configService:l}),this.syncApplicationStep=new xy({...f,apiService:r}),this.startWatchersStep=new yy({...f,scheduleSync:this.scheduleSync.bind(this),onFileBuilt:this.handleFileBuilt.bind(this),shouldSkipTypecheck:()=>this.skipTypecheck})}async start(){const s=Y.default.join(this.state.appPath,et);await P.ensureDir(s),await P.emptyDir(s),await this.clientService.ensureGeneratedClientStub({appPath:this.state.appPath}),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: ${$l(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;await this.ensureValidTokensStep.execute({applicationId:this.state.steps.resolveApplication.output.applicationId});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}),l&&(await this.generateApiClientStep.execute({appPath:this.state.appPath}),this.skipTypecheck=!1,await this.uploadFilesStep.copyAndUploadApiClientFiles(this.state.appPath))}async initializePipeline(s){const r=await this.resolveApplicationStep.execute({manifest:s});return r.applicationId?(await this.ensureValidTokensStep.exchangeTokens({applicationId:r.applicationId}),this.uploadFilesStep.initialize({appPath:this.state.appPath,universalIdentifier:s.application.universalIdentifier}),!0):!1}}const Ey={objects:K.Object,fields:K.Field,logicFunctions:K.LogicFunction,frontComponents:K.FrontComponent,roles:K.Role,skills:K.Skill,views:K.View,navigationMenuItems:K.NavigationMenuItem,pageLayouts:K.PageLayout},Fy=200,Cy={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 Py{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(-(Fy-r.length)),...r]}addEvent(s){this.applyStepEvents([s])}updateEntityStatus(s,r){const l=new Map(this.entities),f=l.get(s);f?.status&&!Cy[f.status].includes(r)||(l.set(s,f?{...f,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,f]of r)r.set(l,{...f,status:s});this.entities=r}updateEntitiesFromManifest(s){const r=new Map;for(const[f,m]of Object.entries(s)){const v=Ey[f];if(v)for(const E of m)r.set(E,v)}const l=new Map(this.entities);for(const[f,m]of l)l.set(f,{...m,type:r.get(f)});this.entities=l}hasObjectsOrFieldsChanged(s){const r=JSON.stringify({objects:s.objects,fields:s.fields}),l=r!==this.previousObjectsFieldsFingerprint;return this.previousObjectsFieldsFingerprint=r,l}}class by{constructor(){this.orchestrator=null,this.unmountUI=null}async close(){this.unmountUI?.(),await this.orchestrator?.close()}async execute(s){const r=s.appPath??Se,l=new Py({appPath:r,frontendUrl:process.env.FRONTEND_URL}),f=new yv(l);l.onChange=()=>f.notify();const{unmount:m}=await vv(f);this.unmountUI=m,this.orchestrator=new Ty({state:l}),await this.orchestrator.start(),this.setupGracefulShutdown()}setupGracefulShutdown(){const s=()=>void this.close().then(()=>process.exit(0));process.on("SIGINT",s),process.on("SIGTERM",s)}}const Ry=o=>`${S.default.cyan(o.file)}:${S.default.yellow(String(o.line))}:${S.default.yellow(String(o.column+1))} - ${S.default.red("error")} ${o.text}`;class ky{async execute(s){const r=s.appPath??Se;console.log(S.default.blue("Running type check...")),console.log(S.default.gray(`App path: ${r}`)),console.log("");const l=await Ll(r);l.length===0&&(console.log(S.default.green("✓ No type errors found")),process.exit(0));for(const f of l)console.log(Ry(f));console.log(""),console.log(S.default.red(`✗ Found ${l.length} type error${l.length===1?"":"s"}`)),process.exit(1)}}const Is=async o=>{const s=Y.default.join(o,et);await P.ensureDir(s);const r=Y.default.join(s,"manifest.json");if(!await P.pathExists(r)){const{manifest:l}=await Rl(o);return l}return await P.readJson(r)};class Oy{constructor(){this.apiService=new Ct}async execute({appPath:s=Se,askForConfirmation:r}){try{console.log(S.default.blue("🚀 Uninstall Twenty Application")),console.log(S.default.gray(`📁 App Path: ${s}`)),console.log(""),r&&!await this.confirmationPrompt()&&(console.error(S.default.red("⛔️ Aborting uninstall")),process.exit(1));const l=await Is(s);if(!l)return{success:!1,error:"Build failed"};const f=await this.apiService.uninstallApplication(l.application.universalIdentifier);return f.success===!1?console.error(S.default.red("❌ Uninstall failed:"),f.error):console.log(S.default.green("✅ Application uninstalled successfully")),f}catch(l){throw console.error(S.default.red("Uninstall failed:"),l instanceof Error?l.message:l),l}}async confirmationPrompt(){const{confirmation:s}=await lt.default.prompt([{type:"confirm",name:"confirmation",message:"Are you sure you want to uninstall this application?",default:!1}]);return s}}class Ly{constructor(){this.configService=new _e}async execute(){try{const s=await this.configService.getAvailableWorkspaces(),r=await this.configService.getDefaultWorkspace();if(s.length===0){console.log(S.default.yellow("⚠ No workspaces configured. Use `twenty auth:login` to create one."));return}console.log(S.default.blue(`Available workspaces:
|
|
709
|
-
`));for(const
|
|
726
|
+
`+s,s=s.replace(hl,`export default function __renderFrontComponent(__container) { __createRoot(__container).render(__frontComponentJsx(${o}, {})); }`)}return s},ay={name:"jsx-transform-to-remote-dom-worker-format-plugin",setup:l=>{l.onLoad({filter:/\.tsx$/},async({path:s})=>{try{const r=await Km.readFile(s,"utf8");return{contents:sy(r),loader:"tsx"}}catch(r){return{errors:[{text:`Failed to transform front component: ${r instanceof Error?r.message:String(r)}`,location:{file:s}}]}}})}},oy=/^\/\/.*$\n/gm,ly={name:"strip-comments",setup:l=>{l.onEnd(async s=>{if(s.errors.length>0)return;const r=Object.keys(s.metafile?.outputs??{}).filter(o=>o.endsWith(".mjs"));for(const o of r){const f=Y.default.resolve(o),m=await ll.readFile(f,"utf-8"),v=m.replace(oy,"");v!==m&&await ll.writeFile(f,v,"utf-8")}})}},cy=l=>[ry(),ay,ly],uy=/^(.+)\((\d+),(\d+)\): error TS\d+: (.+)$/,Ol=l=>{const s=l.match(uy);if(!s)return null;const[,r,o,f,m]=s;return{text:m,file:r,line:Number(o),column:Number(f)-1}},fy=l=>{const s=[];for(const r of l.split(`
|
|
727
|
+
`)){const o=Ol(r);o&&s.push(o)}return s},Ll=l=>{const s=Gr.default.join(l,"tsconfig.json"),r=Gr.default.join(l,"node_modules",".bin","tsc");return new Promise(o=>{xl.execFile(r,["--noEmit","--pretty","false","-p",s],{cwd:l},(f,m,v)=>{o(fy(v||m))})})},py=l=>l.map(s=>({text:s.text,location:{file:s.file,line:s.line,column:s.column,lineText:"",length:0,namespace:"",suggestion:""}})),Nl=(l,s)=>({name:"typecheck",setup:r=>{r.onStart(async()=>{if(s())return;const o=await Ll(l);return{errors:py(o)}})}}),dy=["path","fs","crypto","stream","util","os","url","http","https","events","buffer","querystring","assert","zlib","net","tls","child_process","worker_threads"];class Ul{constructor(s){this.esBuildContext=null,this.isRestarting=!1,this.lastChecksums=new Map,this.buildCompletePromise=Promise.resolve(),this.resolveBuildComplete=null,this.appPath=s.appPath,this.sourcePaths=s.sourcePaths,this.watchMode=s.watch??!0,this.onFileBuilt=s.handleFileBuilt,this.onBuildError=s.handleBuildError,this.config=s.config}shouldRestart(s){const r=this.sourcePaths.sort().join(","),o=[...s].sort().join(",");return r!==o}async start(){this.sourcePaths.length>0&&await this.createContext()}async close(){await this.esBuildContext?.dispose(),this.esBuildContext=null}async restart(s){if(!this.isRestarting){this.isRestarting=!0;try{await this.close();const r=Y.default.join(this.appPath,et);await Xv(r,this.sourcePaths,s),this.sourcePaths=s,this.lastChecksums.clear(),this.sourcePaths.length>0&&await this.createContext()}finally{this.isRestarting=!1}}}async createContext(){const s=Y.default.join(this.appPath,et),r={};for(const m of this.sourcePaths){const v=m.replace(/\.tsx?$/,"");r[v]=Y.default.join(this.appPath,m)}const o=this,f=[...this.config.extraPlugins??[],{name:"build-notifications",setup:m=>{m.onEnd(async v=>{try{if(v.errors.length>0){v.errors[0].text.includes("Could not resolve")||await this.onBuildError?.(v.errors.map(E=>({error:E.text,location:E.location})));return}await Zv({result:v,appPath:this.appPath,fileFolder:this.config.fileFolder,lastChecksums:o.lastChecksums,onFileBuilt:o.onFileBuilt})}finally{o.resolveBuildComplete?.()}})}}];this.esBuildContext=await Sl.context({entryPoints:r,bundle:!0,splitting:!1,format:"esm",platform:this.config.platform,outdir:s,outExtension:{".js":".mjs"},external:this.config.externalModules,tsconfig:Y.default.join(this.appPath,"tsconfig.json"),jsx:this.config.jsx,sourcemap:!0,metafile:!0,logLevel:"silent",minify:this.config.minify,banner:this.config.banner,plugins:f}),this.buildCompletePromise=new Promise(m=>{this.resolveBuildComplete=m}),await this.esBuildContext.rebuild(),await this.buildCompletePromise,this.watchMode&&await this.esBuildContext.watch()}}const Dl=l=>({name:"sdk-generated-resolver",setup:s=>{s.onResolve({filter:/^twenty-sdk\/generated/},()=>({path:Y.default.join(l,"node_modules","twenty-sdk",Vr,"index.ts")}))}}),hy=l=>new Ul({...l,config:{externalModules:dy,fileFolder:k.U.BuiltLogicFunction,platform:"node",extraPlugins:[Nl(l.appPath,l.shouldSkipTypecheck),Dl(l.appPath)],banner:Vm}}),gy=l=>new Ul({...l,config:{externalModules:Qv,fileFolder:k.U.BuiltFrontComponent,jsx:"automatic",extraPlugins:[Nl(l.appPath,l.shouldSkipTypecheck),Dl(l.appPath),...cy()]}});class gl{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=this.watchPaths.map(r=>b.join(this.appPath,r));for(const r of s)if(!await R.pathExists(r))return;this.watcher=Tl.default.watch(s,{awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("all",(r,o)=>{r==="addDir"||r==="unlinkDir"||((r==="add"||r==="change")&&this.copyAndNotify(o),r==="unlink"&&this.handleUnlink(o))})}async close(){await this.watcher?.close()}async copyAndNotify(s){const r=b.relative(this.appPath,s),o=b.join(et,r),f=b.join(this.appPath,o);await R.ensureDir(b.dirname(f)),await R.copy(s,f);const m=await R.readFile(f),v=Kr.default.createHash("md5").update(m).digest("hex");this.handleFileBuilt({fileFolder:this.fileFolder,builtPath:o,sourcePath:r,checksum:v})}async handleUnlink(s){const r=b.relative(this.appPath,s),o=b.join(et,r),f=b.join(this.appPath,o);await R.remove(f)}}class my{constructor(s){this.process=null,this.pendingErrors=[],this.buffer="",this.hasErrors=!1,this.appPath=s.appPath,this.onErrors=s.onErrors}async start(){const s=Gr.default.join(this.appPath,"node_modules",".bin","tsc");if(!await R.pathExists(s))return;const r=Gr.default.join(this.appPath,"tsconfig.json");this.process=xl.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",o=>{this.handleOutput(o.toString())}),this.process.stderr?.on("data",o=>{this.handleOutput(o.toString())})}close(){this.process?.kill(),this.process=null}handleOutput(s){this.buffer+=s;const r=this.buffer.split(`
|
|
728
|
+
`);this.buffer=r.pop()??"";for(const o of r)this.processLine(o)}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 o=this.hasErrors;this.hasErrors=this.pendingErrors.length>0,(this.hasErrors||o)&&this.onErrors(this.pendingErrors),this.pendingErrors=[];return}const r=Ol(s);r&&this.pendingErrors.push(r)}}const vy=new Set(["node_modules",Vr,"dist",".twenty"]);class yy{constructor(s){this.watcher=null,this.appPath=s.appPath,this.handleChangeDetected=s.handleChangeDetected}async start(){const s=this.appPath;this.watcher=Tl.default.watch(this.appPath,{ignored:r=>{const o=b.relative(s,r);if(o==="")return!1;const f=o.split(Y.default.sep)[0];return vy.has(f)||f.startsWith(".")},awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("all",(r,o)=>{if(r==="addDir"||r==="unlinkDir")return;const f=b.relative(this.appPath,o),m=f.startsWith(Is),v=["package.json","yarn.lock"].includes(f);!(f.endsWith(".ts")||f.endsWith(".tsx"))&&!m&&!v||this.handleChangeDetected(f,r)})}async close(){await this.watcher?.close()}}class _y{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}async start(){this.state.steps.startWatchers.status="in_progress",this.notify(),this.manifestWatcher=new yy({appPath:this.state.appPath,handleChangeDetected:this.handleChangeDetected.bind(this)}),await this.manifestWatcher.start()}async handleWatcherRestarts(s){const{logicFunctions:r,frontComponents:o}=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,o);return}this.logicFunctionsWatcher?.shouldRestart(r)&&await this.logicFunctionsWatcher.restart(r),this.frontComponentsWatcher?.shouldRestart(o)&&await this.frontComponentsWatcher.restart(o)}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.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}),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=hy({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=gy({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 gl({appPath:this.state.appPath,fileFolder:k.U.PublicAsset,watchPaths:[Is],handleFileBuilt:this.handleFileBuilt.bind(this)}),await this.assetWatcher.start()}async startDependencyWatcher(){this.dependencyWatcher=new gl({appPath:this.state.appPath,fileFolder:k.U.Dependencies,watchPaths:["package.json","yarn.lock"],handleFileBuilt:this.handleFileBuilt.bind(this)}),this.dependencyWatcher.start()}async startTscWatcher(){this.tscWatcher=new my({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()}}const wy=({manifest:l,builtFileInfos:s})=>{let r=structuredClone(l);for(const[f,{fileFolder:m,checksum:v}]of s.entries()){const E=b.relative(et,f);if(m===k.U.BuiltLogicFunction){const C=r.logicFunctions,M=C.findIndex(j=>j.builtHandlerPath===E);if(M===-1)continue;r={...r,logicFunctions:C.map((j,X)=>X===M?{...j,builtHandlerChecksum:v}:j)}}if(m===k.U.PublicAsset){const C=r.publicAssets,M=C.findIndex(j=>j.filePath===E);if(M===-1)continue;r={...r,publicAssets:C.map((j,X)=>X===M?{...j,checksum:v}:j)};continue}if(m===k.U.BuiltFrontComponent){const C=r.frontComponents,M=C.findIndex(j=>j.builtComponentPath===E)??-1;if(M===-1)continue;r={...r,frontComponents:C.map((j,X)=>X===M?{...j,builtComponentChecksum:v}:j)}}m===k.U.Dependencies&&(E==="package.json"&&(r.application.packageJsonChecksum=v),E==="yarn.lock"&&(r.application.yarnLockChecksum=v))}const o=[];for(const[f,{fileFolder:m}]of s.entries()){const v=b.relative(et,f);if(m===k.U.Dependencies&&v.startsWith(`${Hr}/`)){const E=s.get(f);E&&o.push(E.checksum)}}return o.length>0&&(r.application.apiClientChecksum=Kr.default.createHash("md5").update(o.sort().join("")).digest("hex")),r},xy=async(l,s)=>{const r=Y.default.join(l,et);await R.ensureDir(r);const o=Y.default.join(r,"manifest.json");return await R.writeJSON(o,s,{spaces:2}),o},$l=l=>{if(typeof l=="string")return l;if(yn.default.isAxiosError(l)){const r=[],o=l.response?.status,f=l.response?.statusText;o&&r.push(`HTTP ${o}${f?` ${f}`:""}`);const m=l.response?.data?.errors;if(Array.isArray(m)&&m.length>0){const v=m.map(E=>E.message??"Unknown GraphQL error").join("; ");r.push(v)}else l.response?.data?.message?r.push(l.response.data.message):l.message&&r.push(l.message);return l.code&&r.push(`(${l.code})`),r.join(" - ")||"Unknown Axios error"}if(l instanceof Error)return l.message||l.toString();const s=JSON.stringify(l,null,2);return s==="{}"||s===void 0?String(l):s};class Iy{constructor({apiService:s,state:r,notify:o}){this.apiService=s,this.state=r,this.notify=o}async execute(s){const r=this.state.steps.syncApplication;r.status="in_progress",this.state.updatePipeline({status:"syncing"});const o=[],f=wy({manifest:s.manifest,builtFileInfos:s.builtFileInfos});o.push({message:"Manifest checksums set",status:"info"}),await xy(s.appPath,f),o.push({message:"Manifest saved to output directory",status:"info"}),o.push({message:"Syncing manifest",status:"info"});const m=await this.apiService.syncApplication(f);if(m.success){o.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(o);return}const v=`Sync failed with error: ${$l(m.error)}`;o.push({message:v,status:"error"}),r.output={syncStatus:"error",error:v},r.status="error",this.state.updatePipeline({status:"error",error:v}),this.state.updateAllEntitiesStatus("error"),this.state.applyStepEvents(o)}}class Ay{constructor(s){this.apiService=new Ct,this.applicationUniversalIdentifier=s.applicationUniversalIdentifier,this.appPath=s.appPath}async uploadFile({builtPath:s,fileFolder:r}){const o=b.relative(et,s);return await this.apiService.uploadFile({filePath:Y.default.join(this.appPath,s),builtHandlerPath:o,fileFolder:r,applicationUniversalIdentifier:this.applicationUniversalIdentifier})}}const Sy=["core/types.ts","core/schema.ts","metadata/types.ts","metadata/schema.ts"];class Ty{constructor({state:s,notify:r}){this.state=s,this.notify=r}get isInitialized(){return this.state.steps.uploadFiles.output.fileUploader!==null}initialize(s){const r=this.state.steps.uploadFiles;r.output={...r.output,fileUploader:new Ay({appPath:s.appPath,applicationUniversalIdentifier:s.universalIdentifier})},r.status="in_progress",this.notify(),this.uploadPendingFiles()}uploadFile(s,r,o){const f=this.state.steps.uploadFiles;if(!f.output.fileUploader)return;this.state.addEvent({message:`Uploading ${s}`,status:"info"}),this.state.updateEntityStatus(r,"uploading");const m=f.output.fileUploader.uploadFile({builtPath:s,fileFolder:o}).then(v=>{v.success?(this.state.addEvent({message:`Successfully uploaded ${s}`,status:"success"}),this.state.updateEntityStatus(r,"success")):this.state.addEvent({message:`Failed to upload ${s}: ${v.error}`,status:"error"})}).catch(v=>{this.state.addEvent({message:`Upload failed for ${s}: ${v}`,status:"error"})}).finally(()=>{f.output.activeUploads.delete(m)});f.output.activeUploads.add(m)}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()}async copyAndUploadApiClientFiles(s){const r=b.join(s,"node_modules","twenty-sdk",Vr);if(!await R.pathExists(r))return;const o=b.join(s,et,Hr);await R.ensureDir(o);for(const f of Sy){const m=b.join(r,f);if(!await R.pathExists(m))continue;await R.copy(m,b.join(o,f));const v=await R.readFile(m),E=Kr.default.createHash("md5").update(v).digest("hex"),C=b.join(et,Hr,f),M=b.join(Hr,f);this.state.steps.uploadFiles.output.builtFileInfos.set(C,{checksum:E,builtPath:C,sourcePath:M,fileFolder:k.U.Dependencies}),this.uploadFile(C,M,k.U.Dependencies)}}uploadPendingFiles(){for(const[s,{fileFolder:r,sourcePath:o}]of this.state.steps.uploadFiles.output.builtFileInfos.entries())this.uploadFile(s,o,r)}}class Ey{constructor(s){this.syncTimer=null,this.serverCheckInterval=null,this.skipTypecheck=!0,this.debounceMs=s.debounceMs??200,this.state=s.state;const r=new Ct({disableInterceptors:!0}),o=new _e;this.clientService=new Tv;const f={state:this.state,notify:()=>this.state.notify()};this.checkServerStep=new zv({...f,apiService:r}),this.ensureValidTokensStep=new Jv({...f,apiService:r,configService:o}),this.buildManifestStep=new Gv(f),this.registerAppStep=new Vv({...f,apiService:r,configService:o}),this.resolveApplicationStep=new Yv({...f,apiService:r}),this.uploadFilesStep=new Ty(f),this.generateApiClientStep=new Kv({...f,clientService:this.clientService,configService:o}),this.syncApplicationStep=new Iy({...f,apiService:r}),this.startWatchersStep=new _y({...f,scheduleSync:this.scheduleSync.bind(this),onFileBuilt:this.handleFileBuilt.bind(this),shouldSkipTypecheck:()=>this.skipTypecheck})}async start(){const s=Y.default.join(this.state.appPath,et);await R.ensureDir(s),await R.emptyDir(s),await this.clientService.ensureGeneratedClientStub({appPath:this.state.appPath}),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: ${$l(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;await this.ensureValidTokensStep.execute({applicationId:this.state.steps.resolveApplication.output.applicationId});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 o=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}),o&&(await this.generateApiClientStep.execute({appPath:this.state.appPath}),this.skipTypecheck=!1,await this.uploadFilesStep.copyAndUploadApiClientFiles(this.state.appPath))}async initializePipeline(s){const r=await this.registerAppStep.execute({manifest:s}),o=await this.resolveApplicationStep.execute({manifest:s,applicationRegistrationId:r.applicationRegistrationId??void 0});return o.applicationId?(await this.ensureValidTokensStep.exchangeTokens({applicationId:o.applicationId}),this.uploadFilesStep.initialize({appPath:this.state.appPath,universalIdentifier:s.application.universalIdentifier}),!0):!1}}const Fy={objects:K.Object,fields:K.Field,logicFunctions:K.LogicFunction,frontComponents:K.FrontComponent,roles:K.Role,skills:K.Skill,views:K.View,navigationMenuItems:K.NavigationMenuItem,pageLayouts:K.PageLayout},Cy=200,Ry={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 Py{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(o=>(this.eventIdCounter+=1,{...o,id:this.eventIdCounter,timestamp:new Date,message:o.message.slice(0,5e3)}));this.events=[...this.events.slice(-(Cy-r.length)),...r]}addEvent(s){this.applyStepEvents([s])}updateEntityStatus(s,r){const o=new Map(this.entities),f=o.get(s);f?.status&&!Ry[f.status].includes(r)||(o.set(s,f?{...f,status:r}:{name:s,path:s,status:r}),this.entities=o)}removeEntity(s){const r=new Map(this.entities);r.delete(s),this.entities=r}updateAllEntitiesStatus(s){const r=new Map(this.entities);for(const[o,f]of r)r.set(o,{...f,status:s});this.entities=r}updateEntitiesFromManifest(s){const r=new Map;for(const[f,m]of Object.entries(s)){const v=Fy[f];if(v)for(const E of m)r.set(E,v)}const o=new Map(this.entities);for(const[f,m]of o)o.set(f,{...m,type:r.get(f)});this.entities=o}hasObjectsOrFieldsChanged(s){const r=JSON.stringify({objects:s.objects,fields:s.fields}),o=r!==this.previousObjectsFieldsFingerprint;return this.previousObjectsFieldsFingerprint=r,o}}class by{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??Ae,o=new Py({appPath:r,frontendUrl:process.env.FRONTEND_URL}),f=new yv(o);o.onChange=()=>f.notify();const{unmount:m}=await vv(f);this.unmountUI=m,this.orchestrator=new Ey({state:o}),await this.orchestrator.start(),this.setupGracefulShutdown()}setupGracefulShutdown(){const s=()=>void this.close().then(()=>process.exit(0));process.on("SIGINT",s),process.on("SIGTERM",s)}}const ky=l=>`${A.default.cyan(l.file)}:${A.default.yellow(String(l.line))}:${A.default.yellow(String(l.column+1))} - ${A.default.red("error")} ${l.text}`;class Oy{async execute(s){const r=s.appPath??Ae;console.log(A.default.blue("Running type check...")),console.log(A.default.gray(`App path: ${r}`)),console.log("");const o=await Ll(r);o.length===0&&(console.log(A.default.green("✓ No type errors found")),process.exit(0));for(const f of o)console.log(ky(f));console.log(""),console.log(A.default.red(`✗ Found ${o.length} type error${o.length===1?"":"s"}`)),process.exit(1)}}const Ss=async l=>{const s=Y.default.join(l,et);await R.ensureDir(s);const r=Y.default.join(s,"manifest.json");if(!await R.pathExists(r)){const{manifest:o}=await bl(l);return o}return await R.readJson(r)};class Ly{constructor(){this.apiService=new Ct}async execute({appPath:s=Ae,askForConfirmation:r}){try{console.log(A.default.blue("🚀 Uninstall Twenty Application")),console.log(A.default.gray(`📁 App Path: ${s}`)),console.log(""),r&&!await this.confirmationPrompt()&&(console.error(A.default.red("⛔️ Aborting uninstall")),process.exit(1));const o=await Ss(s);if(!o)return{success:!1,error:"Build failed"};const f=await this.apiService.uninstallApplication(o.application.universalIdentifier);return f.success===!1?console.error(A.default.red("❌ Uninstall failed:"),f.error):console.log(A.default.green("✅ Application uninstalled successfully")),f}catch(o){throw console.error(A.default.red("Uninstall failed:"),o instanceof Error?o.message:o),o}}async confirmationPrompt(){const{confirmation:s}=await lt.default.prompt([{type:"confirm",name:"confirmation",message:"Are you sure you want to uninstall this application?",default:!1}]);return s}}class Ny{constructor(){this.configService=new _e}async execute(){try{const s=await this.configService.getAvailableWorkspaces(),r=await this.configService.getDefaultWorkspace();if(s.length===0){console.log(A.default.yellow("⚠ No workspaces configured. Use `twenty auth:login` to create one."));return}console.log(A.default.blue(`Available workspaces:
|
|
729
|
+
`));for(const o of s){const f=await this.configService.getConfigForWorkspace(o),m=!!f.apiKey,E=o===r?A.default.green(" (default)"):"",C=m?A.default.green("●"):A.default.gray("○");console.log(` ${C} ${o}${E}`),console.log(A.default.gray(` API URL: ${f.apiUrl}`))}console.log(""),console.log(A.default.gray("● = authenticated, ○ = no credentials")),console.log(A.default.gray("Use `twenty auth:switch <workspace>` to change default"))}catch(s){console.error(A.default.red("List failed:"),s instanceof Error?s.message:s),process.exit(1)}}}class Uy{constructor(){this.configService=new _e,this.apiService=new Ct}async execute(s){try{let{apiKey:r,apiUrl:o}=s;const f=await this.configService.getConfig();if(o||(o=(await lt.default.prompt([{type:"input",name:"apiUrl",message:"Twenty API URL:",default:f.apiUrl,validate:E=>{try{return new URL(E),!0}catch{return"Please enter a valid URL"}}}])).apiUrl),r||(r=(await lt.default.prompt([{type:"password",name:"apiKey",message:"API Key:",mask:"*",validate:E=>E.length>0||"API key is required"}])).apiKey),await this.configService.setConfig({apiUrl:o,apiKey:r}),(await this.apiService.validateAuth()).authValid){const v=_e.getActiveWorkspace();console.log(A.default.green(`✓ Successfully authenticated with Twenty (workspace: ${v})`))}else console.log(A.default.red("✗ Authentication failed. Please check your credentials.")),process.exit(1)}catch(r){console.error(A.default.red("Login failed:"),r instanceof Error?r.message:r),process.exit(1)}}}class Dy{constructor(){this.configService=new _e}async execute(){try{await this.configService.clearConfig();const s=_e.getActiveWorkspace();console.log(A.default.green(`✓ Successfully logged out (workspace: ${s})`))}catch(s){console.error(A.default.red("Logout failed:"),s instanceof Error?s.message:s),process.exit(1)}}}class $y{constructor(){this.configService=new _e,this.apiService=new Ct}async execute(){try{const s=_e.getActiveWorkspace(),r=await this.configService.getConfig();if(console.log(A.default.blue("Authentication Status:")),console.log(`Workspace: ${s}`),console.log(`API URL: ${r.apiUrl}`),console.log(`API Key: ${r.apiKey?"***"+r.apiKey.slice(-4):"Not set"}`),r.apiKey){const o=await this.apiService.validateAuth();console.log(`Status: ${o.authValid?A.default.green("✓ Valid"):A.default.red("✗ Invalid")}`)}else console.log(`Status: ${A.default.yellow("⚠ Not authenticated")}`)}catch(s){console.error(A.default.red("Status check failed:"),s instanceof Error?s.message:s),process.exit(1)}}}class Wy{constructor(){this.apiService=new Ct}async execute({appPath:s=Ae,postInstall:r=!1,functionUniversalIdentifier:o,functionName:f,payload:m="{}"}){try{let v;try{v=JSON.parse(m)}catch{console.error(A.default.red("Invalid JSON payload. Please provide valid JSON.")),process.exit(1)}const E=await Ss(s);E||(console.error(A.default.red("Failed to build manifest.")),process.exit(1));const C=await this.apiService.findLogicFunctions();C.success||(console.error(A.default.red("Failed to fetch functions:"),C.error instanceof Error?C.error.message:C.error),process.exit(1));const M=C.data.filter(ne=>ne.universalIdentifier&&this.belongsToApplication(ne,E)),j=M.find(ne=>r?ne.universalIdentifier===E.application.postInstallLogicFunctionUniversalIdentifier:o?ne.universalIdentifier===o:f?ne.name===f:!1);if(!j){const ne=r?"post install":o||f;console.error(A.default.red(`Function "${ne}" not found in application.`)),console.log(""),M.length>0?(console.log(A.default.cyan("Available functions:")),M.forEach(De=>{console.log(` - ${A.default.white(De.name)} (${De.universalIdentifier})`)})):console.log(A.default.yellow("No functions found for this application. Have you synced your app with `yarn app:dev`?")),process.exit(1)}console.log(A.default.blue(`🚀 Executing function "${j.name}"...`)),console.log(A.default.gray(` Payload: ${JSON.stringify(v)}`)),console.log("");const X=await this.apiService.executeLogicFunction({functionId:j.id,payload:v});X.success||(console.error(A.default.red("Execution failed:"),X.error instanceof Error?X.error.message:X.error),process.exit(1));const U=X.data;console.log(A.default.cyan("─".repeat(60))),console.log(A.default.cyan("Execution Result")),console.log(A.default.cyan("─".repeat(60)));const V=U.status==="SUCCESS"?A.default.green:A.default.red;console.log(`${A.default.bold("Status:")} ${V(U.status)}`),console.log(`${A.default.bold("Duration:")} ${U.duration}ms`),k.o(U.data)&&(console.log(""),console.log(A.default.bold("Data:")),console.log(A.default.white(JSON.stringify(U.data,null,2)))),U.error&&(console.log(""),console.log(A.default.bold.red("Error:")),console.log(A.default.red(` Type: ${U.error.errorType}`)),console.log(A.default.red(` Message: ${U.error.errorMessage}`)),U.error.stackTrace&&(console.log(""),console.log(A.default.gray("Stack trace:")),console.log(A.default.gray(U.error.stackTrace)))),U.logs&&(console.log(""),console.log(A.default.bold("Logs:")),console.log(A.default.gray(U.logs))),console.log(A.default.cyan("─".repeat(60))),U.status!=="SUCCESS"&&process.exit(1)}catch(v){console.error(A.default.red("Execution failed:"),v instanceof Error?v.message:v),process.exit(1)}}belongsToApplication(s,r){return r.logicFunctions.some(o=>o.universalIdentifier===s.universalIdentifier)}}class My{constructor(){this.apiService=new Ct}async execute({appPath:s=Ae,functionUniversalIdentifier:r,functionName:o}){try{const f=await Ss(s);f||process.exit(1),this.logWatchInfo({appName:f.application.displayName,functionUniversalIdentifier:r,functionName:o}),await this.apiService.subscribeToLogs({applicationUniversalIdentifier:f.application.universalIdentifier,functionUniversalIdentifier:r,functionName:o})}catch(f){console.error(A.default.red("Watch logs failed:"),f instanceof Error?f.message:f),process.exit(1)}}logWatchInfo({appName:s,functionUniversalIdentifier:r,functionName:o}){const f=s??"Twenty Application",m=r||o?`function "${r||o}"`:"functions";console.log(A.default.blue(`🚀 Watching ${f} ${m} logs:`)),console.log("")}}class By{constructor(){this.configService=new _e,this.apiService=new Ct}async execute(s){try{let{workspace:r}=s;const o=await this.configService.getAvailableWorkspaces(),f=await this.configService.getDefaultWorkspace();if(o.length===0){console.log(A.default.yellow("⚠ No workspaces configured. Use `twenty auth:login` to create one."));return}if(!r){const E=o.map(M=>({name:M===f?`${M} (current default)`:M,value:M}));r=(await lt.default.prompt([{type:"list",name:"workspace",message:"Select a workspace to set as default:",choices:E,default:f}])).workspace}if(o.includes(r)||(console.log(A.default.red(`✗ Workspace "${r}" not found. Available workspaces: ${o.join(", ")}`)),process.exit(1)),r===f){console.log(A.default.blue(`ℹ "${r}" is already the default workspace.`));return}await this.configService.setDefaultWorkspace(r),_e.setActiveWorkspace(r);const v=!!(await this.configService.getConfig()).apiKey;console.log(A.default.green(`✓ Switched default workspace to "${r}"`)),v?(await this.apiService.validateAuth()).authValid?console.log(A.default.green("✓ Authentication is valid")):console.log(A.default.yellow("⚠ Authentication credentials exist but are invalid. Run `twenty auth:login` to re-authenticate.")):console.log(A.default.yellow("⚠ No credentials configured for this workspace. Run `twenty auth:login` to authenticate."))}catch(r){console.error(A.default.red("Switch failed:"),r instanceof Error?r.message:r),process.exit(1)}}}const qy=({name:l,universalIdentifier:s=Ue.v4()})=>{const r=Qe.default(l);return`import { defineFrontComponent } from 'twenty-sdk';
|
|
710
730
|
|
|
711
731
|
// React component - implement your UI here
|
|
712
732
|
const Component = () => {
|
|
@@ -724,7 +744,7 @@ export default defineFrontComponent({
|
|
|
724
744
|
description: 'Add a description for your front component',
|
|
725
745
|
component: Component,
|
|
726
746
|
});
|
|
727
|
-
`},jy=({name:
|
|
747
|
+
`},jy=({name:l,universalIdentifier:s=Ue.v4()})=>{const r=Qe.default(l);return`import { defineLogicFunction } from 'twenty-sdk';
|
|
728
748
|
|
|
729
749
|
// Logic function handler - rename and implement your logic
|
|
730
750
|
const handler = async (params: {
|
|
@@ -761,7 +781,7 @@ export default defineLogicFunction({
|
|
|
761
781
|
// eventName: 'objectName.created',
|
|
762
782
|
// },
|
|
763
783
|
});
|
|
764
|
-
`},ml=({name:
|
|
784
|
+
`},ml=({name:l,universalIdentifier:s=Ue.v4(),viewUniversalIdentifier:r})=>{const o=Qe.default(l),f=r?` viewUniversalIdentifier: '${r}',`:` // Link to a view:
|
|
765
785
|
// viewUniversalIdentifier: '...',
|
|
766
786
|
// Or link to an object:
|
|
767
787
|
// targetObjectUniversalIdentifier: '...',
|
|
@@ -770,7 +790,7 @@ export default defineLogicFunction({
|
|
|
770
790
|
|
|
771
791
|
export default defineNavigationMenuItem({
|
|
772
792
|
universalIdentifier: '${s}',
|
|
773
|
-
name: '${
|
|
793
|
+
name: '${o}',
|
|
774
794
|
icon: 'IconList',
|
|
775
795
|
position: 0,
|
|
776
796
|
${f}
|
|
@@ -782,33 +802,33 @@ ${f}
|
|
|
782
802
|
* Released under MIT license <https://lodash.com/license>
|
|
783
803
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
784
804
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
785
|
-
*/var qy=Jn.exports,vl;function Hy(){return vl||(vl=1,function(o,s){(function(){var r,l="4.17.21",f=200,m="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",v="Expected a function",E="Invalid `variable` option passed into `_.template`",C="__lodash_hash_undefined__",M=500,q="__lodash_placeholder__",X=1,U=2,V=4,ne=1,De=2,Ie=1,ht=2,xn=4,$e=8,Pt=16,We=32,bt=64,Me=128,Rt=256,Qt=512,Vn=30,Yr="...",Ts=800,Es=16,oe=1,Yn=2,Be=3,je=1/0,gt=9007199254740991,G=17976931348623157e292,Te=NaN,de=4294967295,ut=de-1,qt=de>>>1,An=[["ary",Me],["bind",Ie],["bindKey",ht],["curry",$e],["curryRight",Pt],["flip",Qt],["partial",We],["partialRight",bt],["rearg",Rt]],en="[object Arguments]",Xn="[object Array]",Wl="[object AsyncFunction]",Sn="[object Boolean]",In="[object Date]",Ml="[object DOMException]",Zn="[object Error]",Qn="[object Function]",Fs="[object GeneratorFunction]",tt="[object Map]",Tn="[object Number]",Bl="[object Null]",mt="[object Object]",Cs="[object Promise]",jl="[object Proxy]",En="[object RegExp]",nt="[object Set]",Fn="[object String]",er="[object Symbol]",ql="[object Undefined]",Cn="[object WeakMap]",Hl="[object WeakSet]",Pn="[object ArrayBuffer]",tn="[object DataView]",Xr="[object Float32Array]",Zr="[object Float64Array]",Qr="[object Int8Array]",ei="[object Int16Array]",ti="[object Int32Array]",ni="[object Uint8Array]",ri="[object Uint8ClampedArray]",ii="[object Uint16Array]",si="[object Uint32Array]",Gl=/\b__p \+= '';/g,zl=/\b(__p \+=) '' \+/g,Jl=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ps=/&(?:amp|lt|gt|quot|#39);/g,bs=/[&<>"']/g,Kl=RegExp(Ps.source),Vl=RegExp(bs.source),Yl=/<%-([\s\S]+?)%>/g,Xl=/<%([\s\S]+?)%>/g,Rs=/<%=([\s\S]+?)%>/g,Zl=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ql=/^\w*$/,eu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ai=/[\\^$.*+?()[\]{}|]/g,tu=RegExp(ai.source),oi=/^\s+/,nu=/\s/,ru=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,iu=/\{\n\/\* \[wrapped with (.+)\] \*/,su=/,? & /,au=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ou=/[()=,{}\[\]\/\s]/,lu=/\\(\\)?/g,uu=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ks=/\w*$/,cu=/^[-+]0x[0-9a-f]+$/i,fu=/^0b[01]+$/i,pu=/^\[object .+?Constructor\]$/,du=/^0o[0-7]+$/i,hu=/^(?:0|[1-9]\d*)$/,gu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,tr=/($^)/,mu=/['\n\r\u2028\u2029\\]/g,nr="\\ud800-\\udfff",vu="\\u0300-\\u036f",yu="\\ufe20-\\ufe2f",_u="\\u20d0-\\u20ff",Os=vu+yu+_u,Ls="\\u2700-\\u27bf",Ns="a-z\\xdf-\\xf6\\xf8-\\xff",wu="\\xac\\xb1\\xd7\\xf7",xu="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Au="\\u2000-\\u206f",Su=" \\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",Us="A-Z\\xc0-\\xd6\\xd8-\\xde",Ds="\\ufe0e\\ufe0f",$s=wu+xu+Au+Su,li="['’]",Iu="["+nr+"]",Ws="["+$s+"]",rr="["+Os+"]",Ms="\\d+",Tu="["+Ls+"]",Bs="["+Ns+"]",js="[^"+nr+$s+Ms+Ls+Ns+Us+"]",ui="\\ud83c[\\udffb-\\udfff]",Eu="(?:"+rr+"|"+ui+")",qs="[^"+nr+"]",ci="(?:\\ud83c[\\udde6-\\uddff]){2}",fi="[\\ud800-\\udbff][\\udc00-\\udfff]",nn="["+Us+"]",Hs="\\u200d",Gs="(?:"+Bs+"|"+js+")",Fu="(?:"+nn+"|"+js+")",zs="(?:"+li+"(?:d|ll|m|re|s|t|ve))?",Js="(?:"+li+"(?:D|LL|M|RE|S|T|VE))?",Ks=Eu+"?",Vs="["+Ds+"]?",Cu="(?:"+Hs+"(?:"+[qs,ci,fi].join("|")+")"+Vs+Ks+")*",Pu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",bu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ys=Vs+Ks+Cu,Ru="(?:"+[Tu,ci,fi].join("|")+")"+Ys,ku="(?:"+[qs+rr+"?",rr,ci,fi,Iu].join("|")+")",Ou=RegExp(li,"g"),Lu=RegExp(rr,"g"),pi=RegExp(ui+"(?="+ui+")|"+ku+Ys,"g"),Nu=RegExp([nn+"?"+Bs+"+"+zs+"(?="+[Ws,nn,"$"].join("|")+")",Fu+"+"+Js+"(?="+[Ws,nn+Gs,"$"].join("|")+")",nn+"?"+Gs+"+"+zs,nn+"+"+Js,bu,Pu,Ms,Ru].join("|"),"g"),Uu=RegExp("["+Hs+nr+Os+Ds+"]"),Du=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,$u=["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"],Wu=-1,ie={};ie[Xr]=ie[Zr]=ie[Qr]=ie[ei]=ie[ti]=ie[ni]=ie[ri]=ie[ii]=ie[si]=!0,ie[en]=ie[Xn]=ie[Pn]=ie[Sn]=ie[tn]=ie[In]=ie[Zn]=ie[Qn]=ie[tt]=ie[Tn]=ie[mt]=ie[En]=ie[nt]=ie[Fn]=ie[Cn]=!1;var re={};re[en]=re[Xn]=re[Pn]=re[tn]=re[Sn]=re[In]=re[Xr]=re[Zr]=re[Qr]=re[ei]=re[ti]=re[tt]=re[Tn]=re[mt]=re[En]=re[nt]=re[Fn]=re[er]=re[ni]=re[ri]=re[ii]=re[si]=!0,re[Zn]=re[Qn]=re[Cn]=!1;var Mu={À:"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"},Bu={"&":"&","<":"<",">":">",'"':""","'":"'"},ju={"&":"&","<":"<",">":">",""":'"',"'":"'"},qu={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Hu=parseFloat,Gu=parseInt,Xs=typeof qr=="object"&&qr&&qr.Object===Object&&qr,zu=typeof self=="object"&&self&&self.Object===Object&&self,ge=Xs||zu||Function("return this")(),di=s&&!s.nodeType&&s,Ht=di&&!0&&o&&!o.nodeType&&o,Zs=Ht&&Ht.exports===di,hi=Zs&&Xs.process,qe=function(){try{var h=Ht&&Ht.require&&Ht.require("util").types;return h||hi&&hi.binding&&hi.binding("util")}catch{}}(),Qs=qe&&qe.isArrayBuffer,ea=qe&&qe.isDate,ta=qe&&qe.isMap,na=qe&&qe.isRegExp,ra=qe&&qe.isSet,ia=qe&&qe.isTypedArray;function be(h,_,y){switch(y.length){case 0:return h.call(_);case 1:return h.call(_,y[0]);case 2:return h.call(_,y[0],y[1]);case 3:return h.call(_,y[0],y[1],y[2])}return h.apply(_,y)}function Ju(h,_,y,T){for(var D=-1,Z=h==null?0:h.length;++D<Z;){var fe=h[D];_(T,fe,y(fe),h)}return T}function He(h,_){for(var y=-1,T=h==null?0:h.length;++y<T&&_(h[y],y,h)!==!1;);return h}function Ku(h,_){for(var y=h==null?0:h.length;y--&&_(h[y],y,h)!==!1;);return h}function sa(h,_){for(var y=-1,T=h==null?0:h.length;++y<T;)if(!_(h[y],y,h))return!1;return!0}function kt(h,_){for(var y=-1,T=h==null?0:h.length,D=0,Z=[];++y<T;){var fe=h[y];_(fe,y,h)&&(Z[D++]=fe)}return Z}function ir(h,_){var y=h==null?0:h.length;return!!y&&rn(h,_,0)>-1}function gi(h,_,y){for(var T=-1,D=h==null?0:h.length;++T<D;)if(y(_,h[T]))return!0;return!1}function se(h,_){for(var y=-1,T=h==null?0:h.length,D=Array(T);++y<T;)D[y]=_(h[y],y,h);return D}function Ot(h,_){for(var y=-1,T=_.length,D=h.length;++y<T;)h[D+y]=_[y];return h}function mi(h,_,y,T){var D=-1,Z=h==null?0:h.length;for(T&&Z&&(y=h[++D]);++D<Z;)y=_(y,h[D],D,h);return y}function Vu(h,_,y,T){var D=h==null?0:h.length;for(T&&D&&(y=h[--D]);D--;)y=_(y,h[D],D,h);return y}function vi(h,_){for(var y=-1,T=h==null?0:h.length;++y<T;)if(_(h[y],y,h))return!0;return!1}var Yu=yi("length");function Xu(h){return h.split("")}function Zu(h){return h.match(au)||[]}function aa(h,_,y){var T;return y(h,function(D,Z,fe){if(_(D,Z,fe))return T=Z,!1}),T}function sr(h,_,y,T){for(var D=h.length,Z=y+(T?1:-1);T?Z--:++Z<D;)if(_(h[Z],Z,h))return Z;return-1}function rn(h,_,y){return _===_?cc(h,_,y):sr(h,oa,y)}function Qu(h,_,y,T){for(var D=y-1,Z=h.length;++D<Z;)if(T(h[D],_))return D;return-1}function oa(h){return h!==h}function la(h,_){var y=h==null?0:h.length;return y?wi(h,_)/y:Te}function yi(h){return function(_){return _==null?r:_[h]}}function _i(h){return function(_){return h==null?r:h[_]}}function ua(h,_,y,T,D){return D(h,function(Z,fe,te){y=T?(T=!1,Z):_(y,Z,fe,te)}),y}function ec(h,_){var y=h.length;for(h.sort(_);y--;)h[y]=h[y].value;return h}function wi(h,_){for(var y,T=-1,D=h.length;++T<D;){var Z=_(h[T]);Z!==r&&(y=y===r?Z:y+Z)}return y}function xi(h,_){for(var y=-1,T=Array(h);++y<h;)T[y]=_(y);return T}function tc(h,_){return se(_,function(y){return[y,h[y]]})}function ca(h){return h&&h.slice(0,ha(h)+1).replace(oi,"")}function Re(h){return function(_){return h(_)}}function Ai(h,_){return se(_,function(y){return h[y]})}function bn(h,_){return h.has(_)}function fa(h,_){for(var y=-1,T=h.length;++y<T&&rn(_,h[y],0)>-1;);return y}function pa(h,_){for(var y=h.length;y--&&rn(_,h[y],0)>-1;);return y}function nc(h,_){for(var y=h.length,T=0;y--;)h[y]===_&&++T;return T}var rc=_i(Mu),ic=_i(Bu);function sc(h){return"\\"+qu[h]}function ac(h,_){return h==null?r:h[_]}function sn(h){return Uu.test(h)}function oc(h){return Du.test(h)}function lc(h){for(var _,y=[];!(_=h.next()).done;)y.push(_.value);return y}function Si(h){var _=-1,y=Array(h.size);return h.forEach(function(T,D){y[++_]=[D,T]}),y}function da(h,_){return function(y){return h(_(y))}}function Lt(h,_){for(var y=-1,T=h.length,D=0,Z=[];++y<T;){var fe=h[y];(fe===_||fe===q)&&(h[y]=q,Z[D++]=y)}return Z}function ar(h){var _=-1,y=Array(h.size);return h.forEach(function(T){y[++_]=T}),y}function uc(h){var _=-1,y=Array(h.size);return h.forEach(function(T){y[++_]=[T,T]}),y}function cc(h,_,y){for(var T=y-1,D=h.length;++T<D;)if(h[T]===_)return T;return-1}function fc(h,_,y){for(var T=y+1;T--;)if(h[T]===_)return T;return T}function an(h){return sn(h)?dc(h):Yu(h)}function rt(h){return sn(h)?hc(h):Xu(h)}function ha(h){for(var _=h.length;_--&&nu.test(h.charAt(_)););return _}var pc=_i(ju);function dc(h){for(var _=pi.lastIndex=0;pi.test(h);)++_;return _}function hc(h){return h.match(pi)||[]}function gc(h){return h.match(Nu)||[]}var mc=function h(_){_=_==null?ge:on.defaults(ge.Object(),_,on.pick(ge,$u));var y=_.Array,T=_.Date,D=_.Error,Z=_.Function,fe=_.Math,te=_.Object,Ii=_.RegExp,vc=_.String,Ge=_.TypeError,or=y.prototype,yc=Z.prototype,ln=te.prototype,lr=_["__core-js_shared__"],ur=yc.toString,ee=ln.hasOwnProperty,_c=0,ga=function(){var e=/[^.]+$/.exec(lr&&lr.keys&&lr.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),cr=ln.toString,wc=ur.call(te),xc=ge._,Ac=Ii("^"+ur.call(ee).replace(ai,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),fr=Zs?_.Buffer:r,Nt=_.Symbol,pr=_.Uint8Array,ma=fr?fr.allocUnsafe:r,dr=da(te.getPrototypeOf,te),va=te.create,ya=ln.propertyIsEnumerable,hr=or.splice,_a=Nt?Nt.isConcatSpreadable:r,Rn=Nt?Nt.iterator:r,Gt=Nt?Nt.toStringTag:r,gr=function(){try{var e=Yt(te,"defineProperty");return e({},"",{}),e}catch{}}(),Sc=_.clearTimeout!==ge.clearTimeout&&_.clearTimeout,Ic=T&&T.now!==ge.Date.now&&T.now,Tc=_.setTimeout!==ge.setTimeout&&_.setTimeout,mr=fe.ceil,vr=fe.floor,Ti=te.getOwnPropertySymbols,Ec=fr?fr.isBuffer:r,wa=_.isFinite,Fc=or.join,Cc=da(te.keys,te),pe=fe.max,ve=fe.min,Pc=T.now,bc=_.parseInt,xa=fe.random,Rc=or.reverse,Ei=Yt(_,"DataView"),kn=Yt(_,"Map"),Fi=Yt(_,"Promise"),un=Yt(_,"Set"),On=Yt(_,"WeakMap"),Ln=Yt(te,"create"),yr=On&&new On,cn={},kc=Xt(Ei),Oc=Xt(kn),Lc=Xt(Fi),Nc=Xt(un),Uc=Xt(On),_r=Nt?Nt.prototype:r,Nn=_r?_r.valueOf:r,Aa=_r?_r.toString:r;function u(e){if(le(e)&&!$(e)&&!(e instanceof z)){if(e instanceof ze)return e;if(ee.call(e,"__wrapped__"))return Io(e)}return new ze(e)}var fn=function(){function e(){}return function(t){if(!ae(t))return{};if(va)return va(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function wr(){}function ze(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}u.templateSettings={escape:Yl,evaluate:Xl,interpolate:Rs,variable:"",imports:{_:u}},u.prototype=wr.prototype,u.prototype.constructor=u,ze.prototype=fn(wr.prototype),ze.prototype.constructor=ze;function z(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=de,this.__views__=[]}function Dc(){var e=new z(this.__wrapped__);return e.__actions__=Ee(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ee(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ee(this.__views__),e}function $c(){if(this.__filtered__){var e=new z(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function Wc(){var e=this.__wrapped__.value(),t=this.__dir__,n=$(e),i=t<0,a=n?e.length:0,c=Zf(0,a,this.__views__),p=c.start,d=c.end,g=d-p,w=i?d:p-1,x=this.__iteratees__,A=x.length,I=0,F=ve(g,this.__takeCount__);if(!n||!i&&a==g&&F==g)return za(e,this.__actions__);var O=[];e:for(;g--&&I<F;){w+=t;for(var B=-1,L=e[w];++B<A;){var H=x[B],J=H.iteratee,Le=H.type,Ae=J(L);if(Le==Yn)L=Ae;else if(!Ae){if(Le==oe)continue e;break e}}O[I++]=L}return O}z.prototype=fn(wr.prototype),z.prototype.constructor=z;function zt(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 Mc(){this.__data__=Ln?Ln(null):{},this.size=0}function Bc(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function jc(e){var t=this.__data__;if(Ln){var n=t[e];return n===C?r:n}return ee.call(t,e)?t[e]:r}function qc(e){var t=this.__data__;return Ln?t[e]!==r:ee.call(t,e)}function Hc(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ln&&t===r?C:t,this}zt.prototype.clear=Mc,zt.prototype.delete=Bc,zt.prototype.get=jc,zt.prototype.has=qc,zt.prototype.set=Hc;function vt(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 Gc(){this.__data__=[],this.size=0}function zc(e){var t=this.__data__,n=xr(t,e);if(n<0)return!1;var i=t.length-1;return n==i?t.pop():hr.call(t,n,1),--this.size,!0}function Jc(e){var t=this.__data__,n=xr(t,e);return n<0?r:t[n][1]}function Kc(e){return xr(this.__data__,e)>-1}function Vc(e,t){var n=this.__data__,i=xr(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}vt.prototype.clear=Gc,vt.prototype.delete=zc,vt.prototype.get=Jc,vt.prototype.has=Kc,vt.prototype.set=Vc;function yt(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 Yc(){this.size=0,this.__data__={hash:new zt,map:new(kn||vt),string:new zt}}function Xc(e){var t=Or(this,e).delete(e);return this.size-=t?1:0,t}function Zc(e){return Or(this,e).get(e)}function Qc(e){return Or(this,e).has(e)}function ef(e,t){var n=Or(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}yt.prototype.clear=Yc,yt.prototype.delete=Xc,yt.prototype.get=Zc,yt.prototype.has=Qc,yt.prototype.set=ef;function Jt(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new yt;++t<n;)this.add(e[t])}function tf(e){return this.__data__.set(e,C),this}function nf(e){return this.__data__.has(e)}Jt.prototype.add=Jt.prototype.push=tf,Jt.prototype.has=nf;function it(e){var t=this.__data__=new vt(e);this.size=t.size}function rf(){this.__data__=new vt,this.size=0}function sf(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function af(e){return this.__data__.get(e)}function of(e){return this.__data__.has(e)}function lf(e,t){var n=this.__data__;if(n instanceof vt){var i=n.__data__;if(!kn||i.length<f-1)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new yt(i)}return n.set(e,t),this.size=n.size,this}it.prototype.clear=rf,it.prototype.delete=sf,it.prototype.get=af,it.prototype.has=of,it.prototype.set=lf;function Sa(e,t){var n=$(e),i=!n&&Zt(e),a=!n&&!i&&Mt(e),c=!n&&!i&&!a&&gn(e),p=n||i||a||c,d=p?xi(e.length,vc):[],g=d.length;for(var w in e)(t||ee.call(e,w))&&!(p&&(w=="length"||a&&(w=="offset"||w=="parent")||c&&(w=="buffer"||w=="byteLength"||w=="byteOffset")||At(w,g)))&&d.push(w);return d}function Ia(e){var t=e.length;return t?e[$i(0,t-1)]:r}function uf(e,t){return Lr(Ee(e),Kt(t,0,e.length))}function cf(e){return Lr(Ee(e))}function Ci(e,t,n){(n!==r&&!st(e[t],n)||n===r&&!(t in e))&&_t(e,t,n)}function Un(e,t,n){var i=e[t];(!(ee.call(e,t)&&st(i,n))||n===r&&!(t in e))&&_t(e,t,n)}function xr(e,t){for(var n=e.length;n--;)if(st(e[n][0],t))return n;return-1}function ff(e,t,n,i){return Ut(e,function(a,c,p){t(i,a,n(a),p)}),i}function Ta(e,t){return e&&ft(t,he(t),e)}function pf(e,t){return e&&ft(t,Ce(t),e)}function _t(e,t,n){t=="__proto__"&&gr?gr(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Pi(e,t){for(var n=-1,i=t.length,a=y(i),c=e==null;++n<i;)a[n]=c?r:us(e,t[n]);return a}function Kt(e,t,n){return e===e&&(n!==r&&(e=e<=n?e:n),t!==r&&(e=e>=t?e:t)),e}function Je(e,t,n,i,a,c){var p,d=t&X,g=t&U,w=t&V;if(n&&(p=a?n(e,i,a,c):n(e)),p!==r)return p;if(!ae(e))return e;var x=$(e);if(x){if(p=ep(e),!d)return Ee(e,p)}else{var A=ye(e),I=A==Qn||A==Fs;if(Mt(e))return Va(e,d);if(A==mt||A==en||I&&!a){if(p=g||I?{}:go(e),!d)return g?qf(e,pf(p,e)):jf(e,Ta(p,e))}else{if(!re[A])return a?e:{};p=tp(e,A,d)}}c||(c=new it);var F=c.get(e);if(F)return F;c.set(e,p),Ho(e)?e.forEach(function(L){p.add(Je(L,t,n,L,e,c))}):jo(e)&&e.forEach(function(L,H){p.set(H,Je(L,t,n,H,e,c))});var O=w?g?Vi:Ki:g?Ce:he,B=x?r:O(e);return He(B||e,function(L,H){B&&(H=L,L=e[H]),Un(p,H,Je(L,t,n,H,e,c))}),p}function df(e){var t=he(e);return function(n){return Ea(n,e,t)}}function Ea(e,t,n){var i=n.length;if(e==null)return!i;for(e=te(e);i--;){var a=n[i],c=t[a],p=e[a];if(p===r&&!(a in e)||!c(p))return!1}return!0}function Fa(e,t,n){if(typeof e!="function")throw new Ge(v);return qn(function(){e.apply(r,n)},t)}function Dn(e,t,n,i){var a=-1,c=ir,p=!0,d=e.length,g=[],w=t.length;if(!d)return g;n&&(t=se(t,Re(n))),i?(c=gi,p=!1):t.length>=f&&(c=bn,p=!1,t=new Jt(t));e:for(;++a<d;){var x=e[a],A=n==null?x:n(x);if(x=i||x!==0?x:0,p&&A===A){for(var I=w;I--;)if(t[I]===A)continue e;g.push(x)}else c(t,A,i)||g.push(x)}return g}var Ut=eo(ct),Ca=eo(Ri,!0);function hf(e,t){var n=!0;return Ut(e,function(i,a,c){return n=!!t(i,a,c),n}),n}function Ar(e,t,n){for(var i=-1,a=e.length;++i<a;){var c=e[i],p=t(c);if(p!=null&&(d===r?p===p&&!Oe(p):n(p,d)))var d=p,g=c}return g}function gf(e,t,n,i){var a=e.length;for(n=W(n),n<0&&(n=-n>a?0:a+n),i=i===r||i>a?a:W(i),i<0&&(i+=a),i=n>i?0:zo(i);n<i;)e[n++]=t;return e}function Pa(e,t){var n=[];return Ut(e,function(i,a,c){t(i,a,c)&&n.push(i)}),n}function me(e,t,n,i,a){var c=-1,p=e.length;for(n||(n=rp),a||(a=[]);++c<p;){var d=e[c];t>0&&n(d)?t>1?me(d,t-1,n,i,a):Ot(a,d):i||(a[a.length]=d)}return a}var bi=to(),ba=to(!0);function ct(e,t){return e&&bi(e,t,he)}function Ri(e,t){return e&&ba(e,t,he)}function Sr(e,t){return kt(t,function(n){return St(e[n])})}function Vt(e,t){t=$t(t,e);for(var n=0,i=t.length;e!=null&&n<i;)e=e[pt(t[n++])];return n&&n==i?e:r}function Ra(e,t,n){var i=t(e);return $(e)?i:Ot(i,n(e))}function we(e){return e==null?e===r?ql:Bl:Gt&&Gt in te(e)?Xf(e):cp(e)}function ki(e,t){return e>t}function mf(e,t){return e!=null&&ee.call(e,t)}function vf(e,t){return e!=null&&t in te(e)}function yf(e,t,n){return e>=ve(t,n)&&e<pe(t,n)}function Oi(e,t,n){for(var i=n?gi:ir,a=e[0].length,c=e.length,p=c,d=y(c),g=1/0,w=[];p--;){var x=e[p];p&&t&&(x=se(x,Re(t))),g=ve(x.length,g),d[p]=!n&&(t||a>=120&&x.length>=120)?new Jt(p&&x):r}x=e[0];var A=-1,I=d[0];e:for(;++A<a&&w.length<g;){var F=x[A],O=t?t(F):F;if(F=n||F!==0?F:0,!(I?bn(I,O):i(w,O,n))){for(p=c;--p;){var B=d[p];if(!(B?bn(B,O):i(e[p],O,n)))continue e}I&&I.push(O),w.push(F)}}return w}function _f(e,t,n,i){return ct(e,function(a,c,p){t(i,n(a),c,p)}),i}function $n(e,t,n){t=$t(t,e),e=_o(e,t);var i=e==null?e:e[pt(Ve(t))];return i==null?r:be(i,e,n)}function ka(e){return le(e)&&we(e)==en}function wf(e){return le(e)&&we(e)==Pn}function xf(e){return le(e)&&we(e)==In}function Wn(e,t,n,i,a){return e===t?!0:e==null||t==null||!le(e)&&!le(t)?e!==e&&t!==t:Af(e,t,n,i,Wn,a)}function Af(e,t,n,i,a,c){var p=$(e),d=$(t),g=p?Xn:ye(e),w=d?Xn:ye(t);g=g==en?mt:g,w=w==en?mt:w;var x=g==mt,A=w==mt,I=g==w;if(I&&Mt(e)){if(!Mt(t))return!1;p=!0,x=!1}if(I&&!x)return c||(c=new it),p||gn(e)?fo(e,t,n,i,a,c):Vf(e,t,g,n,i,a,c);if(!(n&ne)){var F=x&&ee.call(e,"__wrapped__"),O=A&&ee.call(t,"__wrapped__");if(F||O){var B=F?e.value():e,L=O?t.value():t;return c||(c=new it),a(B,L,n,i,c)}}return I?(c||(c=new it),Yf(e,t,n,i,a,c)):!1}function Sf(e){return le(e)&&ye(e)==tt}function Li(e,t,n,i){var a=n.length,c=a,p=!i;if(e==null)return!c;for(e=te(e);a--;){var d=n[a];if(p&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}for(;++a<c;){d=n[a];var g=d[0],w=e[g],x=d[1];if(p&&d[2]){if(w===r&&!(g in e))return!1}else{var A=new it;if(i)var I=i(w,x,g,e,t,A);if(!(I===r?Wn(x,w,ne|De,i,A):I))return!1}}return!0}function Oa(e){if(!ae(e)||sp(e))return!1;var t=St(e)?Ac:pu;return t.test(Xt(e))}function If(e){return le(e)&&we(e)==En}function Tf(e){return le(e)&&ye(e)==nt}function Ef(e){return le(e)&&Mr(e.length)&&!!ie[we(e)]}function La(e){return typeof e=="function"?e:e==null?Pe:typeof e=="object"?$(e)?Da(e[0],e[1]):Ua(e):rl(e)}function Ni(e){if(!jn(e))return Cc(e);var t=[];for(var n in te(e))ee.call(e,n)&&n!="constructor"&&t.push(n);return t}function Ff(e){if(!ae(e))return up(e);var t=jn(e),n=[];for(var i in e)i=="constructor"&&(t||!ee.call(e,i))||n.push(i);return n}function Ui(e,t){return e<t}function Na(e,t){var n=-1,i=Fe(e)?y(e.length):[];return Ut(e,function(a,c,p){i[++n]=t(a,c,p)}),i}function Ua(e){var t=Xi(e);return t.length==1&&t[0][2]?vo(t[0][0],t[0][1]):function(n){return n===e||Li(n,e,t)}}function Da(e,t){return Qi(e)&&mo(t)?vo(pt(e),t):function(n){var i=us(n,e);return i===r&&i===t?cs(n,e):Wn(t,i,ne|De)}}function Ir(e,t,n,i,a){e!==t&&bi(t,function(c,p){if(a||(a=new it),ae(c))Cf(e,t,p,n,Ir,i,a);else{var d=i?i(ts(e,p),c,p+"",e,t,a):r;d===r&&(d=c),Ci(e,p,d)}},Ce)}function Cf(e,t,n,i,a,c,p){var d=ts(e,n),g=ts(t,n),w=p.get(g);if(w){Ci(e,n,w);return}var x=c?c(d,g,n+"",e,t,p):r,A=x===r;if(A){var I=$(g),F=!I&&Mt(g),O=!I&&!F&&gn(g);x=g,I||F||O?$(d)?x=d:ue(d)?x=Ee(d):F?(A=!1,x=Va(g,!0)):O?(A=!1,x=Ya(g,!0)):x=[]:Hn(g)||Zt(g)?(x=d,Zt(d)?x=Jo(d):(!ae(d)||St(d))&&(x=go(g))):A=!1}A&&(p.set(g,x),a(x,g,i,c,p),p.delete(g)),Ci(e,n,x)}function $a(e,t){var n=e.length;if(n)return t+=t<0?n:0,At(t,n)?e[t]:r}function Wa(e,t,n){t.length?t=se(t,function(c){return $(c)?function(p){return Vt(p,c.length===1?c[0]:c)}:c}):t=[Pe];var i=-1;t=se(t,Re(b()));var a=Na(e,function(c,p,d){var g=se(t,function(w){return w(c)});return{criteria:g,index:++i,value:c}});return ec(a,function(c,p){return Bf(c,p,n)})}function Pf(e,t){return Ma(e,t,function(n,i){return cs(e,i)})}function Ma(e,t,n){for(var i=-1,a=t.length,c={};++i<a;){var p=t[i],d=Vt(e,p);n(d,p)&&Mn(c,$t(p,e),d)}return c}function bf(e){return function(t){return Vt(t,e)}}function Di(e,t,n,i){var a=i?Qu:rn,c=-1,p=t.length,d=e;for(e===t&&(t=Ee(t)),n&&(d=se(e,Re(n)));++c<p;)for(var g=0,w=t[c],x=n?n(w):w;(g=a(d,x,g,i))>-1;)d!==e&&hr.call(d,g,1),hr.call(e,g,1);return e}function Ba(e,t){for(var n=e?t.length:0,i=n-1;n--;){var a=t[n];if(n==i||a!==c){var c=a;At(a)?hr.call(e,a,1):Bi(e,a)}}return e}function $i(e,t){return e+vr(xa()*(t-e+1))}function Rf(e,t,n,i){for(var a=-1,c=pe(mr((t-e)/(n||1)),0),p=y(c);c--;)p[i?c:++a]=e,e+=n;return p}function Wi(e,t){var n="";if(!e||t<1||t>gt)return n;do t%2&&(n+=e),t=vr(t/2),t&&(e+=e);while(t);return n}function j(e,t){return ns(yo(e,t,Pe),e+"")}function kf(e){return Ia(mn(e))}function Of(e,t){var n=mn(e);return Lr(n,Kt(t,0,n.length))}function Mn(e,t,n,i){if(!ae(e))return e;t=$t(t,e);for(var a=-1,c=t.length,p=c-1,d=e;d!=null&&++a<c;){var g=pt(t[a]),w=n;if(g==="__proto__"||g==="constructor"||g==="prototype")return e;if(a!=p){var x=d[g];w=i?i(x,g,d):r,w===r&&(w=ae(x)?x:At(t[a+1])?[]:{})}Un(d,g,w),d=d[g]}return e}var ja=yr?function(e,t){return yr.set(e,t),e}:Pe,Lf=gr?function(e,t){return gr(e,"toString",{configurable:!0,enumerable:!1,value:ps(t),writable:!0})}:Pe;function Nf(e){return Lr(mn(e))}function Ke(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 c=y(a);++i<a;)c[i]=e[i+t];return c}function Uf(e,t){var n;return Ut(e,function(i,a,c){return n=t(i,a,c),!n}),!!n}function Tr(e,t,n){var i=0,a=e==null?i:e.length;if(typeof t=="number"&&t===t&&a<=qt){for(;i<a;){var c=i+a>>>1,p=e[c];p!==null&&!Oe(p)&&(n?p<=t:p<t)?i=c+1:a=c}return a}return Mi(e,t,Pe,n)}function Mi(e,t,n,i){var a=0,c=e==null?0:e.length;if(c===0)return 0;t=n(t);for(var p=t!==t,d=t===null,g=Oe(t),w=t===r;a<c;){var x=vr((a+c)/2),A=n(e[x]),I=A!==r,F=A===null,O=A===A,B=Oe(A);if(p)var L=i||O;else w?L=O&&(i||I):d?L=O&&I&&(i||!F):g?L=O&&I&&!F&&(i||!B):F||B?L=!1:L=i?A<=t:A<t;L?a=x+1:c=x}return ve(c,ut)}function qa(e,t){for(var n=-1,i=e.length,a=0,c=[];++n<i;){var p=e[n],d=t?t(p):p;if(!n||!st(d,g)){var g=d;c[a++]=p===0?0:p}}return c}function Ha(e){return typeof e=="number"?e:Oe(e)?Te:+e}function ke(e){if(typeof e=="string")return e;if($(e))return se(e,ke)+"";if(Oe(e))return Aa?Aa.call(e):"";var t=e+"";return t=="0"&&1/e==-je?"-0":t}function Dt(e,t,n){var i=-1,a=ir,c=e.length,p=!0,d=[],g=d;if(n)p=!1,a=gi;else if(c>=f){var w=t?null:Jf(e);if(w)return ar(w);p=!1,a=bn,g=new Jt}else g=t?[]:d;e:for(;++i<c;){var x=e[i],A=t?t(x):x;if(x=n||x!==0?x:0,p&&A===A){for(var I=g.length;I--;)if(g[I]===A)continue e;t&&g.push(A),d.push(x)}else a(g,A,n)||(g!==d&&g.push(A),d.push(x))}return d}function Bi(e,t){return t=$t(t,e),e=_o(e,t),e==null||delete e[pt(Ve(t))]}function Ga(e,t,n,i){return Mn(e,t,n(Vt(e,t)),i)}function Er(e,t,n,i){for(var a=e.length,c=i?a:-1;(i?c--:++c<a)&&t(e[c],c,e););return n?Ke(e,i?0:c,i?c+1:a):Ke(e,i?c+1:0,i?a:c)}function za(e,t){var n=e;return n instanceof z&&(n=n.value()),mi(t,function(i,a){return a.func.apply(a.thisArg,Ot([i],a.args))},n)}function ji(e,t,n){var i=e.length;if(i<2)return i?Dt(e[0]):[];for(var a=-1,c=y(i);++a<i;)for(var p=e[a],d=-1;++d<i;)d!=a&&(c[a]=Dn(c[a]||p,e[d],t,n));return Dt(me(c,1),t,n)}function Ja(e,t,n){for(var i=-1,a=e.length,c=t.length,p={};++i<a;){var d=i<c?t[i]:r;n(p,e[i],d)}return p}function qi(e){return ue(e)?e:[]}function Hi(e){return typeof e=="function"?e:Pe}function $t(e,t){return $(e)?e:Qi(e,t)?[e]:So(Q(e))}var Df=j;function Wt(e,t,n){var i=e.length;return n=n===r?i:n,!t&&n>=i?e:Ke(e,t,n)}var Ka=Sc||function(e){return ge.clearTimeout(e)};function Va(e,t){if(t)return e.slice();var n=e.length,i=ma?ma(n):new e.constructor(n);return e.copy(i),i}function Gi(e){var t=new e.constructor(e.byteLength);return new pr(t).set(new pr(e)),t}function $f(e,t){var n=t?Gi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Wf(e){var t=new e.constructor(e.source,ks.exec(e));return t.lastIndex=e.lastIndex,t}function Mf(e){return Nn?te(Nn.call(e)):{}}function Ya(e,t){var n=t?Gi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Xa(e,t){if(e!==t){var n=e!==r,i=e===null,a=e===e,c=Oe(e),p=t!==r,d=t===null,g=t===t,w=Oe(t);if(!d&&!w&&!c&&e>t||c&&p&&g&&!d&&!w||i&&p&&g||!n&&g||!a)return 1;if(!i&&!c&&!w&&e<t||w&&n&&a&&!i&&!c||d&&n&&a||!p&&a||!g)return-1}return 0}function Bf(e,t,n){for(var i=-1,a=e.criteria,c=t.criteria,p=a.length,d=n.length;++i<p;){var g=Xa(a[i],c[i]);if(g){if(i>=d)return g;var w=n[i];return g*(w=="desc"?-1:1)}}return e.index-t.index}function Za(e,t,n,i){for(var a=-1,c=e.length,p=n.length,d=-1,g=t.length,w=pe(c-p,0),x=y(g+w),A=!i;++d<g;)x[d]=t[d];for(;++a<p;)(A||a<c)&&(x[n[a]]=e[a]);for(;w--;)x[d++]=e[a++];return x}function Qa(e,t,n,i){for(var a=-1,c=e.length,p=-1,d=n.length,g=-1,w=t.length,x=pe(c-d,0),A=y(x+w),I=!i;++a<x;)A[a]=e[a];for(var F=a;++g<w;)A[F+g]=t[g];for(;++p<d;)(I||a<c)&&(A[F+n[p]]=e[a++]);return A}function Ee(e,t){var n=-1,i=e.length;for(t||(t=y(i));++n<i;)t[n]=e[n];return t}function ft(e,t,n,i){var a=!n;n||(n={});for(var c=-1,p=t.length;++c<p;){var d=t[c],g=i?i(n[d],e[d],d,n,e):r;g===r&&(g=e[d]),a?_t(n,d,g):Un(n,d,g)}return n}function jf(e,t){return ft(e,Zi(e),t)}function qf(e,t){return ft(e,po(e),t)}function Fr(e,t){return function(n,i){var a=$(n)?Ju:ff,c=t?t():{};return a(n,e,b(i,2),c)}}function pn(e){return j(function(t,n){var i=-1,a=n.length,c=a>1?n[a-1]:r,p=a>2?n[2]:r;for(c=e.length>3&&typeof c=="function"?(a--,c):r,p&&xe(n[0],n[1],p)&&(c=a<3?r:c,a=1),t=te(t);++i<a;){var d=n[i];d&&e(t,d,i,c)}return t})}function eo(e,t){return function(n,i){if(n==null)return n;if(!Fe(n))return e(n,i);for(var a=n.length,c=t?a:-1,p=te(n);(t?c--:++c<a)&&i(p[c],c,p)!==!1;);return n}}function to(e){return function(t,n,i){for(var a=-1,c=te(t),p=i(t),d=p.length;d--;){var g=p[e?d:++a];if(n(c[g],g,c)===!1)break}return t}}function Hf(e,t,n){var i=t&Ie,a=Bn(e);function c(){var p=this&&this!==ge&&this instanceof c?a:e;return p.apply(i?n:this,arguments)}return c}function no(e){return function(t){t=Q(t);var n=sn(t)?rt(t):r,i=n?n[0]:t.charAt(0),a=n?Wt(n,1).join(""):t.slice(1);return i[e]()+a}}function dn(e){return function(t){return mi(tl(el(t).replace(Ou,"")),e,"")}}function Bn(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=fn(e.prototype),i=e.apply(n,t);return ae(i)?i:n}}function Gf(e,t,n){var i=Bn(e);function a(){for(var c=arguments.length,p=y(c),d=c,g=hn(a);d--;)p[d]=arguments[d];var w=c<3&&p[0]!==g&&p[c-1]!==g?[]:Lt(p,g);if(c-=w.length,c<n)return oo(e,t,Cr,a.placeholder,r,p,w,r,r,n-c);var x=this&&this!==ge&&this instanceof a?i:e;return be(x,this,p)}return a}function ro(e){return function(t,n,i){var a=te(t);if(!Fe(t)){var c=b(n,3);t=he(t),n=function(d){return c(a[d],d,a)}}var p=e(t,n,i);return p>-1?a[c?t[p]:p]:r}}function io(e){return xt(function(t){var n=t.length,i=n,a=ze.prototype.thru;for(e&&t.reverse();i--;){var c=t[i];if(typeof c!="function")throw new Ge(v);if(a&&!p&&kr(c)=="wrapper")var p=new ze([],!0)}for(i=p?i:n;++i<n;){c=t[i];var d=kr(c),g=d=="wrapper"?Yi(c):r;g&&es(g[0])&&g[1]==(Me|$e|We|Rt)&&!g[4].length&&g[9]==1?p=p[kr(g[0])].apply(p,g[3]):p=c.length==1&&es(c)?p[d]():p.thru(c)}return function(){var w=arguments,x=w[0];if(p&&w.length==1&&$(x))return p.plant(x).value();for(var A=0,I=n?t[A].apply(this,w):x;++A<n;)I=t[A].call(this,I);return I}})}function Cr(e,t,n,i,a,c,p,d,g,w){var x=t&Me,A=t&Ie,I=t&ht,F=t&($e|Pt),O=t&Qt,B=I?r:Bn(e);function L(){for(var H=arguments.length,J=y(H),Le=H;Le--;)J[Le]=arguments[Le];if(F)var Ae=hn(L),Ne=nc(J,Ae);if(i&&(J=Za(J,i,a,F)),c&&(J=Qa(J,c,p,F)),H-=Ne,F&&H<w){var ce=Lt(J,Ae);return oo(e,t,Cr,L.placeholder,n,J,ce,d,g,w-H)}var at=A?n:this,Tt=I?at[e]:e;return H=J.length,d?J=fp(J,d):O&&H>1&&J.reverse(),x&&g<H&&(J.length=g),this&&this!==ge&&this instanceof L&&(Tt=B||Bn(Tt)),Tt.apply(at,J)}return L}function so(e,t){return function(n,i){return _f(n,e,t(i),{})}}function Pr(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=ke(n),i=ke(i)):(n=Ha(n),i=Ha(i)),a=e(n,i)}return a}}function zi(e){return xt(function(t){return t=se(t,Re(b())),j(function(n){var i=this;return e(t,function(a){return be(a,i,n)})})})}function br(e,t){t=t===r?" ":ke(t);var n=t.length;if(n<2)return n?Wi(t,e):t;var i=Wi(t,mr(e/an(t)));return sn(t)?Wt(rt(i),0,e).join(""):i.slice(0,e)}function zf(e,t,n,i){var a=t&Ie,c=Bn(e);function p(){for(var d=-1,g=arguments.length,w=-1,x=i.length,A=y(x+g),I=this&&this!==ge&&this instanceof p?c:e;++w<x;)A[w]=i[w];for(;g--;)A[w++]=arguments[++d];return be(I,a?n:this,A)}return p}function ao(e){return function(t,n,i){return i&&typeof i!="number"&&xe(t,n,i)&&(n=i=r),t=It(t),n===r?(n=t,t=0):n=It(n),i=i===r?t<n?1:-1:It(i),Rf(t,n,i,e)}}function Rr(e){return function(t,n){return typeof t=="string"&&typeof n=="string"||(t=Ye(t),n=Ye(n)),e(t,n)}}function oo(e,t,n,i,a,c,p,d,g,w){var x=t&$e,A=x?p:r,I=x?r:p,F=x?c:r,O=x?r:c;t|=x?We:bt,t&=~(x?bt:We),t&xn||(t&=-4);var B=[e,t,a,F,A,O,I,d,g,w],L=n.apply(r,B);return es(e)&&wo(L,B),L.placeholder=i,xo(L,e,t)}function Ji(e){var t=fe[e];return function(n,i){if(n=Ye(n),i=i==null?0:ve(W(i),292),i&&wa(n)){var a=(Q(n)+"e").split("e"),c=t(a[0]+"e"+(+a[1]+i));return a=(Q(c)+"e").split("e"),+(a[0]+"e"+(+a[1]-i))}return t(n)}}var Jf=un&&1/ar(new un([,-0]))[1]==je?function(e){return new un(e)}:gs;function lo(e){return function(t){var n=ye(t);return n==tt?Si(t):n==nt?uc(t):tc(t,e(t))}}function wt(e,t,n,i,a,c,p,d){var g=t&ht;if(!g&&typeof e!="function")throw new Ge(v);var w=i?i.length:0;if(w||(t&=-97,i=a=r),p=p===r?p:pe(W(p),0),d=d===r?d:W(d),w-=a?a.length:0,t&bt){var x=i,A=a;i=a=r}var I=g?r:Yi(e),F=[e,t,n,i,a,x,A,c,p,d];if(I&&lp(F,I),e=F[0],t=F[1],n=F[2],i=F[3],a=F[4],d=F[9]=F[9]===r?g?0:e.length:pe(F[9]-w,0),!d&&t&($e|Pt)&&(t&=-25),!t||t==Ie)var O=Hf(e,t,n);else t==$e||t==Pt?O=Gf(e,t,d):(t==We||t==(Ie|We))&&!a.length?O=zf(e,t,n,i):O=Cr.apply(r,F);var B=I?ja:wo;return xo(B(O,F),e,t)}function uo(e,t,n,i){return e===r||st(e,ln[n])&&!ee.call(i,n)?t:e}function co(e,t,n,i,a,c){return ae(e)&&ae(t)&&(c.set(t,e),Ir(e,t,r,co,c),c.delete(t)),e}function Kf(e){return Hn(e)?r:e}function fo(e,t,n,i,a,c){var p=n&ne,d=e.length,g=t.length;if(d!=g&&!(p&&g>d))return!1;var w=c.get(e),x=c.get(t);if(w&&x)return w==t&&x==e;var A=-1,I=!0,F=n&De?new Jt:r;for(c.set(e,t),c.set(t,e);++A<d;){var O=e[A],B=t[A];if(i)var L=p?i(B,O,A,t,e,c):i(O,B,A,e,t,c);if(L!==r){if(L)continue;I=!1;break}if(F){if(!vi(t,function(H,J){if(!bn(F,J)&&(O===H||a(O,H,n,i,c)))return F.push(J)})){I=!1;break}}else if(!(O===B||a(O,B,n,i,c))){I=!1;break}}return c.delete(e),c.delete(t),I}function Vf(e,t,n,i,a,c,p){switch(n){case tn:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Pn:return!(e.byteLength!=t.byteLength||!c(new pr(e),new pr(t)));case Sn:case In:case Tn:return st(+e,+t);case Zn:return e.name==t.name&&e.message==t.message;case En:case Fn:return e==t+"";case tt:var d=Si;case nt:var g=i≠if(d||(d=ar),e.size!=t.size&&!g)return!1;var w=p.get(e);if(w)return w==t;i|=De,p.set(e,t);var x=fo(d(e),d(t),i,a,c,p);return p.delete(e),x;case er:if(Nn)return Nn.call(e)==Nn.call(t)}return!1}function Yf(e,t,n,i,a,c){var p=n&ne,d=Ki(e),g=d.length,w=Ki(t),x=w.length;if(g!=x&&!p)return!1;for(var A=g;A--;){var I=d[A];if(!(p?I in t:ee.call(t,I)))return!1}var F=c.get(e),O=c.get(t);if(F&&O)return F==t&&O==e;var B=!0;c.set(e,t),c.set(t,e);for(var L=p;++A<g;){I=d[A];var H=e[I],J=t[I];if(i)var Le=p?i(J,H,I,t,e,c):i(H,J,I,e,t,c);if(!(Le===r?H===J||a(H,J,n,i,c):Le)){B=!1;break}L||(L=I=="constructor")}if(B&&!L){var Ae=e.constructor,Ne=t.constructor;Ae!=Ne&&"constructor"in e&&"constructor"in t&&!(typeof Ae=="function"&&Ae instanceof Ae&&typeof Ne=="function"&&Ne instanceof Ne)&&(B=!1)}return c.delete(e),c.delete(t),B}function xt(e){return ns(yo(e,r,Fo),e+"")}function Ki(e){return Ra(e,he,Zi)}function Vi(e){return Ra(e,Ce,po)}var Yi=yr?function(e){return yr.get(e)}:gs;function kr(e){for(var t=e.name+"",n=cn[t],i=ee.call(cn,t)?n.length:0;i--;){var a=n[i],c=a.func;if(c==null||c==e)return a.name}return t}function hn(e){var t=ee.call(u,"placeholder")?u:e;return t.placeholder}function b(){var e=u.iteratee||ds;return e=e===ds?La:e,arguments.length?e(arguments[0],arguments[1]):e}function Or(e,t){var n=e.__data__;return ip(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Xi(e){for(var t=he(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,mo(a)]}return t}function Yt(e,t){var n=ac(e,t);return Oa(n)?n:r}function Xf(e){var t=ee.call(e,Gt),n=e[Gt];try{e[Gt]=r;var i=!0}catch{}var a=cr.call(e);return i&&(t?e[Gt]=n:delete e[Gt]),a}var Zi=Ti?function(e){return e==null?[]:(e=te(e),kt(Ti(e),function(t){return ya.call(e,t)}))}:ms,po=Ti?function(e){for(var t=[];e;)Ot(t,Zi(e)),e=dr(e);return t}:ms,ye=we;(Ei&&ye(new Ei(new ArrayBuffer(1)))!=tn||kn&&ye(new kn)!=tt||Fi&&ye(Fi.resolve())!=Cs||un&&ye(new un)!=nt||On&&ye(new On)!=Cn)&&(ye=function(e){var t=we(e),n=t==mt?e.constructor:r,i=n?Xt(n):"";if(i)switch(i){case kc:return tn;case Oc:return tt;case Lc:return Cs;case Nc:return nt;case Uc:return Cn}return t});function Zf(e,t,n){for(var i=-1,a=n.length;++i<a;){var c=n[i],p=c.size;switch(c.type){case"drop":e+=p;break;case"dropRight":t-=p;break;case"take":t=ve(t,e+p);break;case"takeRight":e=pe(e,t-p);break}}return{start:e,end:t}}function Qf(e){var t=e.match(iu);return t?t[1].split(su):[]}function ho(e,t,n){t=$t(t,e);for(var i=-1,a=t.length,c=!1;++i<a;){var p=pt(t[i]);if(!(c=e!=null&&n(e,p)))break;e=e[p]}return c||++i!=a?c:(a=e==null?0:e.length,!!a&&Mr(a)&&At(p,a)&&($(e)||Zt(e)))}function ep(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&ee.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function go(e){return typeof e.constructor=="function"&&!jn(e)?fn(dr(e)):{}}function tp(e,t,n){var i=e.constructor;switch(t){case Pn:return Gi(e);case Sn:case In:return new i(+e);case tn:return $f(e,n);case Xr:case Zr:case Qr:case ei:case ti:case ni:case ri:case ii:case si:return Ya(e,n);case tt:return new i;case Tn:case Fn:return new i(e);case En:return Wf(e);case nt:return new i;case er:return Mf(e)}}function np(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(ru,`{
|
|
805
|
+
*/var Hy=Jn.exports,vl;function Gy(){return vl||(vl=1,function(l,s){(function(){var r,o="4.17.21",f=200,m="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",v="Expected a function",E="Invalid `variable` option passed into `_.template`",C="__lodash_hash_undefined__",M=500,j="__lodash_placeholder__",X=1,U=2,V=4,ne=1,De=2,Se=1,ht=2,xn=4,$e=8,Rt=16,We=32,Pt=64,Me=128,bt=256,Qt=512,Vn=30,Yr="...",Ts=800,Es=16,oe=1,Yn=2,Be=3,qe=1/0,gt=9007199254740991,G=17976931348623157e292,Te=NaN,de=4294967295,ct=de-1,jt=de>>>1,In=[["ary",Me],["bind",Se],["bindKey",ht],["curry",$e],["curryRight",Rt],["flip",Qt],["partial",We],["partialRight",Pt],["rearg",bt]],en="[object Arguments]",Xn="[object Array]",Wl="[object AsyncFunction]",An="[object Boolean]",Sn="[object Date]",Ml="[object DOMException]",Zn="[object Error]",Qn="[object Function]",Fs="[object GeneratorFunction]",tt="[object Map]",Tn="[object Number]",Bl="[object Null]",mt="[object Object]",Cs="[object Promise]",ql="[object Proxy]",En="[object RegExp]",nt="[object Set]",Fn="[object String]",er="[object Symbol]",jl="[object Undefined]",Cn="[object WeakMap]",Hl="[object WeakSet]",Rn="[object ArrayBuffer]",tn="[object DataView]",Xr="[object Float32Array]",Zr="[object Float64Array]",Qr="[object Int8Array]",ei="[object Int16Array]",ti="[object Int32Array]",ni="[object Uint8Array]",ri="[object Uint8ClampedArray]",ii="[object Uint16Array]",si="[object Uint32Array]",Gl=/\b__p \+= '';/g,zl=/\b(__p \+=) '' \+/g,Jl=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Rs=/&(?:amp|lt|gt|quot|#39);/g,Ps=/[&<>"']/g,Kl=RegExp(Rs.source),Vl=RegExp(Ps.source),Yl=/<%-([\s\S]+?)%>/g,Xl=/<%([\s\S]+?)%>/g,bs=/<%=([\s\S]+?)%>/g,Zl=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ql=/^\w*$/,ec=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ai=/[\\^$.*+?()[\]{}|]/g,tc=RegExp(ai.source),oi=/^\s+/,nc=/\s/,rc=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ic=/\{\n\/\* \[wrapped with (.+)\] \*/,sc=/,? & /,ac=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,oc=/[()=,{}\[\]\/\s]/,lc=/\\(\\)?/g,cc=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ks=/\w*$/,uc=/^[-+]0x[0-9a-f]+$/i,fc=/^0b[01]+$/i,pc=/^\[object .+?Constructor\]$/,dc=/^0o[0-7]+$/i,hc=/^(?:0|[1-9]\d*)$/,gc=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,tr=/($^)/,mc=/['\n\r\u2028\u2029\\]/g,nr="\\ud800-\\udfff",vc="\\u0300-\\u036f",yc="\\ufe20-\\ufe2f",_c="\\u20d0-\\u20ff",Os=vc+yc+_c,Ls="\\u2700-\\u27bf",Ns="a-z\\xdf-\\xf6\\xf8-\\xff",wc="\\xac\\xb1\\xd7\\xf7",xc="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ic="\\u2000-\\u206f",Ac=" \\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",Us="A-Z\\xc0-\\xd6\\xd8-\\xde",Ds="\\ufe0e\\ufe0f",$s=wc+xc+Ic+Ac,li="['’]",Sc="["+nr+"]",Ws="["+$s+"]",rr="["+Os+"]",Ms="\\d+",Tc="["+Ls+"]",Bs="["+Ns+"]",qs="[^"+nr+$s+Ms+Ls+Ns+Us+"]",ci="\\ud83c[\\udffb-\\udfff]",Ec="(?:"+rr+"|"+ci+")",js="[^"+nr+"]",ui="(?:\\ud83c[\\udde6-\\uddff]){2}",fi="[\\ud800-\\udbff][\\udc00-\\udfff]",nn="["+Us+"]",Hs="\\u200d",Gs="(?:"+Bs+"|"+qs+")",Fc="(?:"+nn+"|"+qs+")",zs="(?:"+li+"(?:d|ll|m|re|s|t|ve))?",Js="(?:"+li+"(?:D|LL|M|RE|S|T|VE))?",Ks=Ec+"?",Vs="["+Ds+"]?",Cc="(?:"+Hs+"(?:"+[js,ui,fi].join("|")+")"+Vs+Ks+")*",Rc="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Pc="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ys=Vs+Ks+Cc,bc="(?:"+[Tc,ui,fi].join("|")+")"+Ys,kc="(?:"+[js+rr+"?",rr,ui,fi,Sc].join("|")+")",Oc=RegExp(li,"g"),Lc=RegExp(rr,"g"),pi=RegExp(ci+"(?="+ci+")|"+kc+Ys,"g"),Nc=RegExp([nn+"?"+Bs+"+"+zs+"(?="+[Ws,nn,"$"].join("|")+")",Fc+"+"+Js+"(?="+[Ws,nn+Gs,"$"].join("|")+")",nn+"?"+Gs+"+"+zs,nn+"+"+Js,Pc,Rc,Ms,bc].join("|"),"g"),Uc=RegExp("["+Hs+nr+Os+Ds+"]"),Dc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,$c=["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"],Wc=-1,ie={};ie[Xr]=ie[Zr]=ie[Qr]=ie[ei]=ie[ti]=ie[ni]=ie[ri]=ie[ii]=ie[si]=!0,ie[en]=ie[Xn]=ie[Rn]=ie[An]=ie[tn]=ie[Sn]=ie[Zn]=ie[Qn]=ie[tt]=ie[Tn]=ie[mt]=ie[En]=ie[nt]=ie[Fn]=ie[Cn]=!1;var re={};re[en]=re[Xn]=re[Rn]=re[tn]=re[An]=re[Sn]=re[Xr]=re[Zr]=re[Qr]=re[ei]=re[ti]=re[tt]=re[Tn]=re[mt]=re[En]=re[nt]=re[Fn]=re[er]=re[ni]=re[ri]=re[ii]=re[si]=!0,re[Zn]=re[Qn]=re[Cn]=!1;var Mc={À:"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"},Bc={"&":"&","<":"<",">":">",'"':""","'":"'"},qc={"&":"&","<":"<",">":">",""":'"',"'":"'"},jc={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Hc=parseFloat,Gc=parseInt,Xs=typeof jr=="object"&&jr&&jr.Object===Object&&jr,zc=typeof self=="object"&&self&&self.Object===Object&&self,ge=Xs||zc||Function("return this")(),di=s&&!s.nodeType&&s,Ht=di&&!0&&l&&!l.nodeType&&l,Zs=Ht&&Ht.exports===di,hi=Zs&&Xs.process,je=function(){try{var h=Ht&&Ht.require&&Ht.require("util").types;return h||hi&&hi.binding&&hi.binding("util")}catch{}}(),Qs=je&&je.isArrayBuffer,ea=je&&je.isDate,ta=je&&je.isMap,na=je&&je.isRegExp,ra=je&&je.isSet,ia=je&&je.isTypedArray;function Pe(h,_,y){switch(y.length){case 0:return h.call(_);case 1:return h.call(_,y[0]);case 2:return h.call(_,y[0],y[1]);case 3:return h.call(_,y[0],y[1],y[2])}return h.apply(_,y)}function Jc(h,_,y,T){for(var D=-1,Z=h==null?0:h.length;++D<Z;){var fe=h[D];_(T,fe,y(fe),h)}return T}function He(h,_){for(var y=-1,T=h==null?0:h.length;++y<T&&_(h[y],y,h)!==!1;);return h}function Kc(h,_){for(var y=h==null?0:h.length;y--&&_(h[y],y,h)!==!1;);return h}function sa(h,_){for(var y=-1,T=h==null?0:h.length;++y<T;)if(!_(h[y],y,h))return!1;return!0}function kt(h,_){for(var y=-1,T=h==null?0:h.length,D=0,Z=[];++y<T;){var fe=h[y];_(fe,y,h)&&(Z[D++]=fe)}return Z}function ir(h,_){var y=h==null?0:h.length;return!!y&&rn(h,_,0)>-1}function gi(h,_,y){for(var T=-1,D=h==null?0:h.length;++T<D;)if(y(_,h[T]))return!0;return!1}function se(h,_){for(var y=-1,T=h==null?0:h.length,D=Array(T);++y<T;)D[y]=_(h[y],y,h);return D}function Ot(h,_){for(var y=-1,T=_.length,D=h.length;++y<T;)h[D+y]=_[y];return h}function mi(h,_,y,T){var D=-1,Z=h==null?0:h.length;for(T&&Z&&(y=h[++D]);++D<Z;)y=_(y,h[D],D,h);return y}function Vc(h,_,y,T){var D=h==null?0:h.length;for(T&&D&&(y=h[--D]);D--;)y=_(y,h[D],D,h);return y}function vi(h,_){for(var y=-1,T=h==null?0:h.length;++y<T;)if(_(h[y],y,h))return!0;return!1}var Yc=yi("length");function Xc(h){return h.split("")}function Zc(h){return h.match(ac)||[]}function aa(h,_,y){var T;return y(h,function(D,Z,fe){if(_(D,Z,fe))return T=Z,!1}),T}function sr(h,_,y,T){for(var D=h.length,Z=y+(T?1:-1);T?Z--:++Z<D;)if(_(h[Z],Z,h))return Z;return-1}function rn(h,_,y){return _===_?uu(h,_,y):sr(h,oa,y)}function Qc(h,_,y,T){for(var D=y-1,Z=h.length;++D<Z;)if(T(h[D],_))return D;return-1}function oa(h){return h!==h}function la(h,_){var y=h==null?0:h.length;return y?wi(h,_)/y:Te}function yi(h){return function(_){return _==null?r:_[h]}}function _i(h){return function(_){return h==null?r:h[_]}}function ca(h,_,y,T,D){return D(h,function(Z,fe,te){y=T?(T=!1,Z):_(y,Z,fe,te)}),y}function eu(h,_){var y=h.length;for(h.sort(_);y--;)h[y]=h[y].value;return h}function wi(h,_){for(var y,T=-1,D=h.length;++T<D;){var Z=_(h[T]);Z!==r&&(y=y===r?Z:y+Z)}return y}function xi(h,_){for(var y=-1,T=Array(h);++y<h;)T[y]=_(y);return T}function tu(h,_){return se(_,function(y){return[y,h[y]]})}function ua(h){return h&&h.slice(0,ha(h)+1).replace(oi,"")}function be(h){return function(_){return h(_)}}function Ii(h,_){return se(_,function(y){return h[y]})}function Pn(h,_){return h.has(_)}function fa(h,_){for(var y=-1,T=h.length;++y<T&&rn(_,h[y],0)>-1;);return y}function pa(h,_){for(var y=h.length;y--&&rn(_,h[y],0)>-1;);return y}function nu(h,_){for(var y=h.length,T=0;y--;)h[y]===_&&++T;return T}var ru=_i(Mc),iu=_i(Bc);function su(h){return"\\"+jc[h]}function au(h,_){return h==null?r:h[_]}function sn(h){return Uc.test(h)}function ou(h){return Dc.test(h)}function lu(h){for(var _,y=[];!(_=h.next()).done;)y.push(_.value);return y}function Ai(h){var _=-1,y=Array(h.size);return h.forEach(function(T,D){y[++_]=[D,T]}),y}function da(h,_){return function(y){return h(_(y))}}function Lt(h,_){for(var y=-1,T=h.length,D=0,Z=[];++y<T;){var fe=h[y];(fe===_||fe===j)&&(h[y]=j,Z[D++]=y)}return Z}function ar(h){var _=-1,y=Array(h.size);return h.forEach(function(T){y[++_]=T}),y}function cu(h){var _=-1,y=Array(h.size);return h.forEach(function(T){y[++_]=[T,T]}),y}function uu(h,_,y){for(var T=y-1,D=h.length;++T<D;)if(h[T]===_)return T;return-1}function fu(h,_,y){for(var T=y+1;T--;)if(h[T]===_)return T;return T}function an(h){return sn(h)?du(h):Yc(h)}function rt(h){return sn(h)?hu(h):Xc(h)}function ha(h){for(var _=h.length;_--&&nc.test(h.charAt(_)););return _}var pu=_i(qc);function du(h){for(var _=pi.lastIndex=0;pi.test(h);)++_;return _}function hu(h){return h.match(pi)||[]}function gu(h){return h.match(Nc)||[]}var mu=function h(_){_=_==null?ge:on.defaults(ge.Object(),_,on.pick(ge,$c));var y=_.Array,T=_.Date,D=_.Error,Z=_.Function,fe=_.Math,te=_.Object,Si=_.RegExp,vu=_.String,Ge=_.TypeError,or=y.prototype,yu=Z.prototype,ln=te.prototype,lr=_["__core-js_shared__"],cr=yu.toString,ee=ln.hasOwnProperty,_u=0,ga=function(){var e=/[^.]+$/.exec(lr&&lr.keys&&lr.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ur=ln.toString,wu=cr.call(te),xu=ge._,Iu=Si("^"+cr.call(ee).replace(ai,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),fr=Zs?_.Buffer:r,Nt=_.Symbol,pr=_.Uint8Array,ma=fr?fr.allocUnsafe:r,dr=da(te.getPrototypeOf,te),va=te.create,ya=ln.propertyIsEnumerable,hr=or.splice,_a=Nt?Nt.isConcatSpreadable:r,bn=Nt?Nt.iterator:r,Gt=Nt?Nt.toStringTag:r,gr=function(){try{var e=Yt(te,"defineProperty");return e({},"",{}),e}catch{}}(),Au=_.clearTimeout!==ge.clearTimeout&&_.clearTimeout,Su=T&&T.now!==ge.Date.now&&T.now,Tu=_.setTimeout!==ge.setTimeout&&_.setTimeout,mr=fe.ceil,vr=fe.floor,Ti=te.getOwnPropertySymbols,Eu=fr?fr.isBuffer:r,wa=_.isFinite,Fu=or.join,Cu=da(te.keys,te),pe=fe.max,ve=fe.min,Ru=T.now,Pu=_.parseInt,xa=fe.random,bu=or.reverse,Ei=Yt(_,"DataView"),kn=Yt(_,"Map"),Fi=Yt(_,"Promise"),cn=Yt(_,"Set"),On=Yt(_,"WeakMap"),Ln=Yt(te,"create"),yr=On&&new On,un={},ku=Xt(Ei),Ou=Xt(kn),Lu=Xt(Fi),Nu=Xt(cn),Uu=Xt(On),_r=Nt?Nt.prototype:r,Nn=_r?_r.valueOf:r,Ia=_r?_r.toString:r;function c(e){if(le(e)&&!$(e)&&!(e instanceof z)){if(e instanceof ze)return e;if(ee.call(e,"__wrapped__"))return So(e)}return new ze(e)}var fn=function(){function e(){}return function(t){if(!ae(t))return{};if(va)return va(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function wr(){}function ze(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}c.templateSettings={escape:Yl,evaluate:Xl,interpolate:bs,variable:"",imports:{_:c}},c.prototype=wr.prototype,c.prototype.constructor=c,ze.prototype=fn(wr.prototype),ze.prototype.constructor=ze;function z(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=de,this.__views__=[]}function Du(){var e=new z(this.__wrapped__);return e.__actions__=Ee(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ee(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ee(this.__views__),e}function $u(){if(this.__filtered__){var e=new z(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function Wu(){var e=this.__wrapped__.value(),t=this.__dir__,n=$(e),i=t<0,a=n?e.length:0,u=Zf(0,a,this.__views__),p=u.start,d=u.end,g=d-p,w=i?d:p-1,x=this.__iteratees__,I=x.length,S=0,F=ve(g,this.__takeCount__);if(!n||!i&&a==g&&F==g)return za(e,this.__actions__);var O=[];e:for(;g--&&S<F;){w+=t;for(var B=-1,L=e[w];++B<I;){var H=x[B],J=H.iteratee,Le=H.type,Ie=J(L);if(Le==Yn)L=Ie;else if(!Ie){if(Le==oe)continue e;break e}}O[S++]=L}return O}z.prototype=fn(wr.prototype),z.prototype.constructor=z;function zt(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 Mu(){this.__data__=Ln?Ln(null):{},this.size=0}function Bu(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function qu(e){var t=this.__data__;if(Ln){var n=t[e];return n===C?r:n}return ee.call(t,e)?t[e]:r}function ju(e){var t=this.__data__;return Ln?t[e]!==r:ee.call(t,e)}function Hu(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ln&&t===r?C:t,this}zt.prototype.clear=Mu,zt.prototype.delete=Bu,zt.prototype.get=qu,zt.prototype.has=ju,zt.prototype.set=Hu;function vt(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 Gu(){this.__data__=[],this.size=0}function zu(e){var t=this.__data__,n=xr(t,e);if(n<0)return!1;var i=t.length-1;return n==i?t.pop():hr.call(t,n,1),--this.size,!0}function Ju(e){var t=this.__data__,n=xr(t,e);return n<0?r:t[n][1]}function Ku(e){return xr(this.__data__,e)>-1}function Vu(e,t){var n=this.__data__,i=xr(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}vt.prototype.clear=Gu,vt.prototype.delete=zu,vt.prototype.get=Ju,vt.prototype.has=Ku,vt.prototype.set=Vu;function yt(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 Yu(){this.size=0,this.__data__={hash:new zt,map:new(kn||vt),string:new zt}}function Xu(e){var t=Or(this,e).delete(e);return this.size-=t?1:0,t}function Zu(e){return Or(this,e).get(e)}function Qu(e){return Or(this,e).has(e)}function ef(e,t){var n=Or(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}yt.prototype.clear=Yu,yt.prototype.delete=Xu,yt.prototype.get=Zu,yt.prototype.has=Qu,yt.prototype.set=ef;function Jt(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new yt;++t<n;)this.add(e[t])}function tf(e){return this.__data__.set(e,C),this}function nf(e){return this.__data__.has(e)}Jt.prototype.add=Jt.prototype.push=tf,Jt.prototype.has=nf;function it(e){var t=this.__data__=new vt(e);this.size=t.size}function rf(){this.__data__=new vt,this.size=0}function sf(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function af(e){return this.__data__.get(e)}function of(e){return this.__data__.has(e)}function lf(e,t){var n=this.__data__;if(n instanceof vt){var i=n.__data__;if(!kn||i.length<f-1)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new yt(i)}return n.set(e,t),this.size=n.size,this}it.prototype.clear=rf,it.prototype.delete=sf,it.prototype.get=af,it.prototype.has=of,it.prototype.set=lf;function Aa(e,t){var n=$(e),i=!n&&Zt(e),a=!n&&!i&&Mt(e),u=!n&&!i&&!a&&gn(e),p=n||i||a||u,d=p?xi(e.length,vu):[],g=d.length;for(var w in e)(t||ee.call(e,w))&&!(p&&(w=="length"||a&&(w=="offset"||w=="parent")||u&&(w=="buffer"||w=="byteLength"||w=="byteOffset")||It(w,g)))&&d.push(w);return d}function Sa(e){var t=e.length;return t?e[$i(0,t-1)]:r}function cf(e,t){return Lr(Ee(e),Kt(t,0,e.length))}function uf(e){return Lr(Ee(e))}function Ci(e,t,n){(n!==r&&!st(e[t],n)||n===r&&!(t in e))&&_t(e,t,n)}function Un(e,t,n){var i=e[t];(!(ee.call(e,t)&&st(i,n))||n===r&&!(t in e))&&_t(e,t,n)}function xr(e,t){for(var n=e.length;n--;)if(st(e[n][0],t))return n;return-1}function ff(e,t,n,i){return Ut(e,function(a,u,p){t(i,a,n(a),p)}),i}function Ta(e,t){return e&&ft(t,he(t),e)}function pf(e,t){return e&&ft(t,Ce(t),e)}function _t(e,t,n){t=="__proto__"&&gr?gr(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Ri(e,t){for(var n=-1,i=t.length,a=y(i),u=e==null;++n<i;)a[n]=u?r:cs(e,t[n]);return a}function Kt(e,t,n){return e===e&&(n!==r&&(e=e<=n?e:n),t!==r&&(e=e>=t?e:t)),e}function Je(e,t,n,i,a,u){var p,d=t&X,g=t&U,w=t&V;if(n&&(p=a?n(e,i,a,u):n(e)),p!==r)return p;if(!ae(e))return e;var x=$(e);if(x){if(p=ep(e),!d)return Ee(e,p)}else{var I=ye(e),S=I==Qn||I==Fs;if(Mt(e))return Va(e,d);if(I==mt||I==en||S&&!a){if(p=g||S?{}:go(e),!d)return g?jf(e,pf(p,e)):qf(e,Ta(p,e))}else{if(!re[I])return a?e:{};p=tp(e,I,d)}}u||(u=new it);var F=u.get(e);if(F)return F;u.set(e,p),Ho(e)?e.forEach(function(L){p.add(Je(L,t,n,L,e,u))}):qo(e)&&e.forEach(function(L,H){p.set(H,Je(L,t,n,H,e,u))});var O=w?g?Vi:Ki:g?Ce:he,B=x?r:O(e);return He(B||e,function(L,H){B&&(H=L,L=e[H]),Un(p,H,Je(L,t,n,H,e,u))}),p}function df(e){var t=he(e);return function(n){return Ea(n,e,t)}}function Ea(e,t,n){var i=n.length;if(e==null)return!i;for(e=te(e);i--;){var a=n[i],u=t[a],p=e[a];if(p===r&&!(a in e)||!u(p))return!1}return!0}function Fa(e,t,n){if(typeof e!="function")throw new Ge(v);return jn(function(){e.apply(r,n)},t)}function Dn(e,t,n,i){var a=-1,u=ir,p=!0,d=e.length,g=[],w=t.length;if(!d)return g;n&&(t=se(t,be(n))),i?(u=gi,p=!1):t.length>=f&&(u=Pn,p=!1,t=new Jt(t));e:for(;++a<d;){var x=e[a],I=n==null?x:n(x);if(x=i||x!==0?x:0,p&&I===I){for(var S=w;S--;)if(t[S]===I)continue e;g.push(x)}else u(t,I,i)||g.push(x)}return g}var Ut=eo(ut),Ca=eo(bi,!0);function hf(e,t){var n=!0;return Ut(e,function(i,a,u){return n=!!t(i,a,u),n}),n}function Ir(e,t,n){for(var i=-1,a=e.length;++i<a;){var u=e[i],p=t(u);if(p!=null&&(d===r?p===p&&!Oe(p):n(p,d)))var d=p,g=u}return g}function gf(e,t,n,i){var a=e.length;for(n=W(n),n<0&&(n=-n>a?0:a+n),i=i===r||i>a?a:W(i),i<0&&(i+=a),i=n>i?0:zo(i);n<i;)e[n++]=t;return e}function Ra(e,t){var n=[];return Ut(e,function(i,a,u){t(i,a,u)&&n.push(i)}),n}function me(e,t,n,i,a){var u=-1,p=e.length;for(n||(n=rp),a||(a=[]);++u<p;){var d=e[u];t>0&&n(d)?t>1?me(d,t-1,n,i,a):Ot(a,d):i||(a[a.length]=d)}return a}var Pi=to(),Pa=to(!0);function ut(e,t){return e&&Pi(e,t,he)}function bi(e,t){return e&&Pa(e,t,he)}function Ar(e,t){return kt(t,function(n){return At(e[n])})}function Vt(e,t){t=$t(t,e);for(var n=0,i=t.length;e!=null&&n<i;)e=e[pt(t[n++])];return n&&n==i?e:r}function ba(e,t,n){var i=t(e);return $(e)?i:Ot(i,n(e))}function we(e){return e==null?e===r?jl:Bl:Gt&&Gt in te(e)?Xf(e):up(e)}function ki(e,t){return e>t}function mf(e,t){return e!=null&&ee.call(e,t)}function vf(e,t){return e!=null&&t in te(e)}function yf(e,t,n){return e>=ve(t,n)&&e<pe(t,n)}function Oi(e,t,n){for(var i=n?gi:ir,a=e[0].length,u=e.length,p=u,d=y(u),g=1/0,w=[];p--;){var x=e[p];p&&t&&(x=se(x,be(t))),g=ve(x.length,g),d[p]=!n&&(t||a>=120&&x.length>=120)?new Jt(p&&x):r}x=e[0];var I=-1,S=d[0];e:for(;++I<a&&w.length<g;){var F=x[I],O=t?t(F):F;if(F=n||F!==0?F:0,!(S?Pn(S,O):i(w,O,n))){for(p=u;--p;){var B=d[p];if(!(B?Pn(B,O):i(e[p],O,n)))continue e}S&&S.push(O),w.push(F)}}return w}function _f(e,t,n,i){return ut(e,function(a,u,p){t(i,n(a),u,p)}),i}function $n(e,t,n){t=$t(t,e),e=_o(e,t);var i=e==null?e:e[pt(Ve(t))];return i==null?r:Pe(i,e,n)}function ka(e){return le(e)&&we(e)==en}function wf(e){return le(e)&&we(e)==Rn}function xf(e){return le(e)&&we(e)==Sn}function Wn(e,t,n,i,a){return e===t?!0:e==null||t==null||!le(e)&&!le(t)?e!==e&&t!==t:If(e,t,n,i,Wn,a)}function If(e,t,n,i,a,u){var p=$(e),d=$(t),g=p?Xn:ye(e),w=d?Xn:ye(t);g=g==en?mt:g,w=w==en?mt:w;var x=g==mt,I=w==mt,S=g==w;if(S&&Mt(e)){if(!Mt(t))return!1;p=!0,x=!1}if(S&&!x)return u||(u=new it),p||gn(e)?fo(e,t,n,i,a,u):Vf(e,t,g,n,i,a,u);if(!(n&ne)){var F=x&&ee.call(e,"__wrapped__"),O=I&&ee.call(t,"__wrapped__");if(F||O){var B=F?e.value():e,L=O?t.value():t;return u||(u=new it),a(B,L,n,i,u)}}return S?(u||(u=new it),Yf(e,t,n,i,a,u)):!1}function Af(e){return le(e)&&ye(e)==tt}function Li(e,t,n,i){var a=n.length,u=a,p=!i;if(e==null)return!u;for(e=te(e);a--;){var d=n[a];if(p&&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],x=d[1];if(p&&d[2]){if(w===r&&!(g in e))return!1}else{var I=new it;if(i)var S=i(w,x,g,e,t,I);if(!(S===r?Wn(x,w,ne|De,i,I):S))return!1}}return!0}function Oa(e){if(!ae(e)||sp(e))return!1;var t=At(e)?Iu:pc;return t.test(Xt(e))}function Sf(e){return le(e)&&we(e)==En}function Tf(e){return le(e)&&ye(e)==nt}function Ef(e){return le(e)&&Mr(e.length)&&!!ie[we(e)]}function La(e){return typeof e=="function"?e:e==null?Re:typeof e=="object"?$(e)?Da(e[0],e[1]):Ua(e):rl(e)}function Ni(e){if(!qn(e))return Cu(e);var t=[];for(var n in te(e))ee.call(e,n)&&n!="constructor"&&t.push(n);return t}function Ff(e){if(!ae(e))return cp(e);var t=qn(e),n=[];for(var i in e)i=="constructor"&&(t||!ee.call(e,i))||n.push(i);return n}function Ui(e,t){return e<t}function Na(e,t){var n=-1,i=Fe(e)?y(e.length):[];return Ut(e,function(a,u,p){i[++n]=t(a,u,p)}),i}function Ua(e){var t=Xi(e);return t.length==1&&t[0][2]?vo(t[0][0],t[0][1]):function(n){return n===e||Li(n,e,t)}}function Da(e,t){return Qi(e)&&mo(t)?vo(pt(e),t):function(n){var i=cs(n,e);return i===r&&i===t?us(n,e):Wn(t,i,ne|De)}}function Sr(e,t,n,i,a){e!==t&&Pi(t,function(u,p){if(a||(a=new it),ae(u))Cf(e,t,p,n,Sr,i,a);else{var d=i?i(ts(e,p),u,p+"",e,t,a):r;d===r&&(d=u),Ci(e,p,d)}},Ce)}function Cf(e,t,n,i,a,u,p){var d=ts(e,n),g=ts(t,n),w=p.get(g);if(w){Ci(e,n,w);return}var x=u?u(d,g,n+"",e,t,p):r,I=x===r;if(I){var S=$(g),F=!S&&Mt(g),O=!S&&!F&&gn(g);x=g,S||F||O?$(d)?x=d:ce(d)?x=Ee(d):F?(I=!1,x=Va(g,!0)):O?(I=!1,x=Ya(g,!0)):x=[]:Hn(g)||Zt(g)?(x=d,Zt(d)?x=Jo(d):(!ae(d)||At(d))&&(x=go(g))):I=!1}I&&(p.set(g,x),a(x,g,i,u,p),p.delete(g)),Ci(e,n,x)}function $a(e,t){var n=e.length;if(n)return t+=t<0?n:0,It(t,n)?e[t]:r}function Wa(e,t,n){t.length?t=se(t,function(u){return $(u)?function(p){return Vt(p,u.length===1?u[0]:u)}:u}):t=[Re];var i=-1;t=se(t,be(P()));var a=Na(e,function(u,p,d){var g=se(t,function(w){return w(u)});return{criteria:g,index:++i,value:u}});return eu(a,function(u,p){return Bf(u,p,n)})}function Rf(e,t){return Ma(e,t,function(n,i){return us(e,i)})}function Ma(e,t,n){for(var i=-1,a=t.length,u={};++i<a;){var p=t[i],d=Vt(e,p);n(d,p)&&Mn(u,$t(p,e),d)}return u}function Pf(e){return function(t){return Vt(t,e)}}function Di(e,t,n,i){var a=i?Qc:rn,u=-1,p=t.length,d=e;for(e===t&&(t=Ee(t)),n&&(d=se(e,be(n)));++u<p;)for(var g=0,w=t[u],x=n?n(w):w;(g=a(d,x,g,i))>-1;)d!==e&&hr.call(d,g,1),hr.call(e,g,1);return e}function Ba(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;It(a)?hr.call(e,a,1):Bi(e,a)}}return e}function $i(e,t){return e+vr(xa()*(t-e+1))}function bf(e,t,n,i){for(var a=-1,u=pe(mr((t-e)/(n||1)),0),p=y(u);u--;)p[i?u:++a]=e,e+=n;return p}function Wi(e,t){var n="";if(!e||t<1||t>gt)return n;do t%2&&(n+=e),t=vr(t/2),t&&(e+=e);while(t);return n}function q(e,t){return ns(yo(e,t,Re),e+"")}function kf(e){return Sa(mn(e))}function Of(e,t){var n=mn(e);return Lr(n,Kt(t,0,n.length))}function Mn(e,t,n,i){if(!ae(e))return e;t=$t(t,e);for(var a=-1,u=t.length,p=u-1,d=e;d!=null&&++a<u;){var g=pt(t[a]),w=n;if(g==="__proto__"||g==="constructor"||g==="prototype")return e;if(a!=p){var x=d[g];w=i?i(x,g,d):r,w===r&&(w=ae(x)?x:It(t[a+1])?[]:{})}Un(d,g,w),d=d[g]}return e}var qa=yr?function(e,t){return yr.set(e,t),e}:Re,Lf=gr?function(e,t){return gr(e,"toString",{configurable:!0,enumerable:!1,value:ps(t),writable:!0})}:Re;function Nf(e){return Lr(mn(e))}function Ke(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=y(a);++i<a;)u[i]=e[i+t];return u}function Uf(e,t){var n;return Ut(e,function(i,a,u){return n=t(i,a,u),!n}),!!n}function Tr(e,t,n){var i=0,a=e==null?i:e.length;if(typeof t=="number"&&t===t&&a<=jt){for(;i<a;){var u=i+a>>>1,p=e[u];p!==null&&!Oe(p)&&(n?p<=t:p<t)?i=u+1:a=u}return a}return Mi(e,t,Re,n)}function Mi(e,t,n,i){var a=0,u=e==null?0:e.length;if(u===0)return 0;t=n(t);for(var p=t!==t,d=t===null,g=Oe(t),w=t===r;a<u;){var x=vr((a+u)/2),I=n(e[x]),S=I!==r,F=I===null,O=I===I,B=Oe(I);if(p)var L=i||O;else w?L=O&&(i||S):d?L=O&&S&&(i||!F):g?L=O&&S&&!F&&(i||!B):F||B?L=!1:L=i?I<=t:I<t;L?a=x+1:u=x}return ve(u,ct)}function ja(e,t){for(var n=-1,i=e.length,a=0,u=[];++n<i;){var p=e[n],d=t?t(p):p;if(!n||!st(d,g)){var g=d;u[a++]=p===0?0:p}}return u}function Ha(e){return typeof e=="number"?e:Oe(e)?Te:+e}function ke(e){if(typeof e=="string")return e;if($(e))return se(e,ke)+"";if(Oe(e))return Ia?Ia.call(e):"";var t=e+"";return t=="0"&&1/e==-qe?"-0":t}function Dt(e,t,n){var i=-1,a=ir,u=e.length,p=!0,d=[],g=d;if(n)p=!1,a=gi;else if(u>=f){var w=t?null:Jf(e);if(w)return ar(w);p=!1,a=Pn,g=new Jt}else g=t?[]:d;e:for(;++i<u;){var x=e[i],I=t?t(x):x;if(x=n||x!==0?x:0,p&&I===I){for(var S=g.length;S--;)if(g[S]===I)continue e;t&&g.push(I),d.push(x)}else a(g,I,n)||(g!==d&&g.push(I),d.push(x))}return d}function Bi(e,t){return t=$t(t,e),e=_o(e,t),e==null||delete e[pt(Ve(t))]}function Ga(e,t,n,i){return Mn(e,t,n(Vt(e,t)),i)}function Er(e,t,n,i){for(var a=e.length,u=i?a:-1;(i?u--:++u<a)&&t(e[u],u,e););return n?Ke(e,i?0:u,i?u+1:a):Ke(e,i?u+1:0,i?a:u)}function za(e,t){var n=e;return n instanceof z&&(n=n.value()),mi(t,function(i,a){return a.func.apply(a.thisArg,Ot([i],a.args))},n)}function qi(e,t,n){var i=e.length;if(i<2)return i?Dt(e[0]):[];for(var a=-1,u=y(i);++a<i;)for(var p=e[a],d=-1;++d<i;)d!=a&&(u[a]=Dn(u[a]||p,e[d],t,n));return Dt(me(u,1),t,n)}function Ja(e,t,n){for(var i=-1,a=e.length,u=t.length,p={};++i<a;){var d=i<u?t[i]:r;n(p,e[i],d)}return p}function ji(e){return ce(e)?e:[]}function Hi(e){return typeof e=="function"?e:Re}function $t(e,t){return $(e)?e:Qi(e,t)?[e]:Ao(Q(e))}var Df=q;function Wt(e,t,n){var i=e.length;return n=n===r?i:n,!t&&n>=i?e:Ke(e,t,n)}var Ka=Au||function(e){return ge.clearTimeout(e)};function Va(e,t){if(t)return e.slice();var n=e.length,i=ma?ma(n):new e.constructor(n);return e.copy(i),i}function Gi(e){var t=new e.constructor(e.byteLength);return new pr(t).set(new pr(e)),t}function $f(e,t){var n=t?Gi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Wf(e){var t=new e.constructor(e.source,ks.exec(e));return t.lastIndex=e.lastIndex,t}function Mf(e){return Nn?te(Nn.call(e)):{}}function Ya(e,t){var n=t?Gi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Xa(e,t){if(e!==t){var n=e!==r,i=e===null,a=e===e,u=Oe(e),p=t!==r,d=t===null,g=t===t,w=Oe(t);if(!d&&!w&&!u&&e>t||u&&p&&g&&!d&&!w||i&&p&&g||!n&&g||!a)return 1;if(!i&&!u&&!w&&e<t||w&&n&&a&&!i&&!u||d&&n&&a||!p&&a||!g)return-1}return 0}function Bf(e,t,n){for(var i=-1,a=e.criteria,u=t.criteria,p=a.length,d=n.length;++i<p;){var g=Xa(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 Za(e,t,n,i){for(var a=-1,u=e.length,p=n.length,d=-1,g=t.length,w=pe(u-p,0),x=y(g+w),I=!i;++d<g;)x[d]=t[d];for(;++a<p;)(I||a<u)&&(x[n[a]]=e[a]);for(;w--;)x[d++]=e[a++];return x}function Qa(e,t,n,i){for(var a=-1,u=e.length,p=-1,d=n.length,g=-1,w=t.length,x=pe(u-d,0),I=y(x+w),S=!i;++a<x;)I[a]=e[a];for(var F=a;++g<w;)I[F+g]=t[g];for(;++p<d;)(S||a<u)&&(I[F+n[p]]=e[a++]);return I}function Ee(e,t){var n=-1,i=e.length;for(t||(t=y(i));++n<i;)t[n]=e[n];return t}function ft(e,t,n,i){var a=!n;n||(n={});for(var u=-1,p=t.length;++u<p;){var d=t[u],g=i?i(n[d],e[d],d,n,e):r;g===r&&(g=e[d]),a?_t(n,d,g):Un(n,d,g)}return n}function qf(e,t){return ft(e,Zi(e),t)}function jf(e,t){return ft(e,po(e),t)}function Fr(e,t){return function(n,i){var a=$(n)?Jc:ff,u=t?t():{};return a(n,e,P(i,2),u)}}function pn(e){return q(function(t,n){var i=-1,a=n.length,u=a>1?n[a-1]:r,p=a>2?n[2]:r;for(u=e.length>3&&typeof u=="function"?(a--,u):r,p&&xe(n[0],n[1],p)&&(u=a<3?r:u,a=1),t=te(t);++i<a;){var d=n[i];d&&e(t,d,i,u)}return t})}function eo(e,t){return function(n,i){if(n==null)return n;if(!Fe(n))return e(n,i);for(var a=n.length,u=t?a:-1,p=te(n);(t?u--:++u<a)&&i(p[u],u,p)!==!1;);return n}}function to(e){return function(t,n,i){for(var a=-1,u=te(t),p=i(t),d=p.length;d--;){var g=p[e?d:++a];if(n(u[g],g,u)===!1)break}return t}}function Hf(e,t,n){var i=t&Se,a=Bn(e);function u(){var p=this&&this!==ge&&this instanceof u?a:e;return p.apply(i?n:this,arguments)}return u}function no(e){return function(t){t=Q(t);var n=sn(t)?rt(t):r,i=n?n[0]:t.charAt(0),a=n?Wt(n,1).join(""):t.slice(1);return i[e]()+a}}function dn(e){return function(t){return mi(tl(el(t).replace(Oc,"")),e,"")}}function Bn(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=fn(e.prototype),i=e.apply(n,t);return ae(i)?i:n}}function Gf(e,t,n){var i=Bn(e);function a(){for(var u=arguments.length,p=y(u),d=u,g=hn(a);d--;)p[d]=arguments[d];var w=u<3&&p[0]!==g&&p[u-1]!==g?[]:Lt(p,g);if(u-=w.length,u<n)return oo(e,t,Cr,a.placeholder,r,p,w,r,r,n-u);var x=this&&this!==ge&&this instanceof a?i:e;return Pe(x,this,p)}return a}function ro(e){return function(t,n,i){var a=te(t);if(!Fe(t)){var u=P(n,3);t=he(t),n=function(d){return u(a[d],d,a)}}var p=e(t,n,i);return p>-1?a[u?t[p]:p]:r}}function io(e){return xt(function(t){var n=t.length,i=n,a=ze.prototype.thru;for(e&&t.reverse();i--;){var u=t[i];if(typeof u!="function")throw new Ge(v);if(a&&!p&&kr(u)=="wrapper")var p=new ze([],!0)}for(i=p?i:n;++i<n;){u=t[i];var d=kr(u),g=d=="wrapper"?Yi(u):r;g&&es(g[0])&&g[1]==(Me|$e|We|bt)&&!g[4].length&&g[9]==1?p=p[kr(g[0])].apply(p,g[3]):p=u.length==1&&es(u)?p[d]():p.thru(u)}return function(){var w=arguments,x=w[0];if(p&&w.length==1&&$(x))return p.plant(x).value();for(var I=0,S=n?t[I].apply(this,w):x;++I<n;)S=t[I].call(this,S);return S}})}function Cr(e,t,n,i,a,u,p,d,g,w){var x=t&Me,I=t&Se,S=t&ht,F=t&($e|Rt),O=t&Qt,B=S?r:Bn(e);function L(){for(var H=arguments.length,J=y(H),Le=H;Le--;)J[Le]=arguments[Le];if(F)var Ie=hn(L),Ne=nu(J,Ie);if(i&&(J=Za(J,i,a,F)),u&&(J=Qa(J,u,p,F)),H-=Ne,F&&H<w){var ue=Lt(J,Ie);return oo(e,t,Cr,L.placeholder,n,J,ue,d,g,w-H)}var at=I?n:this,Tt=S?at[e]:e;return H=J.length,d?J=fp(J,d):O&&H>1&&J.reverse(),x&&g<H&&(J.length=g),this&&this!==ge&&this instanceof L&&(Tt=B||Bn(Tt)),Tt.apply(at,J)}return L}function so(e,t){return function(n,i){return _f(n,e,t(i),{})}}function Rr(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=ke(n),i=ke(i)):(n=Ha(n),i=Ha(i)),a=e(n,i)}return a}}function zi(e){return xt(function(t){return t=se(t,be(P())),q(function(n){var i=this;return e(t,function(a){return Pe(a,i,n)})})})}function Pr(e,t){t=t===r?" ":ke(t);var n=t.length;if(n<2)return n?Wi(t,e):t;var i=Wi(t,mr(e/an(t)));return sn(t)?Wt(rt(i),0,e).join(""):i.slice(0,e)}function zf(e,t,n,i){var a=t&Se,u=Bn(e);function p(){for(var d=-1,g=arguments.length,w=-1,x=i.length,I=y(x+g),S=this&&this!==ge&&this instanceof p?u:e;++w<x;)I[w]=i[w];for(;g--;)I[w++]=arguments[++d];return Pe(S,a?n:this,I)}return p}function ao(e){return function(t,n,i){return i&&typeof i!="number"&&xe(t,n,i)&&(n=i=r),t=St(t),n===r?(n=t,t=0):n=St(n),i=i===r?t<n?1:-1:St(i),bf(t,n,i,e)}}function br(e){return function(t,n){return typeof t=="string"&&typeof n=="string"||(t=Ye(t),n=Ye(n)),e(t,n)}}function oo(e,t,n,i,a,u,p,d,g,w){var x=t&$e,I=x?p:r,S=x?r:p,F=x?u:r,O=x?r:u;t|=x?We:Pt,t&=~(x?Pt:We),t&xn||(t&=-4);var B=[e,t,a,F,I,O,S,d,g,w],L=n.apply(r,B);return es(e)&&wo(L,B),L.placeholder=i,xo(L,e,t)}function Ji(e){var t=fe[e];return function(n,i){if(n=Ye(n),i=i==null?0:ve(W(i),292),i&&wa(n)){var a=(Q(n)+"e").split("e"),u=t(a[0]+"e"+(+a[1]+i));return a=(Q(u)+"e").split("e"),+(a[0]+"e"+(+a[1]-i))}return t(n)}}var Jf=cn&&1/ar(new cn([,-0]))[1]==qe?function(e){return new cn(e)}:gs;function lo(e){return function(t){var n=ye(t);return n==tt?Ai(t):n==nt?cu(t):tu(t,e(t))}}function wt(e,t,n,i,a,u,p,d){var g=t&ht;if(!g&&typeof e!="function")throw new Ge(v);var w=i?i.length:0;if(w||(t&=-97,i=a=r),p=p===r?p:pe(W(p),0),d=d===r?d:W(d),w-=a?a.length:0,t&Pt){var x=i,I=a;i=a=r}var S=g?r:Yi(e),F=[e,t,n,i,a,x,I,u,p,d];if(S&&lp(F,S),e=F[0],t=F[1],n=F[2],i=F[3],a=F[4],d=F[9]=F[9]===r?g?0:e.length:pe(F[9]-w,0),!d&&t&($e|Rt)&&(t&=-25),!t||t==Se)var O=Hf(e,t,n);else t==$e||t==Rt?O=Gf(e,t,d):(t==We||t==(Se|We))&&!a.length?O=zf(e,t,n,i):O=Cr.apply(r,F);var B=S?qa:wo;return xo(B(O,F),e,t)}function co(e,t,n,i){return e===r||st(e,ln[n])&&!ee.call(i,n)?t:e}function uo(e,t,n,i,a,u){return ae(e)&&ae(t)&&(u.set(t,e),Sr(e,t,r,uo,u),u.delete(t)),e}function Kf(e){return Hn(e)?r:e}function fo(e,t,n,i,a,u){var p=n&ne,d=e.length,g=t.length;if(d!=g&&!(p&&g>d))return!1;var w=u.get(e),x=u.get(t);if(w&&x)return w==t&&x==e;var I=-1,S=!0,F=n&De?new Jt:r;for(u.set(e,t),u.set(t,e);++I<d;){var O=e[I],B=t[I];if(i)var L=p?i(B,O,I,t,e,u):i(O,B,I,e,t,u);if(L!==r){if(L)continue;S=!1;break}if(F){if(!vi(t,function(H,J){if(!Pn(F,J)&&(O===H||a(O,H,n,i,u)))return F.push(J)})){S=!1;break}}else if(!(O===B||a(O,B,n,i,u))){S=!1;break}}return u.delete(e),u.delete(t),S}function Vf(e,t,n,i,a,u,p){switch(n){case tn:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Rn:return!(e.byteLength!=t.byteLength||!u(new pr(e),new pr(t)));case An:case Sn:case Tn:return st(+e,+t);case Zn:return e.name==t.name&&e.message==t.message;case En:case Fn:return e==t+"";case tt:var d=Ai;case nt:var g=i≠if(d||(d=ar),e.size!=t.size&&!g)return!1;var w=p.get(e);if(w)return w==t;i|=De,p.set(e,t);var x=fo(d(e),d(t),i,a,u,p);return p.delete(e),x;case er:if(Nn)return Nn.call(e)==Nn.call(t)}return!1}function Yf(e,t,n,i,a,u){var p=n&ne,d=Ki(e),g=d.length,w=Ki(t),x=w.length;if(g!=x&&!p)return!1;for(var I=g;I--;){var S=d[I];if(!(p?S in t:ee.call(t,S)))return!1}var F=u.get(e),O=u.get(t);if(F&&O)return F==t&&O==e;var B=!0;u.set(e,t),u.set(t,e);for(var L=p;++I<g;){S=d[I];var H=e[S],J=t[S];if(i)var Le=p?i(J,H,S,t,e,u):i(H,J,S,e,t,u);if(!(Le===r?H===J||a(H,J,n,i,u):Le)){B=!1;break}L||(L=S=="constructor")}if(B&&!L){var Ie=e.constructor,Ne=t.constructor;Ie!=Ne&&"constructor"in e&&"constructor"in t&&!(typeof Ie=="function"&&Ie instanceof Ie&&typeof Ne=="function"&&Ne instanceof Ne)&&(B=!1)}return u.delete(e),u.delete(t),B}function xt(e){return ns(yo(e,r,Fo),e+"")}function Ki(e){return ba(e,he,Zi)}function Vi(e){return ba(e,Ce,po)}var Yi=yr?function(e){return yr.get(e)}:gs;function kr(e){for(var t=e.name+"",n=un[t],i=ee.call(un,t)?n.length:0;i--;){var a=n[i],u=a.func;if(u==null||u==e)return a.name}return t}function hn(e){var t=ee.call(c,"placeholder")?c:e;return t.placeholder}function P(){var e=c.iteratee||ds;return e=e===ds?La:e,arguments.length?e(arguments[0],arguments[1]):e}function Or(e,t){var n=e.__data__;return ip(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Xi(e){for(var t=he(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,mo(a)]}return t}function Yt(e,t){var n=au(e,t);return Oa(n)?n:r}function Xf(e){var t=ee.call(e,Gt),n=e[Gt];try{e[Gt]=r;var i=!0}catch{}var a=ur.call(e);return i&&(t?e[Gt]=n:delete e[Gt]),a}var Zi=Ti?function(e){return e==null?[]:(e=te(e),kt(Ti(e),function(t){return ya.call(e,t)}))}:ms,po=Ti?function(e){for(var t=[];e;)Ot(t,Zi(e)),e=dr(e);return t}:ms,ye=we;(Ei&&ye(new Ei(new ArrayBuffer(1)))!=tn||kn&&ye(new kn)!=tt||Fi&&ye(Fi.resolve())!=Cs||cn&&ye(new cn)!=nt||On&&ye(new On)!=Cn)&&(ye=function(e){var t=we(e),n=t==mt?e.constructor:r,i=n?Xt(n):"";if(i)switch(i){case ku:return tn;case Ou:return tt;case Lu:return Cs;case Nu:return nt;case Uu:return Cn}return t});function Zf(e,t,n){for(var i=-1,a=n.length;++i<a;){var u=n[i],p=u.size;switch(u.type){case"drop":e+=p;break;case"dropRight":t-=p;break;case"take":t=ve(t,e+p);break;case"takeRight":e=pe(e,t-p);break}}return{start:e,end:t}}function Qf(e){var t=e.match(ic);return t?t[1].split(sc):[]}function ho(e,t,n){t=$t(t,e);for(var i=-1,a=t.length,u=!1;++i<a;){var p=pt(t[i]);if(!(u=e!=null&&n(e,p)))break;e=e[p]}return u||++i!=a?u:(a=e==null?0:e.length,!!a&&Mr(a)&&It(p,a)&&($(e)||Zt(e)))}function ep(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&ee.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function go(e){return typeof e.constructor=="function"&&!qn(e)?fn(dr(e)):{}}function tp(e,t,n){var i=e.constructor;switch(t){case Rn:return Gi(e);case An:case Sn:return new i(+e);case tn:return $f(e,n);case Xr:case Zr:case Qr:case ei:case ti:case ni:case ri:case ii:case si:return Ya(e,n);case tt:return new i;case Tn:case Fn:return new i(e);case En:return Wf(e);case nt:return new i;case er:return Mf(e)}}function np(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(rc,`{
|
|
786
806
|
/* [wrapped with `+t+`] */
|
|
787
|
-
`)}function rp(e){return $(e)||Zt(e)||!!(_a&&e&&e[_a])}function At(e,t){var n=typeof e;return t=t??gt,!!t&&(n=="number"||n!="symbol"&&hu.test(e))&&e>-1&&e%1==0&&e<t}function xe(e,t,n){if(!ae(n))return!1;var i=typeof t;return(i=="number"?Fe(n)&&At(t,n.length):i=="string"&&t in n)?st(n[t],e):!1}function Qi(e,t){if($(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Oe(e)?!0:Ql.test(e)||!Zl.test(e)||t!=null&&e in te(t)}function ip(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function es(e){var t=kr(e),n=u[t];if(typeof n!="function"||!(t in z.prototype))return!1;if(e===n)return!0;var i=Yi(n);return!!i&&e===i[0]}function sp(e){return!!ga&&ga in e}var ap=lr?St:vs;function jn(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||ln;return e===n}function mo(e){return e===e&&!ae(e)}function vo(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==r||e in te(n))}}function op(e){var t=$r(e,function(i){return n.size===M&&n.clear(),i}),n=t.cache;return t}function lp(e,t){var n=e[1],i=t[1],a=n|i,c=a<(Ie|ht|Me),p=i==Me&&n==$e||i==Me&&n==Rt&&e[7].length<=t[8]||i==(Me|Rt)&&t[7].length<=t[8]&&n==$e;if(!(c||p))return e;i&Ie&&(e[2]=t[2],a|=n&Ie?0:xn);var d=t[3];if(d){var g=e[3];e[3]=g?Za(g,d,t[4]):d,e[4]=g?Lt(e[3],q):t[4]}return d=t[5],d&&(g=e[5],e[5]=g?Qa(g,d,t[6]):d,e[6]=g?Lt(e[5],q):t[6]),d=t[7],d&&(e[7]=d),i&Me&&(e[8]=e[8]==null?t[8]:ve(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=a,e}function up(e){var t=[];if(e!=null)for(var n in te(e))t.push(n);return t}function cp(e){return cr.call(e)}function yo(e,t,n){return t=pe(t===r?e.length-1:t,0),function(){for(var i=arguments,a=-1,c=pe(i.length-t,0),p=y(c);++a<c;)p[a]=i[t+a];a=-1;for(var d=y(t+1);++a<t;)d[a]=i[a];return d[t]=n(p),be(e,this,d)}}function _o(e,t){return t.length<2?e:Vt(e,Ke(t,0,-1))}function fp(e,t){for(var n=e.length,i=ve(t.length,n),a=Ee(e);i--;){var c=t[i];e[i]=At(c,n)?a[c]:r}return e}function ts(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var wo=Ao(ja),qn=Tc||function(e,t){return ge.setTimeout(e,t)},ns=Ao(Lf);function xo(e,t,n){var i=t+"";return ns(e,np(i,pp(Qf(i),n)))}function Ao(e){var t=0,n=0;return function(){var i=Pc(),a=Es-(i-n);if(n=i,a>0){if(++t>=Ts)return arguments[0]}else t=0;return e.apply(r,arguments)}}function Lr(e,t){var n=-1,i=e.length,a=i-1;for(t=t===r?i:t;++n<t;){var c=$i(n,a),p=e[c];e[c]=e[n],e[n]=p}return e.length=t,e}var So=op(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(eu,function(n,i,a,c){t.push(a?c.replace(lu,"$1"):i||n)}),t});function pt(e){if(typeof e=="string"||Oe(e))return e;var t=e+"";return t=="0"&&1/e==-je?"-0":t}function Xt(e){if(e!=null){try{return ur.call(e)}catch{}try{return e+""}catch{}}return""}function pp(e,t){return He(An,function(n){var i="_."+n[0];t&n[1]&&!ir(e,i)&&e.push(i)}),e.sort()}function Io(e){if(e instanceof z)return e.clone();var t=new ze(e.__wrapped__,e.__chain__);return t.__actions__=Ee(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function dp(e,t,n){(n?xe(e,t,n):t===r)?t=1:t=pe(W(t),0);var i=e==null?0:e.length;if(!i||t<1)return[];for(var a=0,c=0,p=y(mr(i/t));a<i;)p[c++]=Ke(e,a,a+=t);return p}function hp(e){for(var t=-1,n=e==null?0:e.length,i=0,a=[];++t<n;){var c=e[t];c&&(a[i++]=c)}return a}function gp(){var e=arguments.length;if(!e)return[];for(var t=y(e-1),n=arguments[0],i=e;i--;)t[i-1]=arguments[i];return Ot($(n)?Ee(n):[n],me(t,1))}var mp=j(function(e,t){return ue(e)?Dn(e,me(t,1,ue,!0)):[]}),vp=j(function(e,t){var n=Ve(t);return ue(n)&&(n=r),ue(e)?Dn(e,me(t,1,ue,!0),b(n,2)):[]}),yp=j(function(e,t){var n=Ve(t);return ue(n)&&(n=r),ue(e)?Dn(e,me(t,1,ue,!0),r,n):[]});function _p(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:W(t),Ke(e,t<0?0:t,i)):[]}function wp(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:W(t),t=i-t,Ke(e,0,t<0?0:t)):[]}function xp(e,t){return e&&e.length?Er(e,b(t,3),!0,!0):[]}function Ap(e,t){return e&&e.length?Er(e,b(t,3),!0):[]}function Sp(e,t,n,i){var a=e==null?0:e.length;return a?(n&&typeof n!="number"&&xe(e,t,n)&&(n=0,i=a),gf(e,t,n,i)):[]}function To(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=n==null?0:W(n);return a<0&&(a=pe(i+a,0)),sr(e,b(t,3),a)}function Eo(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=i-1;return n!==r&&(a=W(n),a=n<0?pe(i+a,0):ve(a,i-1)),sr(e,b(t,3),a,!0)}function Fo(e){var t=e==null?0:e.length;return t?me(e,1):[]}function Ip(e){var t=e==null?0:e.length;return t?me(e,je):[]}function Tp(e,t){var n=e==null?0:e.length;return n?(t=t===r?1:W(t),me(e,t)):[]}function Ep(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 Co(e){return e&&e.length?e[0]:r}function Fp(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=n==null?0:W(n);return a<0&&(a=pe(i+a,0)),rn(e,t,a)}function Cp(e){var t=e==null?0:e.length;return t?Ke(e,0,-1):[]}var Pp=j(function(e){var t=se(e,qi);return t.length&&t[0]===e[0]?Oi(t):[]}),bp=j(function(e){var t=Ve(e),n=se(e,qi);return t===Ve(n)?t=r:n.pop(),n.length&&n[0]===e[0]?Oi(n,b(t,2)):[]}),Rp=j(function(e){var t=Ve(e),n=se(e,qi);return t=typeof t=="function"?t:r,t&&n.pop(),n.length&&n[0]===e[0]?Oi(n,r,t):[]});function kp(e,t){return e==null?"":Fc.call(e,t)}function Ve(e){var t=e==null?0:e.length;return t?e[t-1]:r}function Op(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=i;return n!==r&&(a=W(n),a=a<0?pe(i+a,0):ve(a,i-1)),t===t?fc(e,t,a):sr(e,oa,a,!0)}function Lp(e,t){return e&&e.length?$a(e,W(t)):r}var Np=j(Po);function Po(e,t){return e&&e.length&&t&&t.length?Di(e,t):e}function Up(e,t,n){return e&&e.length&&t&&t.length?Di(e,t,b(n,2)):e}function Dp(e,t,n){return e&&e.length&&t&&t.length?Di(e,t,r,n):e}var $p=xt(function(e,t){var n=e==null?0:e.length,i=Pi(e,t);return Ba(e,se(t,function(a){return At(a,n)?+a:a}).sort(Xa)),i});function Wp(e,t){var n=[];if(!(e&&e.length))return n;var i=-1,a=[],c=e.length;for(t=b(t,3);++i<c;){var p=e[i];t(p,i,e)&&(n.push(p),a.push(i))}return Ba(e,a),n}function rs(e){return e==null?e:Rc.call(e)}function Mp(e,t,n){var i=e==null?0:e.length;return i?(n&&typeof n!="number"&&xe(e,t,n)?(t=0,n=i):(t=t==null?0:W(t),n=n===r?i:W(n)),Ke(e,t,n)):[]}function Bp(e,t){return Tr(e,t)}function jp(e,t,n){return Mi(e,t,b(n,2))}function qp(e,t){var n=e==null?0:e.length;if(n){var i=Tr(e,t);if(i<n&&st(e[i],t))return i}return-1}function Hp(e,t){return Tr(e,t,!0)}function Gp(e,t,n){return Mi(e,t,b(n,2),!0)}function zp(e,t){var n=e==null?0:e.length;if(n){var i=Tr(e,t,!0)-1;if(st(e[i],t))return i}return-1}function Jp(e){return e&&e.length?qa(e):[]}function Kp(e,t){return e&&e.length?qa(e,b(t,2)):[]}function Vp(e){var t=e==null?0:e.length;return t?Ke(e,1,t):[]}function Yp(e,t,n){return e&&e.length?(t=n||t===r?1:W(t),Ke(e,0,t<0?0:t)):[]}function Xp(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:W(t),t=i-t,Ke(e,t<0?0:t,i)):[]}function Zp(e,t){return e&&e.length?Er(e,b(t,3),!1,!0):[]}function Qp(e,t){return e&&e.length?Er(e,b(t,3)):[]}var ed=j(function(e){return Dt(me(e,1,ue,!0))}),td=j(function(e){var t=Ve(e);return ue(t)&&(t=r),Dt(me(e,1,ue,!0),b(t,2))}),nd=j(function(e){var t=Ve(e);return t=typeof t=="function"?t:r,Dt(me(e,1,ue,!0),r,t)});function rd(e){return e&&e.length?Dt(e):[]}function id(e,t){return e&&e.length?Dt(e,b(t,2)):[]}function sd(e,t){return t=typeof t=="function"?t:r,e&&e.length?Dt(e,r,t):[]}function is(e){if(!(e&&e.length))return[];var t=0;return e=kt(e,function(n){if(ue(n))return t=pe(n.length,t),!0}),xi(t,function(n){return se(e,yi(n))})}function bo(e,t){if(!(e&&e.length))return[];var n=is(e);return t==null?n:se(n,function(i){return be(t,r,i)})}var ad=j(function(e,t){return ue(e)?Dn(e,t):[]}),od=j(function(e){return ji(kt(e,ue))}),ld=j(function(e){var t=Ve(e);return ue(t)&&(t=r),ji(kt(e,ue),b(t,2))}),ud=j(function(e){var t=Ve(e);return t=typeof t=="function"?t:r,ji(kt(e,ue),r,t)}),cd=j(is);function fd(e,t){return Ja(e||[],t||[],Un)}function pd(e,t){return Ja(e||[],t||[],Mn)}var dd=j(function(e){var t=e.length,n=t>1?e[t-1]:r;return n=typeof n=="function"?(e.pop(),n):r,bo(e,n)});function Ro(e){var t=u(e);return t.__chain__=!0,t}function hd(e,t){return t(e),e}function Nr(e,t){return t(e)}var gd=xt(function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,a=function(c){return Pi(c,e)};return t>1||this.__actions__.length||!(i instanceof z)||!At(n)?this.thru(a):(i=i.slice(n,+n+(t?1:0)),i.__actions__.push({func:Nr,args:[a],thisArg:r}),new ze(i,this.__chain__).thru(function(c){return t&&!c.length&&c.push(r),c}))});function md(){return Ro(this)}function vd(){return new ze(this.value(),this.__chain__)}function yd(){this.__values__===r&&(this.__values__=Go(this.value()));var e=this.__index__>=this.__values__.length,t=e?r:this.__values__[this.__index__++];return{done:e,value:t}}function _d(){return this}function wd(e){for(var t,n=this;n instanceof wr;){var i=Io(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 xd(){var e=this.__wrapped__;if(e instanceof z){var t=e;return this.__actions__.length&&(t=new z(this)),t=t.reverse(),t.__actions__.push({func:Nr,args:[rs],thisArg:r}),new ze(t,this.__chain__)}return this.thru(rs)}function Ad(){return za(this.__wrapped__,this.__actions__)}var Sd=Fr(function(e,t,n){ee.call(e,n)?++e[n]:_t(e,n,1)});function Id(e,t,n){var i=$(e)?sa:hf;return n&&xe(e,t,n)&&(t=r),i(e,b(t,3))}function Td(e,t){var n=$(e)?kt:Pa;return n(e,b(t,3))}var Ed=ro(To),Fd=ro(Eo);function Cd(e,t){return me(Ur(e,t),1)}function Pd(e,t){return me(Ur(e,t),je)}function bd(e,t,n){return n=n===r?1:W(n),me(Ur(e,t),n)}function ko(e,t){var n=$(e)?He:Ut;return n(e,b(t,3))}function Oo(e,t){var n=$(e)?Ku:Ca;return n(e,b(t,3))}var Rd=Fr(function(e,t,n){ee.call(e,n)?e[n].push(t):_t(e,n,[t])});function kd(e,t,n,i){e=Fe(e)?e:mn(e),n=n&&!i?W(n):0;var a=e.length;return n<0&&(n=pe(a+n,0)),Br(e)?n<=a&&e.indexOf(t,n)>-1:!!a&&rn(e,t,n)>-1}var Od=j(function(e,t,n){var i=-1,a=typeof t=="function",c=Fe(e)?y(e.length):[];return Ut(e,function(p){c[++i]=a?be(t,p,n):$n(p,t,n)}),c}),Ld=Fr(function(e,t,n){_t(e,n,t)});function Ur(e,t){var n=$(e)?se:Na;return n(e,b(t,3))}function Nd(e,t,n,i){return e==null?[]:($(t)||(t=t==null?[]:[t]),n=i?r:n,$(n)||(n=n==null?[]:[n]),Wa(e,t,n))}var Ud=Fr(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function Dd(e,t,n){var i=$(e)?mi:ua,a=arguments.length<3;return i(e,b(t,4),n,a,Ut)}function $d(e,t,n){var i=$(e)?Vu:ua,a=arguments.length<3;return i(e,b(t,4),n,a,Ca)}function Wd(e,t){var n=$(e)?kt:Pa;return n(e,Wr(b(t,3)))}function Md(e){var t=$(e)?Ia:kf;return t(e)}function Bd(e,t,n){(n?xe(e,t,n):t===r)?t=1:t=W(t);var i=$(e)?uf:Of;return i(e,t)}function jd(e){var t=$(e)?cf:Nf;return t(e)}function qd(e){if(e==null)return 0;if(Fe(e))return Br(e)?an(e):e.length;var t=ye(e);return t==tt||t==nt?e.size:Ni(e).length}function Hd(e,t,n){var i=$(e)?vi:Uf;return n&&xe(e,t,n)&&(t=r),i(e,b(t,3))}var Gd=j(function(e,t){if(e==null)return[];var n=t.length;return n>1&&xe(e,t[0],t[1])?t=[]:n>2&&xe(t[0],t[1],t[2])&&(t=[t[0]]),Wa(e,me(t,1),[])}),Dr=Ic||function(){return ge.Date.now()};function zd(e,t){if(typeof t!="function")throw new Ge(v);return e=W(e),function(){if(--e<1)return t.apply(this,arguments)}}function Lo(e,t,n){return t=n?r:t,t=e&&t==null?e.length:t,wt(e,Me,r,r,r,r,t)}function No(e,t){var n;if(typeof t!="function")throw new Ge(v);return e=W(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=r),n}}var ss=j(function(e,t,n){var i=Ie;if(n.length){var a=Lt(n,hn(ss));i|=We}return wt(e,i,t,n,a)}),Uo=j(function(e,t,n){var i=Ie|ht;if(n.length){var a=Lt(n,hn(Uo));i|=We}return wt(t,i,e,n,a)});function Do(e,t,n){t=n?r:t;var i=wt(e,$e,r,r,r,r,r,t);return i.placeholder=Do.placeholder,i}function $o(e,t,n){t=n?r:t;var i=wt(e,Pt,r,r,r,r,r,t);return i.placeholder=$o.placeholder,i}function Wo(e,t,n){var i,a,c,p,d,g,w=0,x=!1,A=!1,I=!0;if(typeof e!="function")throw new Ge(v);t=Ye(t)||0,ae(n)&&(x=!!n.leading,A="maxWait"in n,c=A?pe(Ye(n.maxWait)||0,t):c,I="trailing"in n?!!n.trailing:I);function F(ce){var at=i,Tt=a;return i=a=r,w=ce,p=e.apply(Tt,at),p}function O(ce){return w=ce,d=qn(H,t),x?F(ce):p}function B(ce){var at=ce-g,Tt=ce-w,il=t-at;return A?ve(il,c-Tt):il}function L(ce){var at=ce-g,Tt=ce-w;return g===r||at>=t||at<0||A&&Tt>=c}function H(){var ce=Dr();if(L(ce))return J(ce);d=qn(H,B(ce))}function J(ce){return d=r,I&&i?F(ce):(i=a=r,p)}function Le(){d!==r&&Ka(d),w=0,i=g=a=d=r}function Ae(){return d===r?p:J(Dr())}function Ne(){var ce=Dr(),at=L(ce);if(i=arguments,a=this,g=ce,at){if(d===r)return O(g);if(A)return Ka(d),d=qn(H,t),F(g)}return d===r&&(d=qn(H,t)),p}return Ne.cancel=Le,Ne.flush=Ae,Ne}var Jd=j(function(e,t){return Fa(e,1,t)}),Kd=j(function(e,t,n){return Fa(e,Ye(t)||0,n)});function Vd(e){return wt(e,Qt)}function $r(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new Ge(v);var n=function(){var i=arguments,a=t?t.apply(this,i):i[0],c=n.cache;if(c.has(a))return c.get(a);var p=e.apply(this,i);return n.cache=c.set(a,p)||c,p};return n.cache=new($r.Cache||yt),n}$r.Cache=yt;function Wr(e){if(typeof e!="function")throw new Ge(v);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 Yd(e){return No(2,e)}var Xd=Df(function(e,t){t=t.length==1&&$(t[0])?se(t[0],Re(b())):se(me(t,1),Re(b()));var n=t.length;return j(function(i){for(var a=-1,c=ve(i.length,n);++a<c;)i[a]=t[a].call(this,i[a]);return be(e,this,i)})}),as=j(function(e,t){var n=Lt(t,hn(as));return wt(e,We,r,t,n)}),Mo=j(function(e,t){var n=Lt(t,hn(Mo));return wt(e,bt,r,t,n)}),Zd=xt(function(e,t){return wt(e,Rt,r,r,r,t)});function Qd(e,t){if(typeof e!="function")throw new Ge(v);return t=t===r?t:W(t),j(e,t)}function eh(e,t){if(typeof e!="function")throw new Ge(v);return t=t==null?0:pe(W(t),0),j(function(n){var i=n[t],a=Wt(n,0,t);return i&&Ot(a,i),be(e,this,a)})}function th(e,t,n){var i=!0,a=!0;if(typeof e!="function")throw new Ge(v);return ae(n)&&(i="leading"in n?!!n.leading:i,a="trailing"in n?!!n.trailing:a),Wo(e,t,{leading:i,maxWait:t,trailing:a})}function nh(e){return Lo(e,1)}function rh(e,t){return as(Hi(t),e)}function ih(){if(!arguments.length)return[];var e=arguments[0];return $(e)?e:[e]}function sh(e){return Je(e,V)}function ah(e,t){return t=typeof t=="function"?t:r,Je(e,V,t)}function oh(e){return Je(e,X|V)}function lh(e,t){return t=typeof t=="function"?t:r,Je(e,X|V,t)}function uh(e,t){return t==null||Ea(e,t,he(t))}function st(e,t){return e===t||e!==e&&t!==t}var ch=Rr(ki),fh=Rr(function(e,t){return e>=t}),Zt=ka(function(){return arguments}())?ka:function(e){return le(e)&&ee.call(e,"callee")&&!ya.call(e,"callee")},$=y.isArray,ph=Qs?Re(Qs):wf;function Fe(e){return e!=null&&Mr(e.length)&&!St(e)}function ue(e){return le(e)&&Fe(e)}function dh(e){return e===!0||e===!1||le(e)&&we(e)==Sn}var Mt=Ec||vs,hh=ea?Re(ea):xf;function gh(e){return le(e)&&e.nodeType===1&&!Hn(e)}function mh(e){if(e==null)return!0;if(Fe(e)&&($(e)||typeof e=="string"||typeof e.splice=="function"||Mt(e)||gn(e)||Zt(e)))return!e.length;var t=ye(e);if(t==tt||t==nt)return!e.size;if(jn(e))return!Ni(e).length;for(var n in e)if(ee.call(e,n))return!1;return!0}function vh(e,t){return Wn(e,t)}function yh(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 os(e){if(!le(e))return!1;var t=we(e);return t==Zn||t==Ml||typeof e.message=="string"&&typeof e.name=="string"&&!Hn(e)}function _h(e){return typeof e=="number"&&wa(e)}function St(e){if(!ae(e))return!1;var t=we(e);return t==Qn||t==Fs||t==Wl||t==jl}function Bo(e){return typeof e=="number"&&e==W(e)}function Mr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=gt}function ae(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function le(e){return e!=null&&typeof e=="object"}var jo=ta?Re(ta):Sf;function wh(e,t){return e===t||Li(e,t,Xi(t))}function xh(e,t,n){return n=typeof n=="function"?n:r,Li(e,t,Xi(t),n)}function Ah(e){return qo(e)&&e!=+e}function Sh(e){if(ap(e))throw new D(m);return Oa(e)}function Ih(e){return e===null}function Th(e){return e==null}function qo(e){return typeof e=="number"||le(e)&&we(e)==Tn}function Hn(e){if(!le(e)||we(e)!=mt)return!1;var t=dr(e);if(t===null)return!0;var n=ee.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&ur.call(n)==wc}var ls=na?Re(na):If;function Eh(e){return Bo(e)&&e>=-gt&&e<=gt}var Ho=ra?Re(ra):Tf;function Br(e){return typeof e=="string"||!$(e)&&le(e)&&we(e)==Fn}function Oe(e){return typeof e=="symbol"||le(e)&&we(e)==er}var gn=ia?Re(ia):Ef;function Fh(e){return e===r}function Ch(e){return le(e)&&ye(e)==Cn}function Ph(e){return le(e)&&we(e)==Hl}var bh=Rr(Ui),Rh=Rr(function(e,t){return e<=t});function Go(e){if(!e)return[];if(Fe(e))return Br(e)?rt(e):Ee(e);if(Rn&&e[Rn])return lc(e[Rn]());var t=ye(e),n=t==tt?Si:t==nt?ar:mn;return n(e)}function It(e){if(!e)return e===0?e:0;if(e=Ye(e),e===je||e===-je){var t=e<0?-1:1;return t*G}return e===e?e:0}function W(e){var t=It(e),n=t%1;return t===t?n?t-n:t:0}function zo(e){return e?Kt(W(e),0,de):0}function Ye(e){if(typeof e=="number")return e;if(Oe(e))return Te;if(ae(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ae(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=ca(e);var n=fu.test(e);return n||du.test(e)?Gu(e.slice(2),n?2:8):cu.test(e)?Te:+e}function Jo(e){return ft(e,Ce(e))}function kh(e){return e?Kt(W(e),-gt,gt):e===0?e:0}function Q(e){return e==null?"":ke(e)}var Oh=pn(function(e,t){if(jn(t)||Fe(t)){ft(t,he(t),e);return}for(var n in t)ee.call(t,n)&&Un(e,n,t[n])}),Ko=pn(function(e,t){ft(t,Ce(t),e)}),jr=pn(function(e,t,n,i){ft(t,Ce(t),e,i)}),Lh=pn(function(e,t,n,i){ft(t,he(t),e,i)}),Nh=xt(Pi);function Uh(e,t){var n=fn(e);return t==null?n:Ta(n,t)}var Dh=j(function(e,t){e=te(e);var n=-1,i=t.length,a=i>2?t[2]:r;for(a&&xe(t[0],t[1],a)&&(i=1);++n<i;)for(var c=t[n],p=Ce(c),d=-1,g=p.length;++d<g;){var w=p[d],x=e[w];(x===r||st(x,ln[w])&&!ee.call(e,w))&&(e[w]=c[w])}return e}),$h=j(function(e){return e.push(r,co),be(Vo,r,e)});function Wh(e,t){return aa(e,b(t,3),ct)}function Mh(e,t){return aa(e,b(t,3),Ri)}function Bh(e,t){return e==null?e:bi(e,b(t,3),Ce)}function jh(e,t){return e==null?e:ba(e,b(t,3),Ce)}function qh(e,t){return e&&ct(e,b(t,3))}function Hh(e,t){return e&&Ri(e,b(t,3))}function Gh(e){return e==null?[]:Sr(e,he(e))}function zh(e){return e==null?[]:Sr(e,Ce(e))}function us(e,t,n){var i=e==null?r:Vt(e,t);return i===r?n:i}function Jh(e,t){return e!=null&&ho(e,t,mf)}function cs(e,t){return e!=null&&ho(e,t,vf)}var Kh=so(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=cr.call(t)),e[t]=n},ps(Pe)),Vh=so(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=cr.call(t)),ee.call(e,t)?e[t].push(n):e[t]=[n]},b),Yh=j($n);function he(e){return Fe(e)?Sa(e):Ni(e)}function Ce(e){return Fe(e)?Sa(e,!0):Ff(e)}function Xh(e,t){var n={};return t=b(t,3),ct(e,function(i,a,c){_t(n,t(i,a,c),i)}),n}function Zh(e,t){var n={};return t=b(t,3),ct(e,function(i,a,c){_t(n,a,t(i,a,c))}),n}var Qh=pn(function(e,t,n){Ir(e,t,n)}),Vo=pn(function(e,t,n,i){Ir(e,t,n,i)}),eg=xt(function(e,t){var n={};if(e==null)return n;var i=!1;t=se(t,function(c){return c=$t(c,e),i||(i=c.length>1),c}),ft(e,Vi(e),n),i&&(n=Je(n,X|U|V,Kf));for(var a=t.length;a--;)Bi(n,t[a]);return n});function tg(e,t){return Yo(e,Wr(b(t)))}var ng=xt(function(e,t){return e==null?{}:Pf(e,t)});function Yo(e,t){if(e==null)return{};var n=se(Vi(e),function(i){return[i]});return t=b(t),Ma(e,n,function(i,a){return t(i,a[0])})}function rg(e,t,n){t=$t(t,e);var i=-1,a=t.length;for(a||(a=1,e=r);++i<a;){var c=e==null?r:e[pt(t[i])];c===r&&(i=a,c=n),e=St(c)?c.call(e):c}return e}function ig(e,t,n){return e==null?e:Mn(e,t,n)}function sg(e,t,n,i){return i=typeof i=="function"?i:r,e==null?e:Mn(e,t,n,i)}var Xo=lo(he),Zo=lo(Ce);function ag(e,t,n){var i=$(e),a=i||Mt(e)||gn(e);if(t=b(t,4),n==null){var c=e&&e.constructor;a?n=i?new c:[]:ae(e)?n=St(c)?fn(dr(e)):{}:n={}}return(a?He:ct)(e,function(p,d,g){return t(n,p,d,g)}),n}function og(e,t){return e==null?!0:Bi(e,t)}function lg(e,t,n){return e==null?e:Ga(e,t,Hi(n))}function ug(e,t,n,i){return i=typeof i=="function"?i:r,e==null?e:Ga(e,t,Hi(n),i)}function mn(e){return e==null?[]:Ai(e,he(e))}function cg(e){return e==null?[]:Ai(e,Ce(e))}function fg(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=Ye(n),n=n===n?n:0),t!==r&&(t=Ye(t),t=t===t?t:0),Kt(Ye(e),t,n)}function pg(e,t,n){return t=It(t),n===r?(n=t,t=0):n=It(n),e=Ye(e),yf(e,t,n)}function dg(e,t,n){if(n&&typeof n!="boolean"&&xe(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=It(e),t===r?(t=e,e=0):t=It(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var a=xa();return ve(e+a*(t-e+Hu("1e-"+((a+"").length-1))),t)}return $i(e,t)}var hg=dn(function(e,t,n){return t=t.toLowerCase(),e+(n?Qo(t):t)});function Qo(e){return fs(Q(e).toLowerCase())}function el(e){return e=Q(e),e&&e.replace(gu,rc).replace(Lu,"")}function gg(e,t,n){e=Q(e),t=ke(t);var i=e.length;n=n===r?i:Kt(W(n),0,i);var a=n;return n-=t.length,n>=0&&e.slice(n,a)==t}function mg(e){return e=Q(e),e&&Vl.test(e)?e.replace(bs,ic):e}function vg(e){return e=Q(e),e&&tu.test(e)?e.replace(ai,"\\$&"):e}var yg=dn(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),_g=dn(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),wg=no("toLowerCase");function xg(e,t,n){e=Q(e),t=W(t);var i=t?an(e):0;if(!t||i>=t)return e;var a=(t-i)/2;return br(vr(a),n)+e+br(mr(a),n)}function Ag(e,t,n){e=Q(e),t=W(t);var i=t?an(e):0;return t&&i<t?e+br(t-i,n):e}function Sg(e,t,n){e=Q(e),t=W(t);var i=t?an(e):0;return t&&i<t?br(t-i,n)+e:e}function Ig(e,t,n){return n||t==null?t=0:t&&(t=+t),bc(Q(e).replace(oi,""),t||0)}function Tg(e,t,n){return(n?xe(e,t,n):t===r)?t=1:t=W(t),Wi(Q(e),t)}function Eg(){var e=arguments,t=Q(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var Fg=dn(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});function Cg(e,t,n){return n&&typeof n!="number"&&xe(e,t,n)&&(t=n=r),n=n===r?de:n>>>0,n?(e=Q(e),e&&(typeof t=="string"||t!=null&&!ls(t))&&(t=ke(t),!t&&sn(e))?Wt(rt(e),0,n):e.split(t,n)):[]}var Pg=dn(function(e,t,n){return e+(n?" ":"")+fs(t)});function bg(e,t,n){return e=Q(e),n=n==null?0:Kt(W(n),0,e.length),t=ke(t),e.slice(n,n+t.length)==t}function Rg(e,t,n){var i=u.templateSettings;n&&xe(e,t,n)&&(t=r),e=Q(e),t=jr({},t,i,uo);var a=jr({},t.imports,i.imports,uo),c=he(a),p=Ai(a,c),d,g,w=0,x=t.interpolate||tr,A="__p += '",I=Ii((t.escape||tr).source+"|"+x.source+"|"+(x===Rs?uu:tr).source+"|"+(t.evaluate||tr).source+"|$","g"),F="//# sourceURL="+(ee.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Wu+"]")+`
|
|
788
|
-
`;e.replace(
|
|
807
|
+
`)}function rp(e){return $(e)||Zt(e)||!!(_a&&e&&e[_a])}function It(e,t){var n=typeof e;return t=t??gt,!!t&&(n=="number"||n!="symbol"&&hc.test(e))&&e>-1&&e%1==0&&e<t}function xe(e,t,n){if(!ae(n))return!1;var i=typeof t;return(i=="number"?Fe(n)&&It(t,n.length):i=="string"&&t in n)?st(n[t],e):!1}function Qi(e,t){if($(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Oe(e)?!0:Ql.test(e)||!Zl.test(e)||t!=null&&e in te(t)}function ip(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function es(e){var t=kr(e),n=c[t];if(typeof n!="function"||!(t in z.prototype))return!1;if(e===n)return!0;var i=Yi(n);return!!i&&e===i[0]}function sp(e){return!!ga&&ga in e}var ap=lr?At:vs;function qn(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||ln;return e===n}function mo(e){return e===e&&!ae(e)}function vo(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==r||e in te(n))}}function op(e){var t=$r(e,function(i){return n.size===M&&n.clear(),i}),n=t.cache;return t}function lp(e,t){var n=e[1],i=t[1],a=n|i,u=a<(Se|ht|Me),p=i==Me&&n==$e||i==Me&&n==bt&&e[7].length<=t[8]||i==(Me|bt)&&t[7].length<=t[8]&&n==$e;if(!(u||p))return e;i&Se&&(e[2]=t[2],a|=n&Se?0:xn);var d=t[3];if(d){var g=e[3];e[3]=g?Za(g,d,t[4]):d,e[4]=g?Lt(e[3],j):t[4]}return d=t[5],d&&(g=e[5],e[5]=g?Qa(g,d,t[6]):d,e[6]=g?Lt(e[5],j):t[6]),d=t[7],d&&(e[7]=d),i&Me&&(e[8]=e[8]==null?t[8]:ve(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=a,e}function cp(e){var t=[];if(e!=null)for(var n in te(e))t.push(n);return t}function up(e){return ur.call(e)}function yo(e,t,n){return t=pe(t===r?e.length-1:t,0),function(){for(var i=arguments,a=-1,u=pe(i.length-t,0),p=y(u);++a<u;)p[a]=i[t+a];a=-1;for(var d=y(t+1);++a<t;)d[a]=i[a];return d[t]=n(p),Pe(e,this,d)}}function _o(e,t){return t.length<2?e:Vt(e,Ke(t,0,-1))}function fp(e,t){for(var n=e.length,i=ve(t.length,n),a=Ee(e);i--;){var u=t[i];e[i]=It(u,n)?a[u]:r}return e}function ts(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var wo=Io(qa),jn=Tu||function(e,t){return ge.setTimeout(e,t)},ns=Io(Lf);function xo(e,t,n){var i=t+"";return ns(e,np(i,pp(Qf(i),n)))}function Io(e){var t=0,n=0;return function(){var i=Ru(),a=Es-(i-n);if(n=i,a>0){if(++t>=Ts)return arguments[0]}else t=0;return e.apply(r,arguments)}}function Lr(e,t){var n=-1,i=e.length,a=i-1;for(t=t===r?i:t;++n<t;){var u=$i(n,a),p=e[u];e[u]=e[n],e[n]=p}return e.length=t,e}var Ao=op(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(ec,function(n,i,a,u){t.push(a?u.replace(lc,"$1"):i||n)}),t});function pt(e){if(typeof e=="string"||Oe(e))return e;var t=e+"";return t=="0"&&1/e==-qe?"-0":t}function Xt(e){if(e!=null){try{return cr.call(e)}catch{}try{return e+""}catch{}}return""}function pp(e,t){return He(In,function(n){var i="_."+n[0];t&n[1]&&!ir(e,i)&&e.push(i)}),e.sort()}function So(e){if(e instanceof z)return e.clone();var t=new ze(e.__wrapped__,e.__chain__);return t.__actions__=Ee(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function dp(e,t,n){(n?xe(e,t,n):t===r)?t=1:t=pe(W(t),0);var i=e==null?0:e.length;if(!i||t<1)return[];for(var a=0,u=0,p=y(mr(i/t));a<i;)p[u++]=Ke(e,a,a+=t);return p}function hp(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 gp(){var e=arguments.length;if(!e)return[];for(var t=y(e-1),n=arguments[0],i=e;i--;)t[i-1]=arguments[i];return Ot($(n)?Ee(n):[n],me(t,1))}var mp=q(function(e,t){return ce(e)?Dn(e,me(t,1,ce,!0)):[]}),vp=q(function(e,t){var n=Ve(t);return ce(n)&&(n=r),ce(e)?Dn(e,me(t,1,ce,!0),P(n,2)):[]}),yp=q(function(e,t){var n=Ve(t);return ce(n)&&(n=r),ce(e)?Dn(e,me(t,1,ce,!0),r,n):[]});function _p(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:W(t),Ke(e,t<0?0:t,i)):[]}function wp(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:W(t),t=i-t,Ke(e,0,t<0?0:t)):[]}function xp(e,t){return e&&e.length?Er(e,P(t,3),!0,!0):[]}function Ip(e,t){return e&&e.length?Er(e,P(t,3),!0):[]}function Ap(e,t,n,i){var a=e==null?0:e.length;return a?(n&&typeof n!="number"&&xe(e,t,n)&&(n=0,i=a),gf(e,t,n,i)):[]}function To(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=n==null?0:W(n);return a<0&&(a=pe(i+a,0)),sr(e,P(t,3),a)}function Eo(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=i-1;return n!==r&&(a=W(n),a=n<0?pe(i+a,0):ve(a,i-1)),sr(e,P(t,3),a,!0)}function Fo(e){var t=e==null?0:e.length;return t?me(e,1):[]}function Sp(e){var t=e==null?0:e.length;return t?me(e,qe):[]}function Tp(e,t){var n=e==null?0:e.length;return n?(t=t===r?1:W(t),me(e,t)):[]}function Ep(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 Co(e){return e&&e.length?e[0]:r}function Fp(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=n==null?0:W(n);return a<0&&(a=pe(i+a,0)),rn(e,t,a)}function Cp(e){var t=e==null?0:e.length;return t?Ke(e,0,-1):[]}var Rp=q(function(e){var t=se(e,ji);return t.length&&t[0]===e[0]?Oi(t):[]}),Pp=q(function(e){var t=Ve(e),n=se(e,ji);return t===Ve(n)?t=r:n.pop(),n.length&&n[0]===e[0]?Oi(n,P(t,2)):[]}),bp=q(function(e){var t=Ve(e),n=se(e,ji);return t=typeof t=="function"?t:r,t&&n.pop(),n.length&&n[0]===e[0]?Oi(n,r,t):[]});function kp(e,t){return e==null?"":Fu.call(e,t)}function Ve(e){var t=e==null?0:e.length;return t?e[t-1]:r}function Op(e,t,n){var i=e==null?0:e.length;if(!i)return-1;var a=i;return n!==r&&(a=W(n),a=a<0?pe(i+a,0):ve(a,i-1)),t===t?fu(e,t,a):sr(e,oa,a,!0)}function Lp(e,t){return e&&e.length?$a(e,W(t)):r}var Np=q(Ro);function Ro(e,t){return e&&e.length&&t&&t.length?Di(e,t):e}function Up(e,t,n){return e&&e.length&&t&&t.length?Di(e,t,P(n,2)):e}function Dp(e,t,n){return e&&e.length&&t&&t.length?Di(e,t,r,n):e}var $p=xt(function(e,t){var n=e==null?0:e.length,i=Ri(e,t);return Ba(e,se(t,function(a){return It(a,n)?+a:a}).sort(Xa)),i});function Wp(e,t){var n=[];if(!(e&&e.length))return n;var i=-1,a=[],u=e.length;for(t=P(t,3);++i<u;){var p=e[i];t(p,i,e)&&(n.push(p),a.push(i))}return Ba(e,a),n}function rs(e){return e==null?e:bu.call(e)}function Mp(e,t,n){var i=e==null?0:e.length;return i?(n&&typeof n!="number"&&xe(e,t,n)?(t=0,n=i):(t=t==null?0:W(t),n=n===r?i:W(n)),Ke(e,t,n)):[]}function Bp(e,t){return Tr(e,t)}function qp(e,t,n){return Mi(e,t,P(n,2))}function jp(e,t){var n=e==null?0:e.length;if(n){var i=Tr(e,t);if(i<n&&st(e[i],t))return i}return-1}function Hp(e,t){return Tr(e,t,!0)}function Gp(e,t,n){return Mi(e,t,P(n,2),!0)}function zp(e,t){var n=e==null?0:e.length;if(n){var i=Tr(e,t,!0)-1;if(st(e[i],t))return i}return-1}function Jp(e){return e&&e.length?ja(e):[]}function Kp(e,t){return e&&e.length?ja(e,P(t,2)):[]}function Vp(e){var t=e==null?0:e.length;return t?Ke(e,1,t):[]}function Yp(e,t,n){return e&&e.length?(t=n||t===r?1:W(t),Ke(e,0,t<0?0:t)):[]}function Xp(e,t,n){var i=e==null?0:e.length;return i?(t=n||t===r?1:W(t),t=i-t,Ke(e,t<0?0:t,i)):[]}function Zp(e,t){return e&&e.length?Er(e,P(t,3),!1,!0):[]}function Qp(e,t){return e&&e.length?Er(e,P(t,3)):[]}var ed=q(function(e){return Dt(me(e,1,ce,!0))}),td=q(function(e){var t=Ve(e);return ce(t)&&(t=r),Dt(me(e,1,ce,!0),P(t,2))}),nd=q(function(e){var t=Ve(e);return t=typeof t=="function"?t:r,Dt(me(e,1,ce,!0),r,t)});function rd(e){return e&&e.length?Dt(e):[]}function id(e,t){return e&&e.length?Dt(e,P(t,2)):[]}function sd(e,t){return t=typeof t=="function"?t:r,e&&e.length?Dt(e,r,t):[]}function is(e){if(!(e&&e.length))return[];var t=0;return e=kt(e,function(n){if(ce(n))return t=pe(n.length,t),!0}),xi(t,function(n){return se(e,yi(n))})}function Po(e,t){if(!(e&&e.length))return[];var n=is(e);return t==null?n:se(n,function(i){return Pe(t,r,i)})}var ad=q(function(e,t){return ce(e)?Dn(e,t):[]}),od=q(function(e){return qi(kt(e,ce))}),ld=q(function(e){var t=Ve(e);return ce(t)&&(t=r),qi(kt(e,ce),P(t,2))}),cd=q(function(e){var t=Ve(e);return t=typeof t=="function"?t:r,qi(kt(e,ce),r,t)}),ud=q(is);function fd(e,t){return Ja(e||[],t||[],Un)}function pd(e,t){return Ja(e||[],t||[],Mn)}var dd=q(function(e){var t=e.length,n=t>1?e[t-1]:r;return n=typeof n=="function"?(e.pop(),n):r,Po(e,n)});function bo(e){var t=c(e);return t.__chain__=!0,t}function hd(e,t){return t(e),e}function Nr(e,t){return t(e)}var gd=xt(function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,a=function(u){return Ri(u,e)};return t>1||this.__actions__.length||!(i instanceof z)||!It(n)?this.thru(a):(i=i.slice(n,+n+(t?1:0)),i.__actions__.push({func:Nr,args:[a],thisArg:r}),new ze(i,this.__chain__).thru(function(u){return t&&!u.length&&u.push(r),u}))});function md(){return bo(this)}function vd(){return new ze(this.value(),this.__chain__)}function yd(){this.__values__===r&&(this.__values__=Go(this.value()));var e=this.__index__>=this.__values__.length,t=e?r:this.__values__[this.__index__++];return{done:e,value:t}}function _d(){return this}function wd(e){for(var t,n=this;n instanceof wr;){var i=So(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 xd(){var e=this.__wrapped__;if(e instanceof z){var t=e;return this.__actions__.length&&(t=new z(this)),t=t.reverse(),t.__actions__.push({func:Nr,args:[rs],thisArg:r}),new ze(t,this.__chain__)}return this.thru(rs)}function Id(){return za(this.__wrapped__,this.__actions__)}var Ad=Fr(function(e,t,n){ee.call(e,n)?++e[n]:_t(e,n,1)});function Sd(e,t,n){var i=$(e)?sa:hf;return n&&xe(e,t,n)&&(t=r),i(e,P(t,3))}function Td(e,t){var n=$(e)?kt:Ra;return n(e,P(t,3))}var Ed=ro(To),Fd=ro(Eo);function Cd(e,t){return me(Ur(e,t),1)}function Rd(e,t){return me(Ur(e,t),qe)}function Pd(e,t,n){return n=n===r?1:W(n),me(Ur(e,t),n)}function ko(e,t){var n=$(e)?He:Ut;return n(e,P(t,3))}function Oo(e,t){var n=$(e)?Kc:Ca;return n(e,P(t,3))}var bd=Fr(function(e,t,n){ee.call(e,n)?e[n].push(t):_t(e,n,[t])});function kd(e,t,n,i){e=Fe(e)?e:mn(e),n=n&&!i?W(n):0;var a=e.length;return n<0&&(n=pe(a+n,0)),Br(e)?n<=a&&e.indexOf(t,n)>-1:!!a&&rn(e,t,n)>-1}var Od=q(function(e,t,n){var i=-1,a=typeof t=="function",u=Fe(e)?y(e.length):[];return Ut(e,function(p){u[++i]=a?Pe(t,p,n):$n(p,t,n)}),u}),Ld=Fr(function(e,t,n){_t(e,n,t)});function Ur(e,t){var n=$(e)?se:Na;return n(e,P(t,3))}function Nd(e,t,n,i){return e==null?[]:($(t)||(t=t==null?[]:[t]),n=i?r:n,$(n)||(n=n==null?[]:[n]),Wa(e,t,n))}var Ud=Fr(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function Dd(e,t,n){var i=$(e)?mi:ca,a=arguments.length<3;return i(e,P(t,4),n,a,Ut)}function $d(e,t,n){var i=$(e)?Vc:ca,a=arguments.length<3;return i(e,P(t,4),n,a,Ca)}function Wd(e,t){var n=$(e)?kt:Ra;return n(e,Wr(P(t,3)))}function Md(e){var t=$(e)?Sa:kf;return t(e)}function Bd(e,t,n){(n?xe(e,t,n):t===r)?t=1:t=W(t);var i=$(e)?cf:Of;return i(e,t)}function qd(e){var t=$(e)?uf:Nf;return t(e)}function jd(e){if(e==null)return 0;if(Fe(e))return Br(e)?an(e):e.length;var t=ye(e);return t==tt||t==nt?e.size:Ni(e).length}function Hd(e,t,n){var i=$(e)?vi:Uf;return n&&xe(e,t,n)&&(t=r),i(e,P(t,3))}var Gd=q(function(e,t){if(e==null)return[];var n=t.length;return n>1&&xe(e,t[0],t[1])?t=[]:n>2&&xe(t[0],t[1],t[2])&&(t=[t[0]]),Wa(e,me(t,1),[])}),Dr=Su||function(){return ge.Date.now()};function zd(e,t){if(typeof t!="function")throw new Ge(v);return e=W(e),function(){if(--e<1)return t.apply(this,arguments)}}function Lo(e,t,n){return t=n?r:t,t=e&&t==null?e.length:t,wt(e,Me,r,r,r,r,t)}function No(e,t){var n;if(typeof t!="function")throw new Ge(v);return e=W(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=r),n}}var ss=q(function(e,t,n){var i=Se;if(n.length){var a=Lt(n,hn(ss));i|=We}return wt(e,i,t,n,a)}),Uo=q(function(e,t,n){var i=Se|ht;if(n.length){var a=Lt(n,hn(Uo));i|=We}return wt(t,i,e,n,a)});function Do(e,t,n){t=n?r:t;var i=wt(e,$e,r,r,r,r,r,t);return i.placeholder=Do.placeholder,i}function $o(e,t,n){t=n?r:t;var i=wt(e,Rt,r,r,r,r,r,t);return i.placeholder=$o.placeholder,i}function Wo(e,t,n){var i,a,u,p,d,g,w=0,x=!1,I=!1,S=!0;if(typeof e!="function")throw new Ge(v);t=Ye(t)||0,ae(n)&&(x=!!n.leading,I="maxWait"in n,u=I?pe(Ye(n.maxWait)||0,t):u,S="trailing"in n?!!n.trailing:S);function F(ue){var at=i,Tt=a;return i=a=r,w=ue,p=e.apply(Tt,at),p}function O(ue){return w=ue,d=jn(H,t),x?F(ue):p}function B(ue){var at=ue-g,Tt=ue-w,il=t-at;return I?ve(il,u-Tt):il}function L(ue){var at=ue-g,Tt=ue-w;return g===r||at>=t||at<0||I&&Tt>=u}function H(){var ue=Dr();if(L(ue))return J(ue);d=jn(H,B(ue))}function J(ue){return d=r,S&&i?F(ue):(i=a=r,p)}function Le(){d!==r&&Ka(d),w=0,i=g=a=d=r}function Ie(){return d===r?p:J(Dr())}function Ne(){var ue=Dr(),at=L(ue);if(i=arguments,a=this,g=ue,at){if(d===r)return O(g);if(I)return Ka(d),d=jn(H,t),F(g)}return d===r&&(d=jn(H,t)),p}return Ne.cancel=Le,Ne.flush=Ie,Ne}var Jd=q(function(e,t){return Fa(e,1,t)}),Kd=q(function(e,t,n){return Fa(e,Ye(t)||0,n)});function Vd(e){return wt(e,Qt)}function $r(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new Ge(v);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 p=e.apply(this,i);return n.cache=u.set(a,p)||u,p};return n.cache=new($r.Cache||yt),n}$r.Cache=yt;function Wr(e){if(typeof e!="function")throw new Ge(v);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 Yd(e){return No(2,e)}var Xd=Df(function(e,t){t=t.length==1&&$(t[0])?se(t[0],be(P())):se(me(t,1),be(P()));var n=t.length;return q(function(i){for(var a=-1,u=ve(i.length,n);++a<u;)i[a]=t[a].call(this,i[a]);return Pe(e,this,i)})}),as=q(function(e,t){var n=Lt(t,hn(as));return wt(e,We,r,t,n)}),Mo=q(function(e,t){var n=Lt(t,hn(Mo));return wt(e,Pt,r,t,n)}),Zd=xt(function(e,t){return wt(e,bt,r,r,r,t)});function Qd(e,t){if(typeof e!="function")throw new Ge(v);return t=t===r?t:W(t),q(e,t)}function eh(e,t){if(typeof e!="function")throw new Ge(v);return t=t==null?0:pe(W(t),0),q(function(n){var i=n[t],a=Wt(n,0,t);return i&&Ot(a,i),Pe(e,this,a)})}function th(e,t,n){var i=!0,a=!0;if(typeof e!="function")throw new Ge(v);return ae(n)&&(i="leading"in n?!!n.leading:i,a="trailing"in n?!!n.trailing:a),Wo(e,t,{leading:i,maxWait:t,trailing:a})}function nh(e){return Lo(e,1)}function rh(e,t){return as(Hi(t),e)}function ih(){if(!arguments.length)return[];var e=arguments[0];return $(e)?e:[e]}function sh(e){return Je(e,V)}function ah(e,t){return t=typeof t=="function"?t:r,Je(e,V,t)}function oh(e){return Je(e,X|V)}function lh(e,t){return t=typeof t=="function"?t:r,Je(e,X|V,t)}function ch(e,t){return t==null||Ea(e,t,he(t))}function st(e,t){return e===t||e!==e&&t!==t}var uh=br(ki),fh=br(function(e,t){return e>=t}),Zt=ka(function(){return arguments}())?ka:function(e){return le(e)&&ee.call(e,"callee")&&!ya.call(e,"callee")},$=y.isArray,ph=Qs?be(Qs):wf;function Fe(e){return e!=null&&Mr(e.length)&&!At(e)}function ce(e){return le(e)&&Fe(e)}function dh(e){return e===!0||e===!1||le(e)&&we(e)==An}var Mt=Eu||vs,hh=ea?be(ea):xf;function gh(e){return le(e)&&e.nodeType===1&&!Hn(e)}function mh(e){if(e==null)return!0;if(Fe(e)&&($(e)||typeof e=="string"||typeof e.splice=="function"||Mt(e)||gn(e)||Zt(e)))return!e.length;var t=ye(e);if(t==tt||t==nt)return!e.size;if(qn(e))return!Ni(e).length;for(var n in e)if(ee.call(e,n))return!1;return!0}function vh(e,t){return Wn(e,t)}function yh(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 os(e){if(!le(e))return!1;var t=we(e);return t==Zn||t==Ml||typeof e.message=="string"&&typeof e.name=="string"&&!Hn(e)}function _h(e){return typeof e=="number"&&wa(e)}function At(e){if(!ae(e))return!1;var t=we(e);return t==Qn||t==Fs||t==Wl||t==ql}function Bo(e){return typeof e=="number"&&e==W(e)}function Mr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=gt}function ae(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function le(e){return e!=null&&typeof e=="object"}var qo=ta?be(ta):Af;function wh(e,t){return e===t||Li(e,t,Xi(t))}function xh(e,t,n){return n=typeof n=="function"?n:r,Li(e,t,Xi(t),n)}function Ih(e){return jo(e)&&e!=+e}function Ah(e){if(ap(e))throw new D(m);return Oa(e)}function Sh(e){return e===null}function Th(e){return e==null}function jo(e){return typeof e=="number"||le(e)&&we(e)==Tn}function Hn(e){if(!le(e)||we(e)!=mt)return!1;var t=dr(e);if(t===null)return!0;var n=ee.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&cr.call(n)==wu}var ls=na?be(na):Sf;function Eh(e){return Bo(e)&&e>=-gt&&e<=gt}var Ho=ra?be(ra):Tf;function Br(e){return typeof e=="string"||!$(e)&&le(e)&&we(e)==Fn}function Oe(e){return typeof e=="symbol"||le(e)&&we(e)==er}var gn=ia?be(ia):Ef;function Fh(e){return e===r}function Ch(e){return le(e)&&ye(e)==Cn}function Rh(e){return le(e)&&we(e)==Hl}var Ph=br(Ui),bh=br(function(e,t){return e<=t});function Go(e){if(!e)return[];if(Fe(e))return Br(e)?rt(e):Ee(e);if(bn&&e[bn])return lu(e[bn]());var t=ye(e),n=t==tt?Ai:t==nt?ar:mn;return n(e)}function St(e){if(!e)return e===0?e:0;if(e=Ye(e),e===qe||e===-qe){var t=e<0?-1:1;return t*G}return e===e?e:0}function W(e){var t=St(e),n=t%1;return t===t?n?t-n:t:0}function zo(e){return e?Kt(W(e),0,de):0}function Ye(e){if(typeof e=="number")return e;if(Oe(e))return Te;if(ae(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ae(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=ua(e);var n=fc.test(e);return n||dc.test(e)?Gc(e.slice(2),n?2:8):uc.test(e)?Te:+e}function Jo(e){return ft(e,Ce(e))}function kh(e){return e?Kt(W(e),-gt,gt):e===0?e:0}function Q(e){return e==null?"":ke(e)}var Oh=pn(function(e,t){if(qn(t)||Fe(t)){ft(t,he(t),e);return}for(var n in t)ee.call(t,n)&&Un(e,n,t[n])}),Ko=pn(function(e,t){ft(t,Ce(t),e)}),qr=pn(function(e,t,n,i){ft(t,Ce(t),e,i)}),Lh=pn(function(e,t,n,i){ft(t,he(t),e,i)}),Nh=xt(Ri);function Uh(e,t){var n=fn(e);return t==null?n:Ta(n,t)}var Dh=q(function(e,t){e=te(e);var n=-1,i=t.length,a=i>2?t[2]:r;for(a&&xe(t[0],t[1],a)&&(i=1);++n<i;)for(var u=t[n],p=Ce(u),d=-1,g=p.length;++d<g;){var w=p[d],x=e[w];(x===r||st(x,ln[w])&&!ee.call(e,w))&&(e[w]=u[w])}return e}),$h=q(function(e){return e.push(r,uo),Pe(Vo,r,e)});function Wh(e,t){return aa(e,P(t,3),ut)}function Mh(e,t){return aa(e,P(t,3),bi)}function Bh(e,t){return e==null?e:Pi(e,P(t,3),Ce)}function qh(e,t){return e==null?e:Pa(e,P(t,3),Ce)}function jh(e,t){return e&&ut(e,P(t,3))}function Hh(e,t){return e&&bi(e,P(t,3))}function Gh(e){return e==null?[]:Ar(e,he(e))}function zh(e){return e==null?[]:Ar(e,Ce(e))}function cs(e,t,n){var i=e==null?r:Vt(e,t);return i===r?n:i}function Jh(e,t){return e!=null&&ho(e,t,mf)}function us(e,t){return e!=null&&ho(e,t,vf)}var Kh=so(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=ur.call(t)),e[t]=n},ps(Re)),Vh=so(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=ur.call(t)),ee.call(e,t)?e[t].push(n):e[t]=[n]},P),Yh=q($n);function he(e){return Fe(e)?Aa(e):Ni(e)}function Ce(e){return Fe(e)?Aa(e,!0):Ff(e)}function Xh(e,t){var n={};return t=P(t,3),ut(e,function(i,a,u){_t(n,t(i,a,u),i)}),n}function Zh(e,t){var n={};return t=P(t,3),ut(e,function(i,a,u){_t(n,a,t(i,a,u))}),n}var Qh=pn(function(e,t,n){Sr(e,t,n)}),Vo=pn(function(e,t,n,i){Sr(e,t,n,i)}),eg=xt(function(e,t){var n={};if(e==null)return n;var i=!1;t=se(t,function(u){return u=$t(u,e),i||(i=u.length>1),u}),ft(e,Vi(e),n),i&&(n=Je(n,X|U|V,Kf));for(var a=t.length;a--;)Bi(n,t[a]);return n});function tg(e,t){return Yo(e,Wr(P(t)))}var ng=xt(function(e,t){return e==null?{}:Rf(e,t)});function Yo(e,t){if(e==null)return{};var n=se(Vi(e),function(i){return[i]});return t=P(t),Ma(e,n,function(i,a){return t(i,a[0])})}function rg(e,t,n){t=$t(t,e);var i=-1,a=t.length;for(a||(a=1,e=r);++i<a;){var u=e==null?r:e[pt(t[i])];u===r&&(i=a,u=n),e=At(u)?u.call(e):u}return e}function ig(e,t,n){return e==null?e:Mn(e,t,n)}function sg(e,t,n,i){return i=typeof i=="function"?i:r,e==null?e:Mn(e,t,n,i)}var Xo=lo(he),Zo=lo(Ce);function ag(e,t,n){var i=$(e),a=i||Mt(e)||gn(e);if(t=P(t,4),n==null){var u=e&&e.constructor;a?n=i?new u:[]:ae(e)?n=At(u)?fn(dr(e)):{}:n={}}return(a?He:ut)(e,function(p,d,g){return t(n,p,d,g)}),n}function og(e,t){return e==null?!0:Bi(e,t)}function lg(e,t,n){return e==null?e:Ga(e,t,Hi(n))}function cg(e,t,n,i){return i=typeof i=="function"?i:r,e==null?e:Ga(e,t,Hi(n),i)}function mn(e){return e==null?[]:Ii(e,he(e))}function ug(e){return e==null?[]:Ii(e,Ce(e))}function fg(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=Ye(n),n=n===n?n:0),t!==r&&(t=Ye(t),t=t===t?t:0),Kt(Ye(e),t,n)}function pg(e,t,n){return t=St(t),n===r?(n=t,t=0):n=St(n),e=Ye(e),yf(e,t,n)}function dg(e,t,n){if(n&&typeof n!="boolean"&&xe(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=St(e),t===r?(t=e,e=0):t=St(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var a=xa();return ve(e+a*(t-e+Hc("1e-"+((a+"").length-1))),t)}return $i(e,t)}var hg=dn(function(e,t,n){return t=t.toLowerCase(),e+(n?Qo(t):t)});function Qo(e){return fs(Q(e).toLowerCase())}function el(e){return e=Q(e),e&&e.replace(gc,ru).replace(Lc,"")}function gg(e,t,n){e=Q(e),t=ke(t);var i=e.length;n=n===r?i:Kt(W(n),0,i);var a=n;return n-=t.length,n>=0&&e.slice(n,a)==t}function mg(e){return e=Q(e),e&&Vl.test(e)?e.replace(Ps,iu):e}function vg(e){return e=Q(e),e&&tc.test(e)?e.replace(ai,"\\$&"):e}var yg=dn(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),_g=dn(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),wg=no("toLowerCase");function xg(e,t,n){e=Q(e),t=W(t);var i=t?an(e):0;if(!t||i>=t)return e;var a=(t-i)/2;return Pr(vr(a),n)+e+Pr(mr(a),n)}function Ig(e,t,n){e=Q(e),t=W(t);var i=t?an(e):0;return t&&i<t?e+Pr(t-i,n):e}function Ag(e,t,n){e=Q(e),t=W(t);var i=t?an(e):0;return t&&i<t?Pr(t-i,n)+e:e}function Sg(e,t,n){return n||t==null?t=0:t&&(t=+t),Pu(Q(e).replace(oi,""),t||0)}function Tg(e,t,n){return(n?xe(e,t,n):t===r)?t=1:t=W(t),Wi(Q(e),t)}function Eg(){var e=arguments,t=Q(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var Fg=dn(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});function Cg(e,t,n){return n&&typeof n!="number"&&xe(e,t,n)&&(t=n=r),n=n===r?de:n>>>0,n?(e=Q(e),e&&(typeof t=="string"||t!=null&&!ls(t))&&(t=ke(t),!t&&sn(e))?Wt(rt(e),0,n):e.split(t,n)):[]}var Rg=dn(function(e,t,n){return e+(n?" ":"")+fs(t)});function Pg(e,t,n){return e=Q(e),n=n==null?0:Kt(W(n),0,e.length),t=ke(t),e.slice(n,n+t.length)==t}function bg(e,t,n){var i=c.templateSettings;n&&xe(e,t,n)&&(t=r),e=Q(e),t=qr({},t,i,co);var a=qr({},t.imports,i.imports,co),u=he(a),p=Ii(a,u),d,g,w=0,x=t.interpolate||tr,I="__p += '",S=Si((t.escape||tr).source+"|"+x.source+"|"+(x===bs?cc:tr).source+"|"+(t.evaluate||tr).source+"|$","g"),F="//# sourceURL="+(ee.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Wc+"]")+`
|
|
808
|
+
`;e.replace(S,function(L,H,J,Le,Ie,Ne){return J||(J=Le),I+=e.slice(w,Ne).replace(mc,su),H&&(d=!0,I+=`' +
|
|
789
809
|
__e(`+H+`) +
|
|
790
|
-
'`),
|
|
791
|
-
`+
|
|
792
|
-
__p += '`),J&&(
|
|
810
|
+
'`),Ie&&(g=!0,I+=`';
|
|
811
|
+
`+Ie+`;
|
|
812
|
+
__p += '`),J&&(I+=`' +
|
|
793
813
|
((__t = (`+J+`)) == null ? '' : __t) +
|
|
794
|
-
'`),w=Ne+L.length,L}),
|
|
795
|
-
`;var O=ee.call(t,"variable")&&t.variable;if(!O)
|
|
796
|
-
`+
|
|
814
|
+
'`),w=Ne+L.length,L}),I+=`';
|
|
815
|
+
`;var O=ee.call(t,"variable")&&t.variable;if(!O)I=`with (obj) {
|
|
816
|
+
`+I+`
|
|
797
817
|
}
|
|
798
|
-
`;else if(
|
|
818
|
+
`;else if(oc.test(O))throw new D(E);I=(g?I.replace(Gl,""):I).replace(zl,"$1").replace(Jl,"$1;"),I="function("+(O||"obj")+`) {
|
|
799
819
|
`+(O?"":`obj || (obj = {});
|
|
800
820
|
`)+"var __t, __p = ''"+(d?", __e = _.escape":"")+(g?`, __j = Array.prototype.join;
|
|
801
821
|
function print() { __p += __j.call(arguments, '') }
|
|
802
822
|
`:`;
|
|
803
|
-
`)+
|
|
804
|
-
}`;var B=nl(function(){return Z(c,F+"return "+A).apply(r,p)});if(B.source=A,os(B))throw B;return B}function kg(e){return Q(e).toLowerCase()}function Og(e){return Q(e).toUpperCase()}function Lg(e,t,n){if(e=Q(e),e&&(n||t===r))return ca(e);if(!e||!(t=ke(t)))return e;var i=rt(e),a=rt(t),c=fa(i,a),p=pa(i,a)+1;return Wt(i,c,p).join("")}function Ng(e,t,n){if(e=Q(e),e&&(n||t===r))return e.slice(0,ha(e)+1);if(!e||!(t=ke(t)))return e;var i=rt(e),a=pa(i,rt(t))+1;return Wt(i,0,a).join("")}function Ug(e,t,n){if(e=Q(e),e&&(n||t===r))return e.replace(oi,"");if(!e||!(t=ke(t)))return e;var i=rt(e),a=fa(i,rt(t));return Wt(i,a).join("")}function Dg(e,t){var n=Vn,i=Yr;if(ae(t)){var a="separator"in t?t.separator:a;n="length"in t?W(t.length):n,i="omission"in t?ke(t.omission):i}e=Q(e);var c=e.length;if(sn(e)){var p=rt(e);c=p.length}if(n>=c)return e;var d=n-an(i);if(d<1)return i;var g=p?Wt(p,0,d).join(""):e.slice(0,d);if(a===r)return g+i;if(p&&(d+=g.length-d),ls(a)){if(e.slice(d).search(a)){var w,x=g;for(a.global||(a=Ii(a.source,Q(ks.exec(a))+"g")),a.lastIndex=0;w=a.exec(x);)var A=w.index;g=g.slice(0,A===r?d:A)}}else if(e.indexOf(ke(a),d)!=d){var I=g.lastIndexOf(a);I>-1&&(g=g.slice(0,I))}return g+i}function $g(e){return e=Q(e),e&&Kl.test(e)?e.replace(Ps,pc):e}var Wg=dn(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),fs=no("toUpperCase");function tl(e,t,n){return e=Q(e),t=n?r:t,t===r?oc(e)?gc(e):Zu(e):e.match(t)||[]}var nl=j(function(e,t){try{return be(e,r,t)}catch(n){return os(n)?n:new D(n)}}),Mg=xt(function(e,t){return He(t,function(n){n=pt(n),_t(e,n,ss(e[n],e))}),e});function Bg(e){var t=e==null?0:e.length,n=b();return e=t?se(e,function(i){if(typeof i[1]!="function")throw new Ge(v);return[n(i[0]),i[1]]}):[],j(function(i){for(var a=-1;++a<t;){var c=e[a];if(be(c[0],this,i))return be(c[1],this,i)}})}function jg(e){return df(Je(e,X))}function ps(e){return function(){return e}}function qg(e,t){return e==null||e!==e?t:e}var Hg=io(),Gg=io(!0);function Pe(e){return e}function ds(e){return La(typeof e=="function"?e:Je(e,X))}function zg(e){return Ua(Je(e,X))}function Jg(e,t){return Da(e,Je(t,X))}var Kg=j(function(e,t){return function(n){return $n(n,e,t)}}),Vg=j(function(e,t){return function(n){return $n(e,n,t)}});function hs(e,t,n){var i=he(t),a=Sr(t,i);n==null&&!(ae(t)&&(a.length||!i.length))&&(n=t,t=e,e=this,a=Sr(t,he(t)));var c=!(ae(n)&&"chain"in n)||!!n.chain,p=St(e);return He(a,function(d){var g=t[d];e[d]=g,p&&(e.prototype[d]=function(){var w=this.__chain__;if(c||w){var x=e(this.__wrapped__),A=x.__actions__=Ee(this.__actions__);return A.push({func:g,args:arguments,thisArg:e}),x.__chain__=w,x}return g.apply(e,Ot([this.value()],arguments))})}),e}function Yg(){return ge._===this&&(ge._=xc),this}function gs(){}function Xg(e){return e=W(e),j(function(t){return $a(t,e)})}var Zg=zi(se),Qg=zi(sa),em=zi(vi);function rl(e){return Qi(e)?yi(pt(e)):bf(e)}function tm(e){return function(t){return e==null?r:Vt(e,t)}}var nm=ao(),rm=ao(!0);function ms(){return[]}function vs(){return!1}function im(){return{}}function sm(){return""}function am(){return!0}function om(e,t){if(e=W(e),e<1||e>gt)return[];var n=de,i=ve(e,de);t=b(t),e-=de;for(var a=xi(i,t);++n<e;)t(n);return a}function lm(e){return $(e)?se(e,pt):Oe(e)?[e]:Ee(So(Q(e)))}function um(e){var t=++_c;return Q(e)+t}var cm=Pr(function(e,t){return e+t},0),fm=Ji("ceil"),pm=Pr(function(e,t){return e/t},1),dm=Ji("floor");function hm(e){return e&&e.length?Ar(e,Pe,ki):r}function gm(e,t){return e&&e.length?Ar(e,b(t,2),ki):r}function mm(e){return la(e,Pe)}function vm(e,t){return la(e,b(t,2))}function ym(e){return e&&e.length?Ar(e,Pe,Ui):r}function _m(e,t){return e&&e.length?Ar(e,b(t,2),Ui):r}var wm=Pr(function(e,t){return e*t},1),xm=Ji("round"),Am=Pr(function(e,t){return e-t},0);function Sm(e){return e&&e.length?wi(e,Pe):0}function Im(e,t){return e&&e.length?wi(e,b(t,2)):0}return u.after=zd,u.ary=Lo,u.assign=Oh,u.assignIn=Ko,u.assignInWith=jr,u.assignWith=Lh,u.at=Nh,u.before=No,u.bind=ss,u.bindAll=Mg,u.bindKey=Uo,u.castArray=ih,u.chain=Ro,u.chunk=dp,u.compact=hp,u.concat=gp,u.cond=Bg,u.conforms=jg,u.constant=ps,u.countBy=Sd,u.create=Uh,u.curry=Do,u.curryRight=$o,u.debounce=Wo,u.defaults=Dh,u.defaultsDeep=$h,u.defer=Jd,u.delay=Kd,u.difference=mp,u.differenceBy=vp,u.differenceWith=yp,u.drop=_p,u.dropRight=wp,u.dropRightWhile=xp,u.dropWhile=Ap,u.fill=Sp,u.filter=Td,u.flatMap=Cd,u.flatMapDeep=Pd,u.flatMapDepth=bd,u.flatten=Fo,u.flattenDeep=Ip,u.flattenDepth=Tp,u.flip=Vd,u.flow=Hg,u.flowRight=Gg,u.fromPairs=Ep,u.functions=Gh,u.functionsIn=zh,u.groupBy=Rd,u.initial=Cp,u.intersection=Pp,u.intersectionBy=bp,u.intersectionWith=Rp,u.invert=Kh,u.invertBy=Vh,u.invokeMap=Od,u.iteratee=ds,u.keyBy=Ld,u.keys=he,u.keysIn=Ce,u.map=Ur,u.mapKeys=Xh,u.mapValues=Zh,u.matches=zg,u.matchesProperty=Jg,u.memoize=$r,u.merge=Qh,u.mergeWith=Vo,u.method=Kg,u.methodOf=Vg,u.mixin=hs,u.negate=Wr,u.nthArg=Xg,u.omit=eg,u.omitBy=tg,u.once=Yd,u.orderBy=Nd,u.over=Zg,u.overArgs=Xd,u.overEvery=Qg,u.overSome=em,u.partial=as,u.partialRight=Mo,u.partition=Ud,u.pick=ng,u.pickBy=Yo,u.property=rl,u.propertyOf=tm,u.pull=Np,u.pullAll=Po,u.pullAllBy=Up,u.pullAllWith=Dp,u.pullAt=$p,u.range=nm,u.rangeRight=rm,u.rearg=Zd,u.reject=Wd,u.remove=Wp,u.rest=Qd,u.reverse=rs,u.sampleSize=Bd,u.set=ig,u.setWith=sg,u.shuffle=jd,u.slice=Mp,u.sortBy=Gd,u.sortedUniq=Jp,u.sortedUniqBy=Kp,u.split=Cg,u.spread=eh,u.tail=Vp,u.take=Yp,u.takeRight=Xp,u.takeRightWhile=Zp,u.takeWhile=Qp,u.tap=hd,u.throttle=th,u.thru=Nr,u.toArray=Go,u.toPairs=Xo,u.toPairsIn=Zo,u.toPath=lm,u.toPlainObject=Jo,u.transform=ag,u.unary=nh,u.union=ed,u.unionBy=td,u.unionWith=nd,u.uniq=rd,u.uniqBy=id,u.uniqWith=sd,u.unset=og,u.unzip=is,u.unzipWith=bo,u.update=lg,u.updateWith=ug,u.values=mn,u.valuesIn=cg,u.without=ad,u.words=tl,u.wrap=rh,u.xor=od,u.xorBy=ld,u.xorWith=ud,u.zip=cd,u.zipObject=fd,u.zipObjectDeep=pd,u.zipWith=dd,u.entries=Xo,u.entriesIn=Zo,u.extend=Ko,u.extendWith=jr,hs(u,u),u.add=cm,u.attempt=nl,u.camelCase=hg,u.capitalize=Qo,u.ceil=fm,u.clamp=fg,u.clone=sh,u.cloneDeep=oh,u.cloneDeepWith=lh,u.cloneWith=ah,u.conformsTo=uh,u.deburr=el,u.defaultTo=qg,u.divide=pm,u.endsWith=gg,u.eq=st,u.escape=mg,u.escapeRegExp=vg,u.every=Id,u.find=Ed,u.findIndex=To,u.findKey=Wh,u.findLast=Fd,u.findLastIndex=Eo,u.findLastKey=Mh,u.floor=dm,u.forEach=ko,u.forEachRight=Oo,u.forIn=Bh,u.forInRight=jh,u.forOwn=qh,u.forOwnRight=Hh,u.get=us,u.gt=ch,u.gte=fh,u.has=Jh,u.hasIn=cs,u.head=Co,u.identity=Pe,u.includes=kd,u.indexOf=Fp,u.inRange=pg,u.invoke=Yh,u.isArguments=Zt,u.isArray=$,u.isArrayBuffer=ph,u.isArrayLike=Fe,u.isArrayLikeObject=ue,u.isBoolean=dh,u.isBuffer=Mt,u.isDate=hh,u.isElement=gh,u.isEmpty=mh,u.isEqual=vh,u.isEqualWith=yh,u.isError=os,u.isFinite=_h,u.isFunction=St,u.isInteger=Bo,u.isLength=Mr,u.isMap=jo,u.isMatch=wh,u.isMatchWith=xh,u.isNaN=Ah,u.isNative=Sh,u.isNil=Th,u.isNull=Ih,u.isNumber=qo,u.isObject=ae,u.isObjectLike=le,u.isPlainObject=Hn,u.isRegExp=ls,u.isSafeInteger=Eh,u.isSet=Ho,u.isString=Br,u.isSymbol=Oe,u.isTypedArray=gn,u.isUndefined=Fh,u.isWeakMap=Ch,u.isWeakSet=Ph,u.join=kp,u.kebabCase=yg,u.last=Ve,u.lastIndexOf=Op,u.lowerCase=_g,u.lowerFirst=wg,u.lt=bh,u.lte=Rh,u.max=hm,u.maxBy=gm,u.mean=mm,u.meanBy=vm,u.min=ym,u.minBy=_m,u.stubArray=ms,u.stubFalse=vs,u.stubObject=im,u.stubString=sm,u.stubTrue=am,u.multiply=wm,u.nth=Lp,u.noConflict=Yg,u.noop=gs,u.now=Dr,u.pad=xg,u.padEnd=Ag,u.padStart=Sg,u.parseInt=Ig,u.random=dg,u.reduce=Dd,u.reduceRight=$d,u.repeat=Tg,u.replace=Eg,u.result=rg,u.round=xm,u.runInContext=h,u.sample=Md,u.size=qd,u.snakeCase=Fg,u.some=Hd,u.sortedIndex=Bp,u.sortedIndexBy=jp,u.sortedIndexOf=qp,u.sortedLastIndex=Hp,u.sortedLastIndexBy=Gp,u.sortedLastIndexOf=zp,u.startCase=Pg,u.startsWith=bg,u.subtract=Am,u.sum=Sm,u.sumBy=Im,u.template=Rg,u.times=om,u.toFinite=It,u.toInteger=W,u.toLength=zo,u.toLower=kg,u.toNumber=Ye,u.toSafeInteger=kh,u.toString=Q,u.toUpper=Og,u.trim=Lg,u.trimEnd=Ng,u.trimStart=Ug,u.truncate=Dg,u.unescape=$g,u.uniqueId=um,u.upperCase=Wg,u.upperFirst=fs,u.each=ko,u.eachRight=Oo,u.first=Co,hs(u,function(){var e={};return ct(u,function(t,n){ee.call(u.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),u.VERSION=l,He(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){u[e].placeholder=u}),He(["drop","take"],function(e,t){z.prototype[e]=function(n){n=n===r?1:pe(W(n),0);var i=this.__filtered__&&!t?new z(this):this.clone();return i.__filtered__?i.__takeCount__=ve(n,i.__takeCount__):i.__views__.push({size:ve(n,de),type:e+(i.__dir__<0?"Right":"")}),i},z.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),He(["filter","map","takeWhile"],function(e,t){var n=t+1,i=n==oe||n==Be;z.prototype[e]=function(a){var c=this.clone();return c.__iteratees__.push({iteratee:b(a,3),type:n}),c.__filtered__=c.__filtered__||i,c}}),He(["head","last"],function(e,t){var n="take"+(t?"Right":"");z.prototype[e]=function(){return this[n](1).value()[0]}}),He(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");z.prototype[e]=function(){return this.__filtered__?new z(this):this[n](1)}}),z.prototype.compact=function(){return this.filter(Pe)},z.prototype.find=function(e){return this.filter(e).head()},z.prototype.findLast=function(e){return this.reverse().find(e)},z.prototype.invokeMap=j(function(e,t){return typeof e=="function"?new z(this):this.map(function(n){return $n(n,e,t)})}),z.prototype.reject=function(e){return this.filter(Wr(b(e)))},z.prototype.slice=function(e,t){e=W(e);var n=this;return n.__filtered__&&(e>0||t<0)?new z(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(t=W(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},z.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},z.prototype.toArray=function(){return this.take(de)},ct(z.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),a=u[i?"take"+(t=="last"?"Right":""):t],c=i||/^find/.test(t);a&&(u.prototype[t]=function(){var p=this.__wrapped__,d=i?[1]:arguments,g=p instanceof z,w=d[0],x=g||$(p),A=function(H){var J=a.apply(u,Ot([H],d));return i&&I?J[0]:J};x&&n&&typeof w=="function"&&w.length!=1&&(g=x=!1);var I=this.__chain__,F=!!this.__actions__.length,O=c&&!I,B=g&&!F;if(!c&&x){p=B?p:new z(this);var L=e.apply(p,d);return L.__actions__.push({func:Nr,args:[A],thisArg:r}),new ze(L,I)}return O&&B?e.apply(this,d):(L=this.thru(A),O?i?L.value()[0]:L.value():L)})}),He(["pop","push","shift","sort","splice","unshift"],function(e){var t=or[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);u.prototype[e]=function(){var a=arguments;if(i&&!this.__chain__){var c=this.value();return t.apply($(c)?c:[],a)}return this[n](function(p){return t.apply($(p)?p:[],a)})}}),ct(z.prototype,function(e,t){var n=u[t];if(n){var i=n.name+"";ee.call(cn,i)||(cn[i]=[]),cn[i].push({name:t,func:n})}}),cn[Cr(r,ht).name]=[{name:"wrapper",func:r}],z.prototype.clone=Dc,z.prototype.reverse=$c,z.prototype.value=Wc,u.prototype.at=gd,u.prototype.chain=md,u.prototype.commit=vd,u.prototype.next=yd,u.prototype.plant=wd,u.prototype.reverse=xd,u.prototype.toJSON=u.prototype.valueOf=u.prototype.value=Ad,u.prototype.first=u.prototype.head,Rn&&(u.prototype[Rn]=_d),u},on=mc();Ht?((Ht.exports=on)._=on,di._=on):ge._=on}).call(qy)}(Jn,Jn.exports)),Jn.exports}var Gy=Hy();const _s=o=>{const s=Gy.startCase(o).toLowerCase();return s.charAt(0).toUpperCase()+s.slice(1)},zy=({data:o,universalIdentifier:s=Ue.v4()})=>`import { defineObject } from 'twenty-sdk';
|
|
823
|
+
`)+I+`return __p
|
|
824
|
+
}`;var B=nl(function(){return Z(u,F+"return "+I).apply(r,p)});if(B.source=I,os(B))throw B;return B}function kg(e){return Q(e).toLowerCase()}function Og(e){return Q(e).toUpperCase()}function Lg(e,t,n){if(e=Q(e),e&&(n||t===r))return ua(e);if(!e||!(t=ke(t)))return e;var i=rt(e),a=rt(t),u=fa(i,a),p=pa(i,a)+1;return Wt(i,u,p).join("")}function Ng(e,t,n){if(e=Q(e),e&&(n||t===r))return e.slice(0,ha(e)+1);if(!e||!(t=ke(t)))return e;var i=rt(e),a=pa(i,rt(t))+1;return Wt(i,0,a).join("")}function Ug(e,t,n){if(e=Q(e),e&&(n||t===r))return e.replace(oi,"");if(!e||!(t=ke(t)))return e;var i=rt(e),a=fa(i,rt(t));return Wt(i,a).join("")}function Dg(e,t){var n=Vn,i=Yr;if(ae(t)){var a="separator"in t?t.separator:a;n="length"in t?W(t.length):n,i="omission"in t?ke(t.omission):i}e=Q(e);var u=e.length;if(sn(e)){var p=rt(e);u=p.length}if(n>=u)return e;var d=n-an(i);if(d<1)return i;var g=p?Wt(p,0,d).join(""):e.slice(0,d);if(a===r)return g+i;if(p&&(d+=g.length-d),ls(a)){if(e.slice(d).search(a)){var w,x=g;for(a.global||(a=Si(a.source,Q(ks.exec(a))+"g")),a.lastIndex=0;w=a.exec(x);)var I=w.index;g=g.slice(0,I===r?d:I)}}else if(e.indexOf(ke(a),d)!=d){var S=g.lastIndexOf(a);S>-1&&(g=g.slice(0,S))}return g+i}function $g(e){return e=Q(e),e&&Kl.test(e)?e.replace(Rs,pu):e}var Wg=dn(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),fs=no("toUpperCase");function tl(e,t,n){return e=Q(e),t=n?r:t,t===r?ou(e)?gu(e):Zc(e):e.match(t)||[]}var nl=q(function(e,t){try{return Pe(e,r,t)}catch(n){return os(n)?n:new D(n)}}),Mg=xt(function(e,t){return He(t,function(n){n=pt(n),_t(e,n,ss(e[n],e))}),e});function Bg(e){var t=e==null?0:e.length,n=P();return e=t?se(e,function(i){if(typeof i[1]!="function")throw new Ge(v);return[n(i[0]),i[1]]}):[],q(function(i){for(var a=-1;++a<t;){var u=e[a];if(Pe(u[0],this,i))return Pe(u[1],this,i)}})}function qg(e){return df(Je(e,X))}function ps(e){return function(){return e}}function jg(e,t){return e==null||e!==e?t:e}var Hg=io(),Gg=io(!0);function Re(e){return e}function ds(e){return La(typeof e=="function"?e:Je(e,X))}function zg(e){return Ua(Je(e,X))}function Jg(e,t){return Da(e,Je(t,X))}var Kg=q(function(e,t){return function(n){return $n(n,e,t)}}),Vg=q(function(e,t){return function(n){return $n(e,n,t)}});function hs(e,t,n){var i=he(t),a=Ar(t,i);n==null&&!(ae(t)&&(a.length||!i.length))&&(n=t,t=e,e=this,a=Ar(t,he(t)));var u=!(ae(n)&&"chain"in n)||!!n.chain,p=At(e);return He(a,function(d){var g=t[d];e[d]=g,p&&(e.prototype[d]=function(){var w=this.__chain__;if(u||w){var x=e(this.__wrapped__),I=x.__actions__=Ee(this.__actions__);return I.push({func:g,args:arguments,thisArg:e}),x.__chain__=w,x}return g.apply(e,Ot([this.value()],arguments))})}),e}function Yg(){return ge._===this&&(ge._=xu),this}function gs(){}function Xg(e){return e=W(e),q(function(t){return $a(t,e)})}var Zg=zi(se),Qg=zi(sa),em=zi(vi);function rl(e){return Qi(e)?yi(pt(e)):Pf(e)}function tm(e){return function(t){return e==null?r:Vt(e,t)}}var nm=ao(),rm=ao(!0);function ms(){return[]}function vs(){return!1}function im(){return{}}function sm(){return""}function am(){return!0}function om(e,t){if(e=W(e),e<1||e>gt)return[];var n=de,i=ve(e,de);t=P(t),e-=de;for(var a=xi(i,t);++n<e;)t(n);return a}function lm(e){return $(e)?se(e,pt):Oe(e)?[e]:Ee(Ao(Q(e)))}function cm(e){var t=++_u;return Q(e)+t}var um=Rr(function(e,t){return e+t},0),fm=Ji("ceil"),pm=Rr(function(e,t){return e/t},1),dm=Ji("floor");function hm(e){return e&&e.length?Ir(e,Re,ki):r}function gm(e,t){return e&&e.length?Ir(e,P(t,2),ki):r}function mm(e){return la(e,Re)}function vm(e,t){return la(e,P(t,2))}function ym(e){return e&&e.length?Ir(e,Re,Ui):r}function _m(e,t){return e&&e.length?Ir(e,P(t,2),Ui):r}var wm=Rr(function(e,t){return e*t},1),xm=Ji("round"),Im=Rr(function(e,t){return e-t},0);function Am(e){return e&&e.length?wi(e,Re):0}function Sm(e,t){return e&&e.length?wi(e,P(t,2)):0}return c.after=zd,c.ary=Lo,c.assign=Oh,c.assignIn=Ko,c.assignInWith=qr,c.assignWith=Lh,c.at=Nh,c.before=No,c.bind=ss,c.bindAll=Mg,c.bindKey=Uo,c.castArray=ih,c.chain=bo,c.chunk=dp,c.compact=hp,c.concat=gp,c.cond=Bg,c.conforms=qg,c.constant=ps,c.countBy=Ad,c.create=Uh,c.curry=Do,c.curryRight=$o,c.debounce=Wo,c.defaults=Dh,c.defaultsDeep=$h,c.defer=Jd,c.delay=Kd,c.difference=mp,c.differenceBy=vp,c.differenceWith=yp,c.drop=_p,c.dropRight=wp,c.dropRightWhile=xp,c.dropWhile=Ip,c.fill=Ap,c.filter=Td,c.flatMap=Cd,c.flatMapDeep=Rd,c.flatMapDepth=Pd,c.flatten=Fo,c.flattenDeep=Sp,c.flattenDepth=Tp,c.flip=Vd,c.flow=Hg,c.flowRight=Gg,c.fromPairs=Ep,c.functions=Gh,c.functionsIn=zh,c.groupBy=bd,c.initial=Cp,c.intersection=Rp,c.intersectionBy=Pp,c.intersectionWith=bp,c.invert=Kh,c.invertBy=Vh,c.invokeMap=Od,c.iteratee=ds,c.keyBy=Ld,c.keys=he,c.keysIn=Ce,c.map=Ur,c.mapKeys=Xh,c.mapValues=Zh,c.matches=zg,c.matchesProperty=Jg,c.memoize=$r,c.merge=Qh,c.mergeWith=Vo,c.method=Kg,c.methodOf=Vg,c.mixin=hs,c.negate=Wr,c.nthArg=Xg,c.omit=eg,c.omitBy=tg,c.once=Yd,c.orderBy=Nd,c.over=Zg,c.overArgs=Xd,c.overEvery=Qg,c.overSome=em,c.partial=as,c.partialRight=Mo,c.partition=Ud,c.pick=ng,c.pickBy=Yo,c.property=rl,c.propertyOf=tm,c.pull=Np,c.pullAll=Ro,c.pullAllBy=Up,c.pullAllWith=Dp,c.pullAt=$p,c.range=nm,c.rangeRight=rm,c.rearg=Zd,c.reject=Wd,c.remove=Wp,c.rest=Qd,c.reverse=rs,c.sampleSize=Bd,c.set=ig,c.setWith=sg,c.shuffle=qd,c.slice=Mp,c.sortBy=Gd,c.sortedUniq=Jp,c.sortedUniqBy=Kp,c.split=Cg,c.spread=eh,c.tail=Vp,c.take=Yp,c.takeRight=Xp,c.takeRightWhile=Zp,c.takeWhile=Qp,c.tap=hd,c.throttle=th,c.thru=Nr,c.toArray=Go,c.toPairs=Xo,c.toPairsIn=Zo,c.toPath=lm,c.toPlainObject=Jo,c.transform=ag,c.unary=nh,c.union=ed,c.unionBy=td,c.unionWith=nd,c.uniq=rd,c.uniqBy=id,c.uniqWith=sd,c.unset=og,c.unzip=is,c.unzipWith=Po,c.update=lg,c.updateWith=cg,c.values=mn,c.valuesIn=ug,c.without=ad,c.words=tl,c.wrap=rh,c.xor=od,c.xorBy=ld,c.xorWith=cd,c.zip=ud,c.zipObject=fd,c.zipObjectDeep=pd,c.zipWith=dd,c.entries=Xo,c.entriesIn=Zo,c.extend=Ko,c.extendWith=qr,hs(c,c),c.add=um,c.attempt=nl,c.camelCase=hg,c.capitalize=Qo,c.ceil=fm,c.clamp=fg,c.clone=sh,c.cloneDeep=oh,c.cloneDeepWith=lh,c.cloneWith=ah,c.conformsTo=ch,c.deburr=el,c.defaultTo=jg,c.divide=pm,c.endsWith=gg,c.eq=st,c.escape=mg,c.escapeRegExp=vg,c.every=Sd,c.find=Ed,c.findIndex=To,c.findKey=Wh,c.findLast=Fd,c.findLastIndex=Eo,c.findLastKey=Mh,c.floor=dm,c.forEach=ko,c.forEachRight=Oo,c.forIn=Bh,c.forInRight=qh,c.forOwn=jh,c.forOwnRight=Hh,c.get=cs,c.gt=uh,c.gte=fh,c.has=Jh,c.hasIn=us,c.head=Co,c.identity=Re,c.includes=kd,c.indexOf=Fp,c.inRange=pg,c.invoke=Yh,c.isArguments=Zt,c.isArray=$,c.isArrayBuffer=ph,c.isArrayLike=Fe,c.isArrayLikeObject=ce,c.isBoolean=dh,c.isBuffer=Mt,c.isDate=hh,c.isElement=gh,c.isEmpty=mh,c.isEqual=vh,c.isEqualWith=yh,c.isError=os,c.isFinite=_h,c.isFunction=At,c.isInteger=Bo,c.isLength=Mr,c.isMap=qo,c.isMatch=wh,c.isMatchWith=xh,c.isNaN=Ih,c.isNative=Ah,c.isNil=Th,c.isNull=Sh,c.isNumber=jo,c.isObject=ae,c.isObjectLike=le,c.isPlainObject=Hn,c.isRegExp=ls,c.isSafeInteger=Eh,c.isSet=Ho,c.isString=Br,c.isSymbol=Oe,c.isTypedArray=gn,c.isUndefined=Fh,c.isWeakMap=Ch,c.isWeakSet=Rh,c.join=kp,c.kebabCase=yg,c.last=Ve,c.lastIndexOf=Op,c.lowerCase=_g,c.lowerFirst=wg,c.lt=Ph,c.lte=bh,c.max=hm,c.maxBy=gm,c.mean=mm,c.meanBy=vm,c.min=ym,c.minBy=_m,c.stubArray=ms,c.stubFalse=vs,c.stubObject=im,c.stubString=sm,c.stubTrue=am,c.multiply=wm,c.nth=Lp,c.noConflict=Yg,c.noop=gs,c.now=Dr,c.pad=xg,c.padEnd=Ig,c.padStart=Ag,c.parseInt=Sg,c.random=dg,c.reduce=Dd,c.reduceRight=$d,c.repeat=Tg,c.replace=Eg,c.result=rg,c.round=xm,c.runInContext=h,c.sample=Md,c.size=jd,c.snakeCase=Fg,c.some=Hd,c.sortedIndex=Bp,c.sortedIndexBy=qp,c.sortedIndexOf=jp,c.sortedLastIndex=Hp,c.sortedLastIndexBy=Gp,c.sortedLastIndexOf=zp,c.startCase=Rg,c.startsWith=Pg,c.subtract=Im,c.sum=Am,c.sumBy=Sm,c.template=bg,c.times=om,c.toFinite=St,c.toInteger=W,c.toLength=zo,c.toLower=kg,c.toNumber=Ye,c.toSafeInteger=kh,c.toString=Q,c.toUpper=Og,c.trim=Lg,c.trimEnd=Ng,c.trimStart=Ug,c.truncate=Dg,c.unescape=$g,c.uniqueId=cm,c.upperCase=Wg,c.upperFirst=fs,c.each=ko,c.eachRight=Oo,c.first=Co,hs(c,function(){var e={};return ut(c,function(t,n){ee.call(c.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),c.VERSION=o,He(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){c[e].placeholder=c}),He(["drop","take"],function(e,t){z.prototype[e]=function(n){n=n===r?1:pe(W(n),0);var i=this.__filtered__&&!t?new z(this):this.clone();return i.__filtered__?i.__takeCount__=ve(n,i.__takeCount__):i.__views__.push({size:ve(n,de),type:e+(i.__dir__<0?"Right":"")}),i},z.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),He(["filter","map","takeWhile"],function(e,t){var n=t+1,i=n==oe||n==Be;z.prototype[e]=function(a){var u=this.clone();return u.__iteratees__.push({iteratee:P(a,3),type:n}),u.__filtered__=u.__filtered__||i,u}}),He(["head","last"],function(e,t){var n="take"+(t?"Right":"");z.prototype[e]=function(){return this[n](1).value()[0]}}),He(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");z.prototype[e]=function(){return this.__filtered__?new z(this):this[n](1)}}),z.prototype.compact=function(){return this.filter(Re)},z.prototype.find=function(e){return this.filter(e).head()},z.prototype.findLast=function(e){return this.reverse().find(e)},z.prototype.invokeMap=q(function(e,t){return typeof e=="function"?new z(this):this.map(function(n){return $n(n,e,t)})}),z.prototype.reject=function(e){return this.filter(Wr(P(e)))},z.prototype.slice=function(e,t){e=W(e);var n=this;return n.__filtered__&&(e>0||t<0)?new z(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(t=W(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},z.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},z.prototype.toArray=function(){return this.take(de)},ut(z.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),a=c[i?"take"+(t=="last"?"Right":""):t],u=i||/^find/.test(t);a&&(c.prototype[t]=function(){var p=this.__wrapped__,d=i?[1]:arguments,g=p instanceof z,w=d[0],x=g||$(p),I=function(H){var J=a.apply(c,Ot([H],d));return i&&S?J[0]:J};x&&n&&typeof w=="function"&&w.length!=1&&(g=x=!1);var S=this.__chain__,F=!!this.__actions__.length,O=u&&!S,B=g&&!F;if(!u&&x){p=B?p:new z(this);var L=e.apply(p,d);return L.__actions__.push({func:Nr,args:[I],thisArg:r}),new ze(L,S)}return O&&B?e.apply(this,d):(L=this.thru(I),O?i?L.value()[0]:L.value():L)})}),He(["pop","push","shift","sort","splice","unshift"],function(e){var t=or[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);c.prototype[e]=function(){var a=arguments;if(i&&!this.__chain__){var u=this.value();return t.apply($(u)?u:[],a)}return this[n](function(p){return t.apply($(p)?p:[],a)})}}),ut(z.prototype,function(e,t){var n=c[t];if(n){var i=n.name+"";ee.call(un,i)||(un[i]=[]),un[i].push({name:t,func:n})}}),un[Cr(r,ht).name]=[{name:"wrapper",func:r}],z.prototype.clone=Du,z.prototype.reverse=$u,z.prototype.value=Wu,c.prototype.at=gd,c.prototype.chain=md,c.prototype.commit=vd,c.prototype.next=yd,c.prototype.plant=wd,c.prototype.reverse=xd,c.prototype.toJSON=c.prototype.valueOf=c.prototype.value=Id,c.prototype.first=c.prototype.head,bn&&(c.prototype[bn]=_d),c},on=mu();Ht?((Ht.exports=on)._=on,di._=on):ge._=on}).call(Hy)}(Jn,Jn.exports)),Jn.exports}var zy=Gy();const _s=l=>{const s=zy.startCase(l).toLowerCase();return s.charAt(0).toUpperCase()+s.slice(1)},Jy=({data:l,universalIdentifier:s=Ue.v4()})=>`import { defineObject } from 'twenty-sdk';
|
|
805
825
|
|
|
806
826
|
export default defineObject({
|
|
807
827
|
universalIdentifier: '${s}',
|
|
808
|
-
nameSingular: '${
|
|
809
|
-
namePlural: '${
|
|
810
|
-
labelSingular: '${
|
|
811
|
-
labelPlural: '${
|
|
828
|
+
nameSingular: '${l.nameSingular}',
|
|
829
|
+
namePlural: '${l.namePlural}',
|
|
830
|
+
labelSingular: '${l.labelSingular}',
|
|
831
|
+
labelPlural: '${l.labelPlural}',
|
|
812
832
|
icon: 'IconBox',
|
|
813
833
|
fields: [
|
|
814
834
|
// Add your fields here using defineField helper
|
|
@@ -821,11 +841,11 @@ export default defineObject({
|
|
|
821
841
|
// },
|
|
822
842
|
],
|
|
823
843
|
});
|
|
824
|
-
`,
|
|
844
|
+
`,Ky=({name:l})=>`import { definePageLayout } from 'twenty-sdk';
|
|
825
845
|
|
|
826
846
|
export default definePageLayout({
|
|
827
847
|
universalIdentifier: '${Ue.v4()}',
|
|
828
|
-
name: '${
|
|
848
|
+
name: '${l}',
|
|
829
849
|
tabs: [
|
|
830
850
|
{
|
|
831
851
|
universalIdentifier: '${Ue.v4()}',
|
|
@@ -834,21 +854,21 @@ export default definePageLayout({
|
|
|
834
854
|
},
|
|
835
855
|
],
|
|
836
856
|
});
|
|
837
|
-
`,
|
|
857
|
+
`,Vy=({name:l,universalIdentifier:s=Ue.v4()})=>{const r=Qe.default(l);return`import { defineRole } from 'twenty-sdk';
|
|
838
858
|
|
|
839
859
|
export const ${r.toUpperCase().replace(/-/g,"_")}_ROLE_UNIVERSAL_IDENTIFIER =
|
|
840
860
|
'${s}';
|
|
841
861
|
|
|
842
862
|
export default defineRole({
|
|
843
863
|
universalIdentifier: ${r.toUpperCase().replace(/-/g,"_")}_ROLE_UNIVERSAL_IDENTIFIER,
|
|
844
|
-
label: '${
|
|
864
|
+
label: '${l}',
|
|
845
865
|
description: 'Add a description for your role',
|
|
846
866
|
canReadAllObjectRecords: true,
|
|
847
867
|
canUpdateAllObjectRecords: true,
|
|
848
868
|
canSoftDeleteAllObjectRecords: true,
|
|
849
869
|
canDestroyAllObjectRecords: false,
|
|
850
870
|
});
|
|
851
|
-
`},
|
|
871
|
+
`},Yy=({name:l,universalIdentifier:s=Ue.v4()})=>{const r=Qe.default(l);return`import { defineSkill } from 'twenty-sdk';
|
|
852
872
|
|
|
853
873
|
export const ${r.toUpperCase().replace(/-/g,"_")}_SKILL_UNIVERSAL_IDENTIFIER =
|
|
854
874
|
'${s}';
|
|
@@ -856,15 +876,15 @@ export const ${r.toUpperCase().replace(/-/g,"_")}_SKILL_UNIVERSAL_IDENTIFIER =
|
|
|
856
876
|
export default defineSkill({
|
|
857
877
|
universalIdentifier: ${r.toUpperCase().replace(/-/g,"_")}_SKILL_UNIVERSAL_IDENTIFIER,
|
|
858
878
|
name: '${r}',
|
|
859
|
-
label: '${
|
|
879
|
+
label: '${l}',
|
|
860
880
|
description: 'Add a description for your skill',
|
|
861
881
|
content: 'Add the skill content here',
|
|
862
882
|
});
|
|
863
|
-
`},yl=({name:
|
|
883
|
+
`},yl=({name:l,universalIdentifier:s=Ue.v4(),objectUniversalIdentifier:r="fill-later"})=>{const o=Qe.default(l);return`import { defineView } from 'twenty-sdk';
|
|
864
884
|
|
|
865
885
|
export default defineView({
|
|
866
886
|
universalIdentifier: '${s}',
|
|
867
|
-
name: '${
|
|
887
|
+
name: '${o}',
|
|
868
888
|
objectUniversalIdentifier: '${r}',
|
|
869
889
|
icon: 'IconList',
|
|
870
890
|
position: 0,
|
|
@@ -885,14 +905,14 @@ export default defineView({
|
|
|
885
905
|
// },
|
|
886
906
|
// ],
|
|
887
907
|
});
|
|
888
|
-
`},
|
|
889
|
-
description: '${
|
|
908
|
+
`},Xy=({data:l})=>{const s=Ue.v4(),r=l.description?`
|
|
909
|
+
description: '${l.description}',`:"";return`import { defineField, FieldType } from 'twenty-sdk';
|
|
890
910
|
|
|
891
911
|
export default defineField({
|
|
892
912
|
universalIdentifier: '${s}',
|
|
893
|
-
name: '${
|
|
894
|
-
label: '${
|
|
895
|
-
type: FieldMetadataType.${
|
|
896
|
-
objectUniversalIdentifier: '${
|
|
913
|
+
name: '${l.name}',
|
|
914
|
+
label: '${l.label}',
|
|
915
|
+
type: FieldMetadataType.${l.type},
|
|
916
|
+
objectUniversalIdentifier: '${l.objectUniversalIdentifier}',${r}
|
|
897
917
|
});
|
|
898
|
-
`},ws="src";class
|
|
918
|
+
`},ws="src";class Zy{async execute(s,r){try{const o=s??await this.getEntity(),f=this.getFolderName(o),m=r?b.join(Ae,r):b.join(Ae,ws,f);await R.ensureDir(m);const{name:v,file:E}=await this.getEntityData(o),C=b.join(m,this.getFileName(v,o));if(await R.pathExists(C)){const{overwrite:M}=await this.handleFileExist();if(!M)return}await R.writeFile(C,E),console.log(A.default.green(`✓ Created ${f}:`),A.default.cyan(b.relative(Ae,C))),o===K.Object&&await this.promptAndCreateViewAndNavigationMenuItem(v,r)}catch(o){console.error(A.default.red("Add new entity failed:"),o instanceof Error?o.message:o),process.exit(1)}}async getEntityData(s){switch(s){case K.Object:{const r=await this.getObjectData(),o=r.nameSingular,f=Ue.v4();this.lastObjectUniversalIdentifier=f;const m=Jy({data:r,universalIdentifier:f});return{name:o,file:m}}case K.Field:{const r=await this.getFieldData(),o=r.name,f=Xy({data:r});return{name:o,file:f}}case K.LogicFunction:{const r=await this.getEntityName(s),o=jy({name:r});return{name:r,file:o}}case K.FrontComponent:{const r=await this.getEntityName(s),o=qy({name:r});return{name:r,file:o}}case K.Role:{const r=await this.getEntityName(s),o=Vy({name:r});return{name:r,file:o}}case K.Skill:{const r=await this.getEntityName(s),o=Yy({name:r});return{name:r,file:o}}case K.View:{const o=(await this.getViewData()).name,f=yl({name:o});return{name:o,file:f}}case K.NavigationMenuItem:{const r=await this.getEntityName(s),o=ml({name:r});return{name:r,file:o}}case K.PageLayout:{const r=await this.getEntityName(s),o=Ky({name:r});return{name:r,file:o}}default:k.dt()}}async promptAndCreateViewAndNavigationMenuItem(s,r){const{createViewAndNavItem:o}=await lt.default.prompt([{type:"confirm",name:"createViewAndNavItem",message:"Also create a view and navigation menu item for this object? (recommended)",default:!0}]);if(!o||!this.lastObjectUniversalIdentifier)return;const f=Ue.v4(),m=yl({name:`all-${Qe.default(s)}`,universalIdentifier:f,objectUniversalIdentifier:this.lastObjectUniversalIdentifier}),v=r?b.join(Ae,r):b.join(Ae,ws,this.getFolderName(K.View));await R.ensureDir(v);const E=`all-${Qe.default(s)}.ts`,C=b.join(v,E);if(await R.pathExists(C)){const{overwrite:V}=await this.handleFileExist();if(!V)return}await R.writeFile(C,m),console.log(A.default.green("✓ Created view:"),A.default.cyan(b.relative(Ae,C)));const M=ml({name:s,viewUniversalIdentifier:f}),j=r?b.join(Ae,r):b.join(Ae,ws,this.getFolderName(K.NavigationMenuItem));await R.ensureDir(j);const X=`${Qe.default(s)}.ts`,U=b.join(j,X);if(await R.pathExists(U)){const{overwrite:V}=await this.handleFileExist();if(!V)return}await R.writeFile(U,M),console.log(A.default.green("✓ Created navigation menu item:"),A.default.cyan(b.relative(Ae,U)))}async getEntity(){const{entity:s}=await lt.default.prompt([{type:"select",name:"entity",message:"What entity do you want to create?",default:"",choices:Object.values(K)}]);return s}async handleFileExist(){return await lt.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 lt.default.prompt([{type:"input",name:"name",message:`Enter a name for your new ${s}:`,default:"",validate:o=>o.length===0?`${s} name is required`:!0}]);return r}async getFieldData(){return lt.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=>_s(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(k.R),default:k.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 lt.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=>_s(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=>_s(s.namePlural),validate:s=>!s||s.trim().length===0?"Please enter a non empty string":!0}])}async getViewData(){return lt.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`${Qe.default(s)}s`}getFileName(s,r){switch(r){case K.FrontComponent:return`${Qe.default(s)}.tsx`;default:return`${Qe.default(s)}.ts`}}}const Qy=l=>{const s=new Ny,r=new Uy,o=new Dy,f=new $y,m=new By;l.command("auth:login").description("Authenticate with Twenty").option("--api-key <key>","API key for authentication").option("--api-url <url>","Twenty API URL").action(async U=>{await r.execute(U)}),l.command("auth:logout").description("Remove authentication credentials").action(async()=>{await o.execute()}),l.command("auth:status").description("Check authentication status").action(async()=>{await f.execute()}),l.command("auth:switch [workspace]").description("Switch the default workspace for authentication").action(async U=>{await m.execute({workspace:U})}),l.command("auth:list").description("List all configured workspaces").action(async()=>{await s.execute()});const v=new by,E=new Oy,C=new Ly,M=new Zy,j=new My,X=new Wy;l.command("app:dev [appPath]").description("Watch and sync local application changes").action(async U=>{await v.execute({appPath:Gn(U)})}),l.command("app:typecheck [appPath]").description("Run TypeScript type checking on the application").action(async U=>{await E.execute({appPath:Gn(U)})}),l.command("app:uninstall [appPath]").description("Uninstall application from Twenty").option("-y, --yes","Skip confirmation prompt").action(async(U,V)=>{try{const ne=await C.execute({appPath:Gn(U),askForConfirmation:!V?.yes});process.exit(ne.success?0:1)}catch{process.exit(1)}}),l.command("entity:add [entityType]").option("--path <path>","Path in which the entity should be created.").description(`Add a new entity to your application (${Object.values(K).join("|")})`).action(async(U,V)=>{await M.execute(U,V?.path)}),l.command("function: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(U,V)=>{await j.execute({...V,appPath:Gn(U)})}),l.command("function:execute [appPath]").option("--postInstall","Execute post-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(U,V)=>{!V?.postInstall&&!V?.functionUniversalIdentifier&&!V?.functionName&&(console.error(A.default.red("Error: Either --postInstall or --functionName (-n) or --functionUniversalIdentifier (-u) is required.")),process.exit(1)),await X.execute({...V,payload:V?.payload??"{}",appPath:Gn(U)})})},e_="0.6.3",t_={version:e_};Jm.inspect.defaultOptions.depth=10;const wn=new Il.Command;wn.name("twenty").description("CLI for Twenty application development").version(t_.version);wn.option("--workspace <name>","Use a specific workspace configuration (overrides the default set by auth:switch)");wn.hook("preAction",async l=>{let r=(l.optsWithGlobals?l.optsWithGlobals():l.opts()).workspace;r||(r=await new _e().getDefaultWorkspace()),_e.setActiveWorkspace(r),console.log(A.default.gray(`👩💻 Workspace - ${_e.getActiveWorkspace()}`))});Qy(wn);wn.exitOverride();try{wn.parse()}catch(l){l instanceof Il.CommanderError&&process.exit(l.exitCode),l instanceof Error&&(console.error(A.default.red("Error:"),l.message),process.exit(1))}
|