diff --git a/internal/applicant/aliyun.go b/internal/applicant/aliyun.go index f109886e..6ab27e44 100644 --- a/internal/applicant/aliyun.go +++ b/internal/applicant/aliyun.go @@ -3,6 +3,7 @@ package applicant import ( "certimate/internal/domain" "encoding/json" + "fmt" "os" "github.com/go-acme/lego/v4/providers/dns/alidns" @@ -25,6 +26,7 @@ func (a *aliyun) Apply() (*Certificate, error) { os.Setenv("ALICLOUD_ACCESS_KEY", access.AccessKeyId) os.Setenv("ALICLOUD_SECRET_KEY", access.AccessKeySecret) + os.Setenv("ALICLOUD_PROPAGATION_TIMEOUT", fmt.Sprintf("%d", a.option.Timeout)) dnsProvider, err := alidns.NewDNSProvider() if err != nil { return nil, err diff --git a/internal/applicant/applicant.go b/internal/applicant/applicant.go index 92dd20ad..fd869f1d 100644 --- a/internal/applicant/applicant.go +++ b/internal/applicant/applicant.go @@ -1,6 +1,7 @@ package applicant import ( + "certimate/internal/domain" "certimate/internal/utils/app" "crypto" "crypto/ecdsa" @@ -46,6 +47,8 @@ var sslProviderUrls = map[string]string{ const defaultEmail = "536464346@qq.com" +const defaultTimeout = 60 + type Certificate struct { CertUrl string `json:"certUrl"` CertStableUrl string `json:"certStableUrl"` @@ -60,6 +63,7 @@ type ApplyOption struct { Domain string `json:"domain"` Access string `json:"access"` Nameservers string `json:"nameservers"` + Timeout int64 `json:"timeout"` } type MyUser struct { @@ -83,8 +87,22 @@ type Applicant interface { } func Get(record *models.Record) (Applicant, error) { - access := record.ExpandedOne("access") - email := record.GetString("email") + + if record.GetString("applyConfig") == "" { + return nil, errors.New("apply config is empty") + } + + applyConfig := &domain.ApplyConfig{} + + record.UnmarshalJSONField("applyConfig", applyConfig) + + access, err := app.GetApp().Dao().FindRecordById("access", applyConfig.Access) + + if err != nil { + return nil, fmt.Errorf("access record not found: %w", err) + } + + email := applyConfig.Email if email == "" { email = defaultEmail } @@ -92,7 +110,8 @@ func Get(record *models.Record) (Applicant, error) { Email: email, Domain: record.GetString("domain"), Access: access.GetString("config"), - Nameservers: record.GetString("nameservers"), + Nameservers: applyConfig.Nameservers, + Timeout: applyConfig.Timeout, } switch access.GetString("configType") { case configTypeAliyun: diff --git a/internal/applicant/cloudflare.go b/internal/applicant/cloudflare.go index d5f4d2d1..a2e9e061 100644 --- a/internal/applicant/cloudflare.go +++ b/internal/applicant/cloudflare.go @@ -3,6 +3,7 @@ package applicant import ( "certimate/internal/domain" "encoding/json" + "fmt" "os" cf "github.com/go-acme/lego/v4/providers/dns/cloudflare" @@ -23,6 +24,7 @@ func (c *cloudflare) Apply() (*Certificate, error) { json.Unmarshal([]byte(c.option.Access), access) os.Setenv("CLOUDFLARE_DNS_API_TOKEN", access.DnsApiToken) + os.Setenv("CLOUDFLARE_PROPAGATION_TIMEOUT", fmt.Sprintf("%d", c.option.Timeout)) provider, err := cf.NewDNSProvider() if err != nil { diff --git a/internal/applicant/godaddy.go b/internal/applicant/godaddy.go index d8fd7631..911ee7cd 100644 --- a/internal/applicant/godaddy.go +++ b/internal/applicant/godaddy.go @@ -3,6 +3,7 @@ package applicant import ( "certimate/internal/domain" "encoding/json" + "fmt" "os" godaddyProvider "github.com/go-acme/lego/v4/providers/dns/godaddy" @@ -25,6 +26,7 @@ func (a *godaddy) Apply() (*Certificate, error) { os.Setenv("GODADDY_API_KEY", access.ApiKey) os.Setenv("GODADDY_API_SECRET", access.ApiSecret) + os.Setenv("GODADDY_PROPAGATION_TIMEOUT", fmt.Sprintf("%d", a.option.Timeout)) dnsProvider, err := godaddyProvider.NewDNSProvider() if err != nil { diff --git a/internal/applicant/huaweicloud.go b/internal/applicant/huaweicloud.go index 3f15b86c..8da5f6ae 100644 --- a/internal/applicant/huaweicloud.go +++ b/internal/applicant/huaweicloud.go @@ -3,6 +3,7 @@ package applicant import ( "certimate/internal/domain" "encoding/json" + "fmt" "os" huaweicloudProvider "github.com/go-acme/lego/v4/providers/dns/huaweicloud" @@ -26,6 +27,8 @@ func (t *huaweicloud) Apply() (*Certificate, error) { os.Setenv("HUAWEICLOUD_REGION", access.Region) // 华为云的 SDK 要求必须传一个区域,实际上 DNS-01 流程里用不到,但不传会报错 os.Setenv("HUAWEICLOUD_ACCESS_KEY_ID", access.AccessKeyId) os.Setenv("HUAWEICLOUD_SECRET_ACCESS_KEY", access.SecretAccessKey) + os.Setenv("HUAWEICLOUD_PROPAGATION_TIMEOUT", fmt.Sprintf("%d", t.option.Timeout)) + dnsProvider, err := huaweicloudProvider.NewDNSProvider() if err != nil { return nil, err diff --git a/internal/applicant/namesilo.go b/internal/applicant/namesilo.go index f5c0eac0..69f6277a 100644 --- a/internal/applicant/namesilo.go +++ b/internal/applicant/namesilo.go @@ -3,6 +3,7 @@ package applicant import ( "certimate/internal/domain" "encoding/json" + "fmt" "os" namesiloProvider "github.com/go-acme/lego/v4/providers/dns/namesilo" @@ -24,6 +25,7 @@ func (a *namesilo) Apply() (*Certificate, error) { json.Unmarshal([]byte(a.option.Access), access) os.Setenv("NAMESILO_API_KEY", access.ApiKey) + os.Setenv("NAMESILO_PROPAGATION_TIMEOUT", fmt.Sprintf("%d", a.option.Timeout)) dnsProvider, err := namesiloProvider.NewDNSProvider() if err != nil { diff --git a/internal/applicant/tencent.go b/internal/applicant/tencent.go index cba6ec1a..d7ed6dc9 100644 --- a/internal/applicant/tencent.go +++ b/internal/applicant/tencent.go @@ -3,6 +3,7 @@ package applicant import ( "certimate/internal/domain" "encoding/json" + "fmt" "os" "github.com/go-acme/lego/v4/providers/dns/tencentcloud" @@ -25,6 +26,8 @@ func (t *tencent) Apply() (*Certificate, error) { os.Setenv("TENCENTCLOUD_SECRET_ID", access.SecretId) os.Setenv("TENCENTCLOUD_SECRET_KEY", access.SecretKey) + os.Setenv("TENCENTCLOUD_PROPAGATION_TIMEOUT", fmt.Sprintf("%d", t.option.Timeout)) + dnsProvider, err := tencentcloud.NewDNSProvider() if err != nil { return nil, err diff --git a/internal/deployer/aliyun.go b/internal/deployer/aliyun.go index 5bfb7563..52bd6707 100644 --- a/internal/deployer/aliyun.go +++ b/internal/deployer/aliyun.go @@ -190,7 +190,7 @@ func (a *aliyun) resource() (*cas20200407.ListCloudResourcesResponseBodyData, er listCloudResourcesRequest := &cas20200407.ListCloudResourcesRequest{ CloudProduct: tea.String(a.option.Product), - Keyword: tea.String(a.option.Domain), + Keyword: tea.String(getDeployString(a.option.DeployConfig, "domain")), } resp, err := a.client.ListCloudResources(listCloudResourcesRequest) diff --git a/internal/deployer/aliyun_cdn.go b/internal/deployer/aliyun_cdn.go index df2bb83e..d0f1edd4 100644 --- a/internal/deployer/aliyun_cdn.go +++ b/internal/deployer/aliyun_cdn.go @@ -2,6 +2,7 @@ package deployer import ( "certimate/internal/domain" + "certimate/internal/utils/rand" "context" "encoding/json" "fmt" @@ -46,9 +47,9 @@ func (a *AliyunCdn) GetInfo() []string { func (a *AliyunCdn) Deploy(ctx context.Context) error { - certName := fmt.Sprintf("%s-%s", a.option.Domain, a.option.DomainId) + certName := fmt.Sprintf("%s-%s-%s", a.option.Domain, a.option.DomainId, rand.RandStr(6)) setCdnDomainSSLCertificateRequest := &cdn20180510.SetCdnDomainSSLCertificateRequest{ - DomainName: tea.String(a.option.Domain), + DomainName: tea.String(getDeployString(a.option.DeployConfig, "domain")), CertName: tea.String(certName), CertType: tea.String("upload"), SSLProtocol: tea.String("on"), diff --git a/internal/deployer/aliyun_esa.go b/internal/deployer/aliyun_esa.go index c2740434..27ce040f 100644 --- a/internal/deployer/aliyun_esa.go +++ b/internal/deployer/aliyun_esa.go @@ -7,6 +7,7 @@ package deployer import ( "certimate/internal/domain" + "certimate/internal/utils/rand" "context" "encoding/json" "fmt" @@ -51,9 +52,9 @@ func (a *AliyunEsa) GetInfo() []string { func (a *AliyunEsa) Deploy(ctx context.Context) error { - certName := fmt.Sprintf("%s-%s", a.option.Domain, a.option.DomainId) + certName := fmt.Sprintf("%s-%s-%s", a.option.Domain, a.option.DomainId, rand.RandStr(6)) setDcdnDomainSSLCertificateRequest := &dcdn20180115.SetDcdnDomainSSLCertificateRequest{ - DomainName: tea.String(a.option.Domain), + DomainName: tea.String(getDeployString(a.option.DeployConfig, "domain")), CertName: tea.String(certName), CertType: tea.String("upload"), SSLProtocol: tea.String("on"), diff --git a/internal/deployer/deployer.go b/internal/deployer/deployer.go index 71a171d5..1a6497a9 100644 --- a/internal/deployer/deployer.go +++ b/internal/deployer/deployer.go @@ -2,8 +2,8 @@ package deployer import ( "certimate/internal/applicant" + "certimate/internal/domain" "certimate/internal/utils/app" - "certimate/internal/utils/variables" "context" "encoding/json" "errors" @@ -30,6 +30,7 @@ type DeployerOption struct { Product string `json:"product"` Access string `json:"access"` AceessRecord *models.Record `json:"-"` + DeployConfig domain.DeployConfig `json:"deployConfig"` Certificate applicant.Certificate `json:"certificate"` Variables map[string]string `json:"variables"` } @@ -42,52 +43,29 @@ type Deployer interface { func Gets(record *models.Record, cert *applicant.Certificate) ([]Deployer, error) { rs := make([]Deployer, 0) - - if record.GetString("targetAccess") != "" { - singleDeployer, err := Get(record, cert) - if err != nil { - return nil, err - } - rs = append(rs, singleDeployer) + if record.GetString("deployConfig") == "" { + return rs, nil } - if record.GetString("group") != "" { - group := record.ExpandedOne("group") - - if errs := app.GetApp().Dao().ExpandRecord(group, []string{"access"}, nil); len(errs) > 0 { - - errList := make([]error, 0) - for name, err := range errs { - errList = append(errList, fmt.Errorf("展开记录失败,%s: %w", name, err)) - } - err := errors.Join(errList...) - return nil, err - } - - records := group.ExpandedAll("access") - - deployers, err := getByGroup(record, cert, records...) - if err != nil { - return nil, err - } - - rs = append(rs, deployers...) + deployConfigs := make([]domain.DeployConfig, 0) + err := record.UnmarshalJSONField("deployConfig", &deployConfigs) + if err != nil { + return nil, fmt.Errorf("解析部署配置失败: %w", err) } - return rs, nil + if len(deployConfigs) == 0 { + return rs, nil + } -} + for _, deployConfig := range deployConfigs { -func getByGroup(record *models.Record, cert *applicant.Certificate, accesses ...*models.Record) ([]Deployer, error) { + deployer, err := getWithDeployConfig(record, cert, deployConfig) - rs := make([]Deployer, 0) - - for _, access := range accesses { - deployer, err := getWithAccess(record, cert, access) if err != nil { return nil, err } + rs = append(rs, deployer) } @@ -95,15 +73,21 @@ func getByGroup(record *models.Record, cert *applicant.Certificate, accesses ... } -func getWithAccess(record *models.Record, cert *applicant.Certificate, access *models.Record) (Deployer, error) { +func getWithDeployConfig(record *models.Record, cert *applicant.Certificate, deployConfig domain.DeployConfig) (Deployer, error) { + + access, err := app.GetApp().Dao().FindRecordById("access", deployConfig.Access) + + if err != nil { + return nil, fmt.Errorf("access record not found: %w", err) + } option := &DeployerOption{ DomainId: record.Id, Domain: record.GetString("domain"), - Product: getProduct(record), + Product: getProduct(deployConfig.Type), Access: access.GetString("config"), AceessRecord: access, - Variables: variables.Parse2Map(record.GetString("variables")), + DeployConfig: deployConfig, } if cert != nil { option.Certificate = *cert @@ -114,7 +98,7 @@ func getWithAccess(record *models.Record, cert *applicant.Certificate, access *m } } - switch record.GetString("targetType") { + switch deployConfig.Type { case targetAliyunOss: return NewAliyun(option) case targetAliyunCdn: @@ -136,16 +120,8 @@ func getWithAccess(record *models.Record, cert *applicant.Certificate, access *m return nil, errors.New("not implemented") } -func Get(record *models.Record, cert *applicant.Certificate) (Deployer, error) { - - access := record.ExpandedOne("targetAccess") - - return getWithAccess(record, cert, access) -} - -func getProduct(record *models.Record) string { - targetType := record.GetString("targetType") - rs := strings.Split(targetType, "-") +func getProduct(t string) string { + rs := strings.Split(t, "-") if len(rs) < 2 { return "" } @@ -159,3 +135,39 @@ func toStr(tag string, data any) string { byts, _ := json.Marshal(data) return tag + ":" + string(byts) } + +func getDeployString(conf domain.DeployConfig, key string) string { + if _, ok := conf.Config[key]; !ok { + return "" + } + + val, ok := conf.Config[key].(string) + if !ok { + return "" + } + + return val +} + +func getDeployVariables(conf domain.DeployConfig) map[string]string { + rs := make(map[string]string) + data, ok := conf.Config["variables"] + if !ok { + return rs + } + + bts, _ := json.Marshal(data) + + kvData := make([]domain.KV, 0) + + if err := json.Unmarshal(bts, &kvData); err != nil { + return rs + } + + for _, kv := range kvData { + rs[kv.Key] = kv.Value + } + + return rs + +} diff --git a/internal/deployer/local.go b/internal/deployer/local.go index 4457423b..d092db95 100644 --- a/internal/deployer/local.go +++ b/internal/deployer/local.go @@ -11,9 +11,6 @@ import ( ) type localAccess struct { - Command string `json:"command"` - CertPath string `json:"certPath"` - KeyPath string `json:"keyPath"` } type local struct { @@ -41,18 +38,27 @@ func (l *local) Deploy(ctx context.Context) error { if err := json.Unmarshal([]byte(l.option.Access), access); err != nil { return err } + + preCommand := getDeployString(l.option.DeployConfig, "preCommand") + + if preCommand != "" { + if err := execCmd(preCommand); err != nil { + return fmt.Errorf("执行前置命令失败: %w", err) + } + } + // 复制文件 - if err := copyFile(l.option.Certificate.Certificate, access.CertPath); err != nil { + if err := copyFile(l.option.Certificate.Certificate, getDeployString(l.option.DeployConfig, "certPath")); err != nil { return fmt.Errorf("复制证书失败: %w", err) } - if err := copyFile(l.option.Certificate.PrivateKey, access.KeyPath); err != nil { + if err := copyFile(l.option.Certificate.PrivateKey, getDeployString(l.option.DeployConfig, "keyPath")); err != nil { return fmt.Errorf("复制私钥失败: %w", err) } // 执行命令 - if err := execCmd(access.Command); err != nil { + if err := execCmd(getDeployString(l.option.DeployConfig, "command")); err != nil { return fmt.Errorf("执行命令失败: %w", err) } diff --git a/internal/deployer/qiniu.go b/internal/deployer/qiniu.go index f2deae0b..637b1167 100644 --- a/internal/deployer/qiniu.go +++ b/internal/deployer/qiniu.go @@ -78,7 +78,7 @@ func (q *qiuniu) Deploy(ctx context.Context) error { } func (q *qiuniu) enableHttps(certId string) error { - path := fmt.Sprintf("/domain/%s/sslize", q.option.Domain) + path := fmt.Sprintf("/domain/%s/sslize", getDeployString(q.option.DeployConfig, "domain")) body := &modifyDomainCertReq{ CertID: certId, @@ -104,7 +104,7 @@ type domainInfo struct { } func (q *qiuniu) getDomainInfo() (*domainInfo, error) { - path := fmt.Sprintf("/domain/%s", q.option.Domain) + path := fmt.Sprintf("/domain/%s", getDeployString(q.option.DeployConfig, "domain")) res, err := q.req(qiniuGateway+path, http.MethodGet, nil) if err != nil { @@ -135,8 +135,8 @@ func (q *qiuniu) uploadCert() (string, error) { path := "/sslcert" body := &uploadCertReq{ - Name: q.option.Domain, - CommonName: q.option.Domain, + Name: getDeployString(q.option.DeployConfig, "domain"), + CommonName: getDeployString(q.option.DeployConfig, "domain"), Pri: q.option.Certificate.PrivateKey, Ca: q.option.Certificate.Certificate, } @@ -166,7 +166,7 @@ type modifyDomainCertReq struct { } func (q *qiuniu) modifyDomainCert(certId string) error { - path := fmt.Sprintf("/domain/%s/httpsconf", q.option.Domain) + path := fmt.Sprintf("/domain/%s/httpsconf", getDeployString(q.option.DeployConfig, "domain")) body := &modifyDomainCertReq{ CertID: certId, diff --git a/internal/deployer/ssh.go b/internal/deployer/ssh.go index f6757ec9..c7a03d4c 100644 --- a/internal/deployer/ssh.go +++ b/internal/deployer/ssh.go @@ -7,7 +7,6 @@ import ( "fmt" "os" xpath "path" - "strings" "github.com/pkg/sftp" sshPkg "golang.org/x/crypto/ssh" @@ -19,15 +18,11 @@ type ssh struct { } type sshAccess struct { - Host string `json:"host"` - Username string `json:"username"` - Password string `json:"password"` - Key string `json:"key"` - Port string `json:"port"` - PreCommand string `json:"preCommand"` - Command string `json:"command"` - CertPath string `json:"certPath"` - KeyPath string `json:"keyPath"` + Host string `json:"host"` + Username string `json:"username"` + Password string `json:"password"` + Key string `json:"key"` + Port string `json:"port"` } func NewSSH(option *DeployerOption) (Deployer, error) { @@ -50,16 +45,6 @@ func (s *ssh) Deploy(ctx context.Context) error { if err := json.Unmarshal([]byte(s.option.Access), access); err != nil { return err } - - // 将证书路径和命令中的变量替换为实际值 - for k, v := range s.option.Variables { - key := fmt.Sprintf("${%s}", k) - access.CertPath = strings.ReplaceAll(access.CertPath, key, v) - access.KeyPath = strings.ReplaceAll(access.KeyPath, key, v) - access.Command = strings.ReplaceAll(access.Command, key, v) - access.PreCommand = strings.ReplaceAll(access.PreCommand, key, v) - } - // 连接 client, err := s.getClient(access) if err != nil { @@ -70,29 +55,30 @@ func (s *ssh) Deploy(ctx context.Context) error { s.infos = append(s.infos, toStr("ssh连接成功", nil)) // 执行前置命令 - if access.PreCommand != "" { - err, stdout, stderr := s.sshExecCommand(client, access.PreCommand) + preCommand := getDeployString(s.option.DeployConfig, "preCommand") + if preCommand != "" { + err, stdout, stderr := s.sshExecCommand(client, preCommand) if err != nil { return fmt.Errorf("failed to run pre-command: %w, stdout: %s, stderr: %s", err, stdout, stderr) } } // 上传证书 - if err := s.upload(client, s.option.Certificate.Certificate, access.CertPath); err != nil { + if err := s.upload(client, s.option.Certificate.Certificate, getDeployString(s.option.DeployConfig, "certPath")); err != nil { return fmt.Errorf("failed to upload certificate: %w", err) } s.infos = append(s.infos, toStr("ssh上传证书成功", nil)) // 上传私钥 - if err := s.upload(client, s.option.Certificate.PrivateKey, access.KeyPath); err != nil { + if err := s.upload(client, s.option.Certificate.PrivateKey, getDeployString(s.option.DeployConfig, "keyPath")); err != nil { return fmt.Errorf("failed to upload private key: %w", err) } s.infos = append(s.infos, toStr("ssh上传私钥成功", nil)) // 执行命令 - err, stdout, stderr := s.sshExecCommand(client, access.Command) + err, stdout, stderr := s.sshExecCommand(client, getDeployString(s.option.DeployConfig, "command")) if err != nil { return fmt.Errorf("failed to run command: %w, stdout: %s, stderr: %s", err, stdout, stderr) } diff --git a/internal/deployer/webhook.go b/internal/deployer/webhook.go index 0d7999e3..56486585 100644 --- a/internal/deployer/webhook.go +++ b/internal/deployer/webhook.go @@ -14,9 +14,10 @@ type webhookAccess struct { } type hookData struct { - Domain string `json:"domain"` - Certificate string `json:"certificate"` - PrivateKey string `json:"privateKey"` + Domain string `json:"domain"` + Certificate string `json:"certificate"` + PrivateKey string `json:"privateKey"` + Variables map[string]string `json:"variables"` } type webhook struct { @@ -50,6 +51,7 @@ func (w *webhook) Deploy(ctx context.Context) error { Domain: w.option.Domain, Certificate: w.option.Certificate.Certificate, PrivateKey: w.option.Certificate.PrivateKey, + Variables: getDeployVariables(w.option.DeployConfig), } body, _ := json.Marshal(data) diff --git a/internal/domain/domains.go b/internal/domain/domains.go new file mode 100644 index 00000000..ff378274 --- /dev/null +++ b/internal/domain/domains.go @@ -0,0 +1,20 @@ +package domain + +type ApplyConfig struct { + Email string `json:"email"` + Access string `json:"access"` + Timeout int64 `json:"timeout"` + Nameservers string `json:"nameservers"` +} + +type DeployConfig struct { + Id string `json:"id"` + Access string `json:"access"` + Type string `json:"type"` + Config map[string]any `json:"config"` +} + +type KV struct { + Key string `json:"key"` + Value string `json:"value"` +} diff --git a/internal/domains/deploy.go b/internal/domains/deploy.go index d2d8b08f..2f48434b 100644 --- a/internal/domains/deploy.go +++ b/internal/domains/deploy.go @@ -5,7 +5,6 @@ import ( "certimate/internal/deployer" "certimate/internal/utils/app" "context" - "errors" "fmt" "time" @@ -41,18 +40,6 @@ func deploy(ctx context.Context, record *models.Record) error { return err } history.record(checkPhase, "获取记录成功", nil) - if errs := app.GetApp().Dao().ExpandRecord(currRecord, []string{"access", "targetAccess", "group"}, nil); len(errs) > 0 { - - errList := make([]error, 0) - for name, err := range errs { - errList = append(errList, fmt.Errorf("展开记录失败,%s: %w", name, err)) - } - err = errors.Join(errList...) - app.GetApp().Logger().Error("展开记录失败", "err", err) - history.record(checkPhase, "获取授权信息失败", &RecordInfo{Err: err}) - return err - } - history.record(checkPhase, "获取授权信息成功", nil) cert := currRecord.GetString("certificate") expiredAt := currRecord.GetDateTime("expiredAt").Time() @@ -106,6 +93,13 @@ func deploy(ctx context.Context, record *models.Record) error { return err } + // 没有部署配置,也算成功 + if len(deployers) == 0 { + history.record(deployPhase, "没有部署配置", &RecordInfo{Info: []string{"没有部署配置"}}) + history.setWholeSuccess(true) + return nil + } + for _, deployer := range deployers { if err = deployer.Deploy(ctx); err != nil { diff --git a/migrations/1728778480_collections_snapshot.go b/migrations/1728778480_collections_snapshot.go new file mode 100644 index 00000000..7134989e --- /dev/null +++ b/migrations/1728778480_collections_snapshot.go @@ -0,0 +1,731 @@ +package migrations + +import ( + "encoding/json" + + "github.com/pocketbase/dbx" + "github.com/pocketbase/pocketbase/daos" + m "github.com/pocketbase/pocketbase/migrations" + "github.com/pocketbase/pocketbase/models" +) + +func init() { + m.Register(func(db dbx.Builder) error { + jsonData := `[ + { + "id": "z3p974ainxjqlvs", + "created": "2024-07-29 10:02:48.334Z", + "updated": "2024-10-08 06:50:56.637Z", + "name": "domains", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "iuaerpl2", + "name": "domain", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "ukkhuw85", + "name": "email", + "type": "email", + "required": false, + "presentable": false, + "unique": false, + "options": { + "exceptDomains": null, + "onlyDomains": null + } + }, + { + "system": false, + "id": "v98eebqq", + "name": "crontab", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "alc8e9ow", + "name": "access", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "4yzbv8urny5ja1e", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + }, + { + "system": false, + "id": "topsc9bj", + "name": "certUrl", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "vixgq072", + "name": "certStableUrl", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "g3a3sza5", + "name": "privateKey", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "gr6iouny", + "name": "certificate", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "tk6vnrmn", + "name": "issuerCertificate", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "sjo6ibse", + "name": "csr", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "x03n1bkj", + "name": "expiredAt", + "type": "date", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": "", + "max": "" + } + }, + { + "system": false, + "id": "srybpixz", + "name": "targetType", + "type": "select", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSelect": 1, + "values": [ + "aliyun-oss", + "aliyun-cdn", + "aliyun-dcdn", + "ssh", + "webhook", + "tencent-cdn", + "qiniu-cdn", + "local" + ] + } + }, + { + "system": false, + "id": "xy7yk0mb", + "name": "targetAccess", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "4yzbv8urny5ja1e", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + }, + { + "system": false, + "id": "6jqeyggw", + "name": "enabled", + "type": "bool", + "required": false, + "presentable": false, + "unique": false, + "options": {} + }, + { + "system": false, + "id": "hdsjcchf", + "name": "deployed", + "type": "bool", + "required": false, + "presentable": false, + "unique": false, + "options": {} + }, + { + "system": false, + "id": "aiya3rev", + "name": "rightnow", + "type": "bool", + "required": false, + "presentable": false, + "unique": false, + "options": {} + }, + { + "system": false, + "id": "ixznmhzc", + "name": "lastDeployedAt", + "type": "date", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": "", + "max": "" + } + }, + { + "system": false, + "id": "ghtlkn5j", + "name": "lastDeployment", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "0a1o4e6sstp694f", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + }, + { + "system": false, + "id": "zfnyj9he", + "name": "variables", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "1bspzuku", + "name": "group", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "teolp9pl72dxlxq", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + }, + { + "system": false, + "id": "g65gfh7a", + "name": "nameservers", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "wwrzc3jo", + "name": "applyConfig", + "type": "json", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSize": 2000000 + } + }, + { + "system": false, + "id": "474iwy8r", + "name": "deployConfig", + "type": "json", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSize": 2000000 + } + } + ], + "indexes": [ + "CREATE UNIQUE INDEX ` + "`" + `idx_4ABO6EQ` + "`" + ` ON ` + "`" + `domains` + "`" + ` (` + "`" + `domain` + "`" + `)" + ], + "listRule": null, + "viewRule": null, + "createRule": null, + "updateRule": null, + "deleteRule": null, + "options": {} + }, + { + "id": "4yzbv8urny5ja1e", + "created": "2024-07-29 10:04:39.685Z", + "updated": "2024-10-11 13:55:13.777Z", + "name": "access", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "geeur58v", + "name": "name", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "iql7jpwx", + "name": "config", + "type": "json", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSize": 2000000 + } + }, + { + "system": false, + "id": "hwy7m03o", + "name": "configType", + "type": "select", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSelect": 1, + "values": [ + "aliyun", + "tencent", + "huaweicloud", + "qiniu", + "cloudflare", + "namesilo", + "godaddy", + "local", + "ssh", + "webhook" + ] + } + }, + { + "system": false, + "id": "lr33hiwg", + "name": "deleted", + "type": "date", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": "", + "max": "" + } + }, + { + "system": false, + "id": "hsxcnlvd", + "name": "usage", + "type": "select", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSelect": 1, + "values": [ + "apply", + "deploy", + "all" + ] + } + }, + { + "system": false, + "id": "c8egzzwj", + "name": "group", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "teolp9pl72dxlxq", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + } + ], + "indexes": [ + "CREATE UNIQUE INDEX ` + "`" + `idx_wkoST0j` + "`" + ` ON ` + "`" + `access` + "`" + ` (` + "`" + `name` + "`" + `)" + ], + "listRule": null, + "viewRule": null, + "createRule": null, + "updateRule": null, + "deleteRule": null, + "options": {} + }, + { + "id": "0a1o4e6sstp694f", + "created": "2024-07-30 06:30:27.801Z", + "updated": "2024-09-26 12:29:38.334Z", + "name": "deployments", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "farvlzk7", + "name": "domain", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "z3p974ainxjqlvs", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + }, + { + "system": false, + "id": "jx5f69i3", + "name": "log", + "type": "json", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSize": 2000000 + } + }, + { + "system": false, + "id": "qbxdtg9q", + "name": "phase", + "type": "select", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSelect": 1, + "values": [ + "check", + "apply", + "deploy" + ] + } + }, + { + "system": false, + "id": "rglrp1hz", + "name": "phaseSuccess", + "type": "bool", + "required": false, + "presentable": false, + "unique": false, + "options": {} + }, + { + "system": false, + "id": "lt1g1blu", + "name": "deployedAt", + "type": "date", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": "", + "max": "" + } + }, + { + "system": false, + "id": "wledpzgb", + "name": "wholeSuccess", + "type": "bool", + "required": false, + "presentable": false, + "unique": false, + "options": {} + } + ], + "indexes": [], + "listRule": null, + "viewRule": null, + "createRule": null, + "updateRule": null, + "deleteRule": null, + "options": {} + }, + { + "id": "_pb_users_auth_", + "created": "2024-09-12 13:09:54.234Z", + "updated": "2024-09-26 12:29:38.334Z", + "name": "users", + "type": "auth", + "system": false, + "schema": [ + { + "system": false, + "id": "users_name", + "name": "name", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "users_avatar", + "name": "avatar", + "type": "file", + "required": false, + "presentable": false, + "unique": false, + "options": { + "mimeTypes": [ + "image/jpeg", + "image/png", + "image/svg+xml", + "image/gif", + "image/webp" + ], + "thumbs": null, + "maxSelect": 1, + "maxSize": 5242880, + "protected": false + } + } + ], + "indexes": [], + "listRule": "id = @request.auth.id", + "viewRule": "id = @request.auth.id", + "createRule": "", + "updateRule": "id = @request.auth.id", + "deleteRule": "id = @request.auth.id", + "options": { + "allowEmailAuth": true, + "allowOAuth2Auth": true, + "allowUsernameAuth": true, + "exceptEmailDomains": null, + "manageRule": null, + "minPasswordLength": 8, + "onlyEmailDomains": null, + "onlyVerified": false, + "requireEmail": false + } + }, + { + "id": "dy6ccjb60spfy6p", + "created": "2024-09-12 23:12:21.677Z", + "updated": "2024-09-26 12:29:38.334Z", + "name": "settings", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "1tcmdsdf", + "name": "name", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "f9wyhypi", + "name": "content", + "type": "json", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSize": 2000000 + } + } + ], + "indexes": [ + "CREATE UNIQUE INDEX ` + "`" + `idx_RO7X9Vw` + "`" + ` ON ` + "`" + `settings` + "`" + ` (` + "`" + `name` + "`" + `)" + ], + "listRule": null, + "viewRule": null, + "createRule": null, + "updateRule": null, + "deleteRule": null, + "options": {} + }, + { + "id": "teolp9pl72dxlxq", + "created": "2024-09-13 12:51:05.611Z", + "updated": "2024-09-26 12:29:38.334Z", + "name": "access_groups", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "7sajiv6i", + "name": "name", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "xp8admif", + "name": "access", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "4yzbv8urny5ja1e", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": null, + "displayFields": null + } + } + ], + "indexes": [ + "CREATE UNIQUE INDEX ` + "`" + `idx_RgRXp0R` + "`" + ` ON ` + "`" + `access_groups` + "`" + ` (` + "`" + `name` + "`" + `)" + ], + "listRule": null, + "viewRule": null, + "createRule": null, + "updateRule": null, + "deleteRule": null, + "options": {} + } + ]` + + collections := []*models.Collection{} + if err := json.Unmarshal([]byte(jsonData), &collections); err != nil { + return err + } + + return daos.New(db).ImportCollections(collections, true, nil) + }, func(db dbx.Builder) error { + return nil + }) +} diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 00000000..2e03ca09 --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,16 @@ +{ + "name": "certimate", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/immer": { + "version": "10.1.1", + "resolved": "https://registry.npmmirror.com/immer/-/immer-10.1.1.tgz", + "integrity": "sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + } + } +} diff --git a/node_modules/immer/LICENSE b/node_modules/immer/LICENSE new file mode 100644 index 00000000..c0141158 --- /dev/null +++ b/node_modules/immer/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Michel Weststrate + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/immer/dist/cjs/immer.cjs.development.js b/node_modules/immer/dist/cjs/immer.cjs.development.js new file mode 100644 index 00000000..893f6952 --- /dev/null +++ b/node_modules/immer/dist/cjs/immer.cjs.development.js @@ -0,0 +1,1276 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/immer.ts +var immer_exports = {}; +__export(immer_exports, { + Immer: () => Immer2, + applyPatches: () => applyPatches, + castDraft: () => castDraft, + castImmutable: () => castImmutable, + createDraft: () => createDraft, + current: () => current, + enableMapSet: () => enableMapSet, + enablePatches: () => enablePatches, + finishDraft: () => finishDraft, + freeze: () => freeze, + immerable: () => DRAFTABLE, + isDraft: () => isDraft, + isDraftable: () => isDraftable, + nothing: () => NOTHING, + original: () => original, + produce: () => produce, + produceWithPatches: () => produceWithPatches, + setAutoFreeze: () => setAutoFreeze, + setUseStrictShallowCopy: () => setUseStrictShallowCopy +}); +module.exports = __toCommonJS(immer_exports); + +// src/utils/env.ts +var NOTHING = Symbol.for("immer-nothing"); +var DRAFTABLE = Symbol.for("immer-draftable"); +var DRAFT_STATE = Symbol.for("immer-state"); + +// src/utils/errors.ts +var errors = process.env.NODE_ENV !== "production" ? [ + // All error codes, starting by 0: + function(plugin) { + return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.`; + }, + function(thing) { + return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`; + }, + "This object has been frozen and should not be mutated", + function(data) { + return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + data; + }, + "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.", + "Immer forbids circular references", + "The first or second argument to `produce` must be a function", + "The third argument to `produce` must be a function or undefined", + "First argument to `createDraft` must be a plain object, an array, or an immerable object", + "First argument to `finishDraft` must be a draft returned by `createDraft`", + function(thing) { + return `'current' expects a draft, got: ${thing}`; + }, + "Object.defineProperty() cannot be used on an Immer draft", + "Object.setPrototypeOf() cannot be used on an Immer draft", + "Immer only supports deleting array indices", + "Immer only supports setting array indices and the 'length' property", + function(thing) { + return `'original' expects a draft, got: ${thing}`; + } + // Note: if more errors are added, the errorOffset in Patches.ts should be increased + // See Patches.ts for additional errors +] : []; +function die(error, ...args) { + if (process.env.NODE_ENV !== "production") { + const e = errors[error]; + const msg = typeof e === "function" ? e.apply(null, args) : e; + throw new Error(`[Immer] ${msg}`); + } + throw new Error( + `[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf` + ); +} + +// src/utils/common.ts +var getPrototypeOf = Object.getPrototypeOf; +function isDraft(value) { + return !!value && !!value[DRAFT_STATE]; +} +function isDraftable(value) { + if (!value) + return false; + return isPlainObject(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor?.[DRAFTABLE] || isMap(value) || isSet(value); +} +var objectCtorString = Object.prototype.constructor.toString(); +function isPlainObject(value) { + if (!value || typeof value !== "object") + return false; + const proto = getPrototypeOf(value); + if (proto === null) { + return true; + } + const Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor; + if (Ctor === Object) + return true; + return typeof Ctor == "function" && Function.toString.call(Ctor) === objectCtorString; +} +function original(value) { + if (!isDraft(value)) + die(15, value); + return value[DRAFT_STATE].base_; +} +function each(obj, iter) { + if (getArchtype(obj) === 0 /* Object */) { + Reflect.ownKeys(obj).forEach((key) => { + iter(key, obj[key], obj); + }); + } else { + obj.forEach((entry, index) => iter(index, entry, obj)); + } +} +function getArchtype(thing) { + const state = thing[DRAFT_STATE]; + return state ? state.type_ : Array.isArray(thing) ? 1 /* Array */ : isMap(thing) ? 2 /* Map */ : isSet(thing) ? 3 /* Set */ : 0 /* Object */; +} +function has(thing, prop) { + return getArchtype(thing) === 2 /* Map */ ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop); +} +function get(thing, prop) { + return getArchtype(thing) === 2 /* Map */ ? thing.get(prop) : thing[prop]; +} +function set(thing, propOrOldValue, value) { + const t = getArchtype(thing); + if (t === 2 /* Map */) + thing.set(propOrOldValue, value); + else if (t === 3 /* Set */) { + thing.add(value); + } else + thing[propOrOldValue] = value; +} +function is(x, y) { + if (x === y) { + return x !== 0 || 1 / x === 1 / y; + } else { + return x !== x && y !== y; + } +} +function isMap(target) { + return target instanceof Map; +} +function isSet(target) { + return target instanceof Set; +} +function latest(state) { + return state.copy_ || state.base_; +} +function shallowCopy(base, strict) { + if (isMap(base)) { + return new Map(base); + } + if (isSet(base)) { + return new Set(base); + } + if (Array.isArray(base)) + return Array.prototype.slice.call(base); + const isPlain = isPlainObject(base); + if (strict === true || strict === "class_only" && !isPlain) { + const descriptors = Object.getOwnPropertyDescriptors(base); + delete descriptors[DRAFT_STATE]; + let keys = Reflect.ownKeys(descriptors); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const desc = descriptors[key]; + if (desc.writable === false) { + desc.writable = true; + desc.configurable = true; + } + if (desc.get || desc.set) + descriptors[key] = { + configurable: true, + writable: true, + // could live with !!desc.set as well here... + enumerable: desc.enumerable, + value: base[key] + }; + } + return Object.create(getPrototypeOf(base), descriptors); + } else { + const proto = getPrototypeOf(base); + if (proto !== null && isPlain) { + return { ...base }; + } + const obj = Object.create(proto); + return Object.assign(obj, base); + } +} +function freeze(obj, deep = false) { + if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) + return obj; + if (getArchtype(obj) > 1) { + obj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections; + } + Object.freeze(obj); + if (deep) + Object.entries(obj).forEach(([key, value]) => freeze(value, true)); + return obj; +} +function dontMutateFrozenCollections() { + die(2); +} +function isFrozen(obj) { + return Object.isFrozen(obj); +} + +// src/utils/plugins.ts +var plugins = {}; +function getPlugin(pluginKey) { + const plugin = plugins[pluginKey]; + if (!plugin) { + die(0, pluginKey); + } + return plugin; +} +function loadPlugin(pluginKey, implementation) { + if (!plugins[pluginKey]) + plugins[pluginKey] = implementation; +} + +// src/core/scope.ts +var currentScope; +function getCurrentScope() { + return currentScope; +} +function createScope(parent_, immer_) { + return { + drafts_: [], + parent_, + immer_, + // Whenever the modified draft contains a draft from another scope, we + // need to prevent auto-freezing so the unowned draft can be finalized. + canAutoFreeze_: true, + unfinalizedDrafts_: 0 + }; +} +function usePatchesInScope(scope, patchListener) { + if (patchListener) { + getPlugin("Patches"); + scope.patches_ = []; + scope.inversePatches_ = []; + scope.patchListener_ = patchListener; + } +} +function revokeScope(scope) { + leaveScope(scope); + scope.drafts_.forEach(revokeDraft); + scope.drafts_ = null; +} +function leaveScope(scope) { + if (scope === currentScope) { + currentScope = scope.parent_; + } +} +function enterScope(immer2) { + return currentScope = createScope(currentScope, immer2); +} +function revokeDraft(draft) { + const state = draft[DRAFT_STATE]; + if (state.type_ === 0 /* Object */ || state.type_ === 1 /* Array */) + state.revoke_(); + else + state.revoked_ = true; +} + +// src/core/finalize.ts +function processResult(result, scope) { + scope.unfinalizedDrafts_ = scope.drafts_.length; + const baseDraft = scope.drafts_[0]; + const isReplaced = result !== void 0 && result !== baseDraft; + if (isReplaced) { + if (baseDraft[DRAFT_STATE].modified_) { + revokeScope(scope); + die(4); + } + if (isDraftable(result)) { + result = finalize(scope, result); + if (!scope.parent_) + maybeFreeze(scope, result); + } + if (scope.patches_) { + getPlugin("Patches").generateReplacementPatches_( + baseDraft[DRAFT_STATE].base_, + result, + scope.patches_, + scope.inversePatches_ + ); + } + } else { + result = finalize(scope, baseDraft, []); + } + revokeScope(scope); + if (scope.patches_) { + scope.patchListener_(scope.patches_, scope.inversePatches_); + } + return result !== NOTHING ? result : void 0; +} +function finalize(rootScope, value, path) { + if (isFrozen(value)) + return value; + const state = value[DRAFT_STATE]; + if (!state) { + each( + value, + (key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path) + ); + return value; + } + if (state.scope_ !== rootScope) + return value; + if (!state.modified_) { + maybeFreeze(rootScope, state.base_, true); + return state.base_; + } + if (!state.finalized_) { + state.finalized_ = true; + state.scope_.unfinalizedDrafts_--; + const result = state.copy_; + let resultEach = result; + let isSet2 = false; + if (state.type_ === 3 /* Set */) { + resultEach = new Set(result); + result.clear(); + isSet2 = true; + } + each( + resultEach, + (key, childValue) => finalizeProperty(rootScope, state, result, key, childValue, path, isSet2) + ); + maybeFreeze(rootScope, result, false); + if (path && rootScope.patches_) { + getPlugin("Patches").generatePatches_( + state, + path, + rootScope.patches_, + rootScope.inversePatches_ + ); + } + } + return state.copy_; +} +function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath, targetIsSet) { + if (process.env.NODE_ENV !== "production" && childValue === targetObject) + die(5); + if (isDraft(childValue)) { + const path = rootPath && parentState && parentState.type_ !== 3 /* Set */ && // Set objects are atomic since they have no keys. + !has(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0; + const res = finalize(rootScope, childValue, path); + set(targetObject, prop, res); + if (isDraft(res)) { + rootScope.canAutoFreeze_ = false; + } else + return; + } else if (targetIsSet) { + targetObject.add(childValue); + } + if (isDraftable(childValue) && !isFrozen(childValue)) { + if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) { + return; + } + finalize(rootScope, childValue); + if ((!parentState || !parentState.scope_.parent_) && typeof prop !== "symbol" && Object.prototype.propertyIsEnumerable.call(targetObject, prop)) + maybeFreeze(rootScope, childValue); + } +} +function maybeFreeze(scope, value, deep = false) { + if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) { + freeze(value, deep); + } +} + +// src/core/proxy.ts +function createProxyProxy(base, parent) { + const isArray = Array.isArray(base); + const state = { + type_: isArray ? 1 /* Array */ : 0 /* Object */, + // Track which produce call this is associated with. + scope_: parent ? parent.scope_ : getCurrentScope(), + // True for both shallow and deep changes. + modified_: false, + // Used during finalization. + finalized_: false, + // Track which properties have been assigned (true) or deleted (false). + assigned_: {}, + // The parent draft state. + parent_: parent, + // The base state. + base_: base, + // The base proxy. + draft_: null, + // set below + // The base copy with any updated values. + copy_: null, + // Called by the `produce` function. + revoke_: null, + isManual_: false + }; + let target = state; + let traps = objectTraps; + if (isArray) { + target = [state]; + traps = arrayTraps; + } + const { revoke, proxy } = Proxy.revocable(target, traps); + state.draft_ = proxy; + state.revoke_ = revoke; + return proxy; +} +var objectTraps = { + get(state, prop) { + if (prop === DRAFT_STATE) + return state; + const source = latest(state); + if (!has(source, prop)) { + return readPropFromProto(state, source, prop); + } + const value = source[prop]; + if (state.finalized_ || !isDraftable(value)) { + return value; + } + if (value === peek(state.base_, prop)) { + prepareCopy(state); + return state.copy_[prop] = createProxy(value, state); + } + return value; + }, + has(state, prop) { + return prop in latest(state); + }, + ownKeys(state) { + return Reflect.ownKeys(latest(state)); + }, + set(state, prop, value) { + const desc = getDescriptorFromProto(latest(state), prop); + if (desc?.set) { + desc.set.call(state.draft_, value); + return true; + } + if (!state.modified_) { + const current2 = peek(latest(state), prop); + const currentState = current2?.[DRAFT_STATE]; + if (currentState && currentState.base_ === value) { + state.copy_[prop] = value; + state.assigned_[prop] = false; + return true; + } + if (is(value, current2) && (value !== void 0 || has(state.base_, prop))) + return true; + prepareCopy(state); + markChanged(state); + } + if (state.copy_[prop] === value && // special case: handle new props with value 'undefined' + (value !== void 0 || prop in state.copy_) || // special case: NaN + Number.isNaN(value) && Number.isNaN(state.copy_[prop])) + return true; + state.copy_[prop] = value; + state.assigned_[prop] = true; + return true; + }, + deleteProperty(state, prop) { + if (peek(state.base_, prop) !== void 0 || prop in state.base_) { + state.assigned_[prop] = false; + prepareCopy(state); + markChanged(state); + } else { + delete state.assigned_[prop]; + } + if (state.copy_) { + delete state.copy_[prop]; + } + return true; + }, + // Note: We never coerce `desc.value` into an Immer draft, because we can't make + // the same guarantee in ES5 mode. + getOwnPropertyDescriptor(state, prop) { + const owner = latest(state); + const desc = Reflect.getOwnPropertyDescriptor(owner, prop); + if (!desc) + return desc; + return { + writable: true, + configurable: state.type_ !== 1 /* Array */ || prop !== "length", + enumerable: desc.enumerable, + value: owner[prop] + }; + }, + defineProperty() { + die(11); + }, + getPrototypeOf(state) { + return getPrototypeOf(state.base_); + }, + setPrototypeOf() { + die(12); + } +}; +var arrayTraps = {}; +each(objectTraps, (key, fn) => { + arrayTraps[key] = function() { + arguments[0] = arguments[0][0]; + return fn.apply(this, arguments); + }; +}); +arrayTraps.deleteProperty = function(state, prop) { + if (process.env.NODE_ENV !== "production" && isNaN(parseInt(prop))) + die(13); + return arrayTraps.set.call(this, state, prop, void 0); +}; +arrayTraps.set = function(state, prop, value) { + if (process.env.NODE_ENV !== "production" && prop !== "length" && isNaN(parseInt(prop))) + die(14); + return objectTraps.set.call(this, state[0], prop, value, state[0]); +}; +function peek(draft, prop) { + const state = draft[DRAFT_STATE]; + const source = state ? latest(state) : draft; + return source[prop]; +} +function readPropFromProto(state, source, prop) { + const desc = getDescriptorFromProto(source, prop); + return desc ? `value` in desc ? desc.value : ( + // This is a very special case, if the prop is a getter defined by the + // prototype, we should invoke it with the draft as context! + desc.get?.call(state.draft_) + ) : void 0; +} +function getDescriptorFromProto(source, prop) { + if (!(prop in source)) + return void 0; + let proto = getPrototypeOf(source); + while (proto) { + const desc = Object.getOwnPropertyDescriptor(proto, prop); + if (desc) + return desc; + proto = getPrototypeOf(proto); + } + return void 0; +} +function markChanged(state) { + if (!state.modified_) { + state.modified_ = true; + if (state.parent_) { + markChanged(state.parent_); + } + } +} +function prepareCopy(state) { + if (!state.copy_) { + state.copy_ = shallowCopy( + state.base_, + state.scope_.immer_.useStrictShallowCopy_ + ); + } +} + +// src/core/immerClass.ts +var Immer2 = class { + constructor(config) { + this.autoFreeze_ = true; + this.useStrictShallowCopy_ = false; + /** + * The `produce` function takes a value and a "recipe function" (whose + * return value often depends on the base state). The recipe function is + * free to mutate its first argument however it wants. All mutations are + * only ever applied to a __copy__ of the base state. + * + * Pass only a function to create a "curried producer" which relieves you + * from passing the recipe function every time. + * + * Only plain objects and arrays are made mutable. All other objects are + * considered uncopyable. + * + * Note: This function is __bound__ to its `Immer` instance. + * + * @param {any} base - the initial state + * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified + * @param {Function} patchListener - optional function that will be called with all the patches produced here + * @returns {any} a new state, or the initial state if nothing was modified + */ + this.produce = (base, recipe, patchListener) => { + if (typeof base === "function" && typeof recipe !== "function") { + const defaultBase = recipe; + recipe = base; + const self = this; + return function curriedProduce(base2 = defaultBase, ...args) { + return self.produce(base2, (draft) => recipe.call(this, draft, ...args)); + }; + } + if (typeof recipe !== "function") + die(6); + if (patchListener !== void 0 && typeof patchListener !== "function") + die(7); + let result; + if (isDraftable(base)) { + const scope = enterScope(this); + const proxy = createProxy(base, void 0); + let hasError = true; + try { + result = recipe(proxy); + hasError = false; + } finally { + if (hasError) + revokeScope(scope); + else + leaveScope(scope); + } + usePatchesInScope(scope, patchListener); + return processResult(result, scope); + } else if (!base || typeof base !== "object") { + result = recipe(base); + if (result === void 0) + result = base; + if (result === NOTHING) + result = void 0; + if (this.autoFreeze_) + freeze(result, true); + if (patchListener) { + const p = []; + const ip = []; + getPlugin("Patches").generateReplacementPatches_(base, result, p, ip); + patchListener(p, ip); + } + return result; + } else + die(1, base); + }; + this.produceWithPatches = (base, recipe) => { + if (typeof base === "function") { + return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args)); + } + let patches, inversePatches; + const result = this.produce(base, recipe, (p, ip) => { + patches = p; + inversePatches = ip; + }); + return [result, patches, inversePatches]; + }; + if (typeof config?.autoFreeze === "boolean") + this.setAutoFreeze(config.autoFreeze); + if (typeof config?.useStrictShallowCopy === "boolean") + this.setUseStrictShallowCopy(config.useStrictShallowCopy); + } + createDraft(base) { + if (!isDraftable(base)) + die(8); + if (isDraft(base)) + base = current(base); + const scope = enterScope(this); + const proxy = createProxy(base, void 0); + proxy[DRAFT_STATE].isManual_ = true; + leaveScope(scope); + return proxy; + } + finishDraft(draft, patchListener) { + const state = draft && draft[DRAFT_STATE]; + if (!state || !state.isManual_) + die(9); + const { scope_: scope } = state; + usePatchesInScope(scope, patchListener); + return processResult(void 0, scope); + } + /** + * Pass true to automatically freeze all copies created by Immer. + * + * By default, auto-freezing is enabled. + */ + setAutoFreeze(value) { + this.autoFreeze_ = value; + } + /** + * Pass true to enable strict shallow copy. + * + * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties. + */ + setUseStrictShallowCopy(value) { + this.useStrictShallowCopy_ = value; + } + applyPatches(base, patches) { + let i; + for (i = patches.length - 1; i >= 0; i--) { + const patch = patches[i]; + if (patch.path.length === 0 && patch.op === "replace") { + base = patch.value; + break; + } + } + if (i > -1) { + patches = patches.slice(i + 1); + } + const applyPatchesImpl = getPlugin("Patches").applyPatches_; + if (isDraft(base)) { + return applyPatchesImpl(base, patches); + } + return this.produce( + base, + (draft) => applyPatchesImpl(draft, patches) + ); + } +}; +function createProxy(value, parent) { + const draft = isMap(value) ? getPlugin("MapSet").proxyMap_(value, parent) : isSet(value) ? getPlugin("MapSet").proxySet_(value, parent) : createProxyProxy(value, parent); + const scope = parent ? parent.scope_ : getCurrentScope(); + scope.drafts_.push(draft); + return draft; +} + +// src/core/current.ts +function current(value) { + if (!isDraft(value)) + die(10, value); + return currentImpl(value); +} +function currentImpl(value) { + if (!isDraftable(value) || isFrozen(value)) + return value; + const state = value[DRAFT_STATE]; + let copy; + if (state) { + if (!state.modified_) + return state.base_; + state.finalized_ = true; + copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_); + } else { + copy = shallowCopy(value, true); + } + each(copy, (key, childValue) => { + set(copy, key, currentImpl(childValue)); + }); + if (state) { + state.finalized_ = false; + } + return copy; +} + +// src/plugins/patches.ts +function enablePatches() { + const errorOffset = 16; + if (process.env.NODE_ENV !== "production") { + errors.push( + 'Sets cannot have "replace" patches.', + function(op) { + return "Unsupported patch operation: " + op; + }, + function(path) { + return "Cannot apply patch, path doesn't resolve: " + path; + }, + "Patching reserved attributes like __proto__, prototype and constructor is not allowed" + ); + } + const REPLACE = "replace"; + const ADD = "add"; + const REMOVE = "remove"; + function generatePatches_(state, basePath, patches, inversePatches) { + switch (state.type_) { + case 0 /* Object */: + case 2 /* Map */: + return generatePatchesFromAssigned( + state, + basePath, + patches, + inversePatches + ); + case 1 /* Array */: + return generateArrayPatches(state, basePath, patches, inversePatches); + case 3 /* Set */: + return generateSetPatches( + state, + basePath, + patches, + inversePatches + ); + } + } + function generateArrayPatches(state, basePath, patches, inversePatches) { + let { base_, assigned_ } = state; + let copy_ = state.copy_; + if (copy_.length < base_.length) { + ; + [base_, copy_] = [copy_, base_]; + [patches, inversePatches] = [inversePatches, patches]; + } + for (let i = 0; i < base_.length; i++) { + if (assigned_[i] && copy_[i] !== base_[i]) { + const path = basePath.concat([i]); + patches.push({ + op: REPLACE, + path, + // Need to maybe clone it, as it can in fact be the original value + // due to the base/copy inversion at the start of this function + value: clonePatchValueIfNeeded(copy_[i]) + }); + inversePatches.push({ + op: REPLACE, + path, + value: clonePatchValueIfNeeded(base_[i]) + }); + } + } + for (let i = base_.length; i < copy_.length; i++) { + const path = basePath.concat([i]); + patches.push({ + op: ADD, + path, + // Need to maybe clone it, as it can in fact be the original value + // due to the base/copy inversion at the start of this function + value: clonePatchValueIfNeeded(copy_[i]) + }); + } + for (let i = copy_.length - 1; base_.length <= i; --i) { + const path = basePath.concat([i]); + inversePatches.push({ + op: REMOVE, + path + }); + } + } + function generatePatchesFromAssigned(state, basePath, patches, inversePatches) { + const { base_, copy_ } = state; + each(state.assigned_, (key, assignedValue) => { + const origValue = get(base_, key); + const value = get(copy_, key); + const op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD; + if (origValue === value && op === REPLACE) + return; + const path = basePath.concat(key); + patches.push(op === REMOVE ? { op, path } : { op, path, value }); + inversePatches.push( + op === ADD ? { op: REMOVE, path } : op === REMOVE ? { op: ADD, path, value: clonePatchValueIfNeeded(origValue) } : { op: REPLACE, path, value: clonePatchValueIfNeeded(origValue) } + ); + }); + } + function generateSetPatches(state, basePath, patches, inversePatches) { + let { base_, copy_ } = state; + let i = 0; + base_.forEach((value) => { + if (!copy_.has(value)) { + const path = basePath.concat([i]); + patches.push({ + op: REMOVE, + path, + value + }); + inversePatches.unshift({ + op: ADD, + path, + value + }); + } + i++; + }); + i = 0; + copy_.forEach((value) => { + if (!base_.has(value)) { + const path = basePath.concat([i]); + patches.push({ + op: ADD, + path, + value + }); + inversePatches.unshift({ + op: REMOVE, + path, + value + }); + } + i++; + }); + } + function generateReplacementPatches_(baseValue, replacement, patches, inversePatches) { + patches.push({ + op: REPLACE, + path: [], + value: replacement === NOTHING ? void 0 : replacement + }); + inversePatches.push({ + op: REPLACE, + path: [], + value: baseValue + }); + } + function applyPatches_(draft, patches) { + patches.forEach((patch) => { + const { path, op } = patch; + let base = draft; + for (let i = 0; i < path.length - 1; i++) { + const parentType = getArchtype(base); + let p = path[i]; + if (typeof p !== "string" && typeof p !== "number") { + p = "" + p; + } + if ((parentType === 0 /* Object */ || parentType === 1 /* Array */) && (p === "__proto__" || p === "constructor")) + die(errorOffset + 3); + if (typeof base === "function" && p === "prototype") + die(errorOffset + 3); + base = get(base, p); + if (typeof base !== "object") + die(errorOffset + 2, path.join("/")); + } + const type = getArchtype(base); + const value = deepClonePatchValue(patch.value); + const key = path[path.length - 1]; + switch (op) { + case REPLACE: + switch (type) { + case 2 /* Map */: + return base.set(key, value); + case 3 /* Set */: + die(errorOffset); + default: + return base[key] = value; + } + case ADD: + switch (type) { + case 1 /* Array */: + return key === "-" ? base.push(value) : base.splice(key, 0, value); + case 2 /* Map */: + return base.set(key, value); + case 3 /* Set */: + return base.add(value); + default: + return base[key] = value; + } + case REMOVE: + switch (type) { + case 1 /* Array */: + return base.splice(key, 1); + case 2 /* Map */: + return base.delete(key); + case 3 /* Set */: + return base.delete(patch.value); + default: + return delete base[key]; + } + default: + die(errorOffset + 1, op); + } + }); + return draft; + } + function deepClonePatchValue(obj) { + if (!isDraftable(obj)) + return obj; + if (Array.isArray(obj)) + return obj.map(deepClonePatchValue); + if (isMap(obj)) + return new Map( + Array.from(obj.entries()).map(([k, v]) => [k, deepClonePatchValue(v)]) + ); + if (isSet(obj)) + return new Set(Array.from(obj).map(deepClonePatchValue)); + const cloned = Object.create(getPrototypeOf(obj)); + for (const key in obj) + cloned[key] = deepClonePatchValue(obj[key]); + if (has(obj, DRAFTABLE)) + cloned[DRAFTABLE] = obj[DRAFTABLE]; + return cloned; + } + function clonePatchValueIfNeeded(obj) { + if (isDraft(obj)) { + return deepClonePatchValue(obj); + } else + return obj; + } + loadPlugin("Patches", { + applyPatches_, + generatePatches_, + generateReplacementPatches_ + }); +} + +// src/plugins/mapset.ts +function enableMapSet() { + class DraftMap extends Map { + constructor(target, parent) { + super(); + this[DRAFT_STATE] = { + type_: 2 /* Map */, + parent_: parent, + scope_: parent ? parent.scope_ : getCurrentScope(), + modified_: false, + finalized_: false, + copy_: void 0, + assigned_: void 0, + base_: target, + draft_: this, + isManual_: false, + revoked_: false + }; + } + get size() { + return latest(this[DRAFT_STATE]).size; + } + has(key) { + return latest(this[DRAFT_STATE]).has(key); + } + set(key, value) { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + if (!latest(state).has(key) || latest(state).get(key) !== value) { + prepareMapCopy(state); + markChanged(state); + state.assigned_.set(key, true); + state.copy_.set(key, value); + state.assigned_.set(key, true); + } + return this; + } + delete(key) { + if (!this.has(key)) { + return false; + } + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + prepareMapCopy(state); + markChanged(state); + if (state.base_.has(key)) { + state.assigned_.set(key, false); + } else { + state.assigned_.delete(key); + } + state.copy_.delete(key); + return true; + } + clear() { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + if (latest(state).size) { + prepareMapCopy(state); + markChanged(state); + state.assigned_ = /* @__PURE__ */ new Map(); + each(state.base_, (key) => { + state.assigned_.set(key, false); + }); + state.copy_.clear(); + } + } + forEach(cb, thisArg) { + const state = this[DRAFT_STATE]; + latest(state).forEach((_value, key, _map) => { + cb.call(thisArg, this.get(key), key, this); + }); + } + get(key) { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + const value = latest(state).get(key); + if (state.finalized_ || !isDraftable(value)) { + return value; + } + if (value !== state.base_.get(key)) { + return value; + } + const draft = createProxy(value, state); + prepareMapCopy(state); + state.copy_.set(key, draft); + return draft; + } + keys() { + return latest(this[DRAFT_STATE]).keys(); + } + values() { + const iterator = this.keys(); + return { + [Symbol.iterator]: () => this.values(), + next: () => { + const r = iterator.next(); + if (r.done) + return r; + const value = this.get(r.value); + return { + done: false, + value + }; + } + }; + } + entries() { + const iterator = this.keys(); + return { + [Symbol.iterator]: () => this.entries(), + next: () => { + const r = iterator.next(); + if (r.done) + return r; + const value = this.get(r.value); + return { + done: false, + value: [r.value, value] + }; + } + }; + } + [(DRAFT_STATE, Symbol.iterator)]() { + return this.entries(); + } + } + function proxyMap_(target, parent) { + return new DraftMap(target, parent); + } + function prepareMapCopy(state) { + if (!state.copy_) { + state.assigned_ = /* @__PURE__ */ new Map(); + state.copy_ = new Map(state.base_); + } + } + class DraftSet extends Set { + constructor(target, parent) { + super(); + this[DRAFT_STATE] = { + type_: 3 /* Set */, + parent_: parent, + scope_: parent ? parent.scope_ : getCurrentScope(), + modified_: false, + finalized_: false, + copy_: void 0, + base_: target, + draft_: this, + drafts_: /* @__PURE__ */ new Map(), + revoked_: false, + isManual_: false + }; + } + get size() { + return latest(this[DRAFT_STATE]).size; + } + has(value) { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + if (!state.copy_) { + return state.base_.has(value); + } + if (state.copy_.has(value)) + return true; + if (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value))) + return true; + return false; + } + add(value) { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + if (!this.has(value)) { + prepareSetCopy(state); + markChanged(state); + state.copy_.add(value); + } + return this; + } + delete(value) { + if (!this.has(value)) { + return false; + } + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + prepareSetCopy(state); + markChanged(state); + return state.copy_.delete(value) || (state.drafts_.has(value) ? state.copy_.delete(state.drafts_.get(value)) : ( + /* istanbul ignore next */ + false + )); + } + clear() { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + if (latest(state).size) { + prepareSetCopy(state); + markChanged(state); + state.copy_.clear(); + } + } + values() { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + prepareSetCopy(state); + return state.copy_.values(); + } + entries() { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + prepareSetCopy(state); + return state.copy_.entries(); + } + keys() { + return this.values(); + } + [(DRAFT_STATE, Symbol.iterator)]() { + return this.values(); + } + forEach(cb, thisArg) { + const iterator = this.values(); + let result = iterator.next(); + while (!result.done) { + cb.call(thisArg, result.value, result.value, this); + result = iterator.next(); + } + } + } + function proxySet_(target, parent) { + return new DraftSet(target, parent); + } + function prepareSetCopy(state) { + if (!state.copy_) { + state.copy_ = /* @__PURE__ */ new Set(); + state.base_.forEach((value) => { + if (isDraftable(value)) { + const draft = createProxy(value, state); + state.drafts_.set(value, draft); + state.copy_.add(draft); + } else { + state.copy_.add(value); + } + }); + } + } + function assertUnrevoked(state) { + if (state.revoked_) + die(3, JSON.stringify(latest(state))); + } + loadPlugin("MapSet", { proxyMap_, proxySet_ }); +} + +// src/immer.ts +var immer = new Immer2(); +var produce = immer.produce; +var produceWithPatches = immer.produceWithPatches.bind( + immer +); +var setAutoFreeze = immer.setAutoFreeze.bind(immer); +var setUseStrictShallowCopy = immer.setUseStrictShallowCopy.bind(immer); +var applyPatches = immer.applyPatches.bind(immer); +var createDraft = immer.createDraft.bind(immer); +var finishDraft = immer.finishDraft.bind(immer); +function castDraft(value) { + return value; +} +function castImmutable(value) { + return value; +} +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + Immer, + applyPatches, + castDraft, + castImmutable, + createDraft, + current, + enableMapSet, + enablePatches, + finishDraft, + freeze, + immerable, + isDraft, + isDraftable, + nothing, + original, + produce, + produceWithPatches, + setAutoFreeze, + setUseStrictShallowCopy +}); +//# sourceMappingURL=immer.cjs.development.js.map \ No newline at end of file diff --git a/node_modules/immer/dist/cjs/immer.cjs.development.js.map b/node_modules/immer/dist/cjs/immer.cjs.development.js.map new file mode 100644 index 00000000..5b6b3aec --- /dev/null +++ b/node_modules/immer/dist/cjs/immer.cjs.development.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/immer.ts","../../src/utils/env.ts","../../src/utils/errors.ts","../../src/utils/common.ts","../../src/utils/plugins.ts","../../src/core/scope.ts","../../src/core/finalize.ts","../../src/core/proxy.ts","../../src/core/immerClass.ts","../../src/core/current.ts","../../src/plugins/patches.ts","../../src/plugins/mapset.ts"],"sourcesContent":["import {\n\tIProduce,\n\tIProduceWithPatches,\n\tImmer,\n\tDraft,\n\tImmutable\n} from \"./internal\"\n\nexport {\n\tDraft,\n\tWritableDraft,\n\tImmutable,\n\tPatch,\n\tPatchListener,\n\tProducer,\n\toriginal,\n\tcurrent,\n\tisDraft,\n\tisDraftable,\n\tNOTHING as nothing,\n\tDRAFTABLE as immerable,\n\tfreeze,\n\tObjectish,\n\tStrictMode\n} from \"./internal\"\n\nconst immer = new Immer()\n\n/**\n * The `produce` function takes a value and a \"recipe function\" (whose\n * return value often depends on the base state). The recipe function is\n * free to mutate its first argument however it wants. All mutations are\n * only ever applied to a __copy__ of the base state.\n *\n * Pass only a function to create a \"curried producer\" which relieves you\n * from passing the recipe function every time.\n *\n * Only plain objects and arrays are made mutable. All other objects are\n * considered uncopyable.\n *\n * Note: This function is __bound__ to its `Immer` instance.\n *\n * @param {any} base - the initial state\n * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified\n * @param {Function} patchListener - optional function that will be called with all the patches produced here\n * @returns {any} a new state, or the initial state if nothing was modified\n */\nexport const produce: IProduce = immer.produce\n\n/**\n * Like `produce`, but `produceWithPatches` always returns a tuple\n * [nextState, patches, inversePatches] (instead of just the next state)\n */\nexport const produceWithPatches: IProduceWithPatches = immer.produceWithPatches.bind(\n\timmer\n)\n\n/**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * Always freeze by default, even in production mode\n */\nexport const setAutoFreeze = immer.setAutoFreeze.bind(immer)\n\n/**\n * Pass true to enable strict shallow copy.\n *\n * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n */\nexport const setUseStrictShallowCopy = immer.setUseStrictShallowCopy.bind(immer)\n\n/**\n * Apply an array of Immer patches to the first argument.\n *\n * This function is a producer, which means copy-on-write is in effect.\n */\nexport const applyPatches = immer.applyPatches.bind(immer)\n\n/**\n * Create an Immer draft from the given base state, which may be a draft itself.\n * The draft can be modified until you finalize it with the `finishDraft` function.\n */\nexport const createDraft = immer.createDraft.bind(immer)\n\n/**\n * Finalize an Immer draft from a `createDraft` call, returning the base state\n * (if no changes were made) or a modified copy. The draft must *not* be\n * mutated afterwards.\n *\n * Pass a function as the 2nd argument to generate Immer patches based on the\n * changes that were made.\n */\nexport const finishDraft = immer.finishDraft.bind(immer)\n\n/**\n * This function is actually a no-op, but can be used to cast an immutable type\n * to an draft type and make TypeScript happy\n *\n * @param value\n */\nexport function castDraft(value: T): Draft {\n\treturn value as any\n}\n\n/**\n * This function is actually a no-op, but can be used to cast a mutable type\n * to an immutable type and make TypeScript happy\n * @param value\n */\nexport function castImmutable(value: T): Immutable {\n\treturn value as any\n}\n\nexport {Immer}\n\nexport {enablePatches} from \"./plugins/patches\"\nexport {enableMapSet} from \"./plugins/mapset\"\n","// Should be no imports here!\n\n/**\n * The sentinel value returned by producers to replace the draft with undefined.\n */\nexport const NOTHING: unique symbol = Symbol.for(\"immer-nothing\")\n\n/**\n * To let Immer treat your class instances as plain immutable objects\n * (albeit with a custom prototype), you must define either an instance property\n * or a static property on each of your custom classes.\n *\n * Otherwise, your class instance will never be drafted, which means it won't be\n * safe to mutate in a produce callback.\n */\nexport const DRAFTABLE: unique symbol = Symbol.for(\"immer-draftable\")\n\nexport const DRAFT_STATE: unique symbol = Symbol.for(\"immer-state\")\n","export const errors =\n\tprocess.env.NODE_ENV !== \"production\"\n\t\t? [\n\t\t\t\t// All error codes, starting by 0:\n\t\t\t\tfunction(plugin: string) {\n\t\t\t\t\treturn `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \\`enable${plugin}()\\` when initializing your application.`\n\t\t\t\t},\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`\n\t\t\t\t},\n\t\t\t\t\"This object has been frozen and should not be mutated\",\n\t\t\t\tfunction(data: any) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t\"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? \" +\n\t\t\t\t\t\tdata\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t\t\"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.\",\n\t\t\t\t\"Immer forbids circular references\",\n\t\t\t\t\"The first or second argument to `produce` must be a function\",\n\t\t\t\t\"The third argument to `produce` must be a function or undefined\",\n\t\t\t\t\"First argument to `createDraft` must be a plain object, an array, or an immerable object\",\n\t\t\t\t\"First argument to `finishDraft` must be a draft returned by `createDraft`\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'current' expects a draft, got: ${thing}`\n\t\t\t\t},\n\t\t\t\t\"Object.defineProperty() cannot be used on an Immer draft\",\n\t\t\t\t\"Object.setPrototypeOf() cannot be used on an Immer draft\",\n\t\t\t\t\"Immer only supports deleting array indices\",\n\t\t\t\t\"Immer only supports setting array indices and the 'length' property\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'original' expects a draft, got: ${thing}`\n\t\t\t\t}\n\t\t\t\t// Note: if more errors are added, the errorOffset in Patches.ts should be increased\n\t\t\t\t// See Patches.ts for additional errors\n\t\t ]\n\t\t: []\n\nexport function die(error: number, ...args: any[]): never {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tconst e = errors[error]\n\t\tconst msg = typeof e === \"function\" ? e.apply(null, args as any) : e\n\t\tthrow new Error(`[Immer] ${msg}`)\n\t}\n\tthrow new Error(\n\t\t`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`\n\t)\n}\n","import {\n\tDRAFT_STATE,\n\tDRAFTABLE,\n\tObjectish,\n\tDrafted,\n\tAnyObject,\n\tAnyMap,\n\tAnySet,\n\tImmerState,\n\tArchType,\n\tdie,\n\tStrictMode\n} from \"../internal\"\n\nexport const getPrototypeOf = Object.getPrototypeOf\n\n/** Returns true if the given value is an Immer draft */\n/*#__PURE__*/\nexport function isDraft(value: any): boolean {\n\treturn !!value && !!value[DRAFT_STATE]\n}\n\n/** Returns true if the given value can be drafted by Immer */\n/*#__PURE__*/\nexport function isDraftable(value: any): boolean {\n\tif (!value) return false\n\treturn (\n\t\tisPlainObject(value) ||\n\t\tArray.isArray(value) ||\n\t\t!!value[DRAFTABLE] ||\n\t\t!!value.constructor?.[DRAFTABLE] ||\n\t\tisMap(value) ||\n\t\tisSet(value)\n\t)\n}\n\nconst objectCtorString = Object.prototype.constructor.toString()\n/*#__PURE__*/\nexport function isPlainObject(value: any): boolean {\n\tif (!value || typeof value !== \"object\") return false\n\tconst proto = getPrototypeOf(value)\n\tif (proto === null) {\n\t\treturn true\n\t}\n\tconst Ctor =\n\t\tObject.hasOwnProperty.call(proto, \"constructor\") && proto.constructor\n\n\tif (Ctor === Object) return true\n\n\treturn (\n\t\ttypeof Ctor == \"function\" &&\n\t\tFunction.toString.call(Ctor) === objectCtorString\n\t)\n}\n\n/** Get the underlying object that is represented by the given draft */\n/*#__PURE__*/\nexport function original(value: T): T | undefined\nexport function original(value: Drafted): any {\n\tif (!isDraft(value)) die(15, value)\n\treturn value[DRAFT_STATE].base_\n}\n\n/**\n * Each iterates a map, set or array.\n * Or, if any other kind of object, all of its own properties.\n * Regardless whether they are enumerable or symbols\n */\nexport function each(\n\tobj: T,\n\titer: (key: string | number, value: any, source: T) => void\n): void\nexport function each(obj: any, iter: any) {\n\tif (getArchtype(obj) === ArchType.Object) {\n\t\tReflect.ownKeys(obj).forEach(key => {\n\t\t\titer(key, obj[key], obj)\n\t\t})\n\t} else {\n\t\tobj.forEach((entry: any, index: any) => iter(index, entry, obj))\n\t}\n}\n\n/*#__PURE__*/\nexport function getArchtype(thing: any): ArchType {\n\tconst state: undefined | ImmerState = thing[DRAFT_STATE]\n\treturn state\n\t\t? state.type_\n\t\t: Array.isArray(thing)\n\t\t? ArchType.Array\n\t\t: isMap(thing)\n\t\t? ArchType.Map\n\t\t: isSet(thing)\n\t\t? ArchType.Set\n\t\t: ArchType.Object\n}\n\n/*#__PURE__*/\nexport function has(thing: any, prop: PropertyKey): boolean {\n\treturn getArchtype(thing) === ArchType.Map\n\t\t? thing.has(prop)\n\t\t: Object.prototype.hasOwnProperty.call(thing, prop)\n}\n\n/*#__PURE__*/\nexport function get(thing: AnyMap | AnyObject, prop: PropertyKey): any {\n\t// @ts-ignore\n\treturn getArchtype(thing) === ArchType.Map ? thing.get(prop) : thing[prop]\n}\n\n/*#__PURE__*/\nexport function set(thing: any, propOrOldValue: PropertyKey, value: any) {\n\tconst t = getArchtype(thing)\n\tif (t === ArchType.Map) thing.set(propOrOldValue, value)\n\telse if (t === ArchType.Set) {\n\t\tthing.add(value)\n\t} else thing[propOrOldValue] = value\n}\n\n/*#__PURE__*/\nexport function is(x: any, y: any): boolean {\n\t// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n\tif (x === y) {\n\t\treturn x !== 0 || 1 / x === 1 / y\n\t} else {\n\t\treturn x !== x && y !== y\n\t}\n}\n\n/*#__PURE__*/\nexport function isMap(target: any): target is AnyMap {\n\treturn target instanceof Map\n}\n\n/*#__PURE__*/\nexport function isSet(target: any): target is AnySet {\n\treturn target instanceof Set\n}\n/*#__PURE__*/\nexport function latest(state: ImmerState): any {\n\treturn state.copy_ || state.base_\n}\n\n/*#__PURE__*/\nexport function shallowCopy(base: any, strict: StrictMode) {\n\tif (isMap(base)) {\n\t\treturn new Map(base)\n\t}\n\tif (isSet(base)) {\n\t\treturn new Set(base)\n\t}\n\tif (Array.isArray(base)) return Array.prototype.slice.call(base)\n\n\tconst isPlain = isPlainObject(base)\n\n\tif (strict === true || (strict === \"class_only\" && !isPlain)) {\n\t\t// Perform a strict copy\n\t\tconst descriptors = Object.getOwnPropertyDescriptors(base)\n\t\tdelete descriptors[DRAFT_STATE as any]\n\t\tlet keys = Reflect.ownKeys(descriptors)\n\t\tfor (let i = 0; i < keys.length; i++) {\n\t\t\tconst key: any = keys[i]\n\t\t\tconst desc = descriptors[key]\n\t\t\tif (desc.writable === false) {\n\t\t\t\tdesc.writable = true\n\t\t\t\tdesc.configurable = true\n\t\t\t}\n\t\t\t// like object.assign, we will read any _own_, get/set accessors. This helps in dealing\n\t\t\t// with libraries that trap values, like mobx or vue\n\t\t\t// unlike object.assign, non-enumerables will be copied as well\n\t\t\tif (desc.get || desc.set)\n\t\t\t\tdescriptors[key] = {\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\twritable: true, // could live with !!desc.set as well here...\n\t\t\t\t\tenumerable: desc.enumerable,\n\t\t\t\t\tvalue: base[key]\n\t\t\t\t}\n\t\t}\n\t\treturn Object.create(getPrototypeOf(base), descriptors)\n\t} else {\n\t\t// perform a sloppy copy\n\t\tconst proto = getPrototypeOf(base)\n\t\tif (proto !== null && isPlain) {\n\t\t\treturn {...base} // assumption: better inner class optimization than the assign below\n\t\t}\n\t\tconst obj = Object.create(proto)\n\t\treturn Object.assign(obj, base)\n\t}\n}\n\n/**\n * Freezes draftable objects. Returns the original object.\n * By default freezes shallowly, but if the second argument is `true` it will freeze recursively.\n *\n * @param obj\n * @param deep\n */\nexport function freeze(obj: T, deep?: boolean): T\nexport function freeze(obj: any, deep: boolean = false): T {\n\tif (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj\n\tif (getArchtype(obj) > 1 /* Map or Set */) {\n\t\tobj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections as any\n\t}\n\tObject.freeze(obj)\n\tif (deep)\n\t\t// See #590, don't recurse into non-enumerable / Symbol properties when freezing\n\t\t// So use Object.entries (only string-like, enumerables) instead of each()\n\t\tObject.entries(obj).forEach(([key, value]) => freeze(value, true))\n\treturn obj\n}\n\nfunction dontMutateFrozenCollections() {\n\tdie(2)\n}\n\nexport function isFrozen(obj: any): boolean {\n\treturn Object.isFrozen(obj)\n}\n","import {\n\tImmerState,\n\tPatch,\n\tDrafted,\n\tImmerBaseState,\n\tAnyMap,\n\tAnySet,\n\tArchType,\n\tdie\n} from \"../internal\"\n\n/** Plugin utilities */\nconst plugins: {\n\tPatches?: {\n\t\tgeneratePatches_(\n\t\t\tstate: ImmerState,\n\t\t\tbasePath: PatchPath,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tgenerateReplacementPatches_(\n\t\t\tbase: any,\n\t\t\treplacement: any,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tapplyPatches_(draft: T, patches: readonly Patch[]): T\n\t}\n\tMapSet?: {\n\t\tproxyMap_(target: T, parent?: ImmerState): T\n\t\tproxySet_(target: T, parent?: ImmerState): T\n\t}\n} = {}\n\ntype Plugins = typeof plugins\n\nexport function getPlugin(\n\tpluginKey: K\n): Exclude {\n\tconst plugin = plugins[pluginKey]\n\tif (!plugin) {\n\t\tdie(0, pluginKey)\n\t}\n\t// @ts-ignore\n\treturn plugin\n}\n\nexport function loadPlugin(\n\tpluginKey: K,\n\timplementation: Plugins[K]\n): void {\n\tif (!plugins[pluginKey]) plugins[pluginKey] = implementation\n}\n/** Map / Set plugin */\n\nexport interface MapState extends ImmerBaseState {\n\ttype_: ArchType.Map\n\tcopy_: AnyMap | undefined\n\tassigned_: Map | undefined\n\tbase_: AnyMap\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\nexport interface SetState extends ImmerBaseState {\n\ttype_: ArchType.Set\n\tcopy_: AnySet | undefined\n\tbase_: AnySet\n\tdrafts_: Map // maps the original value to the draft value in the new set\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\n/** Patches plugin */\n\nexport type PatchPath = (string | number)[]\n","import {\n\tPatch,\n\tPatchListener,\n\tDrafted,\n\tImmer,\n\tDRAFT_STATE,\n\tImmerState,\n\tArchType,\n\tgetPlugin\n} from \"../internal\"\n\n/** Each scope represents a `produce` call. */\n\nexport interface ImmerScope {\n\tpatches_?: Patch[]\n\tinversePatches_?: Patch[]\n\tcanAutoFreeze_: boolean\n\tdrafts_: any[]\n\tparent_?: ImmerScope\n\tpatchListener_?: PatchListener\n\timmer_: Immer\n\tunfinalizedDrafts_: number\n}\n\nlet currentScope: ImmerScope | undefined\n\nexport function getCurrentScope() {\n\treturn currentScope!\n}\n\nfunction createScope(\n\tparent_: ImmerScope | undefined,\n\timmer_: Immer\n): ImmerScope {\n\treturn {\n\t\tdrafts_: [],\n\t\tparent_,\n\t\timmer_,\n\t\t// Whenever the modified draft contains a draft from another scope, we\n\t\t// need to prevent auto-freezing so the unowned draft can be finalized.\n\t\tcanAutoFreeze_: true,\n\t\tunfinalizedDrafts_: 0\n\t}\n}\n\nexport function usePatchesInScope(\n\tscope: ImmerScope,\n\tpatchListener?: PatchListener\n) {\n\tif (patchListener) {\n\t\tgetPlugin(\"Patches\") // assert we have the plugin\n\t\tscope.patches_ = []\n\t\tscope.inversePatches_ = []\n\t\tscope.patchListener_ = patchListener\n\t}\n}\n\nexport function revokeScope(scope: ImmerScope) {\n\tleaveScope(scope)\n\tscope.drafts_.forEach(revokeDraft)\n\t// @ts-ignore\n\tscope.drafts_ = null\n}\n\nexport function leaveScope(scope: ImmerScope) {\n\tif (scope === currentScope) {\n\t\tcurrentScope = scope.parent_\n\t}\n}\n\nexport function enterScope(immer: Immer) {\n\treturn (currentScope = createScope(currentScope, immer))\n}\n\nfunction revokeDraft(draft: Drafted) {\n\tconst state: ImmerState = draft[DRAFT_STATE]\n\tif (state.type_ === ArchType.Object || state.type_ === ArchType.Array)\n\t\tstate.revoke_()\n\telse state.revoked_ = true\n}\n","import {\n\tImmerScope,\n\tDRAFT_STATE,\n\tisDraftable,\n\tNOTHING,\n\tPatchPath,\n\teach,\n\thas,\n\tfreeze,\n\tImmerState,\n\tisDraft,\n\tSetState,\n\tset,\n\tArchType,\n\tgetPlugin,\n\tdie,\n\trevokeScope,\n\tisFrozen\n} from \"../internal\"\n\nexport function processResult(result: any, scope: ImmerScope) {\n\tscope.unfinalizedDrafts_ = scope.drafts_.length\n\tconst baseDraft = scope.drafts_![0]\n\tconst isReplaced = result !== undefined && result !== baseDraft\n\tif (isReplaced) {\n\t\tif (baseDraft[DRAFT_STATE].modified_) {\n\t\t\trevokeScope(scope)\n\t\t\tdie(4)\n\t\t}\n\t\tif (isDraftable(result)) {\n\t\t\t// Finalize the result in case it contains (or is) a subset of the draft.\n\t\t\tresult = finalize(scope, result)\n\t\t\tif (!scope.parent_) maybeFreeze(scope, result)\n\t\t}\n\t\tif (scope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(\n\t\t\t\tbaseDraft[DRAFT_STATE].base_,\n\t\t\t\tresult,\n\t\t\t\tscope.patches_,\n\t\t\t\tscope.inversePatches_!\n\t\t\t)\n\t\t}\n\t} else {\n\t\t// Finalize the base draft.\n\t\tresult = finalize(scope, baseDraft, [])\n\t}\n\trevokeScope(scope)\n\tif (scope.patches_) {\n\t\tscope.patchListener_!(scope.patches_, scope.inversePatches_!)\n\t}\n\treturn result !== NOTHING ? result : undefined\n}\n\nfunction finalize(rootScope: ImmerScope, value: any, path?: PatchPath) {\n\t// Don't recurse in tho recursive data structures\n\tif (isFrozen(value)) return value\n\n\tconst state: ImmerState = value[DRAFT_STATE]\n\t// A plain object, might need freezing, might contain drafts\n\tif (!state) {\n\t\teach(value, (key, childValue) =>\n\t\t\tfinalizeProperty(rootScope, state, value, key, childValue, path)\n\t\t)\n\t\treturn value\n\t}\n\t// Never finalize drafts owned by another scope.\n\tif (state.scope_ !== rootScope) return value\n\t// Unmodified draft, return the (frozen) original\n\tif (!state.modified_) {\n\t\tmaybeFreeze(rootScope, state.base_, true)\n\t\treturn state.base_\n\t}\n\t// Not finalized yet, let's do that now\n\tif (!state.finalized_) {\n\t\tstate.finalized_ = true\n\t\tstate.scope_.unfinalizedDrafts_--\n\t\tconst result = state.copy_\n\t\t// Finalize all children of the copy\n\t\t// For sets we clone before iterating, otherwise we can get in endless loop due to modifying during iteration, see #628\n\t\t// To preserve insertion order in all cases we then clear the set\n\t\t// And we let finalizeProperty know it needs to re-add non-draft children back to the target\n\t\tlet resultEach = result\n\t\tlet isSet = false\n\t\tif (state.type_ === ArchType.Set) {\n\t\t\tresultEach = new Set(result)\n\t\t\tresult.clear()\n\t\t\tisSet = true\n\t\t}\n\t\teach(resultEach, (key, childValue) =>\n\t\t\tfinalizeProperty(rootScope, state, result, key, childValue, path, isSet)\n\t\t)\n\t\t// everything inside is frozen, we can freeze here\n\t\tmaybeFreeze(rootScope, result, false)\n\t\t// first time finalizing, let's create those patches\n\t\tif (path && rootScope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generatePatches_(\n\t\t\t\tstate,\n\t\t\t\tpath,\n\t\t\t\trootScope.patches_,\n\t\t\t\trootScope.inversePatches_!\n\t\t\t)\n\t\t}\n\t}\n\treturn state.copy_\n}\n\nfunction finalizeProperty(\n\trootScope: ImmerScope,\n\tparentState: undefined | ImmerState,\n\ttargetObject: any,\n\tprop: string | number,\n\tchildValue: any,\n\trootPath?: PatchPath,\n\ttargetIsSet?: boolean\n) {\n\tif (process.env.NODE_ENV !== \"production\" && childValue === targetObject)\n\t\tdie(5)\n\tif (isDraft(childValue)) {\n\t\tconst path =\n\t\t\trootPath &&\n\t\t\tparentState &&\n\t\t\tparentState!.type_ !== ArchType.Set && // Set objects are atomic since they have no keys.\n\t\t\t!has((parentState as Exclude).assigned_!, prop) // Skip deep patches for assigned keys.\n\t\t\t\t? rootPath!.concat(prop)\n\t\t\t\t: undefined\n\t\t// Drafts owned by `scope` are finalized here.\n\t\tconst res = finalize(rootScope, childValue, path)\n\t\tset(targetObject, prop, res)\n\t\t// Drafts from another scope must prevented to be frozen\n\t\t// if we got a draft back from finalize, we're in a nested produce and shouldn't freeze\n\t\tif (isDraft(res)) {\n\t\t\trootScope.canAutoFreeze_ = false\n\t\t} else return\n\t} else if (targetIsSet) {\n\t\ttargetObject.add(childValue)\n\t}\n\t// Search new objects for unfinalized drafts. Frozen objects should never contain drafts.\n\tif (isDraftable(childValue) && !isFrozen(childValue)) {\n\t\tif (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {\n\t\t\t// optimization: if an object is not a draft, and we don't have to\n\t\t\t// deepfreeze everything, and we are sure that no drafts are left in the remaining object\n\t\t\t// cause we saw and finalized all drafts already; we can stop visiting the rest of the tree.\n\t\t\t// This benefits especially adding large data tree's without further processing.\n\t\t\t// See add-data.js perf test\n\t\t\treturn\n\t\t}\n\t\tfinalize(rootScope, childValue)\n\t\t// Immer deep freezes plain objects, so if there is no parent state, we freeze as well\n\t\t// Per #590, we never freeze symbolic properties. Just to make sure don't accidentally interfere\n\t\t// with other frameworks.\n\t\tif (\n\t\t\t(!parentState || !parentState.scope_.parent_) &&\n\t\t\ttypeof prop !== \"symbol\" &&\n\t\t\tObject.prototype.propertyIsEnumerable.call(targetObject, prop)\n\t\t)\n\t\t\tmaybeFreeze(rootScope, childValue)\n\t}\n}\n\nfunction maybeFreeze(scope: ImmerScope, value: any, deep = false) {\n\t// we never freeze for a non-root scope; as it would prevent pruning for drafts inside wrapping objects\n\tif (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {\n\t\tfreeze(value, deep)\n\t}\n}\n","import {\n\teach,\n\thas,\n\tis,\n\tisDraftable,\n\tshallowCopy,\n\tlatest,\n\tImmerBaseState,\n\tImmerState,\n\tDrafted,\n\tAnyObject,\n\tAnyArray,\n\tObjectish,\n\tgetCurrentScope,\n\tgetPrototypeOf,\n\tDRAFT_STATE,\n\tdie,\n\tcreateProxy,\n\tArchType,\n\tImmerScope\n} from \"../internal\"\n\ninterface ProxyBaseState extends ImmerBaseState {\n\tassigned_: {\n\t\t[property: string]: boolean\n\t}\n\tparent_?: ImmerState\n\trevoke_(): void\n}\n\nexport interface ProxyObjectState extends ProxyBaseState {\n\ttype_: ArchType.Object\n\tbase_: any\n\tcopy_: any\n\tdraft_: Drafted\n}\n\nexport interface ProxyArrayState extends ProxyBaseState {\n\ttype_: ArchType.Array\n\tbase_: AnyArray\n\tcopy_: AnyArray | null\n\tdraft_: Drafted\n}\n\ntype ProxyState = ProxyObjectState | ProxyArrayState\n\n/**\n * Returns a new draft of the `base` object.\n *\n * The second argument is the parent draft-state (used internally).\n */\nexport function createProxyProxy(\n\tbase: T,\n\tparent?: ImmerState\n): Drafted {\n\tconst isArray = Array.isArray(base)\n\tconst state: ProxyState = {\n\t\ttype_: isArray ? ArchType.Array : (ArchType.Object as any),\n\t\t// Track which produce call this is associated with.\n\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t// True for both shallow and deep changes.\n\t\tmodified_: false,\n\t\t// Used during finalization.\n\t\tfinalized_: false,\n\t\t// Track which properties have been assigned (true) or deleted (false).\n\t\tassigned_: {},\n\t\t// The parent draft state.\n\t\tparent_: parent,\n\t\t// The base state.\n\t\tbase_: base,\n\t\t// The base proxy.\n\t\tdraft_: null as any, // set below\n\t\t// The base copy with any updated values.\n\t\tcopy_: null,\n\t\t// Called by the `produce` function.\n\t\trevoke_: null as any,\n\t\tisManual_: false\n\t}\n\n\t// the traps must target something, a bit like the 'real' base.\n\t// but also, we need to be able to determine from the target what the relevant state is\n\t// (to avoid creating traps per instance to capture the state in closure,\n\t// and to avoid creating weird hidden properties as well)\n\t// So the trick is to use 'state' as the actual 'target'! (and make sure we intercept everything)\n\t// Note that in the case of an array, we put the state in an array to have better Reflect defaults ootb\n\tlet target: T = state as any\n\tlet traps: ProxyHandler> = objectTraps\n\tif (isArray) {\n\t\ttarget = [state] as any\n\t\ttraps = arrayTraps\n\t}\n\n\tconst {revoke, proxy} = Proxy.revocable(target, traps)\n\tstate.draft_ = proxy as any\n\tstate.revoke_ = revoke\n\treturn proxy as any\n}\n\n/**\n * Object drafts\n */\nexport const objectTraps: ProxyHandler = {\n\tget(state, prop) {\n\t\tif (prop === DRAFT_STATE) return state\n\n\t\tconst source = latest(state)\n\t\tif (!has(source, prop)) {\n\t\t\t// non-existing or non-own property...\n\t\t\treturn readPropFromProto(state, source, prop)\n\t\t}\n\t\tconst value = source[prop]\n\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\treturn value\n\t\t}\n\t\t// Check for existing draft in modified state.\n\t\t// Assigned values are never drafted. This catches any drafts we created, too.\n\t\tif (value === peek(state.base_, prop)) {\n\t\t\tprepareCopy(state)\n\t\t\treturn (state.copy_![prop as any] = createProxy(value, state))\n\t\t}\n\t\treturn value\n\t},\n\thas(state, prop) {\n\t\treturn prop in latest(state)\n\t},\n\townKeys(state) {\n\t\treturn Reflect.ownKeys(latest(state))\n\t},\n\tset(\n\t\tstate: ProxyObjectState,\n\t\tprop: string /* strictly not, but helps TS */,\n\t\tvalue\n\t) {\n\t\tconst desc = getDescriptorFromProto(latest(state), prop)\n\t\tif (desc?.set) {\n\t\t\t// special case: if this write is captured by a setter, we have\n\t\t\t// to trigger it with the correct context\n\t\t\tdesc.set.call(state.draft_, value)\n\t\t\treturn true\n\t\t}\n\t\tif (!state.modified_) {\n\t\t\t// the last check is because we need to be able to distinguish setting a non-existing to undefined (which is a change)\n\t\t\t// from setting an existing property with value undefined to undefined (which is not a change)\n\t\t\tconst current = peek(latest(state), prop)\n\t\t\t// special case, if we assigning the original value to a draft, we can ignore the assignment\n\t\t\tconst currentState: ProxyObjectState = current?.[DRAFT_STATE]\n\t\t\tif (currentState && currentState.base_ === value) {\n\t\t\t\tstate.copy_![prop] = value\n\t\t\t\tstate.assigned_[prop] = false\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (is(value, current) && (value !== undefined || has(state.base_, prop)))\n\t\t\t\treturn true\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t}\n\n\t\tif (\n\t\t\t(state.copy_![prop] === value &&\n\t\t\t\t// special case: handle new props with value 'undefined'\n\t\t\t\t(value !== undefined || prop in state.copy_)) ||\n\t\t\t// special case: NaN\n\t\t\t(Number.isNaN(value) && Number.isNaN(state.copy_![prop]))\n\t\t)\n\t\t\treturn true\n\n\t\t// @ts-ignore\n\t\tstate.copy_![prop] = value\n\t\tstate.assigned_[prop] = true\n\t\treturn true\n\t},\n\tdeleteProperty(state, prop: string) {\n\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\tif (peek(state.base_, prop) !== undefined || prop in state.base_) {\n\t\t\tstate.assigned_[prop] = false\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t} else {\n\t\t\t// if an originally not assigned property was deleted\n\t\t\tdelete state.assigned_[prop]\n\t\t}\n\t\tif (state.copy_) {\n\t\t\tdelete state.copy_[prop]\n\t\t}\n\t\treturn true\n\t},\n\t// Note: We never coerce `desc.value` into an Immer draft, because we can't make\n\t// the same guarantee in ES5 mode.\n\tgetOwnPropertyDescriptor(state, prop) {\n\t\tconst owner = latest(state)\n\t\tconst desc = Reflect.getOwnPropertyDescriptor(owner, prop)\n\t\tif (!desc) return desc\n\t\treturn {\n\t\t\twritable: true,\n\t\t\tconfigurable: state.type_ !== ArchType.Array || prop !== \"length\",\n\t\t\tenumerable: desc.enumerable,\n\t\t\tvalue: owner[prop]\n\t\t}\n\t},\n\tdefineProperty() {\n\t\tdie(11)\n\t},\n\tgetPrototypeOf(state) {\n\t\treturn getPrototypeOf(state.base_)\n\t},\n\tsetPrototypeOf() {\n\t\tdie(12)\n\t}\n}\n\n/**\n * Array drafts\n */\n\nconst arrayTraps: ProxyHandler<[ProxyArrayState]> = {}\neach(objectTraps, (key, fn) => {\n\t// @ts-ignore\n\tarrayTraps[key] = function() {\n\t\targuments[0] = arguments[0][0]\n\t\treturn fn.apply(this, arguments)\n\t}\n})\narrayTraps.deleteProperty = function(state, prop) {\n\tif (process.env.NODE_ENV !== \"production\" && isNaN(parseInt(prop as any)))\n\t\tdie(13)\n\t// @ts-ignore\n\treturn arrayTraps.set!.call(this, state, prop, undefined)\n}\narrayTraps.set = function(state, prop, value) {\n\tif (\n\t\tprocess.env.NODE_ENV !== \"production\" &&\n\t\tprop !== \"length\" &&\n\t\tisNaN(parseInt(prop as any))\n\t)\n\t\tdie(14)\n\treturn objectTraps.set!.call(this, state[0], prop, value, state[0])\n}\n\n// Access a property without creating an Immer draft.\nfunction peek(draft: Drafted, prop: PropertyKey) {\n\tconst state = draft[DRAFT_STATE]\n\tconst source = state ? latest(state) : draft\n\treturn source[prop]\n}\n\nfunction readPropFromProto(state: ImmerState, source: any, prop: PropertyKey) {\n\tconst desc = getDescriptorFromProto(source, prop)\n\treturn desc\n\t\t? `value` in desc\n\t\t\t? desc.value\n\t\t\t: // This is a very special case, if the prop is a getter defined by the\n\t\t\t // prototype, we should invoke it with the draft as context!\n\t\t\t desc.get?.call(state.draft_)\n\t\t: undefined\n}\n\nfunction getDescriptorFromProto(\n\tsource: any,\n\tprop: PropertyKey\n): PropertyDescriptor | undefined {\n\t// 'in' checks proto!\n\tif (!(prop in source)) return undefined\n\tlet proto = getPrototypeOf(source)\n\twhile (proto) {\n\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop)\n\t\tif (desc) return desc\n\t\tproto = getPrototypeOf(proto)\n\t}\n\treturn undefined\n}\n\nexport function markChanged(state: ImmerState) {\n\tif (!state.modified_) {\n\t\tstate.modified_ = true\n\t\tif (state.parent_) {\n\t\t\tmarkChanged(state.parent_)\n\t\t}\n\t}\n}\n\nexport function prepareCopy(state: {\n\tbase_: any\n\tcopy_: any\n\tscope_: ImmerScope\n}) {\n\tif (!state.copy_) {\n\t\tstate.copy_ = shallowCopy(\n\t\t\tstate.base_,\n\t\t\tstate.scope_.immer_.useStrictShallowCopy_\n\t\t)\n\t}\n}\n","import {\n\tIProduceWithPatches,\n\tIProduce,\n\tImmerState,\n\tDrafted,\n\tisDraftable,\n\tprocessResult,\n\tPatch,\n\tObjectish,\n\tDRAFT_STATE,\n\tDraft,\n\tPatchListener,\n\tisDraft,\n\tisMap,\n\tisSet,\n\tcreateProxyProxy,\n\tgetPlugin,\n\tdie,\n\tenterScope,\n\trevokeScope,\n\tleaveScope,\n\tusePatchesInScope,\n\tgetCurrentScope,\n\tNOTHING,\n\tfreeze,\n\tcurrent\n} from \"../internal\"\n\ninterface ProducersFns {\n\tproduce: IProduce\n\tproduceWithPatches: IProduceWithPatches\n}\n\nexport type StrictMode = boolean | \"class_only\";\n\nexport class Immer implements ProducersFns {\n\tautoFreeze_: boolean = true\n\tuseStrictShallowCopy_: StrictMode = false\n\n\tconstructor(config?: {\n\t\tautoFreeze?: boolean\n\t\tuseStrictShallowCopy?: StrictMode\n\t}) {\n\t\tif (typeof config?.autoFreeze === \"boolean\")\n\t\t\tthis.setAutoFreeze(config!.autoFreeze)\n\t\tif (typeof config?.useStrictShallowCopy === \"boolean\")\n\t\t\tthis.setUseStrictShallowCopy(config!.useStrictShallowCopy)\n\t}\n\n\t/**\n\t * The `produce` function takes a value and a \"recipe function\" (whose\n\t * return value often depends on the base state). The recipe function is\n\t * free to mutate its first argument however it wants. All mutations are\n\t * only ever applied to a __copy__ of the base state.\n\t *\n\t * Pass only a function to create a \"curried producer\" which relieves you\n\t * from passing the recipe function every time.\n\t *\n\t * Only plain objects and arrays are made mutable. All other objects are\n\t * considered uncopyable.\n\t *\n\t * Note: This function is __bound__ to its `Immer` instance.\n\t *\n\t * @param {any} base - the initial state\n\t * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified\n\t * @param {Function} patchListener - optional function that will be called with all the patches produced here\n\t * @returns {any} a new state, or the initial state if nothing was modified\n\t */\n\tproduce: IProduce = (base: any, recipe?: any, patchListener?: any) => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\" && typeof recipe !== \"function\") {\n\t\t\tconst defaultBase = recipe\n\t\t\trecipe = base\n\n\t\t\tconst self = this\n\t\t\treturn function curriedProduce(\n\t\t\t\tthis: any,\n\t\t\t\tbase = defaultBase,\n\t\t\t\t...args: any[]\n\t\t\t) {\n\t\t\t\treturn self.produce(base, (draft: Drafted) => recipe.call(this, draft, ...args)) // prettier-ignore\n\t\t\t}\n\t\t}\n\n\t\tif (typeof recipe !== \"function\") die(6)\n\t\tif (patchListener !== undefined && typeof patchListener !== \"function\")\n\t\t\tdie(7)\n\n\t\tlet result\n\n\t\t// Only plain objects, arrays, and \"immerable classes\" are drafted.\n\t\tif (isDraftable(base)) {\n\t\t\tconst scope = enterScope(this)\n\t\t\tconst proxy = createProxy(base, undefined)\n\t\t\tlet hasError = true\n\t\t\ttry {\n\t\t\t\tresult = recipe(proxy)\n\t\t\t\thasError = false\n\t\t\t} finally {\n\t\t\t\t// finally instead of catch + rethrow better preserves original stack\n\t\t\t\tif (hasError) revokeScope(scope)\n\t\t\t\telse leaveScope(scope)\n\t\t\t}\n\t\t\tusePatchesInScope(scope, patchListener)\n\t\t\treturn processResult(result, scope)\n\t\t} else if (!base || typeof base !== \"object\") {\n\t\t\tresult = recipe(base)\n\t\t\tif (result === undefined) result = base\n\t\t\tif (result === NOTHING) result = undefined\n\t\t\tif (this.autoFreeze_) freeze(result, true)\n\t\t\tif (patchListener) {\n\t\t\t\tconst p: Patch[] = []\n\t\t\t\tconst ip: Patch[] = []\n\t\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(base, result, p, ip)\n\t\t\t\tpatchListener(p, ip)\n\t\t\t}\n\t\t\treturn result\n\t\t} else die(1, base)\n\t}\n\n\tproduceWithPatches: IProduceWithPatches = (base: any, recipe?: any): any => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\") {\n\t\t\treturn (state: any, ...args: any[]) =>\n\t\t\t\tthis.produceWithPatches(state, (draft: any) => base(draft, ...args))\n\t\t}\n\n\t\tlet patches: Patch[], inversePatches: Patch[]\n\t\tconst result = this.produce(base, recipe, (p: Patch[], ip: Patch[]) => {\n\t\t\tpatches = p\n\t\t\tinversePatches = ip\n\t\t})\n\t\treturn [result, patches!, inversePatches!]\n\t}\n\n\tcreateDraft(base: T): Draft {\n\t\tif (!isDraftable(base)) die(8)\n\t\tif (isDraft(base)) base = current(base)\n\t\tconst scope = enterScope(this)\n\t\tconst proxy = createProxy(base, undefined)\n\t\tproxy[DRAFT_STATE].isManual_ = true\n\t\tleaveScope(scope)\n\t\treturn proxy as any\n\t}\n\n\tfinishDraft>(\n\t\tdraft: D,\n\t\tpatchListener?: PatchListener\n\t): D extends Draft ? T : never {\n\t\tconst state: ImmerState = draft && (draft as any)[DRAFT_STATE]\n\t\tif (!state || !state.isManual_) die(9)\n\t\tconst {scope_: scope} = state\n\t\tusePatchesInScope(scope, patchListener)\n\t\treturn processResult(undefined, scope)\n\t}\n\n\t/**\n\t * Pass true to automatically freeze all copies created by Immer.\n\t *\n\t * By default, auto-freezing is enabled.\n\t */\n\tsetAutoFreeze(value: boolean) {\n\t\tthis.autoFreeze_ = value\n\t}\n\n\t/**\n\t * Pass true to enable strict shallow copy.\n\t *\n\t * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n\t */\n\tsetUseStrictShallowCopy(value: StrictMode) {\n\t\tthis.useStrictShallowCopy_ = value\n\t}\n\n\tapplyPatches(base: T, patches: readonly Patch[]): T {\n\t\t// If a patch replaces the entire state, take that replacement as base\n\t\t// before applying patches\n\t\tlet i: number\n\t\tfor (i = patches.length - 1; i >= 0; i--) {\n\t\t\tconst patch = patches[i]\n\t\t\tif (patch.path.length === 0 && patch.op === \"replace\") {\n\t\t\t\tbase = patch.value\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// If there was a patch that replaced the entire state, start from the\n\t\t// patch after that.\n\t\tif (i > -1) {\n\t\t\tpatches = patches.slice(i + 1)\n\t\t}\n\n\t\tconst applyPatchesImpl = getPlugin(\"Patches\").applyPatches_\n\t\tif (isDraft(base)) {\n\t\t\t// N.B: never hits if some patch a replacement, patches are never drafts\n\t\t\treturn applyPatchesImpl(base, patches)\n\t\t}\n\t\t// Otherwise, produce a copy of the base state.\n\t\treturn this.produce(base, (draft: Drafted) =>\n\t\t\tapplyPatchesImpl(draft, patches)\n\t\t)\n\t}\n}\n\nexport function createProxy(\n\tvalue: T,\n\tparent?: ImmerState\n): Drafted {\n\t// precondition: createProxy should be guarded by isDraftable, so we know we can safely draft\n\tconst draft: Drafted = isMap(value)\n\t\t? getPlugin(\"MapSet\").proxyMap_(value, parent)\n\t\t: isSet(value)\n\t\t? getPlugin(\"MapSet\").proxySet_(value, parent)\n\t\t: createProxyProxy(value, parent)\n\n\tconst scope = parent ? parent.scope_ : getCurrentScope()\n\tscope.drafts_.push(draft)\n\treturn draft\n}\n","import {\n\tdie,\n\tisDraft,\n\tshallowCopy,\n\teach,\n\tDRAFT_STATE,\n\tset,\n\tImmerState,\n\tisDraftable,\n\tisFrozen\n} from \"../internal\"\n\n/** Takes a snapshot of the current state of a draft and finalizes it (but without freezing). This is a great utility to print the current state during debugging (no Proxies in the way). The output of current can also be safely leaked outside the producer. */\nexport function current(value: T): T\nexport function current(value: any): any {\n\tif (!isDraft(value)) die(10, value)\n\treturn currentImpl(value)\n}\n\nfunction currentImpl(value: any): any {\n\tif (!isDraftable(value) || isFrozen(value)) return value\n\tconst state: ImmerState | undefined = value[DRAFT_STATE]\n\tlet copy: any\n\tif (state) {\n\t\tif (!state.modified_) return state.base_\n\t\t// Optimization: avoid generating new drafts during copying\n\t\tstate.finalized_ = true\n\t\tcopy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_)\n\t} else {\n\t\tcopy = shallowCopy(value, true)\n\t}\n\t// recurse\n\teach(copy, (key, childValue) => {\n\t\tset(copy, key, currentImpl(childValue))\n\t})\n\tif (state) {\n\t\tstate.finalized_ = false\n\t}\n\treturn copy\n}\n","import {immerable} from \"../immer\"\nimport {\n\tImmerState,\n\tPatch,\n\tSetState,\n\tProxyArrayState,\n\tMapState,\n\tProxyObjectState,\n\tPatchPath,\n\tget,\n\teach,\n\thas,\n\tgetArchtype,\n\tgetPrototypeOf,\n\tisSet,\n\tisMap,\n\tloadPlugin,\n\tArchType,\n\tdie,\n\tisDraft,\n\tisDraftable,\n\tNOTHING,\n\terrors\n} from \"../internal\"\n\nexport function enablePatches() {\n\tconst errorOffset = 16\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\terrors.push(\n\t\t\t'Sets cannot have \"replace\" patches.',\n\t\t\tfunction(op: string) {\n\t\t\t\treturn \"Unsupported patch operation: \" + op\n\t\t\t},\n\t\t\tfunction(path: string) {\n\t\t\t\treturn \"Cannot apply patch, path doesn't resolve: \" + path\n\t\t\t},\n\t\t\t\"Patching reserved attributes like __proto__, prototype and constructor is not allowed\"\n\t\t)\n\t}\n\n\tconst REPLACE = \"replace\"\n\tconst ADD = \"add\"\n\tconst REMOVE = \"remove\"\n\n\tfunction generatePatches_(\n\t\tstate: ImmerState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t): void {\n\t\tswitch (state.type_) {\n\t\t\tcase ArchType.Object:\n\t\t\tcase ArchType.Map:\n\t\t\t\treturn generatePatchesFromAssigned(\n\t\t\t\t\tstate,\n\t\t\t\t\tbasePath,\n\t\t\t\t\tpatches,\n\t\t\t\t\tinversePatches\n\t\t\t\t)\n\t\t\tcase ArchType.Array:\n\t\t\t\treturn generateArrayPatches(state, basePath, patches, inversePatches)\n\t\t\tcase ArchType.Set:\n\t\t\t\treturn generateSetPatches(\n\t\t\t\t\t(state as any) as SetState,\n\t\t\t\t\tbasePath,\n\t\t\t\t\tpatches,\n\t\t\t\t\tinversePatches\n\t\t\t\t)\n\t\t}\n\t}\n\n\tfunction generateArrayPatches(\n\t\tstate: ProxyArrayState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tlet {base_, assigned_} = state\n\t\tlet copy_ = state.copy_!\n\n\t\t// Reduce complexity by ensuring `base` is never longer.\n\t\tif (copy_.length < base_.length) {\n\t\t\t// @ts-ignore\n\t\t\t;[base_, copy_] = [copy_, base_]\n\t\t\t;[patches, inversePatches] = [inversePatches, patches]\n\t\t}\n\n\t\t// Process replaced indices.\n\t\tfor (let i = 0; i < base_.length; i++) {\n\t\t\tif (assigned_[i] && copy_[i] !== base_[i]) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: REPLACE,\n\t\t\t\t\tpath,\n\t\t\t\t\t// Need to maybe clone it, as it can in fact be the original value\n\t\t\t\t\t// due to the base/copy inversion at the start of this function\n\t\t\t\t\tvalue: clonePatchValueIfNeeded(copy_[i])\n\t\t\t\t})\n\t\t\t\tinversePatches.push({\n\t\t\t\t\top: REPLACE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue: clonePatchValueIfNeeded(base_[i])\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// Process added indices.\n\t\tfor (let i = base_.length; i < copy_.length; i++) {\n\t\t\tconst path = basePath.concat([i])\n\t\t\tpatches.push({\n\t\t\t\top: ADD,\n\t\t\t\tpath,\n\t\t\t\t// Need to maybe clone it, as it can in fact be the original value\n\t\t\t\t// due to the base/copy inversion at the start of this function\n\t\t\t\tvalue: clonePatchValueIfNeeded(copy_[i])\n\t\t\t})\n\t\t}\n\t\tfor (let i = copy_.length - 1; base_.length <= i; --i) {\n\t\t\tconst path = basePath.concat([i])\n\t\t\tinversePatches.push({\n\t\t\t\top: REMOVE,\n\t\t\t\tpath\n\t\t\t})\n\t\t}\n\t}\n\n\t// This is used for both Map objects and normal objects.\n\tfunction generatePatchesFromAssigned(\n\t\tstate: MapState | ProxyObjectState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tconst {base_, copy_} = state\n\t\teach(state.assigned_!, (key, assignedValue) => {\n\t\t\tconst origValue = get(base_, key)\n\t\t\tconst value = get(copy_!, key)\n\t\t\tconst op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD\n\t\t\tif (origValue === value && op === REPLACE) return\n\t\t\tconst path = basePath.concat(key as any)\n\t\t\tpatches.push(op === REMOVE ? {op, path} : {op, path, value})\n\t\t\tinversePatches.push(\n\t\t\t\top === ADD\n\t\t\t\t\t? {op: REMOVE, path}\n\t\t\t\t\t: op === REMOVE\n\t\t\t\t\t? {op: ADD, path, value: clonePatchValueIfNeeded(origValue)}\n\t\t\t\t\t: {op: REPLACE, path, value: clonePatchValueIfNeeded(origValue)}\n\t\t\t)\n\t\t})\n\t}\n\n\tfunction generateSetPatches(\n\t\tstate: SetState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tlet {base_, copy_} = state\n\n\t\tlet i = 0\n\t\tbase_.forEach((value: any) => {\n\t\t\tif (!copy_!.has(value)) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: REMOVE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t\tinversePatches.unshift({\n\t\t\t\t\top: ADD,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t}\n\t\t\ti++\n\t\t})\n\t\ti = 0\n\t\tcopy_!.forEach((value: any) => {\n\t\t\tif (!base_.has(value)) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: ADD,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t\tinversePatches.unshift({\n\t\t\t\t\top: REMOVE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t}\n\t\t\ti++\n\t\t})\n\t}\n\n\tfunction generateReplacementPatches_(\n\t\tbaseValue: any,\n\t\treplacement: any,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t): void {\n\t\tpatches.push({\n\t\t\top: REPLACE,\n\t\t\tpath: [],\n\t\t\tvalue: replacement === NOTHING ? undefined : replacement\n\t\t})\n\t\tinversePatches.push({\n\t\t\top: REPLACE,\n\t\t\tpath: [],\n\t\t\tvalue: baseValue\n\t\t})\n\t}\n\n\tfunction applyPatches_(draft: T, patches: readonly Patch[]): T {\n\t\tpatches.forEach(patch => {\n\t\t\tconst {path, op} = patch\n\n\t\t\tlet base: any = draft\n\t\t\tfor (let i = 0; i < path.length - 1; i++) {\n\t\t\t\tconst parentType = getArchtype(base)\n\t\t\t\tlet p = path[i]\n\t\t\t\tif (typeof p !== \"string\" && typeof p !== \"number\") {\n\t\t\t\t\tp = \"\" + p\n\t\t\t\t}\n\n\t\t\t\t// See #738, avoid prototype pollution\n\t\t\t\tif (\n\t\t\t\t\t(parentType === ArchType.Object || parentType === ArchType.Array) &&\n\t\t\t\t\t(p === \"__proto__\" || p === \"constructor\")\n\t\t\t\t)\n\t\t\t\t\tdie(errorOffset + 3)\n\t\t\t\tif (typeof base === \"function\" && p === \"prototype\")\n\t\t\t\t\tdie(errorOffset + 3)\n\t\t\t\tbase = get(base, p)\n\t\t\t\tif (typeof base !== \"object\") die(errorOffset + 2, path.join(\"/\"))\n\t\t\t}\n\n\t\t\tconst type = getArchtype(base)\n\t\t\tconst value = deepClonePatchValue(patch.value) // used to clone patch to ensure original patch is not modified, see #411\n\t\t\tconst key = path[path.length - 1]\n\t\t\tswitch (op) {\n\t\t\t\tcase REPLACE:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase ArchType.Map:\n\t\t\t\t\t\t\treturn base.set(key, value)\n\t\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\t\tcase ArchType.Set:\n\t\t\t\t\t\t\tdie(errorOffset)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t// if value is an object, then it's assigned by reference\n\t\t\t\t\t\t\t// in the following add or remove ops, the value field inside the patch will also be modifyed\n\t\t\t\t\t\t\t// so we use value from the cloned patch\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\treturn (base[key] = value)\n\t\t\t\t\t}\n\t\t\t\tcase ADD:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase ArchType.Array:\n\t\t\t\t\t\t\treturn key === \"-\"\n\t\t\t\t\t\t\t\t? base.push(value)\n\t\t\t\t\t\t\t\t: base.splice(key as any, 0, value)\n\t\t\t\t\t\tcase ArchType.Map:\n\t\t\t\t\t\t\treturn base.set(key, value)\n\t\t\t\t\t\tcase ArchType.Set:\n\t\t\t\t\t\t\treturn base.add(value)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn (base[key] = value)\n\t\t\t\t\t}\n\t\t\t\tcase REMOVE:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase ArchType.Array:\n\t\t\t\t\t\t\treturn base.splice(key as any, 1)\n\t\t\t\t\t\tcase ArchType.Map:\n\t\t\t\t\t\t\treturn base.delete(key)\n\t\t\t\t\t\tcase ArchType.Set:\n\t\t\t\t\t\t\treturn base.delete(patch.value)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn delete base[key]\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tdie(errorOffset + 1, op)\n\t\t\t}\n\t\t})\n\n\t\treturn draft\n\t}\n\n\t// optimize: this is quite a performance hit, can we detect intelligently when it is needed?\n\t// E.g. auto-draft when new objects from outside are assigned and modified?\n\t// (See failing test when deepClone just returns obj)\n\tfunction deepClonePatchValue(obj: T): T\n\tfunction deepClonePatchValue(obj: any) {\n\t\tif (!isDraftable(obj)) return obj\n\t\tif (Array.isArray(obj)) return obj.map(deepClonePatchValue)\n\t\tif (isMap(obj))\n\t\t\treturn new Map(\n\t\t\t\tArray.from(obj.entries()).map(([k, v]) => [k, deepClonePatchValue(v)])\n\t\t\t)\n\t\tif (isSet(obj)) return new Set(Array.from(obj).map(deepClonePatchValue))\n\t\tconst cloned = Object.create(getPrototypeOf(obj))\n\t\tfor (const key in obj) cloned[key] = deepClonePatchValue(obj[key])\n\t\tif (has(obj, immerable)) cloned[immerable] = obj[immerable]\n\t\treturn cloned\n\t}\n\n\tfunction clonePatchValueIfNeeded(obj: T): T {\n\t\tif (isDraft(obj)) {\n\t\t\treturn deepClonePatchValue(obj)\n\t\t} else return obj\n\t}\n\n\tloadPlugin(\"Patches\", {\n\t\tapplyPatches_,\n\t\tgeneratePatches_,\n\t\tgenerateReplacementPatches_\n\t})\n}\n","// types only!\nimport {\n\tImmerState,\n\tAnyMap,\n\tAnySet,\n\tMapState,\n\tSetState,\n\tDRAFT_STATE,\n\tgetCurrentScope,\n\tlatest,\n\tisDraftable,\n\tcreateProxy,\n\tloadPlugin,\n\tmarkChanged,\n\tdie,\n\tArchType,\n\teach\n} from \"../internal\"\n\nexport function enableMapSet() {\n\tclass DraftMap extends Map {\n\t\t[DRAFT_STATE]: MapState\n\n\t\tconstructor(target: AnyMap, parent?: ImmerState) {\n\t\t\tsuper()\n\t\t\tthis[DRAFT_STATE] = {\n\t\t\t\ttype_: ArchType.Map,\n\t\t\t\tparent_: parent,\n\t\t\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t\t\tmodified_: false,\n\t\t\t\tfinalized_: false,\n\t\t\t\tcopy_: undefined,\n\t\t\t\tassigned_: undefined,\n\t\t\t\tbase_: target,\n\t\t\t\tdraft_: this as any,\n\t\t\t\tisManual_: false,\n\t\t\t\trevoked_: false\n\t\t\t}\n\t\t}\n\n\t\tget size(): number {\n\t\t\treturn latest(this[DRAFT_STATE]).size\n\t\t}\n\n\t\thas(key: any): boolean {\n\t\t\treturn latest(this[DRAFT_STATE]).has(key)\n\t\t}\n\n\t\tset(key: any, value: any) {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (!latest(state).has(key) || latest(state).get(key) !== value) {\n\t\t\t\tprepareMapCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.assigned_!.set(key, true)\n\t\t\t\tstate.copy_!.set(key, value)\n\t\t\t\tstate.assigned_!.set(key, true)\n\t\t\t}\n\t\t\treturn this\n\t\t}\n\n\t\tdelete(key: any): boolean {\n\t\t\tif (!this.has(key)) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareMapCopy(state)\n\t\t\tmarkChanged(state)\n\t\t\tif (state.base_.has(key)) {\n\t\t\t\tstate.assigned_!.set(key, false)\n\t\t\t} else {\n\t\t\t\tstate.assigned_!.delete(key)\n\t\t\t}\n\t\t\tstate.copy_!.delete(key)\n\t\t\treturn true\n\t\t}\n\n\t\tclear() {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (latest(state).size) {\n\t\t\t\tprepareMapCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.assigned_ = new Map()\n\t\t\t\teach(state.base_, key => {\n\t\t\t\t\tstate.assigned_!.set(key, false)\n\t\t\t\t})\n\t\t\t\tstate.copy_!.clear()\n\t\t\t}\n\t\t}\n\n\t\tforEach(cb: (value: any, key: any, self: any) => void, thisArg?: any) {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tlatest(state).forEach((_value: any, key: any, _map: any) => {\n\t\t\t\tcb.call(thisArg, this.get(key), key, this)\n\t\t\t})\n\t\t}\n\n\t\tget(key: any): any {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tconst value = latest(state).get(key)\n\t\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\t\treturn value\n\t\t\t}\n\t\t\tif (value !== state.base_.get(key)) {\n\t\t\t\treturn value // either already drafted or reassigned\n\t\t\t}\n\t\t\t// despite what it looks, this creates a draft only once, see above condition\n\t\t\tconst draft = createProxy(value, state)\n\t\t\tprepareMapCopy(state)\n\t\t\tstate.copy_!.set(key, draft)\n\t\t\treturn draft\n\t\t}\n\n\t\tkeys(): IterableIterator {\n\t\t\treturn latest(this[DRAFT_STATE]).keys()\n\t\t}\n\n\t\tvalues(): IterableIterator {\n\t\t\tconst iterator = this.keys()\n\t\t\treturn {\n\t\t\t\t[Symbol.iterator]: () => this.values(),\n\t\t\t\tnext: () => {\n\t\t\t\t\tconst r = iterator.next()\n\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\tif (r.done) return r\n\t\t\t\t\tconst value = this.get(r.value)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\tvalue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} as any\n\t\t}\n\n\t\tentries(): IterableIterator<[any, any]> {\n\t\t\tconst iterator = this.keys()\n\t\t\treturn {\n\t\t\t\t[Symbol.iterator]: () => this.entries(),\n\t\t\t\tnext: () => {\n\t\t\t\t\tconst r = iterator.next()\n\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\tif (r.done) return r\n\t\t\t\t\tconst value = this.get(r.value)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\tvalue: [r.value, value]\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} as any\n\t\t}\n\n\t\t[Symbol.iterator]() {\n\t\t\treturn this.entries()\n\t\t}\n\t}\n\n\tfunction proxyMap_(target: T, parent?: ImmerState): T {\n\t\t// @ts-ignore\n\t\treturn new DraftMap(target, parent)\n\t}\n\n\tfunction prepareMapCopy(state: MapState) {\n\t\tif (!state.copy_) {\n\t\t\tstate.assigned_ = new Map()\n\t\t\tstate.copy_ = new Map(state.base_)\n\t\t}\n\t}\n\n\tclass DraftSet extends Set {\n\t\t[DRAFT_STATE]: SetState\n\t\tconstructor(target: AnySet, parent?: ImmerState) {\n\t\t\tsuper()\n\t\t\tthis[DRAFT_STATE] = {\n\t\t\t\ttype_: ArchType.Set,\n\t\t\t\tparent_: parent,\n\t\t\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t\t\tmodified_: false,\n\t\t\t\tfinalized_: false,\n\t\t\t\tcopy_: undefined,\n\t\t\t\tbase_: target,\n\t\t\t\tdraft_: this,\n\t\t\t\tdrafts_: new Map(),\n\t\t\t\trevoked_: false,\n\t\t\t\tisManual_: false\n\t\t\t}\n\t\t}\n\n\t\tget size(): number {\n\t\t\treturn latest(this[DRAFT_STATE]).size\n\t\t}\n\n\t\thas(value: any): boolean {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\t// bit of trickery here, to be able to recognize both the value, and the draft of its value\n\t\t\tif (!state.copy_) {\n\t\t\t\treturn state.base_.has(value)\n\t\t\t}\n\t\t\tif (state.copy_.has(value)) return true\n\t\t\tif (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value)))\n\t\t\t\treturn true\n\t\t\treturn false\n\t\t}\n\n\t\tadd(value: any): any {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (!this.has(value)) {\n\t\t\t\tprepareSetCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.copy_!.add(value)\n\t\t\t}\n\t\t\treturn this\n\t\t}\n\n\t\tdelete(value: any): any {\n\t\t\tif (!this.has(value)) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\tmarkChanged(state)\n\t\t\treturn (\n\t\t\t\tstate.copy_!.delete(value) ||\n\t\t\t\t(state.drafts_.has(value)\n\t\t\t\t\t? state.copy_!.delete(state.drafts_.get(value))\n\t\t\t\t\t: /* istanbul ignore next */ false)\n\t\t\t)\n\t\t}\n\n\t\tclear() {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (latest(state).size) {\n\t\t\t\tprepareSetCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.copy_!.clear()\n\t\t\t}\n\t\t}\n\n\t\tvalues(): IterableIterator {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\treturn state.copy_!.values()\n\t\t}\n\n\t\tentries(): IterableIterator<[any, any]> {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\treturn state.copy_!.entries()\n\t\t}\n\n\t\tkeys(): IterableIterator {\n\t\t\treturn this.values()\n\t\t}\n\n\t\t[Symbol.iterator]() {\n\t\t\treturn this.values()\n\t\t}\n\n\t\tforEach(cb: any, thisArg?: any) {\n\t\t\tconst iterator = this.values()\n\t\t\tlet result = iterator.next()\n\t\t\twhile (!result.done) {\n\t\t\t\tcb.call(thisArg, result.value, result.value, this)\n\t\t\t\tresult = iterator.next()\n\t\t\t}\n\t\t}\n\t}\n\tfunction proxySet_(target: T, parent?: ImmerState): T {\n\t\t// @ts-ignore\n\t\treturn new DraftSet(target, parent)\n\t}\n\n\tfunction prepareSetCopy(state: SetState) {\n\t\tif (!state.copy_) {\n\t\t\t// create drafts for all entries to preserve insertion order\n\t\t\tstate.copy_ = new Set()\n\t\t\tstate.base_.forEach(value => {\n\t\t\t\tif (isDraftable(value)) {\n\t\t\t\t\tconst draft = createProxy(value, state)\n\t\t\t\t\tstate.drafts_.set(value, draft)\n\t\t\t\t\tstate.copy_!.add(draft)\n\t\t\t\t} else {\n\t\t\t\t\tstate.copy_!.add(value)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n\n\tfunction assertUnrevoked(state: any /*ES5State | MapState | SetState*/) {\n\t\tif (state.revoked_) die(3, JSON.stringify(latest(state)))\n\t}\n\n\tloadPlugin(\"MapSet\", {proxyMap_, proxySet_})\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,eAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,IAAM,UAAyB,OAAO,IAAI,eAAe;AAUzD,IAAM,YAA2B,OAAO,IAAI,iBAAiB;AAE7D,IAAM,cAA6B,OAAO,IAAI,aAAa;;;ACjB3D,IAAM,SACZ,QAAQ,IAA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A,WAAS,eAAe,OAAiB;AACxC,QAAI,CAAC,MAAM,OAAO;AAEjB,YAAM,QAAQ,oBAAI,IAAI;AACtB,YAAM,MAAM,QAAQ,WAAS;AAC5B,YAAI,YAAY,KAAK,GAAG;AACvB,gBAAM,QAAQ,YAAY,OAAO,KAAK;AACtC,gBAAM,QAAQ,IAAI,OAAO,KAAK;AAC9B,gBAAM,MAAO,IAAI,KAAK;AAAA,QACvB,OAAO;AACN,gBAAM,MAAO,IAAI,KAAK;AAAA,QACvB;AAAA,MACD,CAAC;AAAA,IACF;AAAA,EACD;AAEA,WAAS,gBAAgB,OAA+C;AACvE,QAAI,MAAM;AAAU,UAAI,GAAG,KAAK,UAAU,OAAO,KAAK,CAAC,CAAC;AAAA,EACzD;AAEA,aAAW,UAAU,EAAC,WAAW,UAAS,CAAC;AAC5C;;;AXrRA,IAAM,QAAQ,IAAIC,OAAM;AAqBjB,IAAM,UAAoB,MAAM;AAMhC,IAAM,qBAA0C,MAAM,mBAAmB;AAAA,EAC/E;AACD;AAOO,IAAM,gBAAgB,MAAM,cAAc,KAAK,KAAK;AAOpD,IAAM,0BAA0B,MAAM,wBAAwB,KAAK,KAAK;AAOxE,IAAM,eAAe,MAAM,aAAa,KAAK,KAAK;AAMlD,IAAM,cAAc,MAAM,YAAY,KAAK,KAAK;AAUhD,IAAM,cAAc,MAAM,YAAY,KAAK,KAAK;AAQhD,SAAS,UAAa,OAAoB;AAChD,SAAO;AACR;AAOO,SAAS,cAAiB,OAAwB;AACxD,SAAO;AACR;","names":["Immer","immer","isSet","current","Immer","base","Immer"]} \ No newline at end of file diff --git a/node_modules/immer/dist/cjs/immer.cjs.production.js b/node_modules/immer/dist/cjs/immer.cjs.production.js new file mode 100644 index 00000000..4b958095 --- /dev/null +++ b/node_modules/immer/dist/cjs/immer.cjs.production.js @@ -0,0 +1,2 @@ +"use strict";var ne=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var Te=Object.prototype.hasOwnProperty;var Ae=(e,t)=>{for(var r in t)ne(e,r,{get:t[r],enumerable:!0})},Ie=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of be(t))!Te.call(e,i)&&i!==r&&ne(e,i,{get:()=>t[i],enumerable:!(n=ge(t,i))||n.enumerable});return e};var De=e=>Ie(ne({},"__esModule",{value:!0}),e);var Be={};Ae(Be,{Immer:()=>J,applyPatches:()=>Ce,castDraft:()=>ke,castImmutable:()=>Ke,createDraft:()=>Re,current:()=>re,enableMapSet:()=>xe,enablePatches:()=>Pe,finishDraft:()=>ve,freeze:()=>K,immerable:()=>N,isDraft:()=>O,isDraftable:()=>A,nothing:()=>j,original:()=>le,produce:()=>Fe,produceWithPatches:()=>Ne,setAutoFreeze:()=>ze,setUseStrictShallowCopy:()=>je});module.exports=De(Be);var j=Symbol.for("immer-nothing"),N=Symbol.for("immer-draftable"),u=Symbol.for("immer-state");function h(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var z=Object.getPrototypeOf;function O(e){return!!e&&!!e[u]}function A(e){return e?ye(e)||Array.isArray(e)||!!e[N]||!!e.constructor?.[N]||v(e)||k(e):!1}var Oe=Object.prototype.constructor.toString();function ye(e){if(!e||typeof e!="object")return!1;let t=z(e);if(t===null)return!0;let r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object?!0:typeof r=="function"&&Function.toString.call(r)===Oe}function le(e){return O(e)||h(15,e),e[u].t}function _(e,t){C(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,n)=>t(n,r,e))}function C(e){let t=e[u];return t?t.o:Array.isArray(e)?1:v(e)?2:k(e)?3:0}function R(e,t){return C(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function X(e,t){return C(e)===2?e.get(t):e[t]}function Q(e,t,r){let n=C(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function pe(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function v(e){return e instanceof Map}function k(e){return e instanceof Set}function T(e){return e.e||e.t}function L(e,t){if(v(e))return new Map(e);if(k(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=ye(e);if(t===!0||t==="class_only"&&!r){let n=Object.getOwnPropertyDescriptors(e);delete n[u];let i=Reflect.ownKeys(n);for(let f=0;f1&&(e.set=e.add=e.clear=e.delete=Me),Object.freeze(e),t&&Object.entries(e).forEach(([r,n])=>K(n,!0))),e}function Me(){h(2)}function $(e){return Object.isFrozen(e)}var ae={};function w(e){let t=ae[e];return t||h(0,e),t}function Y(e,t){ae[e]||(ae[e]=t)}var U;function B(){return U}function _e(e,t){return{a:[],i:e,p:t,P:!0,d:0}}function oe(e,t){t&&(w("Patches"),e.f=[],e.h=[],e.b=t)}function V(e){Z(e),e.a.forEach(we),e.a=null}function Z(e){e===U&&(U=e.i)}function ie(e){return U=_e(U,e)}function we(e){let t=e[u];t.o===0||t.o===1?t.x():t.m=!0}function se(e,t){t.d=t.a.length;let r=t.a[0];return e!==void 0&&e!==r?(r[u].s&&(V(t),h(4)),A(e)&&(e=ee(t,e),t.i||te(t,e)),t.f&&w("Patches").T(r[u].t,e,t.f,t.h)):e=ee(t,r,[]),V(t),t.f&&t.b(t.f,t.h),e!==j?e:void 0}function ee(e,t,r){if($(t))return t;let n=t[u];if(!n)return _(t,(i,f)=>de(e,n,t,i,f,r)),t;if(n.n!==e)return t;if(!n.s)return te(e,n.t,!0),n.t;if(!n.c){n.c=!0,n.n.d--;let i=n.e,f=i,l=!1;n.o===3&&(f=new Set(i),i.clear(),l=!0),_(f,(c,b)=>de(e,n,i,c,b,r,l)),te(e,i,!1),r&&e.f&&w("Patches").g(n,r,e.f,e.h)}return n.e}function de(e,t,r,n,i,f,l){if(O(i)){let c=f&&t&&t.o!==3&&!R(t.r,n)?f.concat(n):void 0,b=ee(e,i,c);if(Q(r,n,b),O(b))e.P=!1;else return}else l&&r.add(i);if(A(i)&&!$(i)){if(!e.p.y&&e.d<1)return;ee(e,i),(!t||!t.n.i)&&typeof n!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,n)&&te(e,i)}}function te(e,t,r=!1){!e.i&&e.p.y&&e.P&&K(t,r)}function he(e,t){let r=Array.isArray(e),n={o:r?1:0,n:t?t.n:B(),s:!1,c:!1,r:{},i:t,t:e,u:null,e:null,x:null,l:!1},i=n,f=ue;r&&(i=[n],f=q);let{revoke:l,proxy:c}=Proxy.revocable(i,f);return n.u=c,n.x=l,c}var ue={get(e,t){if(t===u)return e;let r=T(e);if(!R(r,t))return Ee(e,r,t);let n=r[t];return e.c||!A(n)?n:n===ce(e.t,t)?(fe(e),e.e[t]=W(n,e)):n},has(e,t){return t in T(e)},ownKeys(e){return Reflect.ownKeys(T(e))},set(e,t,r){let n=me(T(e),t);if(n?.set)return n.set.call(e.u,r),!0;if(!e.s){let i=ce(T(e),t),f=i?.[u];if(f&&f.t===r)return e.e[t]=r,e.r[t]=!1,!0;if(pe(r,i)&&(r!==void 0||R(e.t,t)))return!0;fe(e),E(e)}return e.e[t]===r&&(r!==void 0||t in e.e)||Number.isNaN(r)&&Number.isNaN(e.e[t])||(e.e[t]=r,e.r[t]=!0),!0},deleteProperty(e,t){return ce(e.t,t)!==void 0||t in e.t?(e.r[t]=!1,fe(e),E(e)):delete e.r[t],e.e&&delete e.e[t],!0},getOwnPropertyDescriptor(e,t){let r=T(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.o!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){h(11)},getPrototypeOf(e){return z(e.t)},setPrototypeOf(){h(12)}},q={};_(ue,(e,t)=>{q[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});q.deleteProperty=function(e,t){return q.set.call(this,e,t,void 0)};q.set=function(e,t,r){return ue.set.call(this,e[0],t,r,e[0])};function ce(e,t){let r=e[u];return(r?T(r):e)[t]}function Ee(e,t,r){let n=me(t,r);return n?"value"in n?n.value:n.get?.call(e.u):void 0}function me(e,t){if(!(t in e))return;let r=z(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=z(r)}}function E(e){e.s||(e.s=!0,e.i&&E(e.i))}function fe(e){e.e||(e.e=L(e.t,e.n.p.S))}var J=class{constructor(t){this.y=!0;this.S=!1;this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){let f=r;r=t;let l=this;return function(b=f,...a){return l.produce(b,o=>r.call(this,o,...a))}}typeof r!="function"&&h(6),n!==void 0&&typeof n!="function"&&h(7);let i;if(A(t)){let f=ie(this),l=W(t,void 0),c=!0;try{i=r(l),c=!1}finally{c?V(f):Z(f)}return oe(f,n),se(i,f)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===j&&(i=void 0),this.y&&K(i,!0),n){let f=[],l=[];w("Patches").T(t,i,f,l),n(f,l)}return i}else h(1,t)};this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(l,...c)=>this.produceWithPatches(l,b=>t(b,...c));let n,i;return[this.produce(t,r,(l,c)=>{n=l,i=c}),n,i]};typeof t?.autoFreeze=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof t?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){A(t)||h(8),O(t)&&(t=re(t));let r=ie(this),n=W(t,void 0);return n[u].l=!0,Z(r),n}finishDraft(t,r){let n=t&&t[u];(!n||!n.l)&&h(9);let{n:i}=n;return oe(i,r),se(void 0,i)}setAutoFreeze(t){this.y=t}setUseStrictShallowCopy(t){this.S=t}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){let f=r[n];if(f.path.length===0&&f.op==="replace"){t=f.value;break}}n>-1&&(r=r.slice(n+1));let i=w("Patches").A;return O(t)?i(t,r):this.produce(t,f=>i(f,r))}};function W(e,t){let r=v(e)?w("MapSet").I(e,t):k(e)?w("MapSet").D(e,t):he(e,t);return(t?t.n:B()).a.push(r),r}function re(e){return O(e)||h(10,e),Se(e)}function Se(e){if(!A(e)||$(e))return e;let t=e[u],r;if(t){if(!t.s)return t.t;t.c=!0,r=L(e,t.n.p.S)}else r=L(e,!0);return _(r,(n,i)=>{Q(r,n,Se(i))}),t&&(t.c=!1),r}function Pe(){let t="replace",r="add",n="remove";function i(s,S,m,x){switch(s.o){case 0:case 2:return l(s,S,m,x);case 1:return f(s,S,m,x);case 3:return c(s,S,m,x)}}function f(s,S,m,x){let{t:I,r:P}=s,g=s.e;g.length{let d=X(I,g),H=X(P,g),F=y?R(I,g)?t:r:n;if(d===H&&F===t)return;let D=S.concat(g);m.push(F===n?{op:F,path:D}:{op:F,path:D,value:H}),x.push(F===r?{op:n,path:D}:F===n?{op:r,path:D,value:p(d)}:{op:t,path:D,value:p(d)})})}function c(s,S,m,x){let{t:I,e:P}=s,g=0;I.forEach(y=>{if(!P.has(y)){let d=S.concat([g]);m.push({op:n,path:d,value:y}),x.unshift({op:r,path:d,value:y})}g++}),g=0,P.forEach(y=>{if(!I.has(y)){let d=S.concat([g]);m.push({op:r,path:d,value:y}),x.unshift({op:n,path:d,value:y})}g++})}function b(s,S,m,x){m.push({op:t,path:[],value:S===j?void 0:S}),x.push({op:t,path:[],value:s})}function a(s,S){return S.forEach(m=>{let{path:x,op:I}=m,P=s;for(let H=0;H[m,o(x)]));if(k(s))return new Set(Array.from(s).map(o));let S=Object.create(z(s));for(let m in s)S[m]=o(s[m]);return R(s,N)&&(S[N]=s[N]),S}function p(s){return O(s)?o(s):s}Y("Patches",{A:a,g:i,T:b})}function xe(){class e extends Map{constructor(a,o){super();this[u]={o:2,i:o,n:o?o.n:B(),s:!1,c:!1,e:void 0,r:void 0,t:a,u:this,l:!1,m:!1}}get size(){return T(this[u]).size}has(a){return T(this[u]).has(a)}set(a,o){let p=this[u];return l(p),(!T(p).has(a)||T(p).get(a)!==o)&&(r(p),E(p),p.r.set(a,!0),p.e.set(a,o),p.r.set(a,!0)),this}delete(a){if(!this.has(a))return!1;let o=this[u];return l(o),r(o),E(o),o.t.has(a)?o.r.set(a,!1):o.r.delete(a),o.e.delete(a),!0}clear(){let a=this[u];l(a),T(a).size&&(r(a),E(a),a.r=new Map,_(a.t,o=>{a.r.set(o,!1)}),a.e.clear())}forEach(a,o){let p=this[u];T(p).forEach((s,S,m)=>{a.call(o,this.get(S),S,this)})}get(a){let o=this[u];l(o);let p=T(o).get(a);if(o.c||!A(p)||p!==o.t.get(a))return p;let s=W(p,o);return r(o),o.e.set(a,s),s}keys(){return T(this[u]).keys()}values(){let a=this.keys();return{[Symbol.iterator]:()=>this.values(),next:()=>{let o=a.next();return o.done?o:{done:!1,value:this.get(o.value)}}}}entries(){let a=this.keys();return{[Symbol.iterator]:()=>this.entries(),next:()=>{let o=a.next();if(o.done)return o;let p=this.get(o.value);return{done:!1,value:[o.value,p]}}}}[(u,Symbol.iterator)](){return this.entries()}}function t(c,b){return new e(c,b)}function r(c){c.e||(c.r=new Map,c.e=new Map(c.t))}class n extends Set{constructor(a,o){super();this[u]={o:3,i:o,n:o?o.n:B(),s:!1,c:!1,e:void 0,t:a,u:this,a:new Map,m:!1,l:!1}}get size(){return T(this[u]).size}has(a){let o=this[u];return l(o),o.e?!!(o.e.has(a)||o.a.has(a)&&o.e.has(o.a.get(a))):o.t.has(a)}add(a){let o=this[u];return l(o),this.has(a)||(f(o),E(o),o.e.add(a)),this}delete(a){if(!this.has(a))return!1;let o=this[u];return l(o),f(o),E(o),o.e.delete(a)||(o.a.has(a)?o.e.delete(o.a.get(a)):!1)}clear(){let a=this[u];l(a),T(a).size&&(f(a),E(a),a.e.clear())}values(){let a=this[u];return l(a),f(a),a.e.values()}entries(){let a=this[u];return l(a),f(a),a.e.entries()}keys(){return this.values()}[(u,Symbol.iterator)](){return this.values()}forEach(a,o){let p=this.values(),s=p.next();for(;!s.done;)a.call(o,s.value,s.value,this),s=p.next()}}function i(c,b){return new n(c,b)}function f(c){c.e||(c.e=new Set,c.t.forEach(b=>{if(A(b)){let a=W(b,c);c.a.set(b,a),c.e.add(a)}else c.e.add(b)}))}function l(c){c.m&&h(3,JSON.stringify(T(c)))}Y("MapSet",{I:t,D:i})}var M=new J,Fe=M.produce,Ne=M.produceWithPatches.bind(M),ze=M.setAutoFreeze.bind(M),je=M.setUseStrictShallowCopy.bind(M),Ce=M.applyPatches.bind(M),Re=M.createDraft.bind(M),ve=M.finishDraft.bind(M);function ke(e){return e}function Ke(e){return e}0&&(module.exports={Immer,applyPatches,castDraft,castImmutable,createDraft,current,enableMapSet,enablePatches,finishDraft,freeze,immerable,isDraft,isDraftable,nothing,original,produce,produceWithPatches,setAutoFreeze,setUseStrictShallowCopy}); +//# sourceMappingURL=immer.cjs.production.js.map \ No newline at end of file diff --git a/node_modules/immer/dist/cjs/immer.cjs.production.js.map b/node_modules/immer/dist/cjs/immer.cjs.production.js.map new file mode 100644 index 00000000..9d4af35e --- /dev/null +++ b/node_modules/immer/dist/cjs/immer.cjs.production.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/immer.ts","../../src/utils/env.ts","../../src/utils/errors.ts","../../src/utils/common.ts","../../src/utils/plugins.ts","../../src/core/scope.ts","../../src/core/finalize.ts","../../src/core/proxy.ts","../../src/core/immerClass.ts","../../src/core/current.ts","../../src/plugins/patches.ts","../../src/plugins/mapset.ts"],"sourcesContent":["import {\n\tIProduce,\n\tIProduceWithPatches,\n\tImmer,\n\tDraft,\n\tImmutable\n} from \"./internal\"\n\nexport {\n\tDraft,\n\tWritableDraft,\n\tImmutable,\n\tPatch,\n\tPatchListener,\n\tProducer,\n\toriginal,\n\tcurrent,\n\tisDraft,\n\tisDraftable,\n\tNOTHING as nothing,\n\tDRAFTABLE as immerable,\n\tfreeze,\n\tObjectish,\n\tStrictMode\n} from \"./internal\"\n\nconst immer = new Immer()\n\n/**\n * The `produce` function takes a value and a \"recipe function\" (whose\n * return value often depends on the base state). The recipe function is\n * free to mutate its first argument however it wants. All mutations are\n * only ever applied to a __copy__ of the base state.\n *\n * Pass only a function to create a \"curried producer\" which relieves you\n * from passing the recipe function every time.\n *\n * Only plain objects and arrays are made mutable. All other objects are\n * considered uncopyable.\n *\n * Note: This function is __bound__ to its `Immer` instance.\n *\n * @param {any} base - the initial state\n * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified\n * @param {Function} patchListener - optional function that will be called with all the patches produced here\n * @returns {any} a new state, or the initial state if nothing was modified\n */\nexport const produce: IProduce = immer.produce\n\n/**\n * Like `produce`, but `produceWithPatches` always returns a tuple\n * [nextState, patches, inversePatches] (instead of just the next state)\n */\nexport const produceWithPatches: IProduceWithPatches = immer.produceWithPatches.bind(\n\timmer\n)\n\n/**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * Always freeze by default, even in production mode\n */\nexport const setAutoFreeze = immer.setAutoFreeze.bind(immer)\n\n/**\n * Pass true to enable strict shallow copy.\n *\n * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n */\nexport const setUseStrictShallowCopy = immer.setUseStrictShallowCopy.bind(immer)\n\n/**\n * Apply an array of Immer patches to the first argument.\n *\n * This function is a producer, which means copy-on-write is in effect.\n */\nexport const applyPatches = immer.applyPatches.bind(immer)\n\n/**\n * Create an Immer draft from the given base state, which may be a draft itself.\n * The draft can be modified until you finalize it with the `finishDraft` function.\n */\nexport const createDraft = immer.createDraft.bind(immer)\n\n/**\n * Finalize an Immer draft from a `createDraft` call, returning the base state\n * (if no changes were made) or a modified copy. The draft must *not* be\n * mutated afterwards.\n *\n * Pass a function as the 2nd argument to generate Immer patches based on the\n * changes that were made.\n */\nexport const finishDraft = immer.finishDraft.bind(immer)\n\n/**\n * This function is actually a no-op, but can be used to cast an immutable type\n * to an draft type and make TypeScript happy\n *\n * @param value\n */\nexport function castDraft(value: T): Draft {\n\treturn value as any\n}\n\n/**\n * This function is actually a no-op, but can be used to cast a mutable type\n * to an immutable type and make TypeScript happy\n * @param value\n */\nexport function castImmutable(value: T): Immutable {\n\treturn value as any\n}\n\nexport {Immer}\n\nexport {enablePatches} from \"./plugins/patches\"\nexport {enableMapSet} from \"./plugins/mapset\"\n","// Should be no imports here!\n\n/**\n * The sentinel value returned by producers to replace the draft with undefined.\n */\nexport const NOTHING: unique symbol = Symbol.for(\"immer-nothing\")\n\n/**\n * To let Immer treat your class instances as plain immutable objects\n * (albeit with a custom prototype), you must define either an instance property\n * or a static property on each of your custom classes.\n *\n * Otherwise, your class instance will never be drafted, which means it won't be\n * safe to mutate in a produce callback.\n */\nexport const DRAFTABLE: unique symbol = Symbol.for(\"immer-draftable\")\n\nexport const DRAFT_STATE: unique symbol = Symbol.for(\"immer-state\")\n","export const errors =\n\tprocess.env.NODE_ENV !== \"production\"\n\t\t? [\n\t\t\t\t// All error codes, starting by 0:\n\t\t\t\tfunction(plugin: string) {\n\t\t\t\t\treturn `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \\`enable${plugin}()\\` when initializing your application.`\n\t\t\t\t},\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`\n\t\t\t\t},\n\t\t\t\t\"This object has been frozen and should not be mutated\",\n\t\t\t\tfunction(data: any) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t\"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? \" +\n\t\t\t\t\t\tdata\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t\t\"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.\",\n\t\t\t\t\"Immer forbids circular references\",\n\t\t\t\t\"The first or second argument to `produce` must be a function\",\n\t\t\t\t\"The third argument to `produce` must be a function or undefined\",\n\t\t\t\t\"First argument to `createDraft` must be a plain object, an array, or an immerable object\",\n\t\t\t\t\"First argument to `finishDraft` must be a draft returned by `createDraft`\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'current' expects a draft, got: ${thing}`\n\t\t\t\t},\n\t\t\t\t\"Object.defineProperty() cannot be used on an Immer draft\",\n\t\t\t\t\"Object.setPrototypeOf() cannot be used on an Immer draft\",\n\t\t\t\t\"Immer only supports deleting array indices\",\n\t\t\t\t\"Immer only supports setting array indices and the 'length' property\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'original' expects a draft, got: ${thing}`\n\t\t\t\t}\n\t\t\t\t// Note: if more errors are added, the errorOffset in Patches.ts should be increased\n\t\t\t\t// See Patches.ts for additional errors\n\t\t ]\n\t\t: []\n\nexport function die(error: number, ...args: any[]): never {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tconst e = errors[error]\n\t\tconst msg = typeof e === \"function\" ? e.apply(null, args as any) : e\n\t\tthrow new Error(`[Immer] ${msg}`)\n\t}\n\tthrow new Error(\n\t\t`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`\n\t)\n}\n","import {\n\tDRAFT_STATE,\n\tDRAFTABLE,\n\tObjectish,\n\tDrafted,\n\tAnyObject,\n\tAnyMap,\n\tAnySet,\n\tImmerState,\n\tArchType,\n\tdie,\n\tStrictMode\n} from \"../internal\"\n\nexport const getPrototypeOf = Object.getPrototypeOf\n\n/** Returns true if the given value is an Immer draft */\n/*#__PURE__*/\nexport function isDraft(value: any): boolean {\n\treturn !!value && !!value[DRAFT_STATE]\n}\n\n/** Returns true if the given value can be drafted by Immer */\n/*#__PURE__*/\nexport function isDraftable(value: any): boolean {\n\tif (!value) return false\n\treturn (\n\t\tisPlainObject(value) ||\n\t\tArray.isArray(value) ||\n\t\t!!value[DRAFTABLE] ||\n\t\t!!value.constructor?.[DRAFTABLE] ||\n\t\tisMap(value) ||\n\t\tisSet(value)\n\t)\n}\n\nconst objectCtorString = Object.prototype.constructor.toString()\n/*#__PURE__*/\nexport function isPlainObject(value: any): boolean {\n\tif (!value || typeof value !== \"object\") return false\n\tconst proto = getPrototypeOf(value)\n\tif (proto === null) {\n\t\treturn true\n\t}\n\tconst Ctor =\n\t\tObject.hasOwnProperty.call(proto, \"constructor\") && proto.constructor\n\n\tif (Ctor === Object) return true\n\n\treturn (\n\t\ttypeof Ctor == \"function\" &&\n\t\tFunction.toString.call(Ctor) === objectCtorString\n\t)\n}\n\n/** Get the underlying object that is represented by the given draft */\n/*#__PURE__*/\nexport function original(value: T): T | undefined\nexport function original(value: Drafted): any {\n\tif (!isDraft(value)) die(15, value)\n\treturn value[DRAFT_STATE].base_\n}\n\n/**\n * Each iterates a map, set or array.\n * Or, if any other kind of object, all of its own properties.\n * Regardless whether they are enumerable or symbols\n */\nexport function each(\n\tobj: T,\n\titer: (key: string | number, value: any, source: T) => void\n): void\nexport function each(obj: any, iter: any) {\n\tif (getArchtype(obj) === ArchType.Object) {\n\t\tReflect.ownKeys(obj).forEach(key => {\n\t\t\titer(key, obj[key], obj)\n\t\t})\n\t} else {\n\t\tobj.forEach((entry: any, index: any) => iter(index, entry, obj))\n\t}\n}\n\n/*#__PURE__*/\nexport function getArchtype(thing: any): ArchType {\n\tconst state: undefined | ImmerState = thing[DRAFT_STATE]\n\treturn state\n\t\t? state.type_\n\t\t: Array.isArray(thing)\n\t\t? ArchType.Array\n\t\t: isMap(thing)\n\t\t? ArchType.Map\n\t\t: isSet(thing)\n\t\t? ArchType.Set\n\t\t: ArchType.Object\n}\n\n/*#__PURE__*/\nexport function has(thing: any, prop: PropertyKey): boolean {\n\treturn getArchtype(thing) === ArchType.Map\n\t\t? thing.has(prop)\n\t\t: Object.prototype.hasOwnProperty.call(thing, prop)\n}\n\n/*#__PURE__*/\nexport function get(thing: AnyMap | AnyObject, prop: PropertyKey): any {\n\t// @ts-ignore\n\treturn getArchtype(thing) === ArchType.Map ? thing.get(prop) : thing[prop]\n}\n\n/*#__PURE__*/\nexport function set(thing: any, propOrOldValue: PropertyKey, value: any) {\n\tconst t = getArchtype(thing)\n\tif (t === ArchType.Map) thing.set(propOrOldValue, value)\n\telse if (t === ArchType.Set) {\n\t\tthing.add(value)\n\t} else thing[propOrOldValue] = value\n}\n\n/*#__PURE__*/\nexport function is(x: any, y: any): boolean {\n\t// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n\tif (x === y) {\n\t\treturn x !== 0 || 1 / x === 1 / y\n\t} else {\n\t\treturn x !== x && y !== y\n\t}\n}\n\n/*#__PURE__*/\nexport function isMap(target: any): target is AnyMap {\n\treturn target instanceof Map\n}\n\n/*#__PURE__*/\nexport function isSet(target: any): target is AnySet {\n\treturn target instanceof Set\n}\n/*#__PURE__*/\nexport function latest(state: ImmerState): any {\n\treturn state.copy_ || state.base_\n}\n\n/*#__PURE__*/\nexport function shallowCopy(base: any, strict: StrictMode) {\n\tif (isMap(base)) {\n\t\treturn new Map(base)\n\t}\n\tif (isSet(base)) {\n\t\treturn new Set(base)\n\t}\n\tif (Array.isArray(base)) return Array.prototype.slice.call(base)\n\n\tconst isPlain = isPlainObject(base)\n\n\tif (strict === true || (strict === \"class_only\" && !isPlain)) {\n\t\t// Perform a strict copy\n\t\tconst descriptors = Object.getOwnPropertyDescriptors(base)\n\t\tdelete descriptors[DRAFT_STATE as any]\n\t\tlet keys = Reflect.ownKeys(descriptors)\n\t\tfor (let i = 0; i < keys.length; i++) {\n\t\t\tconst key: any = keys[i]\n\t\t\tconst desc = descriptors[key]\n\t\t\tif (desc.writable === false) {\n\t\t\t\tdesc.writable = true\n\t\t\t\tdesc.configurable = true\n\t\t\t}\n\t\t\t// like object.assign, we will read any _own_, get/set accessors. This helps in dealing\n\t\t\t// with libraries that trap values, like mobx or vue\n\t\t\t// unlike object.assign, non-enumerables will be copied as well\n\t\t\tif (desc.get || desc.set)\n\t\t\t\tdescriptors[key] = {\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\twritable: true, // could live with !!desc.set as well here...\n\t\t\t\t\tenumerable: desc.enumerable,\n\t\t\t\t\tvalue: base[key]\n\t\t\t\t}\n\t\t}\n\t\treturn Object.create(getPrototypeOf(base), descriptors)\n\t} else {\n\t\t// perform a sloppy copy\n\t\tconst proto = getPrototypeOf(base)\n\t\tif (proto !== null && isPlain) {\n\t\t\treturn {...base} // assumption: better inner class optimization than the assign below\n\t\t}\n\t\tconst obj = Object.create(proto)\n\t\treturn Object.assign(obj, base)\n\t}\n}\n\n/**\n * Freezes draftable objects. Returns the original object.\n * By default freezes shallowly, but if the second argument is `true` it will freeze recursively.\n *\n * @param obj\n * @param deep\n */\nexport function freeze(obj: T, deep?: boolean): T\nexport function freeze(obj: any, deep: boolean = false): T {\n\tif (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj\n\tif (getArchtype(obj) > 1 /* Map or Set */) {\n\t\tobj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections as any\n\t}\n\tObject.freeze(obj)\n\tif (deep)\n\t\t// See #590, don't recurse into non-enumerable / Symbol properties when freezing\n\t\t// So use Object.entries (only string-like, enumerables) instead of each()\n\t\tObject.entries(obj).forEach(([key, value]) => freeze(value, true))\n\treturn obj\n}\n\nfunction dontMutateFrozenCollections() {\n\tdie(2)\n}\n\nexport function isFrozen(obj: any): boolean {\n\treturn Object.isFrozen(obj)\n}\n","import {\n\tImmerState,\n\tPatch,\n\tDrafted,\n\tImmerBaseState,\n\tAnyMap,\n\tAnySet,\n\tArchType,\n\tdie\n} from \"../internal\"\n\n/** Plugin utilities */\nconst plugins: {\n\tPatches?: {\n\t\tgeneratePatches_(\n\t\t\tstate: ImmerState,\n\t\t\tbasePath: PatchPath,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tgenerateReplacementPatches_(\n\t\t\tbase: any,\n\t\t\treplacement: any,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tapplyPatches_(draft: T, patches: readonly Patch[]): T\n\t}\n\tMapSet?: {\n\t\tproxyMap_(target: T, parent?: ImmerState): T\n\t\tproxySet_(target: T, parent?: ImmerState): T\n\t}\n} = {}\n\ntype Plugins = typeof plugins\n\nexport function getPlugin(\n\tpluginKey: K\n): Exclude {\n\tconst plugin = plugins[pluginKey]\n\tif (!plugin) {\n\t\tdie(0, pluginKey)\n\t}\n\t// @ts-ignore\n\treturn plugin\n}\n\nexport function loadPlugin(\n\tpluginKey: K,\n\timplementation: Plugins[K]\n): void {\n\tif (!plugins[pluginKey]) plugins[pluginKey] = implementation\n}\n/** Map / Set plugin */\n\nexport interface MapState extends ImmerBaseState {\n\ttype_: ArchType.Map\n\tcopy_: AnyMap | undefined\n\tassigned_: Map | undefined\n\tbase_: AnyMap\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\nexport interface SetState extends ImmerBaseState {\n\ttype_: ArchType.Set\n\tcopy_: AnySet | undefined\n\tbase_: AnySet\n\tdrafts_: Map // maps the original value to the draft value in the new set\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\n/** Patches plugin */\n\nexport type PatchPath = (string | number)[]\n","import {\n\tPatch,\n\tPatchListener,\n\tDrafted,\n\tImmer,\n\tDRAFT_STATE,\n\tImmerState,\n\tArchType,\n\tgetPlugin\n} from \"../internal\"\n\n/** Each scope represents a `produce` call. */\n\nexport interface ImmerScope {\n\tpatches_?: Patch[]\n\tinversePatches_?: Patch[]\n\tcanAutoFreeze_: boolean\n\tdrafts_: any[]\n\tparent_?: ImmerScope\n\tpatchListener_?: PatchListener\n\timmer_: Immer\n\tunfinalizedDrafts_: number\n}\n\nlet currentScope: ImmerScope | undefined\n\nexport function getCurrentScope() {\n\treturn currentScope!\n}\n\nfunction createScope(\n\tparent_: ImmerScope | undefined,\n\timmer_: Immer\n): ImmerScope {\n\treturn {\n\t\tdrafts_: [],\n\t\tparent_,\n\t\timmer_,\n\t\t// Whenever the modified draft contains a draft from another scope, we\n\t\t// need to prevent auto-freezing so the unowned draft can be finalized.\n\t\tcanAutoFreeze_: true,\n\t\tunfinalizedDrafts_: 0\n\t}\n}\n\nexport function usePatchesInScope(\n\tscope: ImmerScope,\n\tpatchListener?: PatchListener\n) {\n\tif (patchListener) {\n\t\tgetPlugin(\"Patches\") // assert we have the plugin\n\t\tscope.patches_ = []\n\t\tscope.inversePatches_ = []\n\t\tscope.patchListener_ = patchListener\n\t}\n}\n\nexport function revokeScope(scope: ImmerScope) {\n\tleaveScope(scope)\n\tscope.drafts_.forEach(revokeDraft)\n\t// @ts-ignore\n\tscope.drafts_ = null\n}\n\nexport function leaveScope(scope: ImmerScope) {\n\tif (scope === currentScope) {\n\t\tcurrentScope = scope.parent_\n\t}\n}\n\nexport function enterScope(immer: Immer) {\n\treturn (currentScope = createScope(currentScope, immer))\n}\n\nfunction revokeDraft(draft: Drafted) {\n\tconst state: ImmerState = draft[DRAFT_STATE]\n\tif (state.type_ === ArchType.Object || state.type_ === ArchType.Array)\n\t\tstate.revoke_()\n\telse state.revoked_ = true\n}\n","import {\n\tImmerScope,\n\tDRAFT_STATE,\n\tisDraftable,\n\tNOTHING,\n\tPatchPath,\n\teach,\n\thas,\n\tfreeze,\n\tImmerState,\n\tisDraft,\n\tSetState,\n\tset,\n\tArchType,\n\tgetPlugin,\n\tdie,\n\trevokeScope,\n\tisFrozen\n} from \"../internal\"\n\nexport function processResult(result: any, scope: ImmerScope) {\n\tscope.unfinalizedDrafts_ = scope.drafts_.length\n\tconst baseDraft = scope.drafts_![0]\n\tconst isReplaced = result !== undefined && result !== baseDraft\n\tif (isReplaced) {\n\t\tif (baseDraft[DRAFT_STATE].modified_) {\n\t\t\trevokeScope(scope)\n\t\t\tdie(4)\n\t\t}\n\t\tif (isDraftable(result)) {\n\t\t\t// Finalize the result in case it contains (or is) a subset of the draft.\n\t\t\tresult = finalize(scope, result)\n\t\t\tif (!scope.parent_) maybeFreeze(scope, result)\n\t\t}\n\t\tif (scope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(\n\t\t\t\tbaseDraft[DRAFT_STATE].base_,\n\t\t\t\tresult,\n\t\t\t\tscope.patches_,\n\t\t\t\tscope.inversePatches_!\n\t\t\t)\n\t\t}\n\t} else {\n\t\t// Finalize the base draft.\n\t\tresult = finalize(scope, baseDraft, [])\n\t}\n\trevokeScope(scope)\n\tif (scope.patches_) {\n\t\tscope.patchListener_!(scope.patches_, scope.inversePatches_!)\n\t}\n\treturn result !== NOTHING ? result : undefined\n}\n\nfunction finalize(rootScope: ImmerScope, value: any, path?: PatchPath) {\n\t// Don't recurse in tho recursive data structures\n\tif (isFrozen(value)) return value\n\n\tconst state: ImmerState = value[DRAFT_STATE]\n\t// A plain object, might need freezing, might contain drafts\n\tif (!state) {\n\t\teach(value, (key, childValue) =>\n\t\t\tfinalizeProperty(rootScope, state, value, key, childValue, path)\n\t\t)\n\t\treturn value\n\t}\n\t// Never finalize drafts owned by another scope.\n\tif (state.scope_ !== rootScope) return value\n\t// Unmodified draft, return the (frozen) original\n\tif (!state.modified_) {\n\t\tmaybeFreeze(rootScope, state.base_, true)\n\t\treturn state.base_\n\t}\n\t// Not finalized yet, let's do that now\n\tif (!state.finalized_) {\n\t\tstate.finalized_ = true\n\t\tstate.scope_.unfinalizedDrafts_--\n\t\tconst result = state.copy_\n\t\t// Finalize all children of the copy\n\t\t// For sets we clone before iterating, otherwise we can get in endless loop due to modifying during iteration, see #628\n\t\t// To preserve insertion order in all cases we then clear the set\n\t\t// And we let finalizeProperty know it needs to re-add non-draft children back to the target\n\t\tlet resultEach = result\n\t\tlet isSet = false\n\t\tif (state.type_ === ArchType.Set) {\n\t\t\tresultEach = new Set(result)\n\t\t\tresult.clear()\n\t\t\tisSet = true\n\t\t}\n\t\teach(resultEach, (key, childValue) =>\n\t\t\tfinalizeProperty(rootScope, state, result, key, childValue, path, isSet)\n\t\t)\n\t\t// everything inside is frozen, we can freeze here\n\t\tmaybeFreeze(rootScope, result, false)\n\t\t// first time finalizing, let's create those patches\n\t\tif (path && rootScope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generatePatches_(\n\t\t\t\tstate,\n\t\t\t\tpath,\n\t\t\t\trootScope.patches_,\n\t\t\t\trootScope.inversePatches_!\n\t\t\t)\n\t\t}\n\t}\n\treturn state.copy_\n}\n\nfunction finalizeProperty(\n\trootScope: ImmerScope,\n\tparentState: undefined | ImmerState,\n\ttargetObject: any,\n\tprop: string | number,\n\tchildValue: any,\n\trootPath?: PatchPath,\n\ttargetIsSet?: boolean\n) {\n\tif (process.env.NODE_ENV !== \"production\" && childValue === targetObject)\n\t\tdie(5)\n\tif (isDraft(childValue)) {\n\t\tconst path =\n\t\t\trootPath &&\n\t\t\tparentState &&\n\t\t\tparentState!.type_ !== ArchType.Set && // Set objects are atomic since they have no keys.\n\t\t\t!has((parentState as Exclude).assigned_!, prop) // Skip deep patches for assigned keys.\n\t\t\t\t? rootPath!.concat(prop)\n\t\t\t\t: undefined\n\t\t// Drafts owned by `scope` are finalized here.\n\t\tconst res = finalize(rootScope, childValue, path)\n\t\tset(targetObject, prop, res)\n\t\t// Drafts from another scope must prevented to be frozen\n\t\t// if we got a draft back from finalize, we're in a nested produce and shouldn't freeze\n\t\tif (isDraft(res)) {\n\t\t\trootScope.canAutoFreeze_ = false\n\t\t} else return\n\t} else if (targetIsSet) {\n\t\ttargetObject.add(childValue)\n\t}\n\t// Search new objects for unfinalized drafts. Frozen objects should never contain drafts.\n\tif (isDraftable(childValue) && !isFrozen(childValue)) {\n\t\tif (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {\n\t\t\t// optimization: if an object is not a draft, and we don't have to\n\t\t\t// deepfreeze everything, and we are sure that no drafts are left in the remaining object\n\t\t\t// cause we saw and finalized all drafts already; we can stop visiting the rest of the tree.\n\t\t\t// This benefits especially adding large data tree's without further processing.\n\t\t\t// See add-data.js perf test\n\t\t\treturn\n\t\t}\n\t\tfinalize(rootScope, childValue)\n\t\t// Immer deep freezes plain objects, so if there is no parent state, we freeze as well\n\t\t// Per #590, we never freeze symbolic properties. Just to make sure don't accidentally interfere\n\t\t// with other frameworks.\n\t\tif (\n\t\t\t(!parentState || !parentState.scope_.parent_) &&\n\t\t\ttypeof prop !== \"symbol\" &&\n\t\t\tObject.prototype.propertyIsEnumerable.call(targetObject, prop)\n\t\t)\n\t\t\tmaybeFreeze(rootScope, childValue)\n\t}\n}\n\nfunction maybeFreeze(scope: ImmerScope, value: any, deep = false) {\n\t// we never freeze for a non-root scope; as it would prevent pruning for drafts inside wrapping objects\n\tif (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {\n\t\tfreeze(value, deep)\n\t}\n}\n","import {\n\teach,\n\thas,\n\tis,\n\tisDraftable,\n\tshallowCopy,\n\tlatest,\n\tImmerBaseState,\n\tImmerState,\n\tDrafted,\n\tAnyObject,\n\tAnyArray,\n\tObjectish,\n\tgetCurrentScope,\n\tgetPrototypeOf,\n\tDRAFT_STATE,\n\tdie,\n\tcreateProxy,\n\tArchType,\n\tImmerScope\n} from \"../internal\"\n\ninterface ProxyBaseState extends ImmerBaseState {\n\tassigned_: {\n\t\t[property: string]: boolean\n\t}\n\tparent_?: ImmerState\n\trevoke_(): void\n}\n\nexport interface ProxyObjectState extends ProxyBaseState {\n\ttype_: ArchType.Object\n\tbase_: any\n\tcopy_: any\n\tdraft_: Drafted\n}\n\nexport interface ProxyArrayState extends ProxyBaseState {\n\ttype_: ArchType.Array\n\tbase_: AnyArray\n\tcopy_: AnyArray | null\n\tdraft_: Drafted\n}\n\ntype ProxyState = ProxyObjectState | ProxyArrayState\n\n/**\n * Returns a new draft of the `base` object.\n *\n * The second argument is the parent draft-state (used internally).\n */\nexport function createProxyProxy(\n\tbase: T,\n\tparent?: ImmerState\n): Drafted {\n\tconst isArray = Array.isArray(base)\n\tconst state: ProxyState = {\n\t\ttype_: isArray ? ArchType.Array : (ArchType.Object as any),\n\t\t// Track which produce call this is associated with.\n\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t// True for both shallow and deep changes.\n\t\tmodified_: false,\n\t\t// Used during finalization.\n\t\tfinalized_: false,\n\t\t// Track which properties have been assigned (true) or deleted (false).\n\t\tassigned_: {},\n\t\t// The parent draft state.\n\t\tparent_: parent,\n\t\t// The base state.\n\t\tbase_: base,\n\t\t// The base proxy.\n\t\tdraft_: null as any, // set below\n\t\t// The base copy with any updated values.\n\t\tcopy_: null,\n\t\t// Called by the `produce` function.\n\t\trevoke_: null as any,\n\t\tisManual_: false\n\t}\n\n\t// the traps must target something, a bit like the 'real' base.\n\t// but also, we need to be able to determine from the target what the relevant state is\n\t// (to avoid creating traps per instance to capture the state in closure,\n\t// and to avoid creating weird hidden properties as well)\n\t// So the trick is to use 'state' as the actual 'target'! (and make sure we intercept everything)\n\t// Note that in the case of an array, we put the state in an array to have better Reflect defaults ootb\n\tlet target: T = state as any\n\tlet traps: ProxyHandler> = objectTraps\n\tif (isArray) {\n\t\ttarget = [state] as any\n\t\ttraps = arrayTraps\n\t}\n\n\tconst {revoke, proxy} = Proxy.revocable(target, traps)\n\tstate.draft_ = proxy as any\n\tstate.revoke_ = revoke\n\treturn proxy as any\n}\n\n/**\n * Object drafts\n */\nexport const objectTraps: ProxyHandler = {\n\tget(state, prop) {\n\t\tif (prop === DRAFT_STATE) return state\n\n\t\tconst source = latest(state)\n\t\tif (!has(source, prop)) {\n\t\t\t// non-existing or non-own property...\n\t\t\treturn readPropFromProto(state, source, prop)\n\t\t}\n\t\tconst value = source[prop]\n\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\treturn value\n\t\t}\n\t\t// Check for existing draft in modified state.\n\t\t// Assigned values are never drafted. This catches any drafts we created, too.\n\t\tif (value === peek(state.base_, prop)) {\n\t\t\tprepareCopy(state)\n\t\t\treturn (state.copy_![prop as any] = createProxy(value, state))\n\t\t}\n\t\treturn value\n\t},\n\thas(state, prop) {\n\t\treturn prop in latest(state)\n\t},\n\townKeys(state) {\n\t\treturn Reflect.ownKeys(latest(state))\n\t},\n\tset(\n\t\tstate: ProxyObjectState,\n\t\tprop: string /* strictly not, but helps TS */,\n\t\tvalue\n\t) {\n\t\tconst desc = getDescriptorFromProto(latest(state), prop)\n\t\tif (desc?.set) {\n\t\t\t// special case: if this write is captured by a setter, we have\n\t\t\t// to trigger it with the correct context\n\t\t\tdesc.set.call(state.draft_, value)\n\t\t\treturn true\n\t\t}\n\t\tif (!state.modified_) {\n\t\t\t// the last check is because we need to be able to distinguish setting a non-existing to undefined (which is a change)\n\t\t\t// from setting an existing property with value undefined to undefined (which is not a change)\n\t\t\tconst current = peek(latest(state), prop)\n\t\t\t// special case, if we assigning the original value to a draft, we can ignore the assignment\n\t\t\tconst currentState: ProxyObjectState = current?.[DRAFT_STATE]\n\t\t\tif (currentState && currentState.base_ === value) {\n\t\t\t\tstate.copy_![prop] = value\n\t\t\t\tstate.assigned_[prop] = false\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (is(value, current) && (value !== undefined || has(state.base_, prop)))\n\t\t\t\treturn true\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t}\n\n\t\tif (\n\t\t\t(state.copy_![prop] === value &&\n\t\t\t\t// special case: handle new props with value 'undefined'\n\t\t\t\t(value !== undefined || prop in state.copy_)) ||\n\t\t\t// special case: NaN\n\t\t\t(Number.isNaN(value) && Number.isNaN(state.copy_![prop]))\n\t\t)\n\t\t\treturn true\n\n\t\t// @ts-ignore\n\t\tstate.copy_![prop] = value\n\t\tstate.assigned_[prop] = true\n\t\treturn true\n\t},\n\tdeleteProperty(state, prop: string) {\n\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\tif (peek(state.base_, prop) !== undefined || prop in state.base_) {\n\t\t\tstate.assigned_[prop] = false\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t} else {\n\t\t\t// if an originally not assigned property was deleted\n\t\t\tdelete state.assigned_[prop]\n\t\t}\n\t\tif (state.copy_) {\n\t\t\tdelete state.copy_[prop]\n\t\t}\n\t\treturn true\n\t},\n\t// Note: We never coerce `desc.value` into an Immer draft, because we can't make\n\t// the same guarantee in ES5 mode.\n\tgetOwnPropertyDescriptor(state, prop) {\n\t\tconst owner = latest(state)\n\t\tconst desc = Reflect.getOwnPropertyDescriptor(owner, prop)\n\t\tif (!desc) return desc\n\t\treturn {\n\t\t\twritable: true,\n\t\t\tconfigurable: state.type_ !== ArchType.Array || prop !== \"length\",\n\t\t\tenumerable: desc.enumerable,\n\t\t\tvalue: owner[prop]\n\t\t}\n\t},\n\tdefineProperty() {\n\t\tdie(11)\n\t},\n\tgetPrototypeOf(state) {\n\t\treturn getPrototypeOf(state.base_)\n\t},\n\tsetPrototypeOf() {\n\t\tdie(12)\n\t}\n}\n\n/**\n * Array drafts\n */\n\nconst arrayTraps: ProxyHandler<[ProxyArrayState]> = {}\neach(objectTraps, (key, fn) => {\n\t// @ts-ignore\n\tarrayTraps[key] = function() {\n\t\targuments[0] = arguments[0][0]\n\t\treturn fn.apply(this, arguments)\n\t}\n})\narrayTraps.deleteProperty = function(state, prop) {\n\tif (process.env.NODE_ENV !== \"production\" && isNaN(parseInt(prop as any)))\n\t\tdie(13)\n\t// @ts-ignore\n\treturn arrayTraps.set!.call(this, state, prop, undefined)\n}\narrayTraps.set = function(state, prop, value) {\n\tif (\n\t\tprocess.env.NODE_ENV !== \"production\" &&\n\t\tprop !== \"length\" &&\n\t\tisNaN(parseInt(prop as any))\n\t)\n\t\tdie(14)\n\treturn objectTraps.set!.call(this, state[0], prop, value, state[0])\n}\n\n// Access a property without creating an Immer draft.\nfunction peek(draft: Drafted, prop: PropertyKey) {\n\tconst state = draft[DRAFT_STATE]\n\tconst source = state ? latest(state) : draft\n\treturn source[prop]\n}\n\nfunction readPropFromProto(state: ImmerState, source: any, prop: PropertyKey) {\n\tconst desc = getDescriptorFromProto(source, prop)\n\treturn desc\n\t\t? `value` in desc\n\t\t\t? desc.value\n\t\t\t: // This is a very special case, if the prop is a getter defined by the\n\t\t\t // prototype, we should invoke it with the draft as context!\n\t\t\t desc.get?.call(state.draft_)\n\t\t: undefined\n}\n\nfunction getDescriptorFromProto(\n\tsource: any,\n\tprop: PropertyKey\n): PropertyDescriptor | undefined {\n\t// 'in' checks proto!\n\tif (!(prop in source)) return undefined\n\tlet proto = getPrototypeOf(source)\n\twhile (proto) {\n\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop)\n\t\tif (desc) return desc\n\t\tproto = getPrototypeOf(proto)\n\t}\n\treturn undefined\n}\n\nexport function markChanged(state: ImmerState) {\n\tif (!state.modified_) {\n\t\tstate.modified_ = true\n\t\tif (state.parent_) {\n\t\t\tmarkChanged(state.parent_)\n\t\t}\n\t}\n}\n\nexport function prepareCopy(state: {\n\tbase_: any\n\tcopy_: any\n\tscope_: ImmerScope\n}) {\n\tif (!state.copy_) {\n\t\tstate.copy_ = shallowCopy(\n\t\t\tstate.base_,\n\t\t\tstate.scope_.immer_.useStrictShallowCopy_\n\t\t)\n\t}\n}\n","import {\n\tIProduceWithPatches,\n\tIProduce,\n\tImmerState,\n\tDrafted,\n\tisDraftable,\n\tprocessResult,\n\tPatch,\n\tObjectish,\n\tDRAFT_STATE,\n\tDraft,\n\tPatchListener,\n\tisDraft,\n\tisMap,\n\tisSet,\n\tcreateProxyProxy,\n\tgetPlugin,\n\tdie,\n\tenterScope,\n\trevokeScope,\n\tleaveScope,\n\tusePatchesInScope,\n\tgetCurrentScope,\n\tNOTHING,\n\tfreeze,\n\tcurrent\n} from \"../internal\"\n\ninterface ProducersFns {\n\tproduce: IProduce\n\tproduceWithPatches: IProduceWithPatches\n}\n\nexport type StrictMode = boolean | \"class_only\";\n\nexport class Immer implements ProducersFns {\n\tautoFreeze_: boolean = true\n\tuseStrictShallowCopy_: StrictMode = false\n\n\tconstructor(config?: {\n\t\tautoFreeze?: boolean\n\t\tuseStrictShallowCopy?: StrictMode\n\t}) {\n\t\tif (typeof config?.autoFreeze === \"boolean\")\n\t\t\tthis.setAutoFreeze(config!.autoFreeze)\n\t\tif (typeof config?.useStrictShallowCopy === \"boolean\")\n\t\t\tthis.setUseStrictShallowCopy(config!.useStrictShallowCopy)\n\t}\n\n\t/**\n\t * The `produce` function takes a value and a \"recipe function\" (whose\n\t * return value often depends on the base state). The recipe function is\n\t * free to mutate its first argument however it wants. All mutations are\n\t * only ever applied to a __copy__ of the base state.\n\t *\n\t * Pass only a function to create a \"curried producer\" which relieves you\n\t * from passing the recipe function every time.\n\t *\n\t * Only plain objects and arrays are made mutable. All other objects are\n\t * considered uncopyable.\n\t *\n\t * Note: This function is __bound__ to its `Immer` instance.\n\t *\n\t * @param {any} base - the initial state\n\t * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified\n\t * @param {Function} patchListener - optional function that will be called with all the patches produced here\n\t * @returns {any} a new state, or the initial state if nothing was modified\n\t */\n\tproduce: IProduce = (base: any, recipe?: any, patchListener?: any) => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\" && typeof recipe !== \"function\") {\n\t\t\tconst defaultBase = recipe\n\t\t\trecipe = base\n\n\t\t\tconst self = this\n\t\t\treturn function curriedProduce(\n\t\t\t\tthis: any,\n\t\t\t\tbase = defaultBase,\n\t\t\t\t...args: any[]\n\t\t\t) {\n\t\t\t\treturn self.produce(base, (draft: Drafted) => recipe.call(this, draft, ...args)) // prettier-ignore\n\t\t\t}\n\t\t}\n\n\t\tif (typeof recipe !== \"function\") die(6)\n\t\tif (patchListener !== undefined && typeof patchListener !== \"function\")\n\t\t\tdie(7)\n\n\t\tlet result\n\n\t\t// Only plain objects, arrays, and \"immerable classes\" are drafted.\n\t\tif (isDraftable(base)) {\n\t\t\tconst scope = enterScope(this)\n\t\t\tconst proxy = createProxy(base, undefined)\n\t\t\tlet hasError = true\n\t\t\ttry {\n\t\t\t\tresult = recipe(proxy)\n\t\t\t\thasError = false\n\t\t\t} finally {\n\t\t\t\t// finally instead of catch + rethrow better preserves original stack\n\t\t\t\tif (hasError) revokeScope(scope)\n\t\t\t\telse leaveScope(scope)\n\t\t\t}\n\t\t\tusePatchesInScope(scope, patchListener)\n\t\t\treturn processResult(result, scope)\n\t\t} else if (!base || typeof base !== \"object\") {\n\t\t\tresult = recipe(base)\n\t\t\tif (result === undefined) result = base\n\t\t\tif (result === NOTHING) result = undefined\n\t\t\tif (this.autoFreeze_) freeze(result, true)\n\t\t\tif (patchListener) {\n\t\t\t\tconst p: Patch[] = []\n\t\t\t\tconst ip: Patch[] = []\n\t\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(base, result, p, ip)\n\t\t\t\tpatchListener(p, ip)\n\t\t\t}\n\t\t\treturn result\n\t\t} else die(1, base)\n\t}\n\n\tproduceWithPatches: IProduceWithPatches = (base: any, recipe?: any): any => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\") {\n\t\t\treturn (state: any, ...args: any[]) =>\n\t\t\t\tthis.produceWithPatches(state, (draft: any) => base(draft, ...args))\n\t\t}\n\n\t\tlet patches: Patch[], inversePatches: Patch[]\n\t\tconst result = this.produce(base, recipe, (p: Patch[], ip: Patch[]) => {\n\t\t\tpatches = p\n\t\t\tinversePatches = ip\n\t\t})\n\t\treturn [result, patches!, inversePatches!]\n\t}\n\n\tcreateDraft(base: T): Draft {\n\t\tif (!isDraftable(base)) die(8)\n\t\tif (isDraft(base)) base = current(base)\n\t\tconst scope = enterScope(this)\n\t\tconst proxy = createProxy(base, undefined)\n\t\tproxy[DRAFT_STATE].isManual_ = true\n\t\tleaveScope(scope)\n\t\treturn proxy as any\n\t}\n\n\tfinishDraft>(\n\t\tdraft: D,\n\t\tpatchListener?: PatchListener\n\t): D extends Draft ? T : never {\n\t\tconst state: ImmerState = draft && (draft as any)[DRAFT_STATE]\n\t\tif (!state || !state.isManual_) die(9)\n\t\tconst {scope_: scope} = state\n\t\tusePatchesInScope(scope, patchListener)\n\t\treturn processResult(undefined, scope)\n\t}\n\n\t/**\n\t * Pass true to automatically freeze all copies created by Immer.\n\t *\n\t * By default, auto-freezing is enabled.\n\t */\n\tsetAutoFreeze(value: boolean) {\n\t\tthis.autoFreeze_ = value\n\t}\n\n\t/**\n\t * Pass true to enable strict shallow copy.\n\t *\n\t * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n\t */\n\tsetUseStrictShallowCopy(value: StrictMode) {\n\t\tthis.useStrictShallowCopy_ = value\n\t}\n\n\tapplyPatches(base: T, patches: readonly Patch[]): T {\n\t\t// If a patch replaces the entire state, take that replacement as base\n\t\t// before applying patches\n\t\tlet i: number\n\t\tfor (i = patches.length - 1; i >= 0; i--) {\n\t\t\tconst patch = patches[i]\n\t\t\tif (patch.path.length === 0 && patch.op === \"replace\") {\n\t\t\t\tbase = patch.value\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// If there was a patch that replaced the entire state, start from the\n\t\t// patch after that.\n\t\tif (i > -1) {\n\t\t\tpatches = patches.slice(i + 1)\n\t\t}\n\n\t\tconst applyPatchesImpl = getPlugin(\"Patches\").applyPatches_\n\t\tif (isDraft(base)) {\n\t\t\t// N.B: never hits if some patch a replacement, patches are never drafts\n\t\t\treturn applyPatchesImpl(base, patches)\n\t\t}\n\t\t// Otherwise, produce a copy of the base state.\n\t\treturn this.produce(base, (draft: Drafted) =>\n\t\t\tapplyPatchesImpl(draft, patches)\n\t\t)\n\t}\n}\n\nexport function createProxy(\n\tvalue: T,\n\tparent?: ImmerState\n): Drafted {\n\t// precondition: createProxy should be guarded by isDraftable, so we know we can safely draft\n\tconst draft: Drafted = isMap(value)\n\t\t? getPlugin(\"MapSet\").proxyMap_(value, parent)\n\t\t: isSet(value)\n\t\t? getPlugin(\"MapSet\").proxySet_(value, parent)\n\t\t: createProxyProxy(value, parent)\n\n\tconst scope = parent ? parent.scope_ : getCurrentScope()\n\tscope.drafts_.push(draft)\n\treturn draft\n}\n","import {\n\tdie,\n\tisDraft,\n\tshallowCopy,\n\teach,\n\tDRAFT_STATE,\n\tset,\n\tImmerState,\n\tisDraftable,\n\tisFrozen\n} from \"../internal\"\n\n/** Takes a snapshot of the current state of a draft and finalizes it (but without freezing). This is a great utility to print the current state during debugging (no Proxies in the way). The output of current can also be safely leaked outside the producer. */\nexport function current(value: T): T\nexport function current(value: any): any {\n\tif (!isDraft(value)) die(10, value)\n\treturn currentImpl(value)\n}\n\nfunction currentImpl(value: any): any {\n\tif (!isDraftable(value) || isFrozen(value)) return value\n\tconst state: ImmerState | undefined = value[DRAFT_STATE]\n\tlet copy: any\n\tif (state) {\n\t\tif (!state.modified_) return state.base_\n\t\t// Optimization: avoid generating new drafts during copying\n\t\tstate.finalized_ = true\n\t\tcopy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_)\n\t} else {\n\t\tcopy = shallowCopy(value, true)\n\t}\n\t// recurse\n\teach(copy, (key, childValue) => {\n\t\tset(copy, key, currentImpl(childValue))\n\t})\n\tif (state) {\n\t\tstate.finalized_ = false\n\t}\n\treturn copy\n}\n","import {immerable} from \"../immer\"\nimport {\n\tImmerState,\n\tPatch,\n\tSetState,\n\tProxyArrayState,\n\tMapState,\n\tProxyObjectState,\n\tPatchPath,\n\tget,\n\teach,\n\thas,\n\tgetArchtype,\n\tgetPrototypeOf,\n\tisSet,\n\tisMap,\n\tloadPlugin,\n\tArchType,\n\tdie,\n\tisDraft,\n\tisDraftable,\n\tNOTHING,\n\terrors\n} from \"../internal\"\n\nexport function enablePatches() {\n\tconst errorOffset = 16\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\terrors.push(\n\t\t\t'Sets cannot have \"replace\" patches.',\n\t\t\tfunction(op: string) {\n\t\t\t\treturn \"Unsupported patch operation: \" + op\n\t\t\t},\n\t\t\tfunction(path: string) {\n\t\t\t\treturn \"Cannot apply patch, path doesn't resolve: \" + path\n\t\t\t},\n\t\t\t\"Patching reserved attributes like __proto__, prototype and constructor is not allowed\"\n\t\t)\n\t}\n\n\tconst REPLACE = \"replace\"\n\tconst ADD = \"add\"\n\tconst REMOVE = \"remove\"\n\n\tfunction generatePatches_(\n\t\tstate: ImmerState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t): void {\n\t\tswitch (state.type_) {\n\t\t\tcase ArchType.Object:\n\t\t\tcase ArchType.Map:\n\t\t\t\treturn generatePatchesFromAssigned(\n\t\t\t\t\tstate,\n\t\t\t\t\tbasePath,\n\t\t\t\t\tpatches,\n\t\t\t\t\tinversePatches\n\t\t\t\t)\n\t\t\tcase ArchType.Array:\n\t\t\t\treturn generateArrayPatches(state, basePath, patches, inversePatches)\n\t\t\tcase ArchType.Set:\n\t\t\t\treturn generateSetPatches(\n\t\t\t\t\t(state as any) as SetState,\n\t\t\t\t\tbasePath,\n\t\t\t\t\tpatches,\n\t\t\t\t\tinversePatches\n\t\t\t\t)\n\t\t}\n\t}\n\n\tfunction generateArrayPatches(\n\t\tstate: ProxyArrayState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tlet {base_, assigned_} = state\n\t\tlet copy_ = state.copy_!\n\n\t\t// Reduce complexity by ensuring `base` is never longer.\n\t\tif (copy_.length < base_.length) {\n\t\t\t// @ts-ignore\n\t\t\t;[base_, copy_] = [copy_, base_]\n\t\t\t;[patches, inversePatches] = [inversePatches, patches]\n\t\t}\n\n\t\t// Process replaced indices.\n\t\tfor (let i = 0; i < base_.length; i++) {\n\t\t\tif (assigned_[i] && copy_[i] !== base_[i]) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: REPLACE,\n\t\t\t\t\tpath,\n\t\t\t\t\t// Need to maybe clone it, as it can in fact be the original value\n\t\t\t\t\t// due to the base/copy inversion at the start of this function\n\t\t\t\t\tvalue: clonePatchValueIfNeeded(copy_[i])\n\t\t\t\t})\n\t\t\t\tinversePatches.push({\n\t\t\t\t\top: REPLACE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue: clonePatchValueIfNeeded(base_[i])\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// Process added indices.\n\t\tfor (let i = base_.length; i < copy_.length; i++) {\n\t\t\tconst path = basePath.concat([i])\n\t\t\tpatches.push({\n\t\t\t\top: ADD,\n\t\t\t\tpath,\n\t\t\t\t// Need to maybe clone it, as it can in fact be the original value\n\t\t\t\t// due to the base/copy inversion at the start of this function\n\t\t\t\tvalue: clonePatchValueIfNeeded(copy_[i])\n\t\t\t})\n\t\t}\n\t\tfor (let i = copy_.length - 1; base_.length <= i; --i) {\n\t\t\tconst path = basePath.concat([i])\n\t\t\tinversePatches.push({\n\t\t\t\top: REMOVE,\n\t\t\t\tpath\n\t\t\t})\n\t\t}\n\t}\n\n\t// This is used for both Map objects and normal objects.\n\tfunction generatePatchesFromAssigned(\n\t\tstate: MapState | ProxyObjectState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tconst {base_, copy_} = state\n\t\teach(state.assigned_!, (key, assignedValue) => {\n\t\t\tconst origValue = get(base_, key)\n\t\t\tconst value = get(copy_!, key)\n\t\t\tconst op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD\n\t\t\tif (origValue === value && op === REPLACE) return\n\t\t\tconst path = basePath.concat(key as any)\n\t\t\tpatches.push(op === REMOVE ? {op, path} : {op, path, value})\n\t\t\tinversePatches.push(\n\t\t\t\top === ADD\n\t\t\t\t\t? {op: REMOVE, path}\n\t\t\t\t\t: op === REMOVE\n\t\t\t\t\t? {op: ADD, path, value: clonePatchValueIfNeeded(origValue)}\n\t\t\t\t\t: {op: REPLACE, path, value: clonePatchValueIfNeeded(origValue)}\n\t\t\t)\n\t\t})\n\t}\n\n\tfunction generateSetPatches(\n\t\tstate: SetState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tlet {base_, copy_} = state\n\n\t\tlet i = 0\n\t\tbase_.forEach((value: any) => {\n\t\t\tif (!copy_!.has(value)) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: REMOVE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t\tinversePatches.unshift({\n\t\t\t\t\top: ADD,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t}\n\t\t\ti++\n\t\t})\n\t\ti = 0\n\t\tcopy_!.forEach((value: any) => {\n\t\t\tif (!base_.has(value)) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: ADD,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t\tinversePatches.unshift({\n\t\t\t\t\top: REMOVE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t}\n\t\t\ti++\n\t\t})\n\t}\n\n\tfunction generateReplacementPatches_(\n\t\tbaseValue: any,\n\t\treplacement: any,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t): void {\n\t\tpatches.push({\n\t\t\top: REPLACE,\n\t\t\tpath: [],\n\t\t\tvalue: replacement === NOTHING ? undefined : replacement\n\t\t})\n\t\tinversePatches.push({\n\t\t\top: REPLACE,\n\t\t\tpath: [],\n\t\t\tvalue: baseValue\n\t\t})\n\t}\n\n\tfunction applyPatches_(draft: T, patches: readonly Patch[]): T {\n\t\tpatches.forEach(patch => {\n\t\t\tconst {path, op} = patch\n\n\t\t\tlet base: any = draft\n\t\t\tfor (let i = 0; i < path.length - 1; i++) {\n\t\t\t\tconst parentType = getArchtype(base)\n\t\t\t\tlet p = path[i]\n\t\t\t\tif (typeof p !== \"string\" && typeof p !== \"number\") {\n\t\t\t\t\tp = \"\" + p\n\t\t\t\t}\n\n\t\t\t\t// See #738, avoid prototype pollution\n\t\t\t\tif (\n\t\t\t\t\t(parentType === ArchType.Object || parentType === ArchType.Array) &&\n\t\t\t\t\t(p === \"__proto__\" || p === \"constructor\")\n\t\t\t\t)\n\t\t\t\t\tdie(errorOffset + 3)\n\t\t\t\tif (typeof base === \"function\" && p === \"prototype\")\n\t\t\t\t\tdie(errorOffset + 3)\n\t\t\t\tbase = get(base, p)\n\t\t\t\tif (typeof base !== \"object\") die(errorOffset + 2, path.join(\"/\"))\n\t\t\t}\n\n\t\t\tconst type = getArchtype(base)\n\t\t\tconst value = deepClonePatchValue(patch.value) // used to clone patch to ensure original patch is not modified, see #411\n\t\t\tconst key = path[path.length - 1]\n\t\t\tswitch (op) {\n\t\t\t\tcase REPLACE:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase ArchType.Map:\n\t\t\t\t\t\t\treturn base.set(key, value)\n\t\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\t\tcase ArchType.Set:\n\t\t\t\t\t\t\tdie(errorOffset)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t// if value is an object, then it's assigned by reference\n\t\t\t\t\t\t\t// in the following add or remove ops, the value field inside the patch will also be modifyed\n\t\t\t\t\t\t\t// so we use value from the cloned patch\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\treturn (base[key] = value)\n\t\t\t\t\t}\n\t\t\t\tcase ADD:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase ArchType.Array:\n\t\t\t\t\t\t\treturn key === \"-\"\n\t\t\t\t\t\t\t\t? base.push(value)\n\t\t\t\t\t\t\t\t: base.splice(key as any, 0, value)\n\t\t\t\t\t\tcase ArchType.Map:\n\t\t\t\t\t\t\treturn base.set(key, value)\n\t\t\t\t\t\tcase ArchType.Set:\n\t\t\t\t\t\t\treturn base.add(value)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn (base[key] = value)\n\t\t\t\t\t}\n\t\t\t\tcase REMOVE:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase ArchType.Array:\n\t\t\t\t\t\t\treturn base.splice(key as any, 1)\n\t\t\t\t\t\tcase ArchType.Map:\n\t\t\t\t\t\t\treturn base.delete(key)\n\t\t\t\t\t\tcase ArchType.Set:\n\t\t\t\t\t\t\treturn base.delete(patch.value)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn delete base[key]\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tdie(errorOffset + 1, op)\n\t\t\t}\n\t\t})\n\n\t\treturn draft\n\t}\n\n\t// optimize: this is quite a performance hit, can we detect intelligently when it is needed?\n\t// E.g. auto-draft when new objects from outside are assigned and modified?\n\t// (See failing test when deepClone just returns obj)\n\tfunction deepClonePatchValue(obj: T): T\n\tfunction deepClonePatchValue(obj: any) {\n\t\tif (!isDraftable(obj)) return obj\n\t\tif (Array.isArray(obj)) return obj.map(deepClonePatchValue)\n\t\tif (isMap(obj))\n\t\t\treturn new Map(\n\t\t\t\tArray.from(obj.entries()).map(([k, v]) => [k, deepClonePatchValue(v)])\n\t\t\t)\n\t\tif (isSet(obj)) return new Set(Array.from(obj).map(deepClonePatchValue))\n\t\tconst cloned = Object.create(getPrototypeOf(obj))\n\t\tfor (const key in obj) cloned[key] = deepClonePatchValue(obj[key])\n\t\tif (has(obj, immerable)) cloned[immerable] = obj[immerable]\n\t\treturn cloned\n\t}\n\n\tfunction clonePatchValueIfNeeded(obj: T): T {\n\t\tif (isDraft(obj)) {\n\t\t\treturn deepClonePatchValue(obj)\n\t\t} else return obj\n\t}\n\n\tloadPlugin(\"Patches\", {\n\t\tapplyPatches_,\n\t\tgeneratePatches_,\n\t\tgenerateReplacementPatches_\n\t})\n}\n","// types only!\nimport {\n\tImmerState,\n\tAnyMap,\n\tAnySet,\n\tMapState,\n\tSetState,\n\tDRAFT_STATE,\n\tgetCurrentScope,\n\tlatest,\n\tisDraftable,\n\tcreateProxy,\n\tloadPlugin,\n\tmarkChanged,\n\tdie,\n\tArchType,\n\teach\n} from \"../internal\"\n\nexport function enableMapSet() {\n\tclass DraftMap extends Map {\n\t\t[DRAFT_STATE]: MapState\n\n\t\tconstructor(target: AnyMap, parent?: ImmerState) {\n\t\t\tsuper()\n\t\t\tthis[DRAFT_STATE] = {\n\t\t\t\ttype_: ArchType.Map,\n\t\t\t\tparent_: parent,\n\t\t\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t\t\tmodified_: false,\n\t\t\t\tfinalized_: false,\n\t\t\t\tcopy_: undefined,\n\t\t\t\tassigned_: undefined,\n\t\t\t\tbase_: target,\n\t\t\t\tdraft_: this as any,\n\t\t\t\tisManual_: false,\n\t\t\t\trevoked_: false\n\t\t\t}\n\t\t}\n\n\t\tget size(): number {\n\t\t\treturn latest(this[DRAFT_STATE]).size\n\t\t}\n\n\t\thas(key: any): boolean {\n\t\t\treturn latest(this[DRAFT_STATE]).has(key)\n\t\t}\n\n\t\tset(key: any, value: any) {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (!latest(state).has(key) || latest(state).get(key) !== value) {\n\t\t\t\tprepareMapCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.assigned_!.set(key, true)\n\t\t\t\tstate.copy_!.set(key, value)\n\t\t\t\tstate.assigned_!.set(key, true)\n\t\t\t}\n\t\t\treturn this\n\t\t}\n\n\t\tdelete(key: any): boolean {\n\t\t\tif (!this.has(key)) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareMapCopy(state)\n\t\t\tmarkChanged(state)\n\t\t\tif (state.base_.has(key)) {\n\t\t\t\tstate.assigned_!.set(key, false)\n\t\t\t} else {\n\t\t\t\tstate.assigned_!.delete(key)\n\t\t\t}\n\t\t\tstate.copy_!.delete(key)\n\t\t\treturn true\n\t\t}\n\n\t\tclear() {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (latest(state).size) {\n\t\t\t\tprepareMapCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.assigned_ = new Map()\n\t\t\t\teach(state.base_, key => {\n\t\t\t\t\tstate.assigned_!.set(key, false)\n\t\t\t\t})\n\t\t\t\tstate.copy_!.clear()\n\t\t\t}\n\t\t}\n\n\t\tforEach(cb: (value: any, key: any, self: any) => void, thisArg?: any) {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tlatest(state).forEach((_value: any, key: any, _map: any) => {\n\t\t\t\tcb.call(thisArg, this.get(key), key, this)\n\t\t\t})\n\t\t}\n\n\t\tget(key: any): any {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tconst value = latest(state).get(key)\n\t\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\t\treturn value\n\t\t\t}\n\t\t\tif (value !== state.base_.get(key)) {\n\t\t\t\treturn value // either already drafted or reassigned\n\t\t\t}\n\t\t\t// despite what it looks, this creates a draft only once, see above condition\n\t\t\tconst draft = createProxy(value, state)\n\t\t\tprepareMapCopy(state)\n\t\t\tstate.copy_!.set(key, draft)\n\t\t\treturn draft\n\t\t}\n\n\t\tkeys(): IterableIterator {\n\t\t\treturn latest(this[DRAFT_STATE]).keys()\n\t\t}\n\n\t\tvalues(): IterableIterator {\n\t\t\tconst iterator = this.keys()\n\t\t\treturn {\n\t\t\t\t[Symbol.iterator]: () => this.values(),\n\t\t\t\tnext: () => {\n\t\t\t\t\tconst r = iterator.next()\n\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\tif (r.done) return r\n\t\t\t\t\tconst value = this.get(r.value)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\tvalue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} as any\n\t\t}\n\n\t\tentries(): IterableIterator<[any, any]> {\n\t\t\tconst iterator = this.keys()\n\t\t\treturn {\n\t\t\t\t[Symbol.iterator]: () => this.entries(),\n\t\t\t\tnext: () => {\n\t\t\t\t\tconst r = iterator.next()\n\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\tif (r.done) return r\n\t\t\t\t\tconst value = this.get(r.value)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\tvalue: [r.value, value]\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} as any\n\t\t}\n\n\t\t[Symbol.iterator]() {\n\t\t\treturn this.entries()\n\t\t}\n\t}\n\n\tfunction proxyMap_(target: T, parent?: ImmerState): T {\n\t\t// @ts-ignore\n\t\treturn new DraftMap(target, parent)\n\t}\n\n\tfunction prepareMapCopy(state: MapState) {\n\t\tif (!state.copy_) {\n\t\t\tstate.assigned_ = new Map()\n\t\t\tstate.copy_ = new Map(state.base_)\n\t\t}\n\t}\n\n\tclass DraftSet extends Set {\n\t\t[DRAFT_STATE]: SetState\n\t\tconstructor(target: AnySet, parent?: ImmerState) {\n\t\t\tsuper()\n\t\t\tthis[DRAFT_STATE] = {\n\t\t\t\ttype_: ArchType.Set,\n\t\t\t\tparent_: parent,\n\t\t\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t\t\tmodified_: false,\n\t\t\t\tfinalized_: false,\n\t\t\t\tcopy_: undefined,\n\t\t\t\tbase_: target,\n\t\t\t\tdraft_: this,\n\t\t\t\tdrafts_: new Map(),\n\t\t\t\trevoked_: false,\n\t\t\t\tisManual_: false\n\t\t\t}\n\t\t}\n\n\t\tget size(): number {\n\t\t\treturn latest(this[DRAFT_STATE]).size\n\t\t}\n\n\t\thas(value: any): boolean {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\t// bit of trickery here, to be able to recognize both the value, and the draft of its value\n\t\t\tif (!state.copy_) {\n\t\t\t\treturn state.base_.has(value)\n\t\t\t}\n\t\t\tif (state.copy_.has(value)) return true\n\t\t\tif (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value)))\n\t\t\t\treturn true\n\t\t\treturn false\n\t\t}\n\n\t\tadd(value: any): any {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (!this.has(value)) {\n\t\t\t\tprepareSetCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.copy_!.add(value)\n\t\t\t}\n\t\t\treturn this\n\t\t}\n\n\t\tdelete(value: any): any {\n\t\t\tif (!this.has(value)) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\tmarkChanged(state)\n\t\t\treturn (\n\t\t\t\tstate.copy_!.delete(value) ||\n\t\t\t\t(state.drafts_.has(value)\n\t\t\t\t\t? state.copy_!.delete(state.drafts_.get(value))\n\t\t\t\t\t: /* istanbul ignore next */ false)\n\t\t\t)\n\t\t}\n\n\t\tclear() {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (latest(state).size) {\n\t\t\t\tprepareSetCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.copy_!.clear()\n\t\t\t}\n\t\t}\n\n\t\tvalues(): IterableIterator {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\treturn state.copy_!.values()\n\t\t}\n\n\t\tentries(): IterableIterator<[any, any]> {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\treturn state.copy_!.entries()\n\t\t}\n\n\t\tkeys(): IterableIterator {\n\t\t\treturn this.values()\n\t\t}\n\n\t\t[Symbol.iterator]() {\n\t\t\treturn this.values()\n\t\t}\n\n\t\tforEach(cb: any, thisArg?: any) {\n\t\t\tconst iterator = this.values()\n\t\t\tlet result = iterator.next()\n\t\t\twhile (!result.done) {\n\t\t\t\tcb.call(thisArg, result.value, result.value, this)\n\t\t\t\tresult = iterator.next()\n\t\t\t}\n\t\t}\n\t}\n\tfunction proxySet_(target: T, parent?: ImmerState): T {\n\t\t// @ts-ignore\n\t\treturn new DraftSet(target, parent)\n\t}\n\n\tfunction prepareSetCopy(state: SetState) {\n\t\tif (!state.copy_) {\n\t\t\t// create drafts for all entries to preserve insertion order\n\t\t\tstate.copy_ = new Set()\n\t\t\tstate.base_.forEach(value => {\n\t\t\t\tif (isDraftable(value)) {\n\t\t\t\t\tconst draft = createProxy(value, state)\n\t\t\t\t\tstate.drafts_.set(value, draft)\n\t\t\t\t\tstate.copy_!.add(draft)\n\t\t\t\t} else {\n\t\t\t\t\tstate.copy_!.add(value)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n\n\tfunction assertUnrevoked(state: any /*ES5State | MapState | SetState*/) {\n\t\tif (state.revoked_) die(3, JSON.stringify(latest(state)))\n\t}\n\n\tloadPlugin(\"MapSet\", {proxyMap_, proxySet_})\n}\n"],"mappings":"ubAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,WAAAE,EAAA,iBAAAC,GAAA,cAAAC,GAAA,kBAAAC,GAAA,gBAAAC,GAAA,YAAAC,GAAA,iBAAAC,GAAA,kBAAAC,GAAA,gBAAAC,GAAA,WAAAC,EAAA,cAAAC,EAAA,YAAAC,EAAA,gBAAAC,EAAA,YAAAC,EAAA,aAAAC,GAAA,YAAAC,GAAA,uBAAAC,GAAA,kBAAAC,GAAA,4BAAAC,KAAA,eAAAC,GAAArB,ICKO,IAAMsB,EAAyB,OAAO,IAAI,eAAe,EAUnDC,EAA2B,OAAO,IAAI,iBAAiB,EAEvDC,EAA6B,OAAO,IAAI,aAAa,ECqB3D,SAASC,EAAIC,KAAkBC,EAAoB,CAMzD,MAAM,IAAI,MACT,8BAA8BD,0CAC/B,CACD,CCjCO,IAAME,EAAiB,OAAO,eAI9B,SAASC,EAAQC,EAAqB,CAC5C,MAAO,CAAC,CAACA,GAAS,CAAC,CAACA,EAAMC,CAAW,CACtC,CAIO,SAASC,EAAYF,EAAqB,CAChD,OAAKA,EAEJG,GAAcH,CAAK,GACnB,MAAM,QAAQA,CAAK,GACnB,CAAC,CAACA,EAAMI,CAAS,GACjB,CAAC,CAACJ,EA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O,MAAOA,EAAO,MAAO,IAAI,EACjDA,EAASN,EAAS,KAAK,CAEzB,CACD,CACA,SAASO,EAA4BrC,EAAWC,EAAwB,CAEvE,OAAO,IAAIgC,EAASjC,EAAQC,CAAM,CACnC,CAEA,SAASkC,EAAejB,EAAiB,CACnCA,EAAMT,IAEVS,EAAMT,EAAQ,IAAI,IAClBS,EAAMP,EAAM,QAAQM,GAAS,CAC5B,GAAIU,EAAYV,CAAK,EAAG,CACvB,IAAMW,EAAQC,EAAYZ,EAAOC,CAAK,EACtCA,EAAMgB,EAAQ,IAAIjB,EAAOW,CAAK,EAC9BV,EAAMT,EAAO,IAAImB,CAAK,OAEtBV,EAAMT,EAAO,IAAIQ,CAAK,CAExB,CAAC,EAEH,CAEA,SAASE,EAAgBD,EAA+C,CACnEA,EAAMJ,GAAUwB,EAAI,EAAG,KAAK,UAAUvB,EAAOG,CAAK,CAAC,CAAC,CACzD,CAEAqB,EAAW,SAAU,CAACP,IAAWK,GAAS,CAAC,CAC5C,CXrRA,IAAMG,EAAQ,IAAIC,EAqBLC,GAAoBF,EAAM,QAM1BG,GAA0CH,EAAM,mBAAmB,KAC/EA,CACD,EAOaI,GAAgBJ,EAAM,cAAc,KAAKA,CAAK,EAO9CK,GAA0BL,EAAM,wBAAwB,KAAKA,CAAK,EAOlEM,GAAeN,EAAM,aAAa,KAAKA,CAAK,EAM5CO,GAAcP,EAAM,YAAY,KAAKA,CAAK,EAU1CQ,GAAcR,EAAM,YAAY,KAAKA,CAAK,EAQhD,SAASS,GAAaC,EAAoB,CAChD,OAAOA,CACR,CAOO,SAASC,GAAiBD,EAAwB,CACxD,OAAOA,CACR","names":["immer_exports","__export","Immer","applyPatches","castDraft","castImmutable","createDraft","current","enableMapSet","enablePatches","finishDraft","freeze","DRAFTABLE","isDraft","isDraftable","NOTHING","original","produce","produceWithPatches","setAutoFreeze","setUseStrictShallowCopy","__toCommonJS","NOTHING","DRAFTABLE","DRAFT_STATE","die","error","args","getPrototypeOf","isDraft","value","DRAFT_STATE","isDraftable","isPlainObject","DRAFTABLE","isMap","isSet","objectCtorString","proto","Ctor","original","die","base_","each","obj","iter","getArchtype","key","entry","index","thing","state","type_","has","prop","get","set","propOrOldValue","t","is","x","y","target","latest","copy_","shallowCopy","base","strict","isPlain","descriptors","keys","i","desc","freeze","deep","isFrozen","dontMutateFrozenCollections","plugins","getPlugin","pluginKey","plugin","die","loadPlugin","implementation","currentScope","getCurrentScope","createScope","parent_","immer_","drafts_","canAutoFreeze_","unfinalizedDrafts_","usePatchesInScope","scope","patchListener","getPlugin","patches_","inversePatches_","patchListener_","revokeScope","leaveScope","revokeDraft","enterScope","immer","draft","state","DRAFT_STATE","type_","revoke_","revoked_","processResult","result","scope","unfinalizedDrafts_","drafts_","baseDraft","DRAFT_STATE","modified_","revokeScope","die","isDraftable","finalize","parent_","maybeFreeze","patches_","getPlugin","generateReplacementPatches_","base_","inversePatches_","patchListener_","NOTHING","rootScope","value","path","isFrozen","state","each","key","childValue","finalizeProperty","scope_","finalized_","copy_","resultEach","isSet","type_","generatePatches_","parentState","targetObject","prop","rootPath","targetIsSet","isDraft","has","assigned_","res","set","canAutoFreeze_","immer_","autoFreeze_","deep","freeze","createProxyProxy","base","parent","isArray","state","type_","scope_","getCurrentScope","modified_","finalized_","assigned_","parent_","base_","draft_","copy_","revoke_","isManual_","target","traps","objectTraps","arrayTraps","revoke","proxy","prop","DRAFT_STATE","source","latest","has","readPropFromProto","value","isDraftable","peek","prepareCopy","createProxy","desc","getDescriptorFromProto","current","currentState","is","markChanged","owner","die","getPrototypeOf","each","key","fn","draft","proto","shallowCopy","immer_","useStrictShallowCopy_","Immer","config","autoFreeze_","useStrictShallowCopy_","base","recipe","patchListener","defaultBase","self","args","draft","die","result","isDraftable","scope","enterScope","proxy","createProxy","hasError","revokeScope","leaveScope","usePatchesInScope","processResult","NOTHING","freeze","p","ip","getPlugin","generateReplacementPatches_","state","patches","inversePatches","isDraft","current","DRAFT_STATE","isManual_","scope_","value","i","patch","applyPatchesImpl","applyPatches_","parent","isMap","proxyMap_","isSet","proxySet_","createProxyProxy","getCurrentScope","drafts_","current","value","isDraft","die","currentImpl","isDraftable","isFrozen","state","DRAFT_STATE","copy","modified_","base_","finalized_","shallowCopy","scope_","immer_","useStrictShallowCopy_","each","key","childValue","set","enablePatches","REPLACE","ADD","REMOVE","generatePatches_","state","basePath","patches","inversePatches","type_","generatePatchesFromAssigned","generateArrayPatches","generateSetPatches","base_","assigned_","copy_","i","path","clonePatchValueIfNeeded","each","key","assignedValue","origValue","get","value","op","has","generateReplacementPatches_","baseValue","replacement","NOTHING","applyPatches_","draft","patch","base","parentType","getArchtype","p","die","type","deepClonePatchValue","obj","isDraftable","isMap","k","v","isSet","cloned","getPrototypeOf","DRAFTABLE","isDraft","loadPlugin","enableMapSet","DraftMap","target","parent","DRAFT_STATE","type_","parent_","scope_","getCurrentScope","modified_","finalized_","copy_","assigned_","base_","draft_","isManual_","revoked_","latest","key","value","state","assertUnrevoked","prepareMapCopy","markChanged","each","cb","thisArg","_value","_map","isDraftable","draft","createProxy","iterator","r","proxyMap_","DraftSet","drafts_","prepareSetCopy","result","proxySet_","die","loadPlugin","immer","Immer","produce","produceWithPatches","setAutoFreeze","setUseStrictShallowCopy","applyPatches","createDraft","finishDraft","castDraft","value","castImmutable"]} \ No newline at end of file diff --git a/node_modules/immer/dist/cjs/index.js b/node_modules/immer/dist/cjs/index.js new file mode 100644 index 00000000..9cdcdac8 --- /dev/null +++ b/node_modules/immer/dist/cjs/index.js @@ -0,0 +1,8 @@ + +'use strict' + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./immer.cjs.production.js') +} else { + module.exports = require('./immer.cjs.development.js') +} \ No newline at end of file diff --git a/node_modules/immer/dist/cjs/index.js.flow b/node_modules/immer/dist/cjs/index.js.flow new file mode 100644 index 00000000..6f14c85a --- /dev/null +++ b/node_modules/immer/dist/cjs/index.js.flow @@ -0,0 +1,111 @@ +// @flow + +export interface Patch { + op: "replace" | "remove" | "add"; + path: (string | number)[]; + value?: any; +} + +export type PatchListener = (patches: Patch[], inversePatches: Patch[]) => void + +type Base = {...} | Array +interface IProduce { + /** + * Immer takes a state, and runs a function against it. + * That function can freely mutate the state, as it will create copies-on-write. + * This means that the original state will stay unchanged, and once the function finishes, the modified state is returned. + * + * If the first argument is a function, this is interpreted as the recipe, and will create a curried function that will execute the recipe + * any time it is called with the current state. + * + * @param currentState - the state to start with + * @param recipe - function that receives a proxy of the current state as first argument and which can be freely modified + * @param initialState - if a curried function is created and this argument was given, it will be used as fallback if the curried function is called with a state of undefined + * @returns The next state: a new state, or the current state if nothing was modified + */ + ( + currentState: S, + recipe: (draftState: S) => S | void, + patchListener?: PatchListener + ): S; + // curried invocations with initial state + ( + recipe: (draftState: S, a: A, b: B, c: C, ...extraArgs: any[]) => S | void, + initialState: S + ): (currentState: S | void, a: A, b: B, c: C, ...extraArgs: any[]) => S; + // curried invocations without initial state + ( + recipe: (draftState: S, a: A, b: B, c: C, ...extraArgs: any[]) => S | void + ): (currentState: S, a: A, b: B, c: C, ...extraArgs: any[]) => S; +} + +interface IProduceWithPatches { + /** + * Like `produce`, but instead of just returning the new state, + * a tuple is returned with [nextState, patches, inversePatches] + * + * Like produce, this function supports currying + */ + ( + currentState: S, + recipe: (draftState: S) => S | void + ): [S, Patch[], Patch[]]; + // curried invocations with initial state + ( + recipe: (draftState: S, a: A, b: B, c: C, ...extraArgs: any[]) => S | void, + initialState: S + ): (currentState: S | void, a: A, b: B, c: C, ...extraArgs: any[]) => [S, Patch[], Patch[]]; + // curried invocations without initial state + ( + recipe: (draftState: S, a: A, b: B, c: C, ...extraArgs: any[]) => S | void + ): (currentState: S, a: A, b: B, c: C, ...extraArgs: any[]) => [S, Patch[], Patch[]]; +} + +declare export var produce: IProduce + +declare export var produceWithPatches: IProduceWithPatches + +declare export var nothing: typeof undefined + +declare export var immerable: Symbol + +/** + * Automatically freezes any state trees generated by immer. + * This protects against accidental modifications of the state tree outside of an immer function. + * This comes with a performance impact, so it is recommended to disable this option in production. + * By default it is turned on during local development, and turned off in production. + */ +declare export function setAutoFreeze(autoFreeze: boolean): void + +/** + * Pass false to disable strict shallow copy. + * + * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties. + */ +declare export function setUseStrictShallowCopy(useStrictShallowCopy: boolean): void + +declare export function applyPatches(state: S, patches: Patch[]): S + +declare export function original(value: S): S + +declare export function current(value: S): S + +declare export function isDraft(value: any): boolean + +/** + * Creates a mutable draft from an (immutable) object / array. + * The draft can be modified until `finishDraft` is called + */ +declare export function createDraft(base: T): T + +/** + * Given a draft that was created using `createDraft`, + * finalizes the draft into a new immutable object. + * Optionally a patch-listener can be provided to gather the patches that are needed to construct the object. + */ +declare export function finishDraft(base: T, listener?: PatchListener): T + +declare export function enableMapSet(): void +declare export function enablePatches(): void + +declare export function freeze(obj: T, freeze?: boolean): T diff --git a/node_modules/immer/dist/immer.d.ts b/node_modules/immer/dist/immer.d.ts new file mode 100644 index 00000000..2cb6cddd --- /dev/null +++ b/node_modules/immer/dist/immer.d.ts @@ -0,0 +1,262 @@ +/** + * The sentinel value returned by producers to replace the draft with undefined. + */ +declare const NOTHING: unique symbol; +/** + * To let Immer treat your class instances as plain immutable objects + * (albeit with a custom prototype), you must define either an instance property + * or a static property on each of your custom classes. + * + * Otherwise, your class instance will never be drafted, which means it won't be + * safe to mutate in a produce callback. + */ +declare const DRAFTABLE: unique symbol; + +type AnyFunc = (...args: any[]) => any; +type PrimitiveType = number | string | boolean; +/** Object types that should never be mapped */ +type AtomicObject = Function | Promise | Date | RegExp; +/** + * If the lib "ES2015.Collection" is not included in tsconfig.json, + * types like ReadonlyArray, WeakMap etc. fall back to `any` (specified nowhere) + * or `{}` (from the node types), in both cases entering an infinite recursion in + * pattern matching type mappings + * This type can be used to cast these types to `void` in these cases. + */ +type IfAvailable = true | false extends (T extends never ? true : false) ? Fallback : keyof T extends never ? Fallback : T; +/** + * These should also never be mapped but must be tested after regular Map and + * Set + */ +type WeakReferences = IfAvailable> | IfAvailable>; +type WritableDraft = { + -readonly [K in keyof T]: Draft; +}; +/** Convert a readonly type into a mutable type, if possible */ +type Draft = T extends PrimitiveType ? T : T extends AtomicObject ? T : T extends ReadonlyMap ? Map, Draft> : T extends ReadonlySet ? Set> : T extends WeakReferences ? T : T extends object ? WritableDraft : T; +/** Convert a mutable type into a readonly type */ +type Immutable = T extends PrimitiveType ? T : T extends AtomicObject ? T : T extends ReadonlyMap ? ReadonlyMap, Immutable> : T extends ReadonlySet ? ReadonlySet> : T extends WeakReferences ? T : T extends object ? { + readonly [K in keyof T]: Immutable; +} : T; +interface Patch { + op: "replace" | "remove" | "add"; + path: (string | number)[]; + value?: any; +} +type PatchListener = (patches: Patch[], inversePatches: Patch[]) => void; +/** + * Utility types + */ +type PatchesTuple = readonly [T, Patch[], Patch[]]; +type ValidRecipeReturnType = State | void | undefined | (State extends undefined ? typeof NOTHING : never); +type ReturnTypeWithPatchesIfNeeded = UsePatches extends true ? PatchesTuple : State; +/** + * Core Producer inference + */ +type InferRecipeFromCurried = Curried extends (base: infer State, ...rest: infer Args) => any ? ReturnType extends State ? (draft: Draft, ...rest: Args) => ValidRecipeReturnType> : never : never; +type InferInitialStateFromCurried = Curried extends (base: infer State, ...rest: any[]) => any ? State : never; +type InferCurriedFromRecipe = Recipe extends (draft: infer DraftState, ...args: infer RestArgs) => any ? ReturnType extends ValidRecipeReturnType ? (base: Immutable, ...args: RestArgs) => ReturnTypeWithPatchesIfNeeded : never : never; +type InferCurriedFromInitialStateAndRecipe = Recipe extends (draft: Draft, ...rest: infer RestArgs) => ValidRecipeReturnType ? (base?: State | undefined, ...args: RestArgs) => ReturnTypeWithPatchesIfNeeded : never; +/** + * The `produce` function takes a value and a "recipe function" (whose + * return value often depends on the base state). The recipe function is + * free to mutate its first argument however it wants. All mutations are + * only ever applied to a __copy__ of the base state. + * + * Pass only a function to create a "curried producer" which relieves you + * from passing the recipe function every time. + * + * Only plain objects and arrays are made mutable. All other objects are + * considered uncopyable. + * + * Note: This function is __bound__ to its `Immer` instance. + * + * @param {any} base - the initial state + * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified + * @param {Function} patchListener - optional function that will be called with all the patches produced here + * @returns {any} a new state, or the initial state if nothing was modified + */ +interface IProduce { + /** Curried producer that infers the recipe from the curried output function (e.g. when passing to setState) */ + (recipe: InferRecipeFromCurried, initialState?: InferInitialStateFromCurried): Curried; + /** Curried producer that infers curried from the recipe */ + (recipe: Recipe): InferCurriedFromRecipe; + /** Curried producer that infers curried from the State generic, which is explicitly passed in. */ + (recipe: (state: Draft, initialState: State) => ValidRecipeReturnType): (state?: State) => State; + (recipe: (state: Draft, ...args: Args) => ValidRecipeReturnType, initialState: State): (state?: State, ...args: Args) => State; + (recipe: (state: Draft) => ValidRecipeReturnType): (state: State) => State; + (recipe: (state: Draft, ...args: Args) => ValidRecipeReturnType): (state: State, ...args: Args) => State; + /** Curried producer with initial state, infers recipe from initial state */ + (recipe: Recipe, initialState: State): InferCurriedFromInitialStateAndRecipe; + /** Normal producer */ + >(// By using a default inferred D, rather than Draft in the recipe, we can override it. + base: Base, recipe: (draft: D) => ValidRecipeReturnType, listener?: PatchListener): Base; +} +/** + * Like `produce`, but instead of just returning the new state, + * a tuple is returned with [nextState, patches, inversePatches] + * + * Like produce, this function supports currying + */ +interface IProduceWithPatches { + (recipe: Recipe): InferCurriedFromRecipe; + (recipe: Recipe, initialState: State): InferCurriedFromInitialStateAndRecipe; + >(base: Base, recipe: (draft: D) => ValidRecipeReturnType, listener?: PatchListener): PatchesTuple; +} +/** + * The type for `recipe function` + */ +type Producer = (draft: Draft) => ValidRecipeReturnType>; + +type Objectish = AnyObject | AnyArray | AnyMap | AnySet; +type AnyObject = { + [key: string]: any; +}; +type AnyArray = Array; +type AnySet = Set; +type AnyMap = Map; + +/** Returns true if the given value is an Immer draft */ +declare function isDraft(value: any): boolean; +/** Returns true if the given value can be drafted by Immer */ +declare function isDraftable(value: any): boolean; +/** Get the underlying object that is represented by the given draft */ +declare function original(value: T): T | undefined; +/** + * Freezes draftable objects. Returns the original object. + * By default freezes shallowly, but if the second argument is `true` it will freeze recursively. + * + * @param obj + * @param deep + */ +declare function freeze(obj: T, deep?: boolean): T; + +interface ProducersFns { + produce: IProduce; + produceWithPatches: IProduceWithPatches; +} +type StrictMode = boolean | "class_only"; +declare class Immer implements ProducersFns { + autoFreeze_: boolean; + useStrictShallowCopy_: StrictMode; + constructor(config?: { + autoFreeze?: boolean; + useStrictShallowCopy?: StrictMode; + }); + /** + * The `produce` function takes a value and a "recipe function" (whose + * return value often depends on the base state). The recipe function is + * free to mutate its first argument however it wants. All mutations are + * only ever applied to a __copy__ of the base state. + * + * Pass only a function to create a "curried producer" which relieves you + * from passing the recipe function every time. + * + * Only plain objects and arrays are made mutable. All other objects are + * considered uncopyable. + * + * Note: This function is __bound__ to its `Immer` instance. + * + * @param {any} base - the initial state + * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified + * @param {Function} patchListener - optional function that will be called with all the patches produced here + * @returns {any} a new state, or the initial state if nothing was modified + */ + produce: IProduce; + produceWithPatches: IProduceWithPatches; + createDraft(base: T): Draft; + finishDraft>(draft: D, patchListener?: PatchListener): D extends Draft ? T : never; + /** + * Pass true to automatically freeze all copies created by Immer. + * + * By default, auto-freezing is enabled. + */ + setAutoFreeze(value: boolean): void; + /** + * Pass true to enable strict shallow copy. + * + * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties. + */ + setUseStrictShallowCopy(value: StrictMode): void; + applyPatches(base: T, patches: readonly Patch[]): T; +} + +/** Takes a snapshot of the current state of a draft and finalizes it (but without freezing). This is a great utility to print the current state during debugging (no Proxies in the way). The output of current can also be safely leaked outside the producer. */ +declare function current(value: T): T; + +declare function enablePatches(): void; + +declare function enableMapSet(): void; + +/** + * The `produce` function takes a value and a "recipe function" (whose + * return value often depends on the base state). The recipe function is + * free to mutate its first argument however it wants. All mutations are + * only ever applied to a __copy__ of the base state. + * + * Pass only a function to create a "curried producer" which relieves you + * from passing the recipe function every time. + * + * Only plain objects and arrays are made mutable. All other objects are + * considered uncopyable. + * + * Note: This function is __bound__ to its `Immer` instance. + * + * @param {any} base - the initial state + * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified + * @param {Function} patchListener - optional function that will be called with all the patches produced here + * @returns {any} a new state, or the initial state if nothing was modified + */ +declare const produce: IProduce; +/** + * Like `produce`, but `produceWithPatches` always returns a tuple + * [nextState, patches, inversePatches] (instead of just the next state) + */ +declare const produceWithPatches: IProduceWithPatches; +/** + * Pass true to automatically freeze all copies created by Immer. + * + * Always freeze by default, even in production mode + */ +declare const setAutoFreeze: (value: boolean) => void; +/** + * Pass true to enable strict shallow copy. + * + * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties. + */ +declare const setUseStrictShallowCopy: (value: StrictMode) => void; +/** + * Apply an array of Immer patches to the first argument. + * + * This function is a producer, which means copy-on-write is in effect. + */ +declare const applyPatches: (base: T, patches: readonly Patch[]) => T; +/** + * Create an Immer draft from the given base state, which may be a draft itself. + * The draft can be modified until you finalize it with the `finishDraft` function. + */ +declare const createDraft: (base: T) => Draft; +/** + * Finalize an Immer draft from a `createDraft` call, returning the base state + * (if no changes were made) or a modified copy. The draft must *not* be + * mutated afterwards. + * + * Pass a function as the 2nd argument to generate Immer patches based on the + * changes that were made. + */ +declare const finishDraft: (draft: D, patchListener?: PatchListener | undefined) => D extends Draft ? T : never; +/** + * This function is actually a no-op, but can be used to cast an immutable type + * to an draft type and make TypeScript happy + * + * @param value + */ +declare function castDraft(value: T): Draft; +/** + * This function is actually a no-op, but can be used to cast a mutable type + * to an immutable type and make TypeScript happy + * @param value + */ +declare function castImmutable(value: T): Immutable; + +export { Draft, Immer, Immutable, Objectish, Patch, PatchListener, Producer, StrictMode, WritableDraft, applyPatches, castDraft, castImmutable, createDraft, current, enableMapSet, enablePatches, finishDraft, freeze, DRAFTABLE as immerable, isDraft, isDraftable, NOTHING as nothing, original, produce, produceWithPatches, setAutoFreeze, setUseStrictShallowCopy }; diff --git a/node_modules/immer/dist/immer.legacy-esm.js b/node_modules/immer/dist/immer.legacy-esm.js new file mode 100644 index 00000000..cd8d81bf --- /dev/null +++ b/node_modules/immer/dist/immer.legacy-esm.js @@ -0,0 +1,1250 @@ +var __defProp = Object.defineProperty; +var __getOwnPropSymbols = Object.getOwnPropertySymbols; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __propIsEnum = Object.prototype.propertyIsEnumerable; +var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; +var __spreadValues = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp.call(b, prop)) + __defNormalProp(a, prop, b[prop]); + if (__getOwnPropSymbols) + for (var prop of __getOwnPropSymbols(b)) { + if (__propIsEnum.call(b, prop)) + __defNormalProp(a, prop, b[prop]); + } + return a; +}; + +// src/utils/env.ts +var NOTHING = Symbol.for("immer-nothing"); +var DRAFTABLE = Symbol.for("immer-draftable"); +var DRAFT_STATE = Symbol.for("immer-state"); + +// src/utils/errors.ts +var errors = process.env.NODE_ENV !== "production" ? [ + // All error codes, starting by 0: + function(plugin) { + return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.`; + }, + function(thing) { + return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`; + }, + "This object has been frozen and should not be mutated", + function(data) { + return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + data; + }, + "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.", + "Immer forbids circular references", + "The first or second argument to `produce` must be a function", + "The third argument to `produce` must be a function or undefined", + "First argument to `createDraft` must be a plain object, an array, or an immerable object", + "First argument to `finishDraft` must be a draft returned by `createDraft`", + function(thing) { + return `'current' expects a draft, got: ${thing}`; + }, + "Object.defineProperty() cannot be used on an Immer draft", + "Object.setPrototypeOf() cannot be used on an Immer draft", + "Immer only supports deleting array indices", + "Immer only supports setting array indices and the 'length' property", + function(thing) { + return `'original' expects a draft, got: ${thing}`; + } + // Note: if more errors are added, the errorOffset in Patches.ts should be increased + // See Patches.ts for additional errors +] : []; +function die(error, ...args) { + if (process.env.NODE_ENV !== "production") { + const e = errors[error]; + const msg = typeof e === "function" ? e.apply(null, args) : e; + throw new Error(`[Immer] ${msg}`); + } + throw new Error( + `[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf` + ); +} + +// src/utils/common.ts +var getPrototypeOf = Object.getPrototypeOf; +function isDraft(value) { + return !!value && !!value[DRAFT_STATE]; +} +function isDraftable(value) { + var _a; + if (!value) + return false; + return isPlainObject(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!((_a = value.constructor) == null ? void 0 : _a[DRAFTABLE]) || isMap(value) || isSet(value); +} +var objectCtorString = Object.prototype.constructor.toString(); +function isPlainObject(value) { + if (!value || typeof value !== "object") + return false; + const proto = getPrototypeOf(value); + if (proto === null) { + return true; + } + const Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor; + if (Ctor === Object) + return true; + return typeof Ctor == "function" && Function.toString.call(Ctor) === objectCtorString; +} +function original(value) { + if (!isDraft(value)) + die(15, value); + return value[DRAFT_STATE].base_; +} +function each(obj, iter) { + if (getArchtype(obj) === 0 /* Object */) { + Reflect.ownKeys(obj).forEach((key) => { + iter(key, obj[key], obj); + }); + } else { + obj.forEach((entry, index) => iter(index, entry, obj)); + } +} +function getArchtype(thing) { + const state = thing[DRAFT_STATE]; + return state ? state.type_ : Array.isArray(thing) ? 1 /* Array */ : isMap(thing) ? 2 /* Map */ : isSet(thing) ? 3 /* Set */ : 0 /* Object */; +} +function has(thing, prop) { + return getArchtype(thing) === 2 /* Map */ ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop); +} +function get(thing, prop) { + return getArchtype(thing) === 2 /* Map */ ? thing.get(prop) : thing[prop]; +} +function set(thing, propOrOldValue, value) { + const t = getArchtype(thing); + if (t === 2 /* Map */) + thing.set(propOrOldValue, value); + else if (t === 3 /* Set */) { + thing.add(value); + } else + thing[propOrOldValue] = value; +} +function is(x, y) { + if (x === y) { + return x !== 0 || 1 / x === 1 / y; + } else { + return x !== x && y !== y; + } +} +function isMap(target) { + return target instanceof Map; +} +function isSet(target) { + return target instanceof Set; +} +function latest(state) { + return state.copy_ || state.base_; +} +function shallowCopy(base, strict) { + if (isMap(base)) { + return new Map(base); + } + if (isSet(base)) { + return new Set(base); + } + if (Array.isArray(base)) + return Array.prototype.slice.call(base); + const isPlain = isPlainObject(base); + if (strict === true || strict === "class_only" && !isPlain) { + const descriptors = Object.getOwnPropertyDescriptors(base); + delete descriptors[DRAFT_STATE]; + let keys = Reflect.ownKeys(descriptors); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const desc = descriptors[key]; + if (desc.writable === false) { + desc.writable = true; + desc.configurable = true; + } + if (desc.get || desc.set) + descriptors[key] = { + configurable: true, + writable: true, + // could live with !!desc.set as well here... + enumerable: desc.enumerable, + value: base[key] + }; + } + return Object.create(getPrototypeOf(base), descriptors); + } else { + const proto = getPrototypeOf(base); + if (proto !== null && isPlain) { + return __spreadValues({}, base); + } + const obj = Object.create(proto); + return Object.assign(obj, base); + } +} +function freeze(obj, deep = false) { + if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) + return obj; + if (getArchtype(obj) > 1) { + obj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections; + } + Object.freeze(obj); + if (deep) + Object.entries(obj).forEach(([key, value]) => freeze(value, true)); + return obj; +} +function dontMutateFrozenCollections() { + die(2); +} +function isFrozen(obj) { + return Object.isFrozen(obj); +} + +// src/utils/plugins.ts +var plugins = {}; +function getPlugin(pluginKey) { + const plugin = plugins[pluginKey]; + if (!plugin) { + die(0, pluginKey); + } + return plugin; +} +function loadPlugin(pluginKey, implementation) { + if (!plugins[pluginKey]) + plugins[pluginKey] = implementation; +} + +// src/core/scope.ts +var currentScope; +function getCurrentScope() { + return currentScope; +} +function createScope(parent_, immer_) { + return { + drafts_: [], + parent_, + immer_, + // Whenever the modified draft contains a draft from another scope, we + // need to prevent auto-freezing so the unowned draft can be finalized. + canAutoFreeze_: true, + unfinalizedDrafts_: 0 + }; +} +function usePatchesInScope(scope, patchListener) { + if (patchListener) { + getPlugin("Patches"); + scope.patches_ = []; + scope.inversePatches_ = []; + scope.patchListener_ = patchListener; + } +} +function revokeScope(scope) { + leaveScope(scope); + scope.drafts_.forEach(revokeDraft); + scope.drafts_ = null; +} +function leaveScope(scope) { + if (scope === currentScope) { + currentScope = scope.parent_; + } +} +function enterScope(immer2) { + return currentScope = createScope(currentScope, immer2); +} +function revokeDraft(draft) { + const state = draft[DRAFT_STATE]; + if (state.type_ === 0 /* Object */ || state.type_ === 1 /* Array */) + state.revoke_(); + else + state.revoked_ = true; +} + +// src/core/finalize.ts +function processResult(result, scope) { + scope.unfinalizedDrafts_ = scope.drafts_.length; + const baseDraft = scope.drafts_[0]; + const isReplaced = result !== void 0 && result !== baseDraft; + if (isReplaced) { + if (baseDraft[DRAFT_STATE].modified_) { + revokeScope(scope); + die(4); + } + if (isDraftable(result)) { + result = finalize(scope, result); + if (!scope.parent_) + maybeFreeze(scope, result); + } + if (scope.patches_) { + getPlugin("Patches").generateReplacementPatches_( + baseDraft[DRAFT_STATE].base_, + result, + scope.patches_, + scope.inversePatches_ + ); + } + } else { + result = finalize(scope, baseDraft, []); + } + revokeScope(scope); + if (scope.patches_) { + scope.patchListener_(scope.patches_, scope.inversePatches_); + } + return result !== NOTHING ? result : void 0; +} +function finalize(rootScope, value, path) { + if (isFrozen(value)) + return value; + const state = value[DRAFT_STATE]; + if (!state) { + each( + value, + (key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path) + ); + return value; + } + if (state.scope_ !== rootScope) + return value; + if (!state.modified_) { + maybeFreeze(rootScope, state.base_, true); + return state.base_; + } + if (!state.finalized_) { + state.finalized_ = true; + state.scope_.unfinalizedDrafts_--; + const result = state.copy_; + let resultEach = result; + let isSet2 = false; + if (state.type_ === 3 /* Set */) { + resultEach = new Set(result); + result.clear(); + isSet2 = true; + } + each( + resultEach, + (key, childValue) => finalizeProperty(rootScope, state, result, key, childValue, path, isSet2) + ); + maybeFreeze(rootScope, result, false); + if (path && rootScope.patches_) { + getPlugin("Patches").generatePatches_( + state, + path, + rootScope.patches_, + rootScope.inversePatches_ + ); + } + } + return state.copy_; +} +function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath, targetIsSet) { + if (process.env.NODE_ENV !== "production" && childValue === targetObject) + die(5); + if (isDraft(childValue)) { + const path = rootPath && parentState && parentState.type_ !== 3 /* Set */ && // Set objects are atomic since they have no keys. + !has(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0; + const res = finalize(rootScope, childValue, path); + set(targetObject, prop, res); + if (isDraft(res)) { + rootScope.canAutoFreeze_ = false; + } else + return; + } else if (targetIsSet) { + targetObject.add(childValue); + } + if (isDraftable(childValue) && !isFrozen(childValue)) { + if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) { + return; + } + finalize(rootScope, childValue); + if ((!parentState || !parentState.scope_.parent_) && typeof prop !== "symbol" && Object.prototype.propertyIsEnumerable.call(targetObject, prop)) + maybeFreeze(rootScope, childValue); + } +} +function maybeFreeze(scope, value, deep = false) { + if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) { + freeze(value, deep); + } +} + +// src/core/proxy.ts +function createProxyProxy(base, parent) { + const isArray = Array.isArray(base); + const state = { + type_: isArray ? 1 /* Array */ : 0 /* Object */, + // Track which produce call this is associated with. + scope_: parent ? parent.scope_ : getCurrentScope(), + // True for both shallow and deep changes. + modified_: false, + // Used during finalization. + finalized_: false, + // Track which properties have been assigned (true) or deleted (false). + assigned_: {}, + // The parent draft state. + parent_: parent, + // The base state. + base_: base, + // The base proxy. + draft_: null, + // set below + // The base copy with any updated values. + copy_: null, + // Called by the `produce` function. + revoke_: null, + isManual_: false + }; + let target = state; + let traps = objectTraps; + if (isArray) { + target = [state]; + traps = arrayTraps; + } + const { revoke, proxy } = Proxy.revocable(target, traps); + state.draft_ = proxy; + state.revoke_ = revoke; + return proxy; +} +var objectTraps = { + get(state, prop) { + if (prop === DRAFT_STATE) + return state; + const source = latest(state); + if (!has(source, prop)) { + return readPropFromProto(state, source, prop); + } + const value = source[prop]; + if (state.finalized_ || !isDraftable(value)) { + return value; + } + if (value === peek(state.base_, prop)) { + prepareCopy(state); + return state.copy_[prop] = createProxy(value, state); + } + return value; + }, + has(state, prop) { + return prop in latest(state); + }, + ownKeys(state) { + return Reflect.ownKeys(latest(state)); + }, + set(state, prop, value) { + const desc = getDescriptorFromProto(latest(state), prop); + if (desc == null ? void 0 : desc.set) { + desc.set.call(state.draft_, value); + return true; + } + if (!state.modified_) { + const current2 = peek(latest(state), prop); + const currentState = current2 == null ? void 0 : current2[DRAFT_STATE]; + if (currentState && currentState.base_ === value) { + state.copy_[prop] = value; + state.assigned_[prop] = false; + return true; + } + if (is(value, current2) && (value !== void 0 || has(state.base_, prop))) + return true; + prepareCopy(state); + markChanged(state); + } + if (state.copy_[prop] === value && // special case: handle new props with value 'undefined' + (value !== void 0 || prop in state.copy_) || // special case: NaN + Number.isNaN(value) && Number.isNaN(state.copy_[prop])) + return true; + state.copy_[prop] = value; + state.assigned_[prop] = true; + return true; + }, + deleteProperty(state, prop) { + if (peek(state.base_, prop) !== void 0 || prop in state.base_) { + state.assigned_[prop] = false; + prepareCopy(state); + markChanged(state); + } else { + delete state.assigned_[prop]; + } + if (state.copy_) { + delete state.copy_[prop]; + } + return true; + }, + // Note: We never coerce `desc.value` into an Immer draft, because we can't make + // the same guarantee in ES5 mode. + getOwnPropertyDescriptor(state, prop) { + const owner = latest(state); + const desc = Reflect.getOwnPropertyDescriptor(owner, prop); + if (!desc) + return desc; + return { + writable: true, + configurable: state.type_ !== 1 /* Array */ || prop !== "length", + enumerable: desc.enumerable, + value: owner[prop] + }; + }, + defineProperty() { + die(11); + }, + getPrototypeOf(state) { + return getPrototypeOf(state.base_); + }, + setPrototypeOf() { + die(12); + } +}; +var arrayTraps = {}; +each(objectTraps, (key, fn) => { + arrayTraps[key] = function() { + arguments[0] = arguments[0][0]; + return fn.apply(this, arguments); + }; +}); +arrayTraps.deleteProperty = function(state, prop) { + if (process.env.NODE_ENV !== "production" && isNaN(parseInt(prop))) + die(13); + return arrayTraps.set.call(this, state, prop, void 0); +}; +arrayTraps.set = function(state, prop, value) { + if (process.env.NODE_ENV !== "production" && prop !== "length" && isNaN(parseInt(prop))) + die(14); + return objectTraps.set.call(this, state[0], prop, value, state[0]); +}; +function peek(draft, prop) { + const state = draft[DRAFT_STATE]; + const source = state ? latest(state) : draft; + return source[prop]; +} +function readPropFromProto(state, source, prop) { + var _a; + const desc = getDescriptorFromProto(source, prop); + return desc ? `value` in desc ? desc.value : ( + // This is a very special case, if the prop is a getter defined by the + // prototype, we should invoke it with the draft as context! + (_a = desc.get) == null ? void 0 : _a.call(state.draft_) + ) : void 0; +} +function getDescriptorFromProto(source, prop) { + if (!(prop in source)) + return void 0; + let proto = getPrototypeOf(source); + while (proto) { + const desc = Object.getOwnPropertyDescriptor(proto, prop); + if (desc) + return desc; + proto = getPrototypeOf(proto); + } + return void 0; +} +function markChanged(state) { + if (!state.modified_) { + state.modified_ = true; + if (state.parent_) { + markChanged(state.parent_); + } + } +} +function prepareCopy(state) { + if (!state.copy_) { + state.copy_ = shallowCopy( + state.base_, + state.scope_.immer_.useStrictShallowCopy_ + ); + } +} + +// src/core/immerClass.ts +var Immer2 = class { + constructor(config) { + this.autoFreeze_ = true; + this.useStrictShallowCopy_ = false; + /** + * The `produce` function takes a value and a "recipe function" (whose + * return value often depends on the base state). The recipe function is + * free to mutate its first argument however it wants. All mutations are + * only ever applied to a __copy__ of the base state. + * + * Pass only a function to create a "curried producer" which relieves you + * from passing the recipe function every time. + * + * Only plain objects and arrays are made mutable. All other objects are + * considered uncopyable. + * + * Note: This function is __bound__ to its `Immer` instance. + * + * @param {any} base - the initial state + * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified + * @param {Function} patchListener - optional function that will be called with all the patches produced here + * @returns {any} a new state, or the initial state if nothing was modified + */ + this.produce = (base, recipe, patchListener) => { + if (typeof base === "function" && typeof recipe !== "function") { + const defaultBase = recipe; + recipe = base; + const self = this; + return function curriedProduce(base2 = defaultBase, ...args) { + return self.produce(base2, (draft) => recipe.call(this, draft, ...args)); + }; + } + if (typeof recipe !== "function") + die(6); + if (patchListener !== void 0 && typeof patchListener !== "function") + die(7); + let result; + if (isDraftable(base)) { + const scope = enterScope(this); + const proxy = createProxy(base, void 0); + let hasError = true; + try { + result = recipe(proxy); + hasError = false; + } finally { + if (hasError) + revokeScope(scope); + else + leaveScope(scope); + } + usePatchesInScope(scope, patchListener); + return processResult(result, scope); + } else if (!base || typeof base !== "object") { + result = recipe(base); + if (result === void 0) + result = base; + if (result === NOTHING) + result = void 0; + if (this.autoFreeze_) + freeze(result, true); + if (patchListener) { + const p = []; + const ip = []; + getPlugin("Patches").generateReplacementPatches_(base, result, p, ip); + patchListener(p, ip); + } + return result; + } else + die(1, base); + }; + this.produceWithPatches = (base, recipe) => { + if (typeof base === "function") { + return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args)); + } + let patches, inversePatches; + const result = this.produce(base, recipe, (p, ip) => { + patches = p; + inversePatches = ip; + }); + return [result, patches, inversePatches]; + }; + if (typeof (config == null ? void 0 : config.autoFreeze) === "boolean") + this.setAutoFreeze(config.autoFreeze); + if (typeof (config == null ? void 0 : config.useStrictShallowCopy) === "boolean") + this.setUseStrictShallowCopy(config.useStrictShallowCopy); + } + createDraft(base) { + if (!isDraftable(base)) + die(8); + if (isDraft(base)) + base = current(base); + const scope = enterScope(this); + const proxy = createProxy(base, void 0); + proxy[DRAFT_STATE].isManual_ = true; + leaveScope(scope); + return proxy; + } + finishDraft(draft, patchListener) { + const state = draft && draft[DRAFT_STATE]; + if (!state || !state.isManual_) + die(9); + const { scope_: scope } = state; + usePatchesInScope(scope, patchListener); + return processResult(void 0, scope); + } + /** + * Pass true to automatically freeze all copies created by Immer. + * + * By default, auto-freezing is enabled. + */ + setAutoFreeze(value) { + this.autoFreeze_ = value; + } + /** + * Pass true to enable strict shallow copy. + * + * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties. + */ + setUseStrictShallowCopy(value) { + this.useStrictShallowCopy_ = value; + } + applyPatches(base, patches) { + let i; + for (i = patches.length - 1; i >= 0; i--) { + const patch = patches[i]; + if (patch.path.length === 0 && patch.op === "replace") { + base = patch.value; + break; + } + } + if (i > -1) { + patches = patches.slice(i + 1); + } + const applyPatchesImpl = getPlugin("Patches").applyPatches_; + if (isDraft(base)) { + return applyPatchesImpl(base, patches); + } + return this.produce( + base, + (draft) => applyPatchesImpl(draft, patches) + ); + } +}; +function createProxy(value, parent) { + const draft = isMap(value) ? getPlugin("MapSet").proxyMap_(value, parent) : isSet(value) ? getPlugin("MapSet").proxySet_(value, parent) : createProxyProxy(value, parent); + const scope = parent ? parent.scope_ : getCurrentScope(); + scope.drafts_.push(draft); + return draft; +} + +// src/core/current.ts +function current(value) { + if (!isDraft(value)) + die(10, value); + return currentImpl(value); +} +function currentImpl(value) { + if (!isDraftable(value) || isFrozen(value)) + return value; + const state = value[DRAFT_STATE]; + let copy; + if (state) { + if (!state.modified_) + return state.base_; + state.finalized_ = true; + copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_); + } else { + copy = shallowCopy(value, true); + } + each(copy, (key, childValue) => { + set(copy, key, currentImpl(childValue)); + }); + if (state) { + state.finalized_ = false; + } + return copy; +} + +// src/plugins/patches.ts +function enablePatches() { + const errorOffset = 16; + if (process.env.NODE_ENV !== "production") { + errors.push( + 'Sets cannot have "replace" patches.', + function(op) { + return "Unsupported patch operation: " + op; + }, + function(path) { + return "Cannot apply patch, path doesn't resolve: " + path; + }, + "Patching reserved attributes like __proto__, prototype and constructor is not allowed" + ); + } + const REPLACE = "replace"; + const ADD = "add"; + const REMOVE = "remove"; + function generatePatches_(state, basePath, patches, inversePatches) { + switch (state.type_) { + case 0 /* Object */: + case 2 /* Map */: + return generatePatchesFromAssigned( + state, + basePath, + patches, + inversePatches + ); + case 1 /* Array */: + return generateArrayPatches(state, basePath, patches, inversePatches); + case 3 /* Set */: + return generateSetPatches( + state, + basePath, + patches, + inversePatches + ); + } + } + function generateArrayPatches(state, basePath, patches, inversePatches) { + let { base_, assigned_ } = state; + let copy_ = state.copy_; + if (copy_.length < base_.length) { + ; + [base_, copy_] = [copy_, base_]; + [patches, inversePatches] = [inversePatches, patches]; + } + for (let i = 0; i < base_.length; i++) { + if (assigned_[i] && copy_[i] !== base_[i]) { + const path = basePath.concat([i]); + patches.push({ + op: REPLACE, + path, + // Need to maybe clone it, as it can in fact be the original value + // due to the base/copy inversion at the start of this function + value: clonePatchValueIfNeeded(copy_[i]) + }); + inversePatches.push({ + op: REPLACE, + path, + value: clonePatchValueIfNeeded(base_[i]) + }); + } + } + for (let i = base_.length; i < copy_.length; i++) { + const path = basePath.concat([i]); + patches.push({ + op: ADD, + path, + // Need to maybe clone it, as it can in fact be the original value + // due to the base/copy inversion at the start of this function + value: clonePatchValueIfNeeded(copy_[i]) + }); + } + for (let i = copy_.length - 1; base_.length <= i; --i) { + const path = basePath.concat([i]); + inversePatches.push({ + op: REMOVE, + path + }); + } + } + function generatePatchesFromAssigned(state, basePath, patches, inversePatches) { + const { base_, copy_ } = state; + each(state.assigned_, (key, assignedValue) => { + const origValue = get(base_, key); + const value = get(copy_, key); + const op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD; + if (origValue === value && op === REPLACE) + return; + const path = basePath.concat(key); + patches.push(op === REMOVE ? { op, path } : { op, path, value }); + inversePatches.push( + op === ADD ? { op: REMOVE, path } : op === REMOVE ? { op: ADD, path, value: clonePatchValueIfNeeded(origValue) } : { op: REPLACE, path, value: clonePatchValueIfNeeded(origValue) } + ); + }); + } + function generateSetPatches(state, basePath, patches, inversePatches) { + let { base_, copy_ } = state; + let i = 0; + base_.forEach((value) => { + if (!copy_.has(value)) { + const path = basePath.concat([i]); + patches.push({ + op: REMOVE, + path, + value + }); + inversePatches.unshift({ + op: ADD, + path, + value + }); + } + i++; + }); + i = 0; + copy_.forEach((value) => { + if (!base_.has(value)) { + const path = basePath.concat([i]); + patches.push({ + op: ADD, + path, + value + }); + inversePatches.unshift({ + op: REMOVE, + path, + value + }); + } + i++; + }); + } + function generateReplacementPatches_(baseValue, replacement, patches, inversePatches) { + patches.push({ + op: REPLACE, + path: [], + value: replacement === NOTHING ? void 0 : replacement + }); + inversePatches.push({ + op: REPLACE, + path: [], + value: baseValue + }); + } + function applyPatches_(draft, patches) { + patches.forEach((patch) => { + const { path, op } = patch; + let base = draft; + for (let i = 0; i < path.length - 1; i++) { + const parentType = getArchtype(base); + let p = path[i]; + if (typeof p !== "string" && typeof p !== "number") { + p = "" + p; + } + if ((parentType === 0 /* Object */ || parentType === 1 /* Array */) && (p === "__proto__" || p === "constructor")) + die(errorOffset + 3); + if (typeof base === "function" && p === "prototype") + die(errorOffset + 3); + base = get(base, p); + if (typeof base !== "object") + die(errorOffset + 2, path.join("/")); + } + const type = getArchtype(base); + const value = deepClonePatchValue(patch.value); + const key = path[path.length - 1]; + switch (op) { + case REPLACE: + switch (type) { + case 2 /* Map */: + return base.set(key, value); + case 3 /* Set */: + die(errorOffset); + default: + return base[key] = value; + } + case ADD: + switch (type) { + case 1 /* Array */: + return key === "-" ? base.push(value) : base.splice(key, 0, value); + case 2 /* Map */: + return base.set(key, value); + case 3 /* Set */: + return base.add(value); + default: + return base[key] = value; + } + case REMOVE: + switch (type) { + case 1 /* Array */: + return base.splice(key, 1); + case 2 /* Map */: + return base.delete(key); + case 3 /* Set */: + return base.delete(patch.value); + default: + return delete base[key]; + } + default: + die(errorOffset + 1, op); + } + }); + return draft; + } + function deepClonePatchValue(obj) { + if (!isDraftable(obj)) + return obj; + if (Array.isArray(obj)) + return obj.map(deepClonePatchValue); + if (isMap(obj)) + return new Map( + Array.from(obj.entries()).map(([k, v]) => [k, deepClonePatchValue(v)]) + ); + if (isSet(obj)) + return new Set(Array.from(obj).map(deepClonePatchValue)); + const cloned = Object.create(getPrototypeOf(obj)); + for (const key in obj) + cloned[key] = deepClonePatchValue(obj[key]); + if (has(obj, DRAFTABLE)) + cloned[DRAFTABLE] = obj[DRAFTABLE]; + return cloned; + } + function clonePatchValueIfNeeded(obj) { + if (isDraft(obj)) { + return deepClonePatchValue(obj); + } else + return obj; + } + loadPlugin("Patches", { + applyPatches_, + generatePatches_, + generateReplacementPatches_ + }); +} + +// src/plugins/mapset.ts +function enableMapSet() { + class DraftMap extends Map { + constructor(target, parent) { + super(); + this[DRAFT_STATE] = { + type_: 2 /* Map */, + parent_: parent, + scope_: parent ? parent.scope_ : getCurrentScope(), + modified_: false, + finalized_: false, + copy_: void 0, + assigned_: void 0, + base_: target, + draft_: this, + isManual_: false, + revoked_: false + }; + } + get size() { + return latest(this[DRAFT_STATE]).size; + } + has(key) { + return latest(this[DRAFT_STATE]).has(key); + } + set(key, value) { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + if (!latest(state).has(key) || latest(state).get(key) !== value) { + prepareMapCopy(state); + markChanged(state); + state.assigned_.set(key, true); + state.copy_.set(key, value); + state.assigned_.set(key, true); + } + return this; + } + delete(key) { + if (!this.has(key)) { + return false; + } + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + prepareMapCopy(state); + markChanged(state); + if (state.base_.has(key)) { + state.assigned_.set(key, false); + } else { + state.assigned_.delete(key); + } + state.copy_.delete(key); + return true; + } + clear() { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + if (latest(state).size) { + prepareMapCopy(state); + markChanged(state); + state.assigned_ = /* @__PURE__ */ new Map(); + each(state.base_, (key) => { + state.assigned_.set(key, false); + }); + state.copy_.clear(); + } + } + forEach(cb, thisArg) { + const state = this[DRAFT_STATE]; + latest(state).forEach((_value, key, _map) => { + cb.call(thisArg, this.get(key), key, this); + }); + } + get(key) { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + const value = latest(state).get(key); + if (state.finalized_ || !isDraftable(value)) { + return value; + } + if (value !== state.base_.get(key)) { + return value; + } + const draft = createProxy(value, state); + prepareMapCopy(state); + state.copy_.set(key, draft); + return draft; + } + keys() { + return latest(this[DRAFT_STATE]).keys(); + } + values() { + const iterator = this.keys(); + return { + [Symbol.iterator]: () => this.values(), + next: () => { + const r = iterator.next(); + if (r.done) + return r; + const value = this.get(r.value); + return { + done: false, + value + }; + } + }; + } + entries() { + const iterator = this.keys(); + return { + [Symbol.iterator]: () => this.entries(), + next: () => { + const r = iterator.next(); + if (r.done) + return r; + const value = this.get(r.value); + return { + done: false, + value: [r.value, value] + }; + } + }; + } + [(DRAFT_STATE, Symbol.iterator)]() { + return this.entries(); + } + } + function proxyMap_(target, parent) { + return new DraftMap(target, parent); + } + function prepareMapCopy(state) { + if (!state.copy_) { + state.assigned_ = /* @__PURE__ */ new Map(); + state.copy_ = new Map(state.base_); + } + } + class DraftSet extends Set { + constructor(target, parent) { + super(); + this[DRAFT_STATE] = { + type_: 3 /* Set */, + parent_: parent, + scope_: parent ? parent.scope_ : getCurrentScope(), + modified_: false, + finalized_: false, + copy_: void 0, + base_: target, + draft_: this, + drafts_: /* @__PURE__ */ new Map(), + revoked_: false, + isManual_: false + }; + } + get size() { + return latest(this[DRAFT_STATE]).size; + } + has(value) { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + if (!state.copy_) { + return state.base_.has(value); + } + if (state.copy_.has(value)) + return true; + if (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value))) + return true; + return false; + } + add(value) { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + if (!this.has(value)) { + prepareSetCopy(state); + markChanged(state); + state.copy_.add(value); + } + return this; + } + delete(value) { + if (!this.has(value)) { + return false; + } + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + prepareSetCopy(state); + markChanged(state); + return state.copy_.delete(value) || (state.drafts_.has(value) ? state.copy_.delete(state.drafts_.get(value)) : ( + /* istanbul ignore next */ + false + )); + } + clear() { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + if (latest(state).size) { + prepareSetCopy(state); + markChanged(state); + state.copy_.clear(); + } + } + values() { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + prepareSetCopy(state); + return state.copy_.values(); + } + entries() { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + prepareSetCopy(state); + return state.copy_.entries(); + } + keys() { + return this.values(); + } + [(DRAFT_STATE, Symbol.iterator)]() { + return this.values(); + } + forEach(cb, thisArg) { + const iterator = this.values(); + let result = iterator.next(); + while (!result.done) { + cb.call(thisArg, result.value, result.value, this); + result = iterator.next(); + } + } + } + function proxySet_(target, parent) { + return new DraftSet(target, parent); + } + function prepareSetCopy(state) { + if (!state.copy_) { + state.copy_ = /* @__PURE__ */ new Set(); + state.base_.forEach((value) => { + if (isDraftable(value)) { + const draft = createProxy(value, state); + state.drafts_.set(value, draft); + state.copy_.add(draft); + } else { + state.copy_.add(value); + } + }); + } + } + function assertUnrevoked(state) { + if (state.revoked_) + die(3, JSON.stringify(latest(state))); + } + loadPlugin("MapSet", { proxyMap_, proxySet_ }); +} + +// src/immer.ts +var immer = new Immer2(); +var produce = immer.produce; +var produceWithPatches = immer.produceWithPatches.bind( + immer +); +var setAutoFreeze = immer.setAutoFreeze.bind(immer); +var setUseStrictShallowCopy = immer.setUseStrictShallowCopy.bind(immer); +var applyPatches = immer.applyPatches.bind(immer); +var createDraft = immer.createDraft.bind(immer); +var finishDraft = immer.finishDraft.bind(immer); +function castDraft(value) { + return value; +} +function castImmutable(value) { + return value; +} +export { + Immer2 as Immer, + applyPatches, + castDraft, + castImmutable, + createDraft, + current, + enableMapSet, + enablePatches, + finishDraft, + freeze, + DRAFTABLE as immerable, + isDraft, + isDraftable, + NOTHING as nothing, + original, + produce, + produceWithPatches, + setAutoFreeze, + setUseStrictShallowCopy +}; +//# sourceMappingURL=immer.legacy-esm.js.map \ No newline at end of file diff --git a/node_modules/immer/dist/immer.legacy-esm.js.map b/node_modules/immer/dist/immer.legacy-esm.js.map new file mode 100644 index 00000000..53ecd2d8 --- /dev/null +++ b/node_modules/immer/dist/immer.legacy-esm.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/utils/env.ts","../src/utils/errors.ts","../src/utils/common.ts","../src/utils/plugins.ts","../src/core/scope.ts","../src/core/finalize.ts","../src/core/proxy.ts","../src/core/immerClass.ts","../src/core/current.ts","../src/plugins/patches.ts","../src/plugins/mapset.ts","../src/immer.ts"],"sourcesContent":["// Should be no imports here!\n\n/**\n * The sentinel value returned by producers to replace the draft with undefined.\n */\nexport const NOTHING: unique symbol = Symbol.for(\"immer-nothing\")\n\n/**\n * To let Immer treat your class instances as plain immutable objects\n * (albeit with a custom prototype), you must define either an instance property\n * or a static property on each of your custom classes.\n *\n * Otherwise, your class instance will never be drafted, which means it won't be\n * safe to mutate in a produce callback.\n */\nexport const DRAFTABLE: unique symbol = Symbol.for(\"immer-draftable\")\n\nexport const DRAFT_STATE: unique symbol = Symbol.for(\"immer-state\")\n","export const errors =\n\tprocess.env.NODE_ENV !== \"production\"\n\t\t? [\n\t\t\t\t// All error codes, starting by 0:\n\t\t\t\tfunction(plugin: string) {\n\t\t\t\t\treturn `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \\`enable${plugin}()\\` when initializing your application.`\n\t\t\t\t},\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`\n\t\t\t\t},\n\t\t\t\t\"This object has been frozen and should not be mutated\",\n\t\t\t\tfunction(data: any) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t\"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? \" +\n\t\t\t\t\t\tdata\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t\t\"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.\",\n\t\t\t\t\"Immer forbids circular references\",\n\t\t\t\t\"The first or second argument to `produce` must be a function\",\n\t\t\t\t\"The third argument to `produce` must be a function or undefined\",\n\t\t\t\t\"First argument to `createDraft` must be a plain object, an array, or an immerable object\",\n\t\t\t\t\"First argument to `finishDraft` must be a draft returned by `createDraft`\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'current' expects a draft, got: ${thing}`\n\t\t\t\t},\n\t\t\t\t\"Object.defineProperty() cannot be used on an Immer draft\",\n\t\t\t\t\"Object.setPrototypeOf() cannot be used on an Immer draft\",\n\t\t\t\t\"Immer only supports deleting array indices\",\n\t\t\t\t\"Immer only supports setting array indices and the 'length' property\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'original' expects a draft, got: ${thing}`\n\t\t\t\t}\n\t\t\t\t// Note: if more errors are added, the errorOffset in Patches.ts should be increased\n\t\t\t\t// See Patches.ts for additional errors\n\t\t ]\n\t\t: []\n\nexport function die(error: number, ...args: any[]): never {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tconst e = errors[error]\n\t\tconst msg = typeof e === \"function\" ? e.apply(null, args as any) : e\n\t\tthrow new Error(`[Immer] ${msg}`)\n\t}\n\tthrow new Error(\n\t\t`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`\n\t)\n}\n","import {\n\tDRAFT_STATE,\n\tDRAFTABLE,\n\tObjectish,\n\tDrafted,\n\tAnyObject,\n\tAnyMap,\n\tAnySet,\n\tImmerState,\n\tArchType,\n\tdie,\n\tStrictMode\n} from \"../internal\"\n\nexport const getPrototypeOf = Object.getPrototypeOf\n\n/** Returns true if the given value is an Immer draft */\n/*#__PURE__*/\nexport function isDraft(value: any): boolean {\n\treturn !!value && !!value[DRAFT_STATE]\n}\n\n/** Returns true if the given value can be drafted by Immer */\n/*#__PURE__*/\nexport function isDraftable(value: any): boolean {\n\tif (!value) return false\n\treturn (\n\t\tisPlainObject(value) ||\n\t\tArray.isArray(value) ||\n\t\t!!value[DRAFTABLE] ||\n\t\t!!value.constructor?.[DRAFTABLE] ||\n\t\tisMap(value) ||\n\t\tisSet(value)\n\t)\n}\n\nconst objectCtorString = Object.prototype.constructor.toString()\n/*#__PURE__*/\nexport function isPlainObject(value: any): boolean {\n\tif (!value || typeof value !== \"object\") return false\n\tconst proto = getPrototypeOf(value)\n\tif (proto === null) {\n\t\treturn true\n\t}\n\tconst Ctor =\n\t\tObject.hasOwnProperty.call(proto, \"constructor\") && proto.constructor\n\n\tif (Ctor === Object) return true\n\n\treturn (\n\t\ttypeof Ctor == \"function\" &&\n\t\tFunction.toString.call(Ctor) === objectCtorString\n\t)\n}\n\n/** Get the underlying object that is represented by the given draft */\n/*#__PURE__*/\nexport function original(value: T): T | undefined\nexport function original(value: Drafted): any {\n\tif (!isDraft(value)) die(15, value)\n\treturn value[DRAFT_STATE].base_\n}\n\n/**\n * Each iterates a map, set or array.\n * Or, if any other kind of object, all of its own properties.\n * Regardless whether they are enumerable or symbols\n */\nexport function each(\n\tobj: T,\n\titer: (key: string | number, value: any, source: T) => void\n): void\nexport function each(obj: any, iter: any) {\n\tif (getArchtype(obj) === ArchType.Object) {\n\t\tReflect.ownKeys(obj).forEach(key => {\n\t\t\titer(key, obj[key], obj)\n\t\t})\n\t} else {\n\t\tobj.forEach((entry: any, index: any) => iter(index, entry, obj))\n\t}\n}\n\n/*#__PURE__*/\nexport function getArchtype(thing: any): ArchType {\n\tconst state: undefined | ImmerState = thing[DRAFT_STATE]\n\treturn state\n\t\t? state.type_\n\t\t: Array.isArray(thing)\n\t\t? ArchType.Array\n\t\t: isMap(thing)\n\t\t? ArchType.Map\n\t\t: isSet(thing)\n\t\t? ArchType.Set\n\t\t: ArchType.Object\n}\n\n/*#__PURE__*/\nexport function has(thing: any, prop: PropertyKey): boolean {\n\treturn getArchtype(thing) === ArchType.Map\n\t\t? thing.has(prop)\n\t\t: Object.prototype.hasOwnProperty.call(thing, prop)\n}\n\n/*#__PURE__*/\nexport function get(thing: AnyMap | AnyObject, prop: PropertyKey): any {\n\t// @ts-ignore\n\treturn getArchtype(thing) === ArchType.Map ? thing.get(prop) : thing[prop]\n}\n\n/*#__PURE__*/\nexport function set(thing: any, propOrOldValue: PropertyKey, value: any) {\n\tconst t = getArchtype(thing)\n\tif (t === ArchType.Map) thing.set(propOrOldValue, value)\n\telse if (t === ArchType.Set) {\n\t\tthing.add(value)\n\t} else thing[propOrOldValue] = value\n}\n\n/*#__PURE__*/\nexport function is(x: any, y: any): boolean {\n\t// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n\tif (x === y) {\n\t\treturn x !== 0 || 1 / x === 1 / y\n\t} else {\n\t\treturn x !== x && y !== y\n\t}\n}\n\n/*#__PURE__*/\nexport function isMap(target: any): target is AnyMap {\n\treturn target instanceof Map\n}\n\n/*#__PURE__*/\nexport function isSet(target: any): target is AnySet {\n\treturn target instanceof Set\n}\n/*#__PURE__*/\nexport function latest(state: ImmerState): any {\n\treturn state.copy_ || state.base_\n}\n\n/*#__PURE__*/\nexport function shallowCopy(base: any, strict: StrictMode) {\n\tif (isMap(base)) {\n\t\treturn new Map(base)\n\t}\n\tif (isSet(base)) {\n\t\treturn new Set(base)\n\t}\n\tif (Array.isArray(base)) return Array.prototype.slice.call(base)\n\n\tconst isPlain = isPlainObject(base)\n\n\tif (strict === true || (strict === \"class_only\" && !isPlain)) {\n\t\t// Perform a strict copy\n\t\tconst descriptors = Object.getOwnPropertyDescriptors(base)\n\t\tdelete descriptors[DRAFT_STATE as any]\n\t\tlet keys = Reflect.ownKeys(descriptors)\n\t\tfor (let i = 0; i < keys.length; i++) {\n\t\t\tconst key: any = keys[i]\n\t\t\tconst desc = descriptors[key]\n\t\t\tif (desc.writable === false) {\n\t\t\t\tdesc.writable = true\n\t\t\t\tdesc.configurable = true\n\t\t\t}\n\t\t\t// like object.assign, we will read any _own_, get/set accessors. This helps in dealing\n\t\t\t// with libraries that trap values, like mobx or vue\n\t\t\t// unlike object.assign, non-enumerables will be copied as well\n\t\t\tif (desc.get || desc.set)\n\t\t\t\tdescriptors[key] = {\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\twritable: true, // could live with !!desc.set as well here...\n\t\t\t\t\tenumerable: desc.enumerable,\n\t\t\t\t\tvalue: base[key]\n\t\t\t\t}\n\t\t}\n\t\treturn Object.create(getPrototypeOf(base), descriptors)\n\t} else {\n\t\t// perform a sloppy copy\n\t\tconst proto = getPrototypeOf(base)\n\t\tif (proto !== null && isPlain) {\n\t\t\treturn {...base} // assumption: better inner class optimization than the assign below\n\t\t}\n\t\tconst obj = Object.create(proto)\n\t\treturn Object.assign(obj, base)\n\t}\n}\n\n/**\n * Freezes draftable objects. Returns the original object.\n * By default freezes shallowly, but if the second argument is `true` it will freeze recursively.\n *\n * @param obj\n * @param deep\n */\nexport function freeze(obj: T, deep?: boolean): T\nexport function freeze(obj: any, deep: boolean = false): T {\n\tif (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj\n\tif (getArchtype(obj) > 1 /* Map or Set */) {\n\t\tobj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections as any\n\t}\n\tObject.freeze(obj)\n\tif (deep)\n\t\t// See #590, don't recurse into non-enumerable / Symbol properties when freezing\n\t\t// So use Object.entries (only string-like, enumerables) instead of each()\n\t\tObject.entries(obj).forEach(([key, value]) => freeze(value, true))\n\treturn obj\n}\n\nfunction dontMutateFrozenCollections() {\n\tdie(2)\n}\n\nexport function isFrozen(obj: any): boolean {\n\treturn Object.isFrozen(obj)\n}\n","import {\n\tImmerState,\n\tPatch,\n\tDrafted,\n\tImmerBaseState,\n\tAnyMap,\n\tAnySet,\n\tArchType,\n\tdie\n} from \"../internal\"\n\n/** Plugin utilities */\nconst plugins: {\n\tPatches?: {\n\t\tgeneratePatches_(\n\t\t\tstate: ImmerState,\n\t\t\tbasePath: PatchPath,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tgenerateReplacementPatches_(\n\t\t\tbase: any,\n\t\t\treplacement: any,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tapplyPatches_(draft: T, patches: readonly Patch[]): T\n\t}\n\tMapSet?: {\n\t\tproxyMap_(target: T, parent?: ImmerState): T\n\t\tproxySet_(target: T, parent?: ImmerState): T\n\t}\n} = {}\n\ntype Plugins = typeof plugins\n\nexport function getPlugin(\n\tpluginKey: K\n): Exclude {\n\tconst plugin = plugins[pluginKey]\n\tif (!plugin) {\n\t\tdie(0, pluginKey)\n\t}\n\t// @ts-ignore\n\treturn plugin\n}\n\nexport function loadPlugin(\n\tpluginKey: K,\n\timplementation: Plugins[K]\n): void {\n\tif (!plugins[pluginKey]) plugins[pluginKey] = implementation\n}\n/** Map / Set plugin */\n\nexport interface MapState extends ImmerBaseState {\n\ttype_: ArchType.Map\n\tcopy_: AnyMap | undefined\n\tassigned_: Map | undefined\n\tbase_: AnyMap\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\nexport interface SetState extends ImmerBaseState {\n\ttype_: ArchType.Set\n\tcopy_: AnySet | undefined\n\tbase_: AnySet\n\tdrafts_: Map // maps the original value to the draft value in the new set\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\n/** Patches plugin */\n\nexport type PatchPath = (string | number)[]\n","import {\n\tPatch,\n\tPatchListener,\n\tDrafted,\n\tImmer,\n\tDRAFT_STATE,\n\tImmerState,\n\tArchType,\n\tgetPlugin\n} from \"../internal\"\n\n/** Each scope represents a `produce` call. */\n\nexport interface ImmerScope {\n\tpatches_?: Patch[]\n\tinversePatches_?: Patch[]\n\tcanAutoFreeze_: boolean\n\tdrafts_: any[]\n\tparent_?: ImmerScope\n\tpatchListener_?: PatchListener\n\timmer_: Immer\n\tunfinalizedDrafts_: number\n}\n\nlet currentScope: ImmerScope | undefined\n\nexport function getCurrentScope() {\n\treturn currentScope!\n}\n\nfunction createScope(\n\tparent_: ImmerScope | undefined,\n\timmer_: Immer\n): ImmerScope {\n\treturn {\n\t\tdrafts_: [],\n\t\tparent_,\n\t\timmer_,\n\t\t// Whenever the modified draft contains a draft from another scope, we\n\t\t// need to prevent auto-freezing so the unowned draft can be finalized.\n\t\tcanAutoFreeze_: true,\n\t\tunfinalizedDrafts_: 0\n\t}\n}\n\nexport function usePatchesInScope(\n\tscope: ImmerScope,\n\tpatchListener?: PatchListener\n) {\n\tif (patchListener) {\n\t\tgetPlugin(\"Patches\") // assert we have the plugin\n\t\tscope.patches_ = []\n\t\tscope.inversePatches_ = []\n\t\tscope.patchListener_ = patchListener\n\t}\n}\n\nexport function revokeScope(scope: ImmerScope) {\n\tleaveScope(scope)\n\tscope.drafts_.forEach(revokeDraft)\n\t// @ts-ignore\n\tscope.drafts_ = null\n}\n\nexport function leaveScope(scope: ImmerScope) {\n\tif (scope === currentScope) {\n\t\tcurrentScope = scope.parent_\n\t}\n}\n\nexport function enterScope(immer: Immer) {\n\treturn (currentScope = createScope(currentScope, immer))\n}\n\nfunction revokeDraft(draft: Drafted) {\n\tconst state: ImmerState = draft[DRAFT_STATE]\n\tif (state.type_ === ArchType.Object || state.type_ === ArchType.Array)\n\t\tstate.revoke_()\n\telse state.revoked_ = true\n}\n","import {\n\tImmerScope,\n\tDRAFT_STATE,\n\tisDraftable,\n\tNOTHING,\n\tPatchPath,\n\teach,\n\thas,\n\tfreeze,\n\tImmerState,\n\tisDraft,\n\tSetState,\n\tset,\n\tArchType,\n\tgetPlugin,\n\tdie,\n\trevokeScope,\n\tisFrozen\n} from \"../internal\"\n\nexport function processResult(result: any, scope: ImmerScope) {\n\tscope.unfinalizedDrafts_ = scope.drafts_.length\n\tconst baseDraft = scope.drafts_![0]\n\tconst isReplaced = result !== undefined && result !== baseDraft\n\tif (isReplaced) {\n\t\tif (baseDraft[DRAFT_STATE].modified_) {\n\t\t\trevokeScope(scope)\n\t\t\tdie(4)\n\t\t}\n\t\tif (isDraftable(result)) {\n\t\t\t// Finalize the result in case it contains (or is) a subset of the draft.\n\t\t\tresult = finalize(scope, result)\n\t\t\tif (!scope.parent_) maybeFreeze(scope, result)\n\t\t}\n\t\tif (scope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(\n\t\t\t\tbaseDraft[DRAFT_STATE].base_,\n\t\t\t\tresult,\n\t\t\t\tscope.patches_,\n\t\t\t\tscope.inversePatches_!\n\t\t\t)\n\t\t}\n\t} else {\n\t\t// Finalize the base draft.\n\t\tresult = finalize(scope, baseDraft, [])\n\t}\n\trevokeScope(scope)\n\tif (scope.patches_) {\n\t\tscope.patchListener_!(scope.patches_, scope.inversePatches_!)\n\t}\n\treturn result !== NOTHING ? result : undefined\n}\n\nfunction finalize(rootScope: ImmerScope, value: any, path?: PatchPath) {\n\t// Don't recurse in tho recursive data structures\n\tif (isFrozen(value)) return value\n\n\tconst state: ImmerState = value[DRAFT_STATE]\n\t// A plain object, might need freezing, might contain drafts\n\tif (!state) {\n\t\teach(value, (key, childValue) =>\n\t\t\tfinalizeProperty(rootScope, state, value, key, childValue, path)\n\t\t)\n\t\treturn value\n\t}\n\t// Never finalize drafts owned by another scope.\n\tif (state.scope_ !== rootScope) return value\n\t// Unmodified draft, return the (frozen) original\n\tif (!state.modified_) {\n\t\tmaybeFreeze(rootScope, state.base_, true)\n\t\treturn state.base_\n\t}\n\t// Not finalized yet, let's do that now\n\tif (!state.finalized_) {\n\t\tstate.finalized_ = true\n\t\tstate.scope_.unfinalizedDrafts_--\n\t\tconst result = state.copy_\n\t\t// Finalize all children of the copy\n\t\t// For sets we clone before iterating, otherwise we can get in endless loop due to modifying during iteration, see #628\n\t\t// To preserve insertion order in all cases we then clear the set\n\t\t// And we let finalizeProperty know it needs to re-add non-draft children back to the target\n\t\tlet resultEach = result\n\t\tlet isSet = false\n\t\tif (state.type_ === ArchType.Set) {\n\t\t\tresultEach = new Set(result)\n\t\t\tresult.clear()\n\t\t\tisSet = true\n\t\t}\n\t\teach(resultEach, (key, childValue) =>\n\t\t\tfinalizeProperty(rootScope, state, result, key, childValue, path, isSet)\n\t\t)\n\t\t// everything inside is frozen, we can freeze here\n\t\tmaybeFreeze(rootScope, result, false)\n\t\t// first time finalizing, let's create those patches\n\t\tif (path && rootScope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generatePatches_(\n\t\t\t\tstate,\n\t\t\t\tpath,\n\t\t\t\trootScope.patches_,\n\t\t\t\trootScope.inversePatches_!\n\t\t\t)\n\t\t}\n\t}\n\treturn state.copy_\n}\n\nfunction finalizeProperty(\n\trootScope: ImmerScope,\n\tparentState: undefined | ImmerState,\n\ttargetObject: any,\n\tprop: string | number,\n\tchildValue: any,\n\trootPath?: PatchPath,\n\ttargetIsSet?: boolean\n) {\n\tif (process.env.NODE_ENV !== \"production\" && childValue === targetObject)\n\t\tdie(5)\n\tif (isDraft(childValue)) {\n\t\tconst path =\n\t\t\trootPath &&\n\t\t\tparentState &&\n\t\t\tparentState!.type_ !== ArchType.Set && // Set objects are atomic since they have no keys.\n\t\t\t!has((parentState as Exclude).assigned_!, prop) // Skip deep patches for assigned keys.\n\t\t\t\t? rootPath!.concat(prop)\n\t\t\t\t: undefined\n\t\t// Drafts owned by `scope` are finalized here.\n\t\tconst res = finalize(rootScope, childValue, path)\n\t\tset(targetObject, prop, res)\n\t\t// Drafts from another scope must prevented to be frozen\n\t\t// if we got a draft back from finalize, we're in a nested produce and shouldn't freeze\n\t\tif (isDraft(res)) {\n\t\t\trootScope.canAutoFreeze_ = false\n\t\t} else return\n\t} else if (targetIsSet) {\n\t\ttargetObject.add(childValue)\n\t}\n\t// Search new objects for unfinalized drafts. Frozen objects should never contain drafts.\n\tif (isDraftable(childValue) && !isFrozen(childValue)) {\n\t\tif (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {\n\t\t\t// optimization: if an object is not a draft, and we don't have to\n\t\t\t// deepfreeze everything, and we are sure that no drafts are left in the remaining object\n\t\t\t// cause we saw and finalized all drafts already; we can stop visiting the rest of the tree.\n\t\t\t// This benefits especially adding large data tree's without further processing.\n\t\t\t// See add-data.js perf test\n\t\t\treturn\n\t\t}\n\t\tfinalize(rootScope, childValue)\n\t\t// Immer deep freezes plain objects, so if there is no parent state, we freeze as well\n\t\t// Per #590, we never freeze symbolic properties. Just to make sure don't accidentally interfere\n\t\t// with other frameworks.\n\t\tif (\n\t\t\t(!parentState || !parentState.scope_.parent_) &&\n\t\t\ttypeof prop !== \"symbol\" &&\n\t\t\tObject.prototype.propertyIsEnumerable.call(targetObject, prop)\n\t\t)\n\t\t\tmaybeFreeze(rootScope, childValue)\n\t}\n}\n\nfunction maybeFreeze(scope: ImmerScope, value: any, deep = false) {\n\t// we never freeze for a non-root scope; as it would prevent pruning for drafts inside wrapping objects\n\tif (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {\n\t\tfreeze(value, deep)\n\t}\n}\n","import {\n\teach,\n\thas,\n\tis,\n\tisDraftable,\n\tshallowCopy,\n\tlatest,\n\tImmerBaseState,\n\tImmerState,\n\tDrafted,\n\tAnyObject,\n\tAnyArray,\n\tObjectish,\n\tgetCurrentScope,\n\tgetPrototypeOf,\n\tDRAFT_STATE,\n\tdie,\n\tcreateProxy,\n\tArchType,\n\tImmerScope\n} from \"../internal\"\n\ninterface ProxyBaseState extends ImmerBaseState {\n\tassigned_: {\n\t\t[property: string]: boolean\n\t}\n\tparent_?: ImmerState\n\trevoke_(): void\n}\n\nexport interface ProxyObjectState extends ProxyBaseState {\n\ttype_: ArchType.Object\n\tbase_: any\n\tcopy_: any\n\tdraft_: Drafted\n}\n\nexport interface ProxyArrayState extends ProxyBaseState {\n\ttype_: ArchType.Array\n\tbase_: AnyArray\n\tcopy_: AnyArray | null\n\tdraft_: Drafted\n}\n\ntype ProxyState = ProxyObjectState | ProxyArrayState\n\n/**\n * Returns a new draft of the `base` object.\n *\n * The second argument is the parent draft-state (used internally).\n */\nexport function createProxyProxy(\n\tbase: T,\n\tparent?: ImmerState\n): Drafted {\n\tconst isArray = Array.isArray(base)\n\tconst state: ProxyState = {\n\t\ttype_: isArray ? ArchType.Array : (ArchType.Object as any),\n\t\t// Track which produce call this is associated with.\n\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t// True for both shallow and deep changes.\n\t\tmodified_: false,\n\t\t// Used during finalization.\n\t\tfinalized_: false,\n\t\t// Track which properties have been assigned (true) or deleted (false).\n\t\tassigned_: {},\n\t\t// The parent draft state.\n\t\tparent_: parent,\n\t\t// The base state.\n\t\tbase_: base,\n\t\t// The base proxy.\n\t\tdraft_: null as any, // set below\n\t\t// The base copy with any updated values.\n\t\tcopy_: null,\n\t\t// Called by the `produce` function.\n\t\trevoke_: null as any,\n\t\tisManual_: false\n\t}\n\n\t// the traps must target something, a bit like the 'real' base.\n\t// but also, we need to be able to determine from the target what the relevant state is\n\t// (to avoid creating traps per instance to capture the state in closure,\n\t// and to avoid creating weird hidden properties as well)\n\t// So the trick is to use 'state' as the actual 'target'! (and make sure we intercept everything)\n\t// Note that in the case of an array, we put the state in an array to have better Reflect defaults ootb\n\tlet target: T = state as any\n\tlet traps: ProxyHandler> = objectTraps\n\tif (isArray) {\n\t\ttarget = [state] as any\n\t\ttraps = arrayTraps\n\t}\n\n\tconst {revoke, proxy} = Proxy.revocable(target, traps)\n\tstate.draft_ = proxy as any\n\tstate.revoke_ = revoke\n\treturn proxy as any\n}\n\n/**\n * Object drafts\n */\nexport const objectTraps: ProxyHandler = {\n\tget(state, prop) {\n\t\tif (prop === DRAFT_STATE) return state\n\n\t\tconst source = latest(state)\n\t\tif (!has(source, prop)) {\n\t\t\t// non-existing or non-own property...\n\t\t\treturn readPropFromProto(state, source, prop)\n\t\t}\n\t\tconst value = source[prop]\n\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\treturn value\n\t\t}\n\t\t// Check for existing draft in modified state.\n\t\t// Assigned values are never drafted. This catches any drafts we created, too.\n\t\tif (value === peek(state.base_, prop)) {\n\t\t\tprepareCopy(state)\n\t\t\treturn (state.copy_![prop as any] = createProxy(value, state))\n\t\t}\n\t\treturn value\n\t},\n\thas(state, prop) {\n\t\treturn prop in latest(state)\n\t},\n\townKeys(state) {\n\t\treturn Reflect.ownKeys(latest(state))\n\t},\n\tset(\n\t\tstate: ProxyObjectState,\n\t\tprop: string /* strictly not, but helps TS */,\n\t\tvalue\n\t) {\n\t\tconst desc = getDescriptorFromProto(latest(state), prop)\n\t\tif (desc?.set) {\n\t\t\t// special case: if this write is captured by a setter, we have\n\t\t\t// to trigger it with the correct context\n\t\t\tdesc.set.call(state.draft_, value)\n\t\t\treturn true\n\t\t}\n\t\tif (!state.modified_) {\n\t\t\t// the last check is because we need to be able to distinguish setting a non-existing to undefined (which is a change)\n\t\t\t// from setting an existing property with value undefined to undefined (which is not a change)\n\t\t\tconst current = peek(latest(state), prop)\n\t\t\t// special case, if we assigning the original value to a draft, we can ignore the assignment\n\t\t\tconst currentState: ProxyObjectState = current?.[DRAFT_STATE]\n\t\t\tif (currentState && currentState.base_ === value) {\n\t\t\t\tstate.copy_![prop] = value\n\t\t\t\tstate.assigned_[prop] = false\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (is(value, current) && (value !== undefined || has(state.base_, prop)))\n\t\t\t\treturn true\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t}\n\n\t\tif (\n\t\t\t(state.copy_![prop] === value &&\n\t\t\t\t// special case: handle new props with value 'undefined'\n\t\t\t\t(value !== undefined || prop in state.copy_)) ||\n\t\t\t// special case: NaN\n\t\t\t(Number.isNaN(value) && Number.isNaN(state.copy_![prop]))\n\t\t)\n\t\t\treturn true\n\n\t\t// @ts-ignore\n\t\tstate.copy_![prop] = value\n\t\tstate.assigned_[prop] = true\n\t\treturn true\n\t},\n\tdeleteProperty(state, prop: string) {\n\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\tif (peek(state.base_, prop) !== undefined || prop in state.base_) {\n\t\t\tstate.assigned_[prop] = false\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t} else {\n\t\t\t// if an originally not assigned property was deleted\n\t\t\tdelete state.assigned_[prop]\n\t\t}\n\t\tif (state.copy_) {\n\t\t\tdelete state.copy_[prop]\n\t\t}\n\t\treturn true\n\t},\n\t// Note: We never coerce `desc.value` into an Immer draft, because we can't make\n\t// the same guarantee in ES5 mode.\n\tgetOwnPropertyDescriptor(state, prop) {\n\t\tconst owner = latest(state)\n\t\tconst desc = Reflect.getOwnPropertyDescriptor(owner, prop)\n\t\tif (!desc) return desc\n\t\treturn {\n\t\t\twritable: true,\n\t\t\tconfigurable: state.type_ !== ArchType.Array || prop !== \"length\",\n\t\t\tenumerable: desc.enumerable,\n\t\t\tvalue: owner[prop]\n\t\t}\n\t},\n\tdefineProperty() {\n\t\tdie(11)\n\t},\n\tgetPrototypeOf(state) {\n\t\treturn getPrototypeOf(state.base_)\n\t},\n\tsetPrototypeOf() {\n\t\tdie(12)\n\t}\n}\n\n/**\n * Array drafts\n */\n\nconst arrayTraps: ProxyHandler<[ProxyArrayState]> = {}\neach(objectTraps, (key, fn) => {\n\t// @ts-ignore\n\tarrayTraps[key] = function() {\n\t\targuments[0] = arguments[0][0]\n\t\treturn fn.apply(this, arguments)\n\t}\n})\narrayTraps.deleteProperty = function(state, prop) {\n\tif (process.env.NODE_ENV !== \"production\" && isNaN(parseInt(prop as any)))\n\t\tdie(13)\n\t// @ts-ignore\n\treturn arrayTraps.set!.call(this, state, prop, undefined)\n}\narrayTraps.set = function(state, prop, value) {\n\tif (\n\t\tprocess.env.NODE_ENV !== \"production\" &&\n\t\tprop !== \"length\" &&\n\t\tisNaN(parseInt(prop as any))\n\t)\n\t\tdie(14)\n\treturn objectTraps.set!.call(this, state[0], prop, value, state[0])\n}\n\n// Access a property without creating an Immer draft.\nfunction peek(draft: Drafted, prop: PropertyKey) {\n\tconst state = draft[DRAFT_STATE]\n\tconst source = state ? latest(state) : draft\n\treturn source[prop]\n}\n\nfunction readPropFromProto(state: ImmerState, source: any, prop: PropertyKey) {\n\tconst desc = getDescriptorFromProto(source, prop)\n\treturn desc\n\t\t? `value` in desc\n\t\t\t? desc.value\n\t\t\t: // This is a very special case, if the prop is a getter defined by the\n\t\t\t // prototype, we should invoke it with the draft as context!\n\t\t\t desc.get?.call(state.draft_)\n\t\t: undefined\n}\n\nfunction getDescriptorFromProto(\n\tsource: any,\n\tprop: PropertyKey\n): PropertyDescriptor | undefined {\n\t// 'in' checks proto!\n\tif (!(prop in source)) return undefined\n\tlet proto = getPrototypeOf(source)\n\twhile (proto) {\n\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop)\n\t\tif (desc) return desc\n\t\tproto = getPrototypeOf(proto)\n\t}\n\treturn undefined\n}\n\nexport function markChanged(state: ImmerState) {\n\tif (!state.modified_) {\n\t\tstate.modified_ = true\n\t\tif (state.parent_) {\n\t\t\tmarkChanged(state.parent_)\n\t\t}\n\t}\n}\n\nexport function prepareCopy(state: {\n\tbase_: any\n\tcopy_: any\n\tscope_: ImmerScope\n}) {\n\tif (!state.copy_) {\n\t\tstate.copy_ = shallowCopy(\n\t\t\tstate.base_,\n\t\t\tstate.scope_.immer_.useStrictShallowCopy_\n\t\t)\n\t}\n}\n","import {\n\tIProduceWithPatches,\n\tIProduce,\n\tImmerState,\n\tDrafted,\n\tisDraftable,\n\tprocessResult,\n\tPatch,\n\tObjectish,\n\tDRAFT_STATE,\n\tDraft,\n\tPatchListener,\n\tisDraft,\n\tisMap,\n\tisSet,\n\tcreateProxyProxy,\n\tgetPlugin,\n\tdie,\n\tenterScope,\n\trevokeScope,\n\tleaveScope,\n\tusePatchesInScope,\n\tgetCurrentScope,\n\tNOTHING,\n\tfreeze,\n\tcurrent\n} from \"../internal\"\n\ninterface ProducersFns {\n\tproduce: IProduce\n\tproduceWithPatches: IProduceWithPatches\n}\n\nexport type StrictMode = boolean | \"class_only\";\n\nexport class Immer implements ProducersFns {\n\tautoFreeze_: boolean = true\n\tuseStrictShallowCopy_: StrictMode = false\n\n\tconstructor(config?: {\n\t\tautoFreeze?: boolean\n\t\tuseStrictShallowCopy?: StrictMode\n\t}) {\n\t\tif (typeof config?.autoFreeze === \"boolean\")\n\t\t\tthis.setAutoFreeze(config!.autoFreeze)\n\t\tif (typeof config?.useStrictShallowCopy === \"boolean\")\n\t\t\tthis.setUseStrictShallowCopy(config!.useStrictShallowCopy)\n\t}\n\n\t/**\n\t * The `produce` function takes a value and a \"recipe function\" (whose\n\t * return value often depends on the base state). The recipe function is\n\t * free to mutate its first argument however it wants. All mutations are\n\t * only ever applied to a __copy__ of the base state.\n\t *\n\t * Pass only a function to create a \"curried producer\" which relieves you\n\t * from passing the recipe function every time.\n\t *\n\t * Only plain objects and arrays are made mutable. All other objects are\n\t * considered uncopyable.\n\t *\n\t * Note: This function is __bound__ to its `Immer` instance.\n\t *\n\t * @param {any} base - the initial state\n\t * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified\n\t * @param {Function} patchListener - optional function that will be called with all the patches produced here\n\t * @returns {any} a new state, or the initial state if nothing was modified\n\t */\n\tproduce: IProduce = (base: any, recipe?: any, patchListener?: any) => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\" && typeof recipe !== \"function\") {\n\t\t\tconst defaultBase = recipe\n\t\t\trecipe = base\n\n\t\t\tconst self = this\n\t\t\treturn function curriedProduce(\n\t\t\t\tthis: any,\n\t\t\t\tbase = defaultBase,\n\t\t\t\t...args: any[]\n\t\t\t) {\n\t\t\t\treturn self.produce(base, (draft: Drafted) => recipe.call(this, draft, ...args)) // prettier-ignore\n\t\t\t}\n\t\t}\n\n\t\tif (typeof recipe !== \"function\") die(6)\n\t\tif (patchListener !== undefined && typeof patchListener !== \"function\")\n\t\t\tdie(7)\n\n\t\tlet result\n\n\t\t// Only plain objects, arrays, and \"immerable classes\" are drafted.\n\t\tif (isDraftable(base)) {\n\t\t\tconst scope = enterScope(this)\n\t\t\tconst proxy = createProxy(base, undefined)\n\t\t\tlet hasError = true\n\t\t\ttry {\n\t\t\t\tresult = recipe(proxy)\n\t\t\t\thasError = false\n\t\t\t} finally {\n\t\t\t\t// finally instead of catch + rethrow better preserves original stack\n\t\t\t\tif (hasError) revokeScope(scope)\n\t\t\t\telse leaveScope(scope)\n\t\t\t}\n\t\t\tusePatchesInScope(scope, patchListener)\n\t\t\treturn processResult(result, scope)\n\t\t} else if (!base || typeof base !== \"object\") {\n\t\t\tresult = recipe(base)\n\t\t\tif (result === undefined) result = base\n\t\t\tif (result === NOTHING) result = undefined\n\t\t\tif (this.autoFreeze_) freeze(result, true)\n\t\t\tif (patchListener) {\n\t\t\t\tconst p: Patch[] = []\n\t\t\t\tconst ip: Patch[] = []\n\t\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(base, result, p, ip)\n\t\t\t\tpatchListener(p, ip)\n\t\t\t}\n\t\t\treturn result\n\t\t} else die(1, base)\n\t}\n\n\tproduceWithPatches: IProduceWithPatches = (base: any, recipe?: any): any => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\") {\n\t\t\treturn (state: any, ...args: any[]) =>\n\t\t\t\tthis.produceWithPatches(state, (draft: any) => base(draft, ...args))\n\t\t}\n\n\t\tlet patches: Patch[], inversePatches: Patch[]\n\t\tconst result = this.produce(base, recipe, (p: Patch[], ip: Patch[]) => {\n\t\t\tpatches = p\n\t\t\tinversePatches = ip\n\t\t})\n\t\treturn [result, patches!, inversePatches!]\n\t}\n\n\tcreateDraft(base: T): Draft {\n\t\tif (!isDraftable(base)) die(8)\n\t\tif (isDraft(base)) base = current(base)\n\t\tconst scope = enterScope(this)\n\t\tconst proxy = createProxy(base, undefined)\n\t\tproxy[DRAFT_STATE].isManual_ = true\n\t\tleaveScope(scope)\n\t\treturn proxy as any\n\t}\n\n\tfinishDraft>(\n\t\tdraft: D,\n\t\tpatchListener?: PatchListener\n\t): D extends Draft ? T : never {\n\t\tconst state: ImmerState = draft && (draft as any)[DRAFT_STATE]\n\t\tif (!state || !state.isManual_) die(9)\n\t\tconst {scope_: scope} = state\n\t\tusePatchesInScope(scope, patchListener)\n\t\treturn processResult(undefined, scope)\n\t}\n\n\t/**\n\t * Pass true to automatically freeze all copies created by Immer.\n\t *\n\t * By default, auto-freezing is enabled.\n\t */\n\tsetAutoFreeze(value: boolean) {\n\t\tthis.autoFreeze_ = value\n\t}\n\n\t/**\n\t * Pass true to enable strict shallow copy.\n\t *\n\t * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n\t */\n\tsetUseStrictShallowCopy(value: StrictMode) {\n\t\tthis.useStrictShallowCopy_ = value\n\t}\n\n\tapplyPatches(base: T, patches: readonly Patch[]): T {\n\t\t// If a patch replaces the entire state, take that replacement as base\n\t\t// before applying patches\n\t\tlet i: number\n\t\tfor (i = patches.length - 1; i >= 0; i--) {\n\t\t\tconst patch = patches[i]\n\t\t\tif (patch.path.length === 0 && patch.op === \"replace\") {\n\t\t\t\tbase = patch.value\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// If there was a patch that replaced the entire state, start from the\n\t\t// patch after that.\n\t\tif (i > -1) {\n\t\t\tpatches = patches.slice(i + 1)\n\t\t}\n\n\t\tconst applyPatchesImpl = getPlugin(\"Patches\").applyPatches_\n\t\tif (isDraft(base)) {\n\t\t\t// N.B: never hits if some patch a replacement, patches are never drafts\n\t\t\treturn applyPatchesImpl(base, patches)\n\t\t}\n\t\t// Otherwise, produce a copy of the base state.\n\t\treturn this.produce(base, (draft: Drafted) =>\n\t\t\tapplyPatchesImpl(draft, patches)\n\t\t)\n\t}\n}\n\nexport function createProxy(\n\tvalue: T,\n\tparent?: ImmerState\n): Drafted {\n\t// precondition: createProxy should be guarded by isDraftable, so we know we can safely draft\n\tconst draft: Drafted = isMap(value)\n\t\t? getPlugin(\"MapSet\").proxyMap_(value, parent)\n\t\t: isSet(value)\n\t\t? getPlugin(\"MapSet\").proxySet_(value, parent)\n\t\t: createProxyProxy(value, parent)\n\n\tconst scope = parent ? parent.scope_ : getCurrentScope()\n\tscope.drafts_.push(draft)\n\treturn draft\n}\n","import {\n\tdie,\n\tisDraft,\n\tshallowCopy,\n\teach,\n\tDRAFT_STATE,\n\tset,\n\tImmerState,\n\tisDraftable,\n\tisFrozen\n} from \"../internal\"\n\n/** Takes a snapshot of the current state of a draft and finalizes it (but without freezing). This is a great utility to print the current state during debugging (no Proxies in the way). The output of current can also be safely leaked outside the producer. */\nexport function current(value: T): T\nexport function current(value: any): any {\n\tif (!isDraft(value)) die(10, value)\n\treturn currentImpl(value)\n}\n\nfunction currentImpl(value: any): any {\n\tif (!isDraftable(value) || isFrozen(value)) return value\n\tconst state: ImmerState | undefined = value[DRAFT_STATE]\n\tlet copy: any\n\tif (state) {\n\t\tif (!state.modified_) return state.base_\n\t\t// Optimization: avoid generating new drafts during copying\n\t\tstate.finalized_ = true\n\t\tcopy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_)\n\t} else {\n\t\tcopy = shallowCopy(value, true)\n\t}\n\t// recurse\n\teach(copy, (key, childValue) => {\n\t\tset(copy, key, currentImpl(childValue))\n\t})\n\tif (state) {\n\t\tstate.finalized_ = false\n\t}\n\treturn copy\n}\n","import {immerable} from \"../immer\"\nimport {\n\tImmerState,\n\tPatch,\n\tSetState,\n\tProxyArrayState,\n\tMapState,\n\tProxyObjectState,\n\tPatchPath,\n\tget,\n\teach,\n\thas,\n\tgetArchtype,\n\tgetPrototypeOf,\n\tisSet,\n\tisMap,\n\tloadPlugin,\n\tArchType,\n\tdie,\n\tisDraft,\n\tisDraftable,\n\tNOTHING,\n\terrors\n} from \"../internal\"\n\nexport function enablePatches() {\n\tconst errorOffset = 16\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\terrors.push(\n\t\t\t'Sets cannot have \"replace\" patches.',\n\t\t\tfunction(op: string) {\n\t\t\t\treturn \"Unsupported patch operation: \" + op\n\t\t\t},\n\t\t\tfunction(path: string) {\n\t\t\t\treturn \"Cannot apply patch, path doesn't resolve: \" + path\n\t\t\t},\n\t\t\t\"Patching reserved attributes like __proto__, prototype and constructor is not allowed\"\n\t\t)\n\t}\n\n\tconst REPLACE = \"replace\"\n\tconst ADD = \"add\"\n\tconst REMOVE = \"remove\"\n\n\tfunction generatePatches_(\n\t\tstate: ImmerState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t): void {\n\t\tswitch (state.type_) {\n\t\t\tcase ArchType.Object:\n\t\t\tcase ArchType.Map:\n\t\t\t\treturn generatePatchesFromAssigned(\n\t\t\t\t\tstate,\n\t\t\t\t\tbasePath,\n\t\t\t\t\tpatches,\n\t\t\t\t\tinversePatches\n\t\t\t\t)\n\t\t\tcase ArchType.Array:\n\t\t\t\treturn generateArrayPatches(state, basePath, patches, inversePatches)\n\t\t\tcase ArchType.Set:\n\t\t\t\treturn generateSetPatches(\n\t\t\t\t\t(state as any) as SetState,\n\t\t\t\t\tbasePath,\n\t\t\t\t\tpatches,\n\t\t\t\t\tinversePatches\n\t\t\t\t)\n\t\t}\n\t}\n\n\tfunction generateArrayPatches(\n\t\tstate: ProxyArrayState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tlet {base_, assigned_} = state\n\t\tlet copy_ = state.copy_!\n\n\t\t// Reduce complexity by ensuring `base` is never longer.\n\t\tif (copy_.length < base_.length) {\n\t\t\t// @ts-ignore\n\t\t\t;[base_, copy_] = [copy_, base_]\n\t\t\t;[patches, inversePatches] = [inversePatches, patches]\n\t\t}\n\n\t\t// Process replaced indices.\n\t\tfor (let i = 0; i < base_.length; i++) {\n\t\t\tif (assigned_[i] && copy_[i] !== base_[i]) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: REPLACE,\n\t\t\t\t\tpath,\n\t\t\t\t\t// Need to maybe clone it, as it can in fact be the original value\n\t\t\t\t\t// due to the base/copy inversion at the start of this function\n\t\t\t\t\tvalue: clonePatchValueIfNeeded(copy_[i])\n\t\t\t\t})\n\t\t\t\tinversePatches.push({\n\t\t\t\t\top: REPLACE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue: clonePatchValueIfNeeded(base_[i])\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// Process added indices.\n\t\tfor (let i = base_.length; i < copy_.length; i++) {\n\t\t\tconst path = basePath.concat([i])\n\t\t\tpatches.push({\n\t\t\t\top: ADD,\n\t\t\t\tpath,\n\t\t\t\t// Need to maybe clone it, as it can in fact be the original value\n\t\t\t\t// due to the base/copy inversion at the start of this function\n\t\t\t\tvalue: clonePatchValueIfNeeded(copy_[i])\n\t\t\t})\n\t\t}\n\t\tfor (let i = copy_.length - 1; base_.length <= i; --i) {\n\t\t\tconst path = basePath.concat([i])\n\t\t\tinversePatches.push({\n\t\t\t\top: REMOVE,\n\t\t\t\tpath\n\t\t\t})\n\t\t}\n\t}\n\n\t// This is used for both Map objects and normal objects.\n\tfunction generatePatchesFromAssigned(\n\t\tstate: MapState | ProxyObjectState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tconst {base_, copy_} = state\n\t\teach(state.assigned_!, (key, assignedValue) => {\n\t\t\tconst origValue = get(base_, key)\n\t\t\tconst value = get(copy_!, key)\n\t\t\tconst op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD\n\t\t\tif (origValue === value && op === REPLACE) return\n\t\t\tconst path = basePath.concat(key as any)\n\t\t\tpatches.push(op === REMOVE ? {op, path} : {op, path, value})\n\t\t\tinversePatches.push(\n\t\t\t\top === ADD\n\t\t\t\t\t? {op: REMOVE, path}\n\t\t\t\t\t: op === REMOVE\n\t\t\t\t\t? {op: ADD, path, value: clonePatchValueIfNeeded(origValue)}\n\t\t\t\t\t: {op: REPLACE, path, value: clonePatchValueIfNeeded(origValue)}\n\t\t\t)\n\t\t})\n\t}\n\n\tfunction generateSetPatches(\n\t\tstate: SetState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tlet {base_, copy_} = state\n\n\t\tlet i = 0\n\t\tbase_.forEach((value: any) => {\n\t\t\tif (!copy_!.has(value)) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: REMOVE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t\tinversePatches.unshift({\n\t\t\t\t\top: ADD,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t}\n\t\t\ti++\n\t\t})\n\t\ti = 0\n\t\tcopy_!.forEach((value: any) => {\n\t\t\tif (!base_.has(value)) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: ADD,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t\tinversePatches.unshift({\n\t\t\t\t\top: REMOVE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t}\n\t\t\ti++\n\t\t})\n\t}\n\n\tfunction generateReplacementPatches_(\n\t\tbaseValue: any,\n\t\treplacement: any,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t): void {\n\t\tpatches.push({\n\t\t\top: REPLACE,\n\t\t\tpath: [],\n\t\t\tvalue: replacement === NOTHING ? undefined : replacement\n\t\t})\n\t\tinversePatches.push({\n\t\t\top: REPLACE,\n\t\t\tpath: [],\n\t\t\tvalue: baseValue\n\t\t})\n\t}\n\n\tfunction applyPatches_(draft: T, patches: readonly Patch[]): T {\n\t\tpatches.forEach(patch => {\n\t\t\tconst {path, op} = patch\n\n\t\t\tlet base: any = draft\n\t\t\tfor (let i = 0; i < path.length - 1; i++) {\n\t\t\t\tconst parentType = getArchtype(base)\n\t\t\t\tlet p = path[i]\n\t\t\t\tif (typeof p !== \"string\" && typeof p !== \"number\") {\n\t\t\t\t\tp = \"\" + p\n\t\t\t\t}\n\n\t\t\t\t// See #738, avoid prototype pollution\n\t\t\t\tif (\n\t\t\t\t\t(parentType === ArchType.Object || parentType === ArchType.Array) &&\n\t\t\t\t\t(p === \"__proto__\" || p === \"constructor\")\n\t\t\t\t)\n\t\t\t\t\tdie(errorOffset + 3)\n\t\t\t\tif (typeof base === \"function\" && p === \"prototype\")\n\t\t\t\t\tdie(errorOffset + 3)\n\t\t\t\tbase = get(base, p)\n\t\t\t\tif (typeof base !== \"object\") die(errorOffset + 2, path.join(\"/\"))\n\t\t\t}\n\n\t\t\tconst type = getArchtype(base)\n\t\t\tconst value = deepClonePatchValue(patch.value) // used to clone patch to ensure original patch is not modified, see #411\n\t\t\tconst key = path[path.length - 1]\n\t\t\tswitch (op) {\n\t\t\t\tcase REPLACE:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase ArchType.Map:\n\t\t\t\t\t\t\treturn base.set(key, value)\n\t\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\t\tcase ArchType.Set:\n\t\t\t\t\t\t\tdie(errorOffset)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t// if value is an object, then it's assigned by reference\n\t\t\t\t\t\t\t// in the following add or remove ops, the value field inside the patch will also be modifyed\n\t\t\t\t\t\t\t// so we use value from the cloned patch\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\treturn (base[key] = value)\n\t\t\t\t\t}\n\t\t\t\tcase ADD:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase ArchType.Array:\n\t\t\t\t\t\t\treturn key === \"-\"\n\t\t\t\t\t\t\t\t? base.push(value)\n\t\t\t\t\t\t\t\t: base.splice(key as any, 0, value)\n\t\t\t\t\t\tcase ArchType.Map:\n\t\t\t\t\t\t\treturn base.set(key, value)\n\t\t\t\t\t\tcase ArchType.Set:\n\t\t\t\t\t\t\treturn base.add(value)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn (base[key] = value)\n\t\t\t\t\t}\n\t\t\t\tcase REMOVE:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase ArchType.Array:\n\t\t\t\t\t\t\treturn base.splice(key as any, 1)\n\t\t\t\t\t\tcase ArchType.Map:\n\t\t\t\t\t\t\treturn base.delete(key)\n\t\t\t\t\t\tcase ArchType.Set:\n\t\t\t\t\t\t\treturn base.delete(patch.value)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn delete base[key]\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tdie(errorOffset + 1, op)\n\t\t\t}\n\t\t})\n\n\t\treturn draft\n\t}\n\n\t// optimize: this is quite a performance hit, can we detect intelligently when it is needed?\n\t// E.g. auto-draft when new objects from outside are assigned and modified?\n\t// (See failing test when deepClone just returns obj)\n\tfunction deepClonePatchValue(obj: T): T\n\tfunction deepClonePatchValue(obj: any) {\n\t\tif (!isDraftable(obj)) return obj\n\t\tif (Array.isArray(obj)) return obj.map(deepClonePatchValue)\n\t\tif (isMap(obj))\n\t\t\treturn new Map(\n\t\t\t\tArray.from(obj.entries()).map(([k, v]) => [k, deepClonePatchValue(v)])\n\t\t\t)\n\t\tif (isSet(obj)) return new Set(Array.from(obj).map(deepClonePatchValue))\n\t\tconst cloned = Object.create(getPrototypeOf(obj))\n\t\tfor (const key in obj) cloned[key] = deepClonePatchValue(obj[key])\n\t\tif (has(obj, immerable)) cloned[immerable] = obj[immerable]\n\t\treturn cloned\n\t}\n\n\tfunction clonePatchValueIfNeeded(obj: T): T {\n\t\tif (isDraft(obj)) {\n\t\t\treturn deepClonePatchValue(obj)\n\t\t} else return obj\n\t}\n\n\tloadPlugin(\"Patches\", {\n\t\tapplyPatches_,\n\t\tgeneratePatches_,\n\t\tgenerateReplacementPatches_\n\t})\n}\n","// types only!\nimport {\n\tImmerState,\n\tAnyMap,\n\tAnySet,\n\tMapState,\n\tSetState,\n\tDRAFT_STATE,\n\tgetCurrentScope,\n\tlatest,\n\tisDraftable,\n\tcreateProxy,\n\tloadPlugin,\n\tmarkChanged,\n\tdie,\n\tArchType,\n\teach\n} from \"../internal\"\n\nexport function enableMapSet() {\n\tclass DraftMap extends Map {\n\t\t[DRAFT_STATE]: MapState\n\n\t\tconstructor(target: AnyMap, parent?: ImmerState) {\n\t\t\tsuper()\n\t\t\tthis[DRAFT_STATE] = {\n\t\t\t\ttype_: ArchType.Map,\n\t\t\t\tparent_: parent,\n\t\t\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t\t\tmodified_: false,\n\t\t\t\tfinalized_: false,\n\t\t\t\tcopy_: undefined,\n\t\t\t\tassigned_: undefined,\n\t\t\t\tbase_: target,\n\t\t\t\tdraft_: this as any,\n\t\t\t\tisManual_: false,\n\t\t\t\trevoked_: false\n\t\t\t}\n\t\t}\n\n\t\tget size(): number {\n\t\t\treturn latest(this[DRAFT_STATE]).size\n\t\t}\n\n\t\thas(key: any): boolean {\n\t\t\treturn latest(this[DRAFT_STATE]).has(key)\n\t\t}\n\n\t\tset(key: any, value: any) {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (!latest(state).has(key) || latest(state).get(key) !== value) {\n\t\t\t\tprepareMapCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.assigned_!.set(key, true)\n\t\t\t\tstate.copy_!.set(key, value)\n\t\t\t\tstate.assigned_!.set(key, true)\n\t\t\t}\n\t\t\treturn this\n\t\t}\n\n\t\tdelete(key: any): boolean {\n\t\t\tif (!this.has(key)) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareMapCopy(state)\n\t\t\tmarkChanged(state)\n\t\t\tif (state.base_.has(key)) {\n\t\t\t\tstate.assigned_!.set(key, false)\n\t\t\t} else {\n\t\t\t\tstate.assigned_!.delete(key)\n\t\t\t}\n\t\t\tstate.copy_!.delete(key)\n\t\t\treturn true\n\t\t}\n\n\t\tclear() {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (latest(state).size) {\n\t\t\t\tprepareMapCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.assigned_ = new Map()\n\t\t\t\teach(state.base_, key => {\n\t\t\t\t\tstate.assigned_!.set(key, false)\n\t\t\t\t})\n\t\t\t\tstate.copy_!.clear()\n\t\t\t}\n\t\t}\n\n\t\tforEach(cb: (value: any, key: any, self: any) => void, thisArg?: any) {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tlatest(state).forEach((_value: any, key: any, _map: any) => {\n\t\t\t\tcb.call(thisArg, this.get(key), key, this)\n\t\t\t})\n\t\t}\n\n\t\tget(key: any): any {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tconst value = latest(state).get(key)\n\t\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\t\treturn value\n\t\t\t}\n\t\t\tif (value !== state.base_.get(key)) {\n\t\t\t\treturn value // either already drafted or reassigned\n\t\t\t}\n\t\t\t// despite what it looks, this creates a draft only once, see above condition\n\t\t\tconst draft = createProxy(value, state)\n\t\t\tprepareMapCopy(state)\n\t\t\tstate.copy_!.set(key, draft)\n\t\t\treturn draft\n\t\t}\n\n\t\tkeys(): IterableIterator {\n\t\t\treturn latest(this[DRAFT_STATE]).keys()\n\t\t}\n\n\t\tvalues(): IterableIterator {\n\t\t\tconst iterator = this.keys()\n\t\t\treturn {\n\t\t\t\t[Symbol.iterator]: () => this.values(),\n\t\t\t\tnext: () => {\n\t\t\t\t\tconst r = iterator.next()\n\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\tif (r.done) return r\n\t\t\t\t\tconst value = this.get(r.value)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\tvalue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} as any\n\t\t}\n\n\t\tentries(): IterableIterator<[any, any]> {\n\t\t\tconst iterator = this.keys()\n\t\t\treturn {\n\t\t\t\t[Symbol.iterator]: () => this.entries(),\n\t\t\t\tnext: () => {\n\t\t\t\t\tconst r = iterator.next()\n\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\tif (r.done) return r\n\t\t\t\t\tconst value = this.get(r.value)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\tvalue: [r.value, value]\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} as any\n\t\t}\n\n\t\t[Symbol.iterator]() {\n\t\t\treturn this.entries()\n\t\t}\n\t}\n\n\tfunction proxyMap_(target: T, parent?: ImmerState): T {\n\t\t// @ts-ignore\n\t\treturn new DraftMap(target, parent)\n\t}\n\n\tfunction prepareMapCopy(state: MapState) {\n\t\tif (!state.copy_) {\n\t\t\tstate.assigned_ = new Map()\n\t\t\tstate.copy_ = new Map(state.base_)\n\t\t}\n\t}\n\n\tclass DraftSet extends Set {\n\t\t[DRAFT_STATE]: SetState\n\t\tconstructor(target: AnySet, parent?: ImmerState) {\n\t\t\tsuper()\n\t\t\tthis[DRAFT_STATE] = {\n\t\t\t\ttype_: ArchType.Set,\n\t\t\t\tparent_: parent,\n\t\t\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t\t\tmodified_: false,\n\t\t\t\tfinalized_: false,\n\t\t\t\tcopy_: undefined,\n\t\t\t\tbase_: target,\n\t\t\t\tdraft_: this,\n\t\t\t\tdrafts_: new Map(),\n\t\t\t\trevoked_: false,\n\t\t\t\tisManual_: false\n\t\t\t}\n\t\t}\n\n\t\tget size(): number {\n\t\t\treturn latest(this[DRAFT_STATE]).size\n\t\t}\n\n\t\thas(value: any): boolean {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\t// bit of trickery here, to be able to recognize both the value, and the draft of its value\n\t\t\tif (!state.copy_) {\n\t\t\t\treturn state.base_.has(value)\n\t\t\t}\n\t\t\tif (state.copy_.has(value)) return true\n\t\t\tif (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value)))\n\t\t\t\treturn true\n\t\t\treturn false\n\t\t}\n\n\t\tadd(value: any): any {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (!this.has(value)) {\n\t\t\t\tprepareSetCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.copy_!.add(value)\n\t\t\t}\n\t\t\treturn this\n\t\t}\n\n\t\tdelete(value: any): any {\n\t\t\tif (!this.has(value)) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\tmarkChanged(state)\n\t\t\treturn (\n\t\t\t\tstate.copy_!.delete(value) ||\n\t\t\t\t(state.drafts_.has(value)\n\t\t\t\t\t? state.copy_!.delete(state.drafts_.get(value))\n\t\t\t\t\t: /* istanbul ignore next */ false)\n\t\t\t)\n\t\t}\n\n\t\tclear() {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (latest(state).size) {\n\t\t\t\tprepareSetCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.copy_!.clear()\n\t\t\t}\n\t\t}\n\n\t\tvalues(): IterableIterator {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\treturn state.copy_!.values()\n\t\t}\n\n\t\tentries(): IterableIterator<[any, any]> {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\treturn state.copy_!.entries()\n\t\t}\n\n\t\tkeys(): IterableIterator {\n\t\t\treturn this.values()\n\t\t}\n\n\t\t[Symbol.iterator]() {\n\t\t\treturn this.values()\n\t\t}\n\n\t\tforEach(cb: any, thisArg?: any) {\n\t\t\tconst iterator = this.values()\n\t\t\tlet result = iterator.next()\n\t\t\twhile (!result.done) {\n\t\t\t\tcb.call(thisArg, result.value, result.value, this)\n\t\t\t\tresult = iterator.next()\n\t\t\t}\n\t\t}\n\t}\n\tfunction proxySet_(target: T, parent?: ImmerState): T {\n\t\t// @ts-ignore\n\t\treturn new DraftSet(target, parent)\n\t}\n\n\tfunction prepareSetCopy(state: SetState) {\n\t\tif (!state.copy_) {\n\t\t\t// create drafts for all entries to preserve insertion order\n\t\t\tstate.copy_ = new Set()\n\t\t\tstate.base_.forEach(value => {\n\t\t\t\tif (isDraftable(value)) {\n\t\t\t\t\tconst draft = createProxy(value, state)\n\t\t\t\t\tstate.drafts_.set(value, draft)\n\t\t\t\t\tstate.copy_!.add(draft)\n\t\t\t\t} else {\n\t\t\t\t\tstate.copy_!.add(value)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n\n\tfunction assertUnrevoked(state: any /*ES5State | MapState | SetState*/) {\n\t\tif (state.revoked_) die(3, JSON.stringify(latest(state)))\n\t}\n\n\tloadPlugin(\"MapSet\", {proxyMap_, proxySet_})\n}\n","import {\n\tIProduce,\n\tIProduceWithPatches,\n\tImmer,\n\tDraft,\n\tImmutable\n} from \"./internal\"\n\nexport {\n\tDraft,\n\tWritableDraft,\n\tImmutable,\n\tPatch,\n\tPatchListener,\n\tProducer,\n\toriginal,\n\tcurrent,\n\tisDraft,\n\tisDraftable,\n\tNOTHING as nothing,\n\tDRAFTABLE as immerable,\n\tfreeze,\n\tObjectish,\n\tStrictMode\n} from \"./internal\"\n\nconst immer = new Immer()\n\n/**\n * The `produce` function takes a value and a \"recipe function\" (whose\n * return value often depends on the base state). The recipe function is\n * free to mutate its first argument however it wants. All mutations are\n * only ever applied to a __copy__ of the base state.\n *\n * Pass only a function to create a \"curried producer\" which relieves you\n * from passing the recipe function every time.\n *\n * Only plain objects and arrays are made mutable. All other objects are\n * considered uncopyable.\n *\n * Note: This function is __bound__ to its `Immer` instance.\n *\n * @param {any} base - the initial state\n * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified\n * @param {Function} patchListener - optional function that will be called with all the patches produced here\n * @returns {any} a new state, or the initial state if nothing was modified\n */\nexport const produce: IProduce = immer.produce\n\n/**\n * Like `produce`, but `produceWithPatches` always returns a tuple\n * [nextState, patches, inversePatches] (instead of just the next state)\n */\nexport const produceWithPatches: IProduceWithPatches = immer.produceWithPatches.bind(\n\timmer\n)\n\n/**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * Always freeze by default, even in production mode\n */\nexport const setAutoFreeze = immer.setAutoFreeze.bind(immer)\n\n/**\n * Pass true to enable strict shallow copy.\n *\n * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n */\nexport const setUseStrictShallowCopy = immer.setUseStrictShallowCopy.bind(immer)\n\n/**\n * Apply an array of Immer patches to the first argument.\n *\n * This function is a producer, which means copy-on-write is in effect.\n */\nexport const applyPatches = immer.applyPatches.bind(immer)\n\n/**\n * Create an Immer draft from the given base state, which may be a draft itself.\n * The draft can be modified until you finalize it with the `finishDraft` function.\n */\nexport const createDraft = immer.createDraft.bind(immer)\n\n/**\n * Finalize an Immer draft from a `createDraft` call, returning the base state\n * (if no changes were made) or a modified copy. The draft must *not* be\n * mutated afterwards.\n *\n * Pass a function as the 2nd argument to generate Immer patches based on the\n * changes that were made.\n */\nexport const finishDraft = immer.finishDraft.bind(immer)\n\n/**\n * This function is actually a no-op, but can be used to cast an immutable type\n * to an draft type and make TypeScript happy\n *\n * @param value\n */\nexport function castDraft(value: T): Draft {\n\treturn value as any\n}\n\n/**\n * This function is actually a no-op, but can be used to cast a mutable type\n * to an immutable type and make TypeScript happy\n * @param value\n */\nexport function castImmutable(value: T): Immutable {\n\treturn value as any\n}\n\nexport {Immer}\n\nexport {enablePatches} from \"./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git a/node_modules/immer/dist/immer.mjs b/node_modules/immer/dist/immer.mjs new file mode 100644 index 00000000..591ccf14 --- /dev/null +++ b/node_modules/immer/dist/immer.mjs @@ -0,0 +1,1231 @@ +// src/utils/env.ts +var NOTHING = Symbol.for("immer-nothing"); +var DRAFTABLE = Symbol.for("immer-draftable"); +var DRAFT_STATE = Symbol.for("immer-state"); + +// src/utils/errors.ts +var errors = process.env.NODE_ENV !== "production" ? [ + // All error codes, starting by 0: + function(plugin) { + return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.`; + }, + function(thing) { + return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`; + }, + "This object has been frozen and should not be mutated", + function(data) { + return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + data; + }, + "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.", + "Immer forbids circular references", + "The first or second argument to `produce` must be a function", + "The third argument to `produce` must be a function or undefined", + "First argument to `createDraft` must be a plain object, an array, or an immerable object", + "First argument to `finishDraft` must be a draft returned by `createDraft`", + function(thing) { + return `'current' expects a draft, got: ${thing}`; + }, + "Object.defineProperty() cannot be used on an Immer draft", + "Object.setPrototypeOf() cannot be used on an Immer draft", + "Immer only supports deleting array indices", + "Immer only supports setting array indices and the 'length' property", + function(thing) { + return `'original' expects a draft, got: ${thing}`; + } + // Note: if more errors are added, the errorOffset in Patches.ts should be increased + // See Patches.ts for additional errors +] : []; +function die(error, ...args) { + if (process.env.NODE_ENV !== "production") { + const e = errors[error]; + const msg = typeof e === "function" ? e.apply(null, args) : e; + throw new Error(`[Immer] ${msg}`); + } + throw new Error( + `[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf` + ); +} + +// src/utils/common.ts +var getPrototypeOf = Object.getPrototypeOf; +function isDraft(value) { + return !!value && !!value[DRAFT_STATE]; +} +function isDraftable(value) { + if (!value) + return false; + return isPlainObject(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor?.[DRAFTABLE] || isMap(value) || isSet(value); +} +var objectCtorString = Object.prototype.constructor.toString(); +function isPlainObject(value) { + if (!value || typeof value !== "object") + return false; + const proto = getPrototypeOf(value); + if (proto === null) { + return true; + } + const Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor; + if (Ctor === Object) + return true; + return typeof Ctor == "function" && Function.toString.call(Ctor) === objectCtorString; +} +function original(value) { + if (!isDraft(value)) + die(15, value); + return value[DRAFT_STATE].base_; +} +function each(obj, iter) { + if (getArchtype(obj) === 0 /* Object */) { + Reflect.ownKeys(obj).forEach((key) => { + iter(key, obj[key], obj); + }); + } else { + obj.forEach((entry, index) => iter(index, entry, obj)); + } +} +function getArchtype(thing) { + const state = thing[DRAFT_STATE]; + return state ? state.type_ : Array.isArray(thing) ? 1 /* Array */ : isMap(thing) ? 2 /* Map */ : isSet(thing) ? 3 /* Set */ : 0 /* Object */; +} +function has(thing, prop) { + return getArchtype(thing) === 2 /* Map */ ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop); +} +function get(thing, prop) { + return getArchtype(thing) === 2 /* Map */ ? thing.get(prop) : thing[prop]; +} +function set(thing, propOrOldValue, value) { + const t = getArchtype(thing); + if (t === 2 /* Map */) + thing.set(propOrOldValue, value); + else if (t === 3 /* Set */) { + thing.add(value); + } else + thing[propOrOldValue] = value; +} +function is(x, y) { + if (x === y) { + return x !== 0 || 1 / x === 1 / y; + } else { + return x !== x && y !== y; + } +} +function isMap(target) { + return target instanceof Map; +} +function isSet(target) { + return target instanceof Set; +} +function latest(state) { + return state.copy_ || state.base_; +} +function shallowCopy(base, strict) { + if (isMap(base)) { + return new Map(base); + } + if (isSet(base)) { + return new Set(base); + } + if (Array.isArray(base)) + return Array.prototype.slice.call(base); + const isPlain = isPlainObject(base); + if (strict === true || strict === "class_only" && !isPlain) { + const descriptors = Object.getOwnPropertyDescriptors(base); + delete descriptors[DRAFT_STATE]; + let keys = Reflect.ownKeys(descriptors); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const desc = descriptors[key]; + if (desc.writable === false) { + desc.writable = true; + desc.configurable = true; + } + if (desc.get || desc.set) + descriptors[key] = { + configurable: true, + writable: true, + // could live with !!desc.set as well here... + enumerable: desc.enumerable, + value: base[key] + }; + } + return Object.create(getPrototypeOf(base), descriptors); + } else { + const proto = getPrototypeOf(base); + if (proto !== null && isPlain) { + return { ...base }; + } + const obj = Object.create(proto); + return Object.assign(obj, base); + } +} +function freeze(obj, deep = false) { + if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) + return obj; + if (getArchtype(obj) > 1) { + obj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections; + } + Object.freeze(obj); + if (deep) + Object.entries(obj).forEach(([key, value]) => freeze(value, true)); + return obj; +} +function dontMutateFrozenCollections() { + die(2); +} +function isFrozen(obj) { + return Object.isFrozen(obj); +} + +// src/utils/plugins.ts +var plugins = {}; +function getPlugin(pluginKey) { + const plugin = plugins[pluginKey]; + if (!plugin) { + die(0, pluginKey); + } + return plugin; +} +function loadPlugin(pluginKey, implementation) { + if (!plugins[pluginKey]) + plugins[pluginKey] = implementation; +} + +// src/core/scope.ts +var currentScope; +function getCurrentScope() { + return currentScope; +} +function createScope(parent_, immer_) { + return { + drafts_: [], + parent_, + immer_, + // Whenever the modified draft contains a draft from another scope, we + // need to prevent auto-freezing so the unowned draft can be finalized. + canAutoFreeze_: true, + unfinalizedDrafts_: 0 + }; +} +function usePatchesInScope(scope, patchListener) { + if (patchListener) { + getPlugin("Patches"); + scope.patches_ = []; + scope.inversePatches_ = []; + scope.patchListener_ = patchListener; + } +} +function revokeScope(scope) { + leaveScope(scope); + scope.drafts_.forEach(revokeDraft); + scope.drafts_ = null; +} +function leaveScope(scope) { + if (scope === currentScope) { + currentScope = scope.parent_; + } +} +function enterScope(immer2) { + return currentScope = createScope(currentScope, immer2); +} +function revokeDraft(draft) { + const state = draft[DRAFT_STATE]; + if (state.type_ === 0 /* Object */ || state.type_ === 1 /* Array */) + state.revoke_(); + else + state.revoked_ = true; +} + +// src/core/finalize.ts +function processResult(result, scope) { + scope.unfinalizedDrafts_ = scope.drafts_.length; + const baseDraft = scope.drafts_[0]; + const isReplaced = result !== void 0 && result !== baseDraft; + if (isReplaced) { + if (baseDraft[DRAFT_STATE].modified_) { + revokeScope(scope); + die(4); + } + if (isDraftable(result)) { + result = finalize(scope, result); + if (!scope.parent_) + maybeFreeze(scope, result); + } + if (scope.patches_) { + getPlugin("Patches").generateReplacementPatches_( + baseDraft[DRAFT_STATE].base_, + result, + scope.patches_, + scope.inversePatches_ + ); + } + } else { + result = finalize(scope, baseDraft, []); + } + revokeScope(scope); + if (scope.patches_) { + scope.patchListener_(scope.patches_, scope.inversePatches_); + } + return result !== NOTHING ? result : void 0; +} +function finalize(rootScope, value, path) { + if (isFrozen(value)) + return value; + const state = value[DRAFT_STATE]; + if (!state) { + each( + value, + (key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path) + ); + return value; + } + if (state.scope_ !== rootScope) + return value; + if (!state.modified_) { + maybeFreeze(rootScope, state.base_, true); + return state.base_; + } + if (!state.finalized_) { + state.finalized_ = true; + state.scope_.unfinalizedDrafts_--; + const result = state.copy_; + let resultEach = result; + let isSet2 = false; + if (state.type_ === 3 /* Set */) { + resultEach = new Set(result); + result.clear(); + isSet2 = true; + } + each( + resultEach, + (key, childValue) => finalizeProperty(rootScope, state, result, key, childValue, path, isSet2) + ); + maybeFreeze(rootScope, result, false); + if (path && rootScope.patches_) { + getPlugin("Patches").generatePatches_( + state, + path, + rootScope.patches_, + rootScope.inversePatches_ + ); + } + } + return state.copy_; +} +function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath, targetIsSet) { + if (process.env.NODE_ENV !== "production" && childValue === targetObject) + die(5); + if (isDraft(childValue)) { + const path = rootPath && parentState && parentState.type_ !== 3 /* Set */ && // Set objects are atomic since they have no keys. + !has(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0; + const res = finalize(rootScope, childValue, path); + set(targetObject, prop, res); + if (isDraft(res)) { + rootScope.canAutoFreeze_ = false; + } else + return; + } else if (targetIsSet) { + targetObject.add(childValue); + } + if (isDraftable(childValue) && !isFrozen(childValue)) { + if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) { + return; + } + finalize(rootScope, childValue); + if ((!parentState || !parentState.scope_.parent_) && typeof prop !== "symbol" && Object.prototype.propertyIsEnumerable.call(targetObject, prop)) + maybeFreeze(rootScope, childValue); + } +} +function maybeFreeze(scope, value, deep = false) { + if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) { + freeze(value, deep); + } +} + +// src/core/proxy.ts +function createProxyProxy(base, parent) { + const isArray = Array.isArray(base); + const state = { + type_: isArray ? 1 /* Array */ : 0 /* Object */, + // Track which produce call this is associated with. + scope_: parent ? parent.scope_ : getCurrentScope(), + // True for both shallow and deep changes. + modified_: false, + // Used during finalization. + finalized_: false, + // Track which properties have been assigned (true) or deleted (false). + assigned_: {}, + // The parent draft state. + parent_: parent, + // The base state. + base_: base, + // The base proxy. + draft_: null, + // set below + // The base copy with any updated values. + copy_: null, + // Called by the `produce` function. + revoke_: null, + isManual_: false + }; + let target = state; + let traps = objectTraps; + if (isArray) { + target = [state]; + traps = arrayTraps; + } + const { revoke, proxy } = Proxy.revocable(target, traps); + state.draft_ = proxy; + state.revoke_ = revoke; + return proxy; +} +var objectTraps = { + get(state, prop) { + if (prop === DRAFT_STATE) + return state; + const source = latest(state); + if (!has(source, prop)) { + return readPropFromProto(state, source, prop); + } + const value = source[prop]; + if (state.finalized_ || !isDraftable(value)) { + return value; + } + if (value === peek(state.base_, prop)) { + prepareCopy(state); + return state.copy_[prop] = createProxy(value, state); + } + return value; + }, + has(state, prop) { + return prop in latest(state); + }, + ownKeys(state) { + return Reflect.ownKeys(latest(state)); + }, + set(state, prop, value) { + const desc = getDescriptorFromProto(latest(state), prop); + if (desc?.set) { + desc.set.call(state.draft_, value); + return true; + } + if (!state.modified_) { + const current2 = peek(latest(state), prop); + const currentState = current2?.[DRAFT_STATE]; + if (currentState && currentState.base_ === value) { + state.copy_[prop] = value; + state.assigned_[prop] = false; + return true; + } + if (is(value, current2) && (value !== void 0 || has(state.base_, prop))) + return true; + prepareCopy(state); + markChanged(state); + } + if (state.copy_[prop] === value && // special case: handle new props with value 'undefined' + (value !== void 0 || prop in state.copy_) || // special case: NaN + Number.isNaN(value) && Number.isNaN(state.copy_[prop])) + return true; + state.copy_[prop] = value; + state.assigned_[prop] = true; + return true; + }, + deleteProperty(state, prop) { + if (peek(state.base_, prop) !== void 0 || prop in state.base_) { + state.assigned_[prop] = false; + prepareCopy(state); + markChanged(state); + } else { + delete state.assigned_[prop]; + } + if (state.copy_) { + delete state.copy_[prop]; + } + return true; + }, + // Note: We never coerce `desc.value` into an Immer draft, because we can't make + // the same guarantee in ES5 mode. + getOwnPropertyDescriptor(state, prop) { + const owner = latest(state); + const desc = Reflect.getOwnPropertyDescriptor(owner, prop); + if (!desc) + return desc; + return { + writable: true, + configurable: state.type_ !== 1 /* Array */ || prop !== "length", + enumerable: desc.enumerable, + value: owner[prop] + }; + }, + defineProperty() { + die(11); + }, + getPrototypeOf(state) { + return getPrototypeOf(state.base_); + }, + setPrototypeOf() { + die(12); + } +}; +var arrayTraps = {}; +each(objectTraps, (key, fn) => { + arrayTraps[key] = function() { + arguments[0] = arguments[0][0]; + return fn.apply(this, arguments); + }; +}); +arrayTraps.deleteProperty = function(state, prop) { + if (process.env.NODE_ENV !== "production" && isNaN(parseInt(prop))) + die(13); + return arrayTraps.set.call(this, state, prop, void 0); +}; +arrayTraps.set = function(state, prop, value) { + if (process.env.NODE_ENV !== "production" && prop !== "length" && isNaN(parseInt(prop))) + die(14); + return objectTraps.set.call(this, state[0], prop, value, state[0]); +}; +function peek(draft, prop) { + const state = draft[DRAFT_STATE]; + const source = state ? latest(state) : draft; + return source[prop]; +} +function readPropFromProto(state, source, prop) { + const desc = getDescriptorFromProto(source, prop); + return desc ? `value` in desc ? desc.value : ( + // This is a very special case, if the prop is a getter defined by the + // prototype, we should invoke it with the draft as context! + desc.get?.call(state.draft_) + ) : void 0; +} +function getDescriptorFromProto(source, prop) { + if (!(prop in source)) + return void 0; + let proto = getPrototypeOf(source); + while (proto) { + const desc = Object.getOwnPropertyDescriptor(proto, prop); + if (desc) + return desc; + proto = getPrototypeOf(proto); + } + return void 0; +} +function markChanged(state) { + if (!state.modified_) { + state.modified_ = true; + if (state.parent_) { + markChanged(state.parent_); + } + } +} +function prepareCopy(state) { + if (!state.copy_) { + state.copy_ = shallowCopy( + state.base_, + state.scope_.immer_.useStrictShallowCopy_ + ); + } +} + +// src/core/immerClass.ts +var Immer2 = class { + constructor(config) { + this.autoFreeze_ = true; + this.useStrictShallowCopy_ = false; + /** + * The `produce` function takes a value and a "recipe function" (whose + * return value often depends on the base state). The recipe function is + * free to mutate its first argument however it wants. All mutations are + * only ever applied to a __copy__ of the base state. + * + * Pass only a function to create a "curried producer" which relieves you + * from passing the recipe function every time. + * + * Only plain objects and arrays are made mutable. All other objects are + * considered uncopyable. + * + * Note: This function is __bound__ to its `Immer` instance. + * + * @param {any} base - the initial state + * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified + * @param {Function} patchListener - optional function that will be called with all the patches produced here + * @returns {any} a new state, or the initial state if nothing was modified + */ + this.produce = (base, recipe, patchListener) => { + if (typeof base === "function" && typeof recipe !== "function") { + const defaultBase = recipe; + recipe = base; + const self = this; + return function curriedProduce(base2 = defaultBase, ...args) { + return self.produce(base2, (draft) => recipe.call(this, draft, ...args)); + }; + } + if (typeof recipe !== "function") + die(6); + if (patchListener !== void 0 && typeof patchListener !== "function") + die(7); + let result; + if (isDraftable(base)) { + const scope = enterScope(this); + const proxy = createProxy(base, void 0); + let hasError = true; + try { + result = recipe(proxy); + hasError = false; + } finally { + if (hasError) + revokeScope(scope); + else + leaveScope(scope); + } + usePatchesInScope(scope, patchListener); + return processResult(result, scope); + } else if (!base || typeof base !== "object") { + result = recipe(base); + if (result === void 0) + result = base; + if (result === NOTHING) + result = void 0; + if (this.autoFreeze_) + freeze(result, true); + if (patchListener) { + const p = []; + const ip = []; + getPlugin("Patches").generateReplacementPatches_(base, result, p, ip); + patchListener(p, ip); + } + return result; + } else + die(1, base); + }; + this.produceWithPatches = (base, recipe) => { + if (typeof base === "function") { + return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args)); + } + let patches, inversePatches; + const result = this.produce(base, recipe, (p, ip) => { + patches = p; + inversePatches = ip; + }); + return [result, patches, inversePatches]; + }; + if (typeof config?.autoFreeze === "boolean") + this.setAutoFreeze(config.autoFreeze); + if (typeof config?.useStrictShallowCopy === "boolean") + this.setUseStrictShallowCopy(config.useStrictShallowCopy); + } + createDraft(base) { + if (!isDraftable(base)) + die(8); + if (isDraft(base)) + base = current(base); + const scope = enterScope(this); + const proxy = createProxy(base, void 0); + proxy[DRAFT_STATE].isManual_ = true; + leaveScope(scope); + return proxy; + } + finishDraft(draft, patchListener) { + const state = draft && draft[DRAFT_STATE]; + if (!state || !state.isManual_) + die(9); + const { scope_: scope } = state; + usePatchesInScope(scope, patchListener); + return processResult(void 0, scope); + } + /** + * Pass true to automatically freeze all copies created by Immer. + * + * By default, auto-freezing is enabled. + */ + setAutoFreeze(value) { + this.autoFreeze_ = value; + } + /** + * Pass true to enable strict shallow copy. + * + * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties. + */ + setUseStrictShallowCopy(value) { + this.useStrictShallowCopy_ = value; + } + applyPatches(base, patches) { + let i; + for (i = patches.length - 1; i >= 0; i--) { + const patch = patches[i]; + if (patch.path.length === 0 && patch.op === "replace") { + base = patch.value; + break; + } + } + if (i > -1) { + patches = patches.slice(i + 1); + } + const applyPatchesImpl = getPlugin("Patches").applyPatches_; + if (isDraft(base)) { + return applyPatchesImpl(base, patches); + } + return this.produce( + base, + (draft) => applyPatchesImpl(draft, patches) + ); + } +}; +function createProxy(value, parent) { + const draft = isMap(value) ? getPlugin("MapSet").proxyMap_(value, parent) : isSet(value) ? getPlugin("MapSet").proxySet_(value, parent) : createProxyProxy(value, parent); + const scope = parent ? parent.scope_ : getCurrentScope(); + scope.drafts_.push(draft); + return draft; +} + +// src/core/current.ts +function current(value) { + if (!isDraft(value)) + die(10, value); + return currentImpl(value); +} +function currentImpl(value) { + if (!isDraftable(value) || isFrozen(value)) + return value; + const state = value[DRAFT_STATE]; + let copy; + if (state) { + if (!state.modified_) + return state.base_; + state.finalized_ = true; + copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_); + } else { + copy = shallowCopy(value, true); + } + each(copy, (key, childValue) => { + set(copy, key, currentImpl(childValue)); + }); + if (state) { + state.finalized_ = false; + } + return copy; +} + +// src/plugins/patches.ts +function enablePatches() { + const errorOffset = 16; + if (process.env.NODE_ENV !== "production") { + errors.push( + 'Sets cannot have "replace" patches.', + function(op) { + return "Unsupported patch operation: " + op; + }, + function(path) { + return "Cannot apply patch, path doesn't resolve: " + path; + }, + "Patching reserved attributes like __proto__, prototype and constructor is not allowed" + ); + } + const REPLACE = "replace"; + const ADD = "add"; + const REMOVE = "remove"; + function generatePatches_(state, basePath, patches, inversePatches) { + switch (state.type_) { + case 0 /* Object */: + case 2 /* Map */: + return generatePatchesFromAssigned( + state, + basePath, + patches, + inversePatches + ); + case 1 /* Array */: + return generateArrayPatches(state, basePath, patches, inversePatches); + case 3 /* Set */: + return generateSetPatches( + state, + basePath, + patches, + inversePatches + ); + } + } + function generateArrayPatches(state, basePath, patches, inversePatches) { + let { base_, assigned_ } = state; + let copy_ = state.copy_; + if (copy_.length < base_.length) { + ; + [base_, copy_] = [copy_, base_]; + [patches, inversePatches] = [inversePatches, patches]; + } + for (let i = 0; i < base_.length; i++) { + if (assigned_[i] && copy_[i] !== base_[i]) { + const path = basePath.concat([i]); + patches.push({ + op: REPLACE, + path, + // Need to maybe clone it, as it can in fact be the original value + // due to the base/copy inversion at the start of this function + value: clonePatchValueIfNeeded(copy_[i]) + }); + inversePatches.push({ + op: REPLACE, + path, + value: clonePatchValueIfNeeded(base_[i]) + }); + } + } + for (let i = base_.length; i < copy_.length; i++) { + const path = basePath.concat([i]); + patches.push({ + op: ADD, + path, + // Need to maybe clone it, as it can in fact be the original value + // due to the base/copy inversion at the start of this function + value: clonePatchValueIfNeeded(copy_[i]) + }); + } + for (let i = copy_.length - 1; base_.length <= i; --i) { + const path = basePath.concat([i]); + inversePatches.push({ + op: REMOVE, + path + }); + } + } + function generatePatchesFromAssigned(state, basePath, patches, inversePatches) { + const { base_, copy_ } = state; + each(state.assigned_, (key, assignedValue) => { + const origValue = get(base_, key); + const value = get(copy_, key); + const op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD; + if (origValue === value && op === REPLACE) + return; + const path = basePath.concat(key); + patches.push(op === REMOVE ? { op, path } : { op, path, value }); + inversePatches.push( + op === ADD ? { op: REMOVE, path } : op === REMOVE ? { op: ADD, path, value: clonePatchValueIfNeeded(origValue) } : { op: REPLACE, path, value: clonePatchValueIfNeeded(origValue) } + ); + }); + } + function generateSetPatches(state, basePath, patches, inversePatches) { + let { base_, copy_ } = state; + let i = 0; + base_.forEach((value) => { + if (!copy_.has(value)) { + const path = basePath.concat([i]); + patches.push({ + op: REMOVE, + path, + value + }); + inversePatches.unshift({ + op: ADD, + path, + value + }); + } + i++; + }); + i = 0; + copy_.forEach((value) => { + if (!base_.has(value)) { + const path = basePath.concat([i]); + patches.push({ + op: ADD, + path, + value + }); + inversePatches.unshift({ + op: REMOVE, + path, + value + }); + } + i++; + }); + } + function generateReplacementPatches_(baseValue, replacement, patches, inversePatches) { + patches.push({ + op: REPLACE, + path: [], + value: replacement === NOTHING ? void 0 : replacement + }); + inversePatches.push({ + op: REPLACE, + path: [], + value: baseValue + }); + } + function applyPatches_(draft, patches) { + patches.forEach((patch) => { + const { path, op } = patch; + let base = draft; + for (let i = 0; i < path.length - 1; i++) { + const parentType = getArchtype(base); + let p = path[i]; + if (typeof p !== "string" && typeof p !== "number") { + p = "" + p; + } + if ((parentType === 0 /* Object */ || parentType === 1 /* Array */) && (p === "__proto__" || p === "constructor")) + die(errorOffset + 3); + if (typeof base === "function" && p === "prototype") + die(errorOffset + 3); + base = get(base, p); + if (typeof base !== "object") + die(errorOffset + 2, path.join("/")); + } + const type = getArchtype(base); + const value = deepClonePatchValue(patch.value); + const key = path[path.length - 1]; + switch (op) { + case REPLACE: + switch (type) { + case 2 /* Map */: + return base.set(key, value); + case 3 /* Set */: + die(errorOffset); + default: + return base[key] = value; + } + case ADD: + switch (type) { + case 1 /* Array */: + return key === "-" ? base.push(value) : base.splice(key, 0, value); + case 2 /* Map */: + return base.set(key, value); + case 3 /* Set */: + return base.add(value); + default: + return base[key] = value; + } + case REMOVE: + switch (type) { + case 1 /* Array */: + return base.splice(key, 1); + case 2 /* Map */: + return base.delete(key); + case 3 /* Set */: + return base.delete(patch.value); + default: + return delete base[key]; + } + default: + die(errorOffset + 1, op); + } + }); + return draft; + } + function deepClonePatchValue(obj) { + if (!isDraftable(obj)) + return obj; + if (Array.isArray(obj)) + return obj.map(deepClonePatchValue); + if (isMap(obj)) + return new Map( + Array.from(obj.entries()).map(([k, v]) => [k, deepClonePatchValue(v)]) + ); + if (isSet(obj)) + return new Set(Array.from(obj).map(deepClonePatchValue)); + const cloned = Object.create(getPrototypeOf(obj)); + for (const key in obj) + cloned[key] = deepClonePatchValue(obj[key]); + if (has(obj, DRAFTABLE)) + cloned[DRAFTABLE] = obj[DRAFTABLE]; + return cloned; + } + function clonePatchValueIfNeeded(obj) { + if (isDraft(obj)) { + return deepClonePatchValue(obj); + } else + return obj; + } + loadPlugin("Patches", { + applyPatches_, + generatePatches_, + generateReplacementPatches_ + }); +} + +// src/plugins/mapset.ts +function enableMapSet() { + class DraftMap extends Map { + constructor(target, parent) { + super(); + this[DRAFT_STATE] = { + type_: 2 /* Map */, + parent_: parent, + scope_: parent ? parent.scope_ : getCurrentScope(), + modified_: false, + finalized_: false, + copy_: void 0, + assigned_: void 0, + base_: target, + draft_: this, + isManual_: false, + revoked_: false + }; + } + get size() { + return latest(this[DRAFT_STATE]).size; + } + has(key) { + return latest(this[DRAFT_STATE]).has(key); + } + set(key, value) { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + if (!latest(state).has(key) || latest(state).get(key) !== value) { + prepareMapCopy(state); + markChanged(state); + state.assigned_.set(key, true); + state.copy_.set(key, value); + state.assigned_.set(key, true); + } + return this; + } + delete(key) { + if (!this.has(key)) { + return false; + } + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + prepareMapCopy(state); + markChanged(state); + if (state.base_.has(key)) { + state.assigned_.set(key, false); + } else { + state.assigned_.delete(key); + } + state.copy_.delete(key); + return true; + } + clear() { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + if (latest(state).size) { + prepareMapCopy(state); + markChanged(state); + state.assigned_ = /* @__PURE__ */ new Map(); + each(state.base_, (key) => { + state.assigned_.set(key, false); + }); + state.copy_.clear(); + } + } + forEach(cb, thisArg) { + const state = this[DRAFT_STATE]; + latest(state).forEach((_value, key, _map) => { + cb.call(thisArg, this.get(key), key, this); + }); + } + get(key) { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + const value = latest(state).get(key); + if (state.finalized_ || !isDraftable(value)) { + return value; + } + if (value !== state.base_.get(key)) { + return value; + } + const draft = createProxy(value, state); + prepareMapCopy(state); + state.copy_.set(key, draft); + return draft; + } + keys() { + return latest(this[DRAFT_STATE]).keys(); + } + values() { + const iterator = this.keys(); + return { + [Symbol.iterator]: () => this.values(), + next: () => { + const r = iterator.next(); + if (r.done) + return r; + const value = this.get(r.value); + return { + done: false, + value + }; + } + }; + } + entries() { + const iterator = this.keys(); + return { + [Symbol.iterator]: () => this.entries(), + next: () => { + const r = iterator.next(); + if (r.done) + return r; + const value = this.get(r.value); + return { + done: false, + value: [r.value, value] + }; + } + }; + } + [(DRAFT_STATE, Symbol.iterator)]() { + return this.entries(); + } + } + function proxyMap_(target, parent) { + return new DraftMap(target, parent); + } + function prepareMapCopy(state) { + if (!state.copy_) { + state.assigned_ = /* @__PURE__ */ new Map(); + state.copy_ = new Map(state.base_); + } + } + class DraftSet extends Set { + constructor(target, parent) { + super(); + this[DRAFT_STATE] = { + type_: 3 /* Set */, + parent_: parent, + scope_: parent ? parent.scope_ : getCurrentScope(), + modified_: false, + finalized_: false, + copy_: void 0, + base_: target, + draft_: this, + drafts_: /* @__PURE__ */ new Map(), + revoked_: false, + isManual_: false + }; + } + get size() { + return latest(this[DRAFT_STATE]).size; + } + has(value) { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + if (!state.copy_) { + return state.base_.has(value); + } + if (state.copy_.has(value)) + return true; + if (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value))) + return true; + return false; + } + add(value) { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + if (!this.has(value)) { + prepareSetCopy(state); + markChanged(state); + state.copy_.add(value); + } + return this; + } + delete(value) { + if (!this.has(value)) { + return false; + } + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + prepareSetCopy(state); + markChanged(state); + return state.copy_.delete(value) || (state.drafts_.has(value) ? state.copy_.delete(state.drafts_.get(value)) : ( + /* istanbul ignore next */ + false + )); + } + clear() { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + if (latest(state).size) { + prepareSetCopy(state); + markChanged(state); + state.copy_.clear(); + } + } + values() { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + prepareSetCopy(state); + return state.copy_.values(); + } + entries() { + const state = this[DRAFT_STATE]; + assertUnrevoked(state); + prepareSetCopy(state); + return state.copy_.entries(); + } + keys() { + return this.values(); + } + [(DRAFT_STATE, Symbol.iterator)]() { + return this.values(); + } + forEach(cb, thisArg) { + const iterator = this.values(); + let result = iterator.next(); + while (!result.done) { + cb.call(thisArg, result.value, result.value, this); + result = iterator.next(); + } + } + } + function proxySet_(target, parent) { + return new DraftSet(target, parent); + } + function prepareSetCopy(state) { + if (!state.copy_) { + state.copy_ = /* @__PURE__ */ new Set(); + state.base_.forEach((value) => { + if (isDraftable(value)) { + const draft = createProxy(value, state); + state.drafts_.set(value, draft); + state.copy_.add(draft); + } else { + state.copy_.add(value); + } + }); + } + } + function assertUnrevoked(state) { + if (state.revoked_) + die(3, JSON.stringify(latest(state))); + } + loadPlugin("MapSet", { proxyMap_, proxySet_ }); +} + +// src/immer.ts +var immer = new Immer2(); +var produce = immer.produce; +var produceWithPatches = immer.produceWithPatches.bind( + immer +); +var setAutoFreeze = immer.setAutoFreeze.bind(immer); +var setUseStrictShallowCopy = immer.setUseStrictShallowCopy.bind(immer); +var applyPatches = immer.applyPatches.bind(immer); +var createDraft = immer.createDraft.bind(immer); +var finishDraft = immer.finishDraft.bind(immer); +function castDraft(value) { + return value; +} +function castImmutable(value) { + return value; +} +export { + Immer2 as Immer, + applyPatches, + castDraft, + castImmutable, + createDraft, + current, + enableMapSet, + enablePatches, + finishDraft, + freeze, + DRAFTABLE as immerable, + isDraft, + isDraftable, + NOTHING as nothing, + original, + produce, + produceWithPatches, + setAutoFreeze, + setUseStrictShallowCopy +}; +//# sourceMappingURL=immer.mjs.map \ No newline at end of file diff --git a/node_modules/immer/dist/immer.mjs.map b/node_modules/immer/dist/immer.mjs.map new file mode 100644 index 00000000..c98cbbf7 --- /dev/null +++ b/node_modules/immer/dist/immer.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/utils/env.ts","../src/utils/errors.ts","../src/utils/common.ts","../src/utils/plugins.ts","../src/core/scope.ts","../src/core/finalize.ts","../src/core/proxy.ts","../src/core/immerClass.ts","../src/core/current.ts","../src/plugins/patches.ts","../src/plugins/mapset.ts","../src/immer.ts"],"sourcesContent":["// Should be no imports here!\n\n/**\n * The sentinel value returned by producers to replace the draft with undefined.\n */\nexport const NOTHING: unique symbol = Symbol.for(\"immer-nothing\")\n\n/**\n * To let Immer treat your class instances as plain immutable objects\n * (albeit with a custom prototype), you must define either an instance property\n * or a static property on each of your custom classes.\n *\n * Otherwise, your class instance will never be drafted, which means it won't be\n * safe to mutate in a produce callback.\n */\nexport const DRAFTABLE: unique symbol = Symbol.for(\"immer-draftable\")\n\nexport const DRAFT_STATE: unique symbol = Symbol.for(\"immer-state\")\n","export const errors =\n\tprocess.env.NODE_ENV !== \"production\"\n\t\t? [\n\t\t\t\t// All error codes, starting by 0:\n\t\t\t\tfunction(plugin: string) {\n\t\t\t\t\treturn `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \\`enable${plugin}()\\` when initializing your application.`\n\t\t\t\t},\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`\n\t\t\t\t},\n\t\t\t\t\"This object has been frozen and should not be mutated\",\n\t\t\t\tfunction(data: any) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t\"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? \" +\n\t\t\t\t\t\tdata\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t\t\"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.\",\n\t\t\t\t\"Immer forbids circular references\",\n\t\t\t\t\"The first or second argument to `produce` must be a function\",\n\t\t\t\t\"The third argument to `produce` must be a function or undefined\",\n\t\t\t\t\"First argument to `createDraft` must be a plain object, an array, or an immerable object\",\n\t\t\t\t\"First argument to `finishDraft` must be a draft returned by `createDraft`\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'current' expects a draft, got: ${thing}`\n\t\t\t\t},\n\t\t\t\t\"Object.defineProperty() cannot be used on an Immer draft\",\n\t\t\t\t\"Object.setPrototypeOf() cannot be used on an Immer draft\",\n\t\t\t\t\"Immer only supports deleting array indices\",\n\t\t\t\t\"Immer only supports setting array indices and the 'length' property\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'original' expects a draft, got: ${thing}`\n\t\t\t\t}\n\t\t\t\t// Note: if more errors are added, the errorOffset in Patches.ts should be increased\n\t\t\t\t// See Patches.ts for additional errors\n\t\t ]\n\t\t: []\n\nexport function die(error: number, ...args: any[]): never {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tconst e = errors[error]\n\t\tconst msg = typeof e === \"function\" ? e.apply(null, args as any) : e\n\t\tthrow new Error(`[Immer] ${msg}`)\n\t}\n\tthrow new Error(\n\t\t`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`\n\t)\n}\n","import {\n\tDRAFT_STATE,\n\tDRAFTABLE,\n\tObjectish,\n\tDrafted,\n\tAnyObject,\n\tAnyMap,\n\tAnySet,\n\tImmerState,\n\tArchType,\n\tdie,\n\tStrictMode\n} from \"../internal\"\n\nexport const getPrototypeOf = Object.getPrototypeOf\n\n/** Returns true if the given value is an Immer draft */\n/*#__PURE__*/\nexport function isDraft(value: any): boolean {\n\treturn !!value && !!value[DRAFT_STATE]\n}\n\n/** Returns true if the given value can be drafted by Immer */\n/*#__PURE__*/\nexport function isDraftable(value: any): boolean {\n\tif (!value) return false\n\treturn (\n\t\tisPlainObject(value) ||\n\t\tArray.isArray(value) ||\n\t\t!!value[DRAFTABLE] ||\n\t\t!!value.constructor?.[DRAFTABLE] ||\n\t\tisMap(value) ||\n\t\tisSet(value)\n\t)\n}\n\nconst objectCtorString = Object.prototype.constructor.toString()\n/*#__PURE__*/\nexport function isPlainObject(value: any): boolean {\n\tif (!value || typeof value !== \"object\") return false\n\tconst proto = getPrototypeOf(value)\n\tif (proto === null) {\n\t\treturn true\n\t}\n\tconst Ctor =\n\t\tObject.hasOwnProperty.call(proto, \"constructor\") && proto.constructor\n\n\tif (Ctor === Object) return true\n\n\treturn (\n\t\ttypeof Ctor == \"function\" &&\n\t\tFunction.toString.call(Ctor) === objectCtorString\n\t)\n}\n\n/** Get the underlying object that is represented by the given draft */\n/*#__PURE__*/\nexport function original(value: T): T | undefined\nexport function original(value: Drafted): any {\n\tif (!isDraft(value)) die(15, value)\n\treturn value[DRAFT_STATE].base_\n}\n\n/**\n * Each iterates a map, set or array.\n * Or, if any other kind of object, all of its own properties.\n * Regardless whether they are enumerable or symbols\n */\nexport function each(\n\tobj: T,\n\titer: (key: string | number, value: any, source: T) => void\n): void\nexport function each(obj: any, iter: any) {\n\tif (getArchtype(obj) === ArchType.Object) {\n\t\tReflect.ownKeys(obj).forEach(key => {\n\t\t\titer(key, obj[key], obj)\n\t\t})\n\t} else {\n\t\tobj.forEach((entry: any, index: any) => iter(index, entry, obj))\n\t}\n}\n\n/*#__PURE__*/\nexport function getArchtype(thing: any): ArchType {\n\tconst state: undefined | ImmerState = thing[DRAFT_STATE]\n\treturn state\n\t\t? state.type_\n\t\t: Array.isArray(thing)\n\t\t? ArchType.Array\n\t\t: isMap(thing)\n\t\t? ArchType.Map\n\t\t: isSet(thing)\n\t\t? ArchType.Set\n\t\t: ArchType.Object\n}\n\n/*#__PURE__*/\nexport function has(thing: any, prop: PropertyKey): boolean {\n\treturn getArchtype(thing) === ArchType.Map\n\t\t? thing.has(prop)\n\t\t: Object.prototype.hasOwnProperty.call(thing, prop)\n}\n\n/*#__PURE__*/\nexport function get(thing: AnyMap | AnyObject, prop: PropertyKey): any {\n\t// @ts-ignore\n\treturn getArchtype(thing) === ArchType.Map ? thing.get(prop) : thing[prop]\n}\n\n/*#__PURE__*/\nexport function set(thing: any, propOrOldValue: PropertyKey, value: any) {\n\tconst t = getArchtype(thing)\n\tif (t === ArchType.Map) thing.set(propOrOldValue, value)\n\telse if (t === ArchType.Set) {\n\t\tthing.add(value)\n\t} else thing[propOrOldValue] = value\n}\n\n/*#__PURE__*/\nexport function is(x: any, y: any): boolean {\n\t// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n\tif (x === y) {\n\t\treturn x !== 0 || 1 / x === 1 / y\n\t} else {\n\t\treturn x !== x && y !== y\n\t}\n}\n\n/*#__PURE__*/\nexport function isMap(target: any): target is AnyMap {\n\treturn target instanceof Map\n}\n\n/*#__PURE__*/\nexport function isSet(target: any): target is AnySet {\n\treturn target instanceof Set\n}\n/*#__PURE__*/\nexport function latest(state: ImmerState): any {\n\treturn state.copy_ || state.base_\n}\n\n/*#__PURE__*/\nexport function shallowCopy(base: any, strict: StrictMode) {\n\tif (isMap(base)) {\n\t\treturn new Map(base)\n\t}\n\tif (isSet(base)) {\n\t\treturn new Set(base)\n\t}\n\tif (Array.isArray(base)) return Array.prototype.slice.call(base)\n\n\tconst isPlain = isPlainObject(base)\n\n\tif (strict === true || (strict === \"class_only\" && !isPlain)) {\n\t\t// Perform a strict copy\n\t\tconst descriptors = Object.getOwnPropertyDescriptors(base)\n\t\tdelete descriptors[DRAFT_STATE as any]\n\t\tlet keys = Reflect.ownKeys(descriptors)\n\t\tfor (let i = 0; i < keys.length; i++) {\n\t\t\tconst key: any = keys[i]\n\t\t\tconst desc = descriptors[key]\n\t\t\tif (desc.writable === false) {\n\t\t\t\tdesc.writable = true\n\t\t\t\tdesc.configurable = true\n\t\t\t}\n\t\t\t// like object.assign, we will read any _own_, get/set accessors. This helps in dealing\n\t\t\t// with libraries that trap values, like mobx or vue\n\t\t\t// unlike object.assign, non-enumerables will be copied as well\n\t\t\tif (desc.get || desc.set)\n\t\t\t\tdescriptors[key] = {\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\twritable: true, // could live with !!desc.set as well here...\n\t\t\t\t\tenumerable: desc.enumerable,\n\t\t\t\t\tvalue: base[key]\n\t\t\t\t}\n\t\t}\n\t\treturn Object.create(getPrototypeOf(base), descriptors)\n\t} else {\n\t\t// perform a sloppy copy\n\t\tconst proto = getPrototypeOf(base)\n\t\tif (proto !== null && isPlain) {\n\t\t\treturn {...base} // assumption: better inner class optimization than the assign below\n\t\t}\n\t\tconst obj = Object.create(proto)\n\t\treturn Object.assign(obj, base)\n\t}\n}\n\n/**\n * Freezes draftable objects. Returns the original object.\n * By default freezes shallowly, but if the second argument is `true` it will freeze recursively.\n *\n * @param obj\n * @param deep\n */\nexport function freeze(obj: T, deep?: boolean): T\nexport function freeze(obj: any, deep: boolean = false): T {\n\tif (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj\n\tif (getArchtype(obj) > 1 /* Map or Set */) {\n\t\tobj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections as any\n\t}\n\tObject.freeze(obj)\n\tif (deep)\n\t\t// See #590, don't recurse into non-enumerable / Symbol properties when freezing\n\t\t// So use Object.entries (only string-like, enumerables) instead of each()\n\t\tObject.entries(obj).forEach(([key, value]) => freeze(value, true))\n\treturn obj\n}\n\nfunction dontMutateFrozenCollections() {\n\tdie(2)\n}\n\nexport function isFrozen(obj: any): boolean {\n\treturn Object.isFrozen(obj)\n}\n","import {\n\tImmerState,\n\tPatch,\n\tDrafted,\n\tImmerBaseState,\n\tAnyMap,\n\tAnySet,\n\tArchType,\n\tdie\n} from \"../internal\"\n\n/** Plugin utilities */\nconst plugins: {\n\tPatches?: {\n\t\tgeneratePatches_(\n\t\t\tstate: ImmerState,\n\t\t\tbasePath: PatchPath,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tgenerateReplacementPatches_(\n\t\t\tbase: any,\n\t\t\treplacement: any,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tapplyPatches_(draft: T, patches: readonly Patch[]): T\n\t}\n\tMapSet?: {\n\t\tproxyMap_(target: T, parent?: ImmerState): T\n\t\tproxySet_(target: T, parent?: ImmerState): T\n\t}\n} = {}\n\ntype Plugins = typeof plugins\n\nexport function getPlugin(\n\tpluginKey: K\n): Exclude {\n\tconst plugin = plugins[pluginKey]\n\tif (!plugin) {\n\t\tdie(0, pluginKey)\n\t}\n\t// @ts-ignore\n\treturn plugin\n}\n\nexport function loadPlugin(\n\tpluginKey: K,\n\timplementation: Plugins[K]\n): void {\n\tif (!plugins[pluginKey]) plugins[pluginKey] = implementation\n}\n/** Map / Set plugin */\n\nexport interface MapState extends ImmerBaseState {\n\ttype_: ArchType.Map\n\tcopy_: AnyMap | undefined\n\tassigned_: Map | undefined\n\tbase_: AnyMap\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\nexport interface SetState extends ImmerBaseState {\n\ttype_: ArchType.Set\n\tcopy_: AnySet | undefined\n\tbase_: AnySet\n\tdrafts_: Map // maps the original value to the draft value in the new set\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\n/** Patches plugin */\n\nexport type PatchPath = (string | number)[]\n","import {\n\tPatch,\n\tPatchListener,\n\tDrafted,\n\tImmer,\n\tDRAFT_STATE,\n\tImmerState,\n\tArchType,\n\tgetPlugin\n} from \"../internal\"\n\n/** Each scope represents a `produce` call. */\n\nexport interface ImmerScope {\n\tpatches_?: Patch[]\n\tinversePatches_?: Patch[]\n\tcanAutoFreeze_: boolean\n\tdrafts_: any[]\n\tparent_?: ImmerScope\n\tpatchListener_?: PatchListener\n\timmer_: Immer\n\tunfinalizedDrafts_: number\n}\n\nlet currentScope: ImmerScope | undefined\n\nexport function getCurrentScope() {\n\treturn currentScope!\n}\n\nfunction createScope(\n\tparent_: ImmerScope | undefined,\n\timmer_: Immer\n): ImmerScope {\n\treturn {\n\t\tdrafts_: [],\n\t\tparent_,\n\t\timmer_,\n\t\t// Whenever the modified draft contains a draft from another scope, we\n\t\t// need to prevent auto-freezing so the unowned draft can be finalized.\n\t\tcanAutoFreeze_: true,\n\t\tunfinalizedDrafts_: 0\n\t}\n}\n\nexport function usePatchesInScope(\n\tscope: ImmerScope,\n\tpatchListener?: PatchListener\n) {\n\tif (patchListener) {\n\t\tgetPlugin(\"Patches\") // assert we have the plugin\n\t\tscope.patches_ = []\n\t\tscope.inversePatches_ = []\n\t\tscope.patchListener_ = patchListener\n\t}\n}\n\nexport function revokeScope(scope: ImmerScope) {\n\tleaveScope(scope)\n\tscope.drafts_.forEach(revokeDraft)\n\t// @ts-ignore\n\tscope.drafts_ = null\n}\n\nexport function leaveScope(scope: ImmerScope) {\n\tif (scope === currentScope) {\n\t\tcurrentScope = scope.parent_\n\t}\n}\n\nexport function enterScope(immer: Immer) {\n\treturn (currentScope = createScope(currentScope, immer))\n}\n\nfunction revokeDraft(draft: Drafted) {\n\tconst state: ImmerState = draft[DRAFT_STATE]\n\tif (state.type_ === ArchType.Object || state.type_ === ArchType.Array)\n\t\tstate.revoke_()\n\telse state.revoked_ = true\n}\n","import {\n\tImmerScope,\n\tDRAFT_STATE,\n\tisDraftable,\n\tNOTHING,\n\tPatchPath,\n\teach,\n\thas,\n\tfreeze,\n\tImmerState,\n\tisDraft,\n\tSetState,\n\tset,\n\tArchType,\n\tgetPlugin,\n\tdie,\n\trevokeScope,\n\tisFrozen\n} from \"../internal\"\n\nexport function processResult(result: any, scope: ImmerScope) {\n\tscope.unfinalizedDrafts_ = scope.drafts_.length\n\tconst baseDraft = scope.drafts_![0]\n\tconst isReplaced = result !== undefined && result !== baseDraft\n\tif (isReplaced) {\n\t\tif (baseDraft[DRAFT_STATE].modified_) {\n\t\t\trevokeScope(scope)\n\t\t\tdie(4)\n\t\t}\n\t\tif (isDraftable(result)) {\n\t\t\t// Finalize the result in case it contains (or is) a subset of the draft.\n\t\t\tresult = finalize(scope, result)\n\t\t\tif (!scope.parent_) maybeFreeze(scope, result)\n\t\t}\n\t\tif (scope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(\n\t\t\t\tbaseDraft[DRAFT_STATE].base_,\n\t\t\t\tresult,\n\t\t\t\tscope.patches_,\n\t\t\t\tscope.inversePatches_!\n\t\t\t)\n\t\t}\n\t} else {\n\t\t// Finalize the base draft.\n\t\tresult = finalize(scope, baseDraft, [])\n\t}\n\trevokeScope(scope)\n\tif (scope.patches_) {\n\t\tscope.patchListener_!(scope.patches_, scope.inversePatches_!)\n\t}\n\treturn result !== NOTHING ? result : undefined\n}\n\nfunction finalize(rootScope: ImmerScope, value: any, path?: PatchPath) {\n\t// Don't recurse in tho recursive data structures\n\tif (isFrozen(value)) return value\n\n\tconst state: ImmerState = value[DRAFT_STATE]\n\t// A plain object, might need freezing, might contain drafts\n\tif (!state) {\n\t\teach(value, (key, childValue) =>\n\t\t\tfinalizeProperty(rootScope, state, value, key, childValue, path)\n\t\t)\n\t\treturn value\n\t}\n\t// Never finalize drafts owned by another scope.\n\tif (state.scope_ !== rootScope) return value\n\t// Unmodified draft, return the (frozen) original\n\tif (!state.modified_) {\n\t\tmaybeFreeze(rootScope, state.base_, true)\n\t\treturn state.base_\n\t}\n\t// Not finalized yet, let's do that now\n\tif (!state.finalized_) {\n\t\tstate.finalized_ = true\n\t\tstate.scope_.unfinalizedDrafts_--\n\t\tconst result = state.copy_\n\t\t// Finalize all children of the copy\n\t\t// For sets we clone before iterating, otherwise we can get in endless loop due to modifying during iteration, see #628\n\t\t// To preserve insertion order in all cases we then clear the set\n\t\t// And we let finalizeProperty know it needs to re-add non-draft children back to the target\n\t\tlet resultEach = result\n\t\tlet isSet = false\n\t\tif (state.type_ === ArchType.Set) {\n\t\t\tresultEach = new Set(result)\n\t\t\tresult.clear()\n\t\t\tisSet = true\n\t\t}\n\t\teach(resultEach, (key, childValue) =>\n\t\t\tfinalizeProperty(rootScope, state, result, key, childValue, path, isSet)\n\t\t)\n\t\t// everything inside is frozen, we can freeze here\n\t\tmaybeFreeze(rootScope, result, false)\n\t\t// first time finalizing, let's create those patches\n\t\tif (path && rootScope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generatePatches_(\n\t\t\t\tstate,\n\t\t\t\tpath,\n\t\t\t\trootScope.patches_,\n\t\t\t\trootScope.inversePatches_!\n\t\t\t)\n\t\t}\n\t}\n\treturn state.copy_\n}\n\nfunction finalizeProperty(\n\trootScope: ImmerScope,\n\tparentState: undefined | ImmerState,\n\ttargetObject: any,\n\tprop: string | number,\n\tchildValue: any,\n\trootPath?: PatchPath,\n\ttargetIsSet?: boolean\n) {\n\tif (process.env.NODE_ENV !== \"production\" && childValue === targetObject)\n\t\tdie(5)\n\tif (isDraft(childValue)) {\n\t\tconst path =\n\t\t\trootPath &&\n\t\t\tparentState &&\n\t\t\tparentState!.type_ !== ArchType.Set && // Set objects are atomic since they have no keys.\n\t\t\t!has((parentState as Exclude).assigned_!, prop) // Skip deep patches for assigned keys.\n\t\t\t\t? rootPath!.concat(prop)\n\t\t\t\t: undefined\n\t\t// Drafts owned by `scope` are finalized here.\n\t\tconst res = finalize(rootScope, childValue, path)\n\t\tset(targetObject, prop, res)\n\t\t// Drafts from another scope must prevented to be frozen\n\t\t// if we got a draft back from finalize, we're in a nested produce and shouldn't freeze\n\t\tif (isDraft(res)) {\n\t\t\trootScope.canAutoFreeze_ = false\n\t\t} else return\n\t} else if (targetIsSet) {\n\t\ttargetObject.add(childValue)\n\t}\n\t// Search new objects for unfinalized drafts. Frozen objects should never contain drafts.\n\tif (isDraftable(childValue) && !isFrozen(childValue)) {\n\t\tif (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {\n\t\t\t// optimization: if an object is not a draft, and we don't have to\n\t\t\t// deepfreeze everything, and we are sure that no drafts are left in the remaining object\n\t\t\t// cause we saw and finalized all drafts already; we can stop visiting the rest of the tree.\n\t\t\t// This benefits especially adding large data tree's without further processing.\n\t\t\t// See add-data.js perf test\n\t\t\treturn\n\t\t}\n\t\tfinalize(rootScope, childValue)\n\t\t// Immer deep freezes plain objects, so if there is no parent state, we freeze as well\n\t\t// Per #590, we never freeze symbolic properties. Just to make sure don't accidentally interfere\n\t\t// with other frameworks.\n\t\tif (\n\t\t\t(!parentState || !parentState.scope_.parent_) &&\n\t\t\ttypeof prop !== \"symbol\" &&\n\t\t\tObject.prototype.propertyIsEnumerable.call(targetObject, prop)\n\t\t)\n\t\t\tmaybeFreeze(rootScope, childValue)\n\t}\n}\n\nfunction maybeFreeze(scope: ImmerScope, value: any, deep = false) {\n\t// we never freeze for a non-root scope; as it would prevent pruning for drafts inside wrapping objects\n\tif (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {\n\t\tfreeze(value, deep)\n\t}\n}\n","import {\n\teach,\n\thas,\n\tis,\n\tisDraftable,\n\tshallowCopy,\n\tlatest,\n\tImmerBaseState,\n\tImmerState,\n\tDrafted,\n\tAnyObject,\n\tAnyArray,\n\tObjectish,\n\tgetCurrentScope,\n\tgetPrototypeOf,\n\tDRAFT_STATE,\n\tdie,\n\tcreateProxy,\n\tArchType,\n\tImmerScope\n} from \"../internal\"\n\ninterface ProxyBaseState extends ImmerBaseState {\n\tassigned_: {\n\t\t[property: string]: boolean\n\t}\n\tparent_?: ImmerState\n\trevoke_(): void\n}\n\nexport interface ProxyObjectState extends ProxyBaseState {\n\ttype_: ArchType.Object\n\tbase_: any\n\tcopy_: any\n\tdraft_: Drafted\n}\n\nexport interface ProxyArrayState extends ProxyBaseState {\n\ttype_: ArchType.Array\n\tbase_: AnyArray\n\tcopy_: AnyArray | null\n\tdraft_: Drafted\n}\n\ntype ProxyState = ProxyObjectState | ProxyArrayState\n\n/**\n * Returns a new draft of the `base` object.\n *\n * The second argument is the parent draft-state (used internally).\n */\nexport function createProxyProxy(\n\tbase: T,\n\tparent?: ImmerState\n): Drafted {\n\tconst isArray = Array.isArray(base)\n\tconst state: ProxyState = {\n\t\ttype_: isArray ? ArchType.Array : (ArchType.Object as any),\n\t\t// Track which produce call this is associated with.\n\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t// True for both shallow and deep changes.\n\t\tmodified_: false,\n\t\t// Used during finalization.\n\t\tfinalized_: false,\n\t\t// Track which properties have been assigned (true) or deleted (false).\n\t\tassigned_: {},\n\t\t// The parent draft state.\n\t\tparent_: parent,\n\t\t// The base state.\n\t\tbase_: base,\n\t\t// The base proxy.\n\t\tdraft_: null as any, // set below\n\t\t// The base copy with any updated values.\n\t\tcopy_: null,\n\t\t// Called by the `produce` function.\n\t\trevoke_: null as any,\n\t\tisManual_: false\n\t}\n\n\t// the traps must target something, a bit like the 'real' base.\n\t// but also, we need to be able to determine from the target what the relevant state is\n\t// (to avoid creating traps per instance to capture the state in closure,\n\t// and to avoid creating weird hidden properties as well)\n\t// So the trick is to use 'state' as the actual 'target'! (and make sure we intercept everything)\n\t// Note that in the case of an array, we put the state in an array to have better Reflect defaults ootb\n\tlet target: T = state as any\n\tlet traps: ProxyHandler> = objectTraps\n\tif (isArray) {\n\t\ttarget = [state] as any\n\t\ttraps = arrayTraps\n\t}\n\n\tconst {revoke, proxy} = Proxy.revocable(target, traps)\n\tstate.draft_ = proxy as any\n\tstate.revoke_ = revoke\n\treturn proxy as any\n}\n\n/**\n * Object drafts\n */\nexport const objectTraps: ProxyHandler = {\n\tget(state, prop) {\n\t\tif (prop === DRAFT_STATE) return state\n\n\t\tconst source = latest(state)\n\t\tif (!has(source, prop)) {\n\t\t\t// non-existing or non-own property...\n\t\t\treturn readPropFromProto(state, source, prop)\n\t\t}\n\t\tconst value = source[prop]\n\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\treturn value\n\t\t}\n\t\t// Check for existing draft in modified state.\n\t\t// Assigned values are never drafted. This catches any drafts we created, too.\n\t\tif (value === peek(state.base_, prop)) {\n\t\t\tprepareCopy(state)\n\t\t\treturn (state.copy_![prop as any] = createProxy(value, state))\n\t\t}\n\t\treturn value\n\t},\n\thas(state, prop) {\n\t\treturn prop in latest(state)\n\t},\n\townKeys(state) {\n\t\treturn Reflect.ownKeys(latest(state))\n\t},\n\tset(\n\t\tstate: ProxyObjectState,\n\t\tprop: string /* strictly not, but helps TS */,\n\t\tvalue\n\t) {\n\t\tconst desc = getDescriptorFromProto(latest(state), prop)\n\t\tif (desc?.set) {\n\t\t\t// special case: if this write is captured by a setter, we have\n\t\t\t// to trigger it with the correct context\n\t\t\tdesc.set.call(state.draft_, value)\n\t\t\treturn true\n\t\t}\n\t\tif (!state.modified_) {\n\t\t\t// the last check is because we need to be able to distinguish setting a non-existing to undefined (which is a change)\n\t\t\t// from setting an existing property with value undefined to undefined (which is not a change)\n\t\t\tconst current = peek(latest(state), prop)\n\t\t\t// special case, if we assigning the original value to a draft, we can ignore the assignment\n\t\t\tconst currentState: ProxyObjectState = current?.[DRAFT_STATE]\n\t\t\tif (currentState && currentState.base_ === value) {\n\t\t\t\tstate.copy_![prop] = value\n\t\t\t\tstate.assigned_[prop] = false\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (is(value, current) && (value !== undefined || has(state.base_, prop)))\n\t\t\t\treturn true\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t}\n\n\t\tif (\n\t\t\t(state.copy_![prop] === value &&\n\t\t\t\t// special case: handle new props with value 'undefined'\n\t\t\t\t(value !== undefined || prop in state.copy_)) ||\n\t\t\t// special case: NaN\n\t\t\t(Number.isNaN(value) && Number.isNaN(state.copy_![prop]))\n\t\t)\n\t\t\treturn true\n\n\t\t// @ts-ignore\n\t\tstate.copy_![prop] = value\n\t\tstate.assigned_[prop] = true\n\t\treturn true\n\t},\n\tdeleteProperty(state, prop: string) {\n\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\tif (peek(state.base_, prop) !== undefined || prop in state.base_) {\n\t\t\tstate.assigned_[prop] = false\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t} else {\n\t\t\t// if an originally not assigned property was deleted\n\t\t\tdelete state.assigned_[prop]\n\t\t}\n\t\tif (state.copy_) {\n\t\t\tdelete state.copy_[prop]\n\t\t}\n\t\treturn true\n\t},\n\t// Note: We never coerce `desc.value` into an Immer draft, because we can't make\n\t// the same guarantee in ES5 mode.\n\tgetOwnPropertyDescriptor(state, prop) {\n\t\tconst owner = latest(state)\n\t\tconst desc = Reflect.getOwnPropertyDescriptor(owner, prop)\n\t\tif (!desc) return desc\n\t\treturn {\n\t\t\twritable: true,\n\t\t\tconfigurable: state.type_ !== ArchType.Array || prop !== \"length\",\n\t\t\tenumerable: desc.enumerable,\n\t\t\tvalue: owner[prop]\n\t\t}\n\t},\n\tdefineProperty() {\n\t\tdie(11)\n\t},\n\tgetPrototypeOf(state) {\n\t\treturn getPrototypeOf(state.base_)\n\t},\n\tsetPrototypeOf() {\n\t\tdie(12)\n\t}\n}\n\n/**\n * Array drafts\n */\n\nconst arrayTraps: ProxyHandler<[ProxyArrayState]> = {}\neach(objectTraps, (key, fn) => {\n\t// @ts-ignore\n\tarrayTraps[key] = function() {\n\t\targuments[0] = arguments[0][0]\n\t\treturn fn.apply(this, arguments)\n\t}\n})\narrayTraps.deleteProperty = function(state, prop) {\n\tif (process.env.NODE_ENV !== \"production\" && isNaN(parseInt(prop as any)))\n\t\tdie(13)\n\t// @ts-ignore\n\treturn arrayTraps.set!.call(this, state, prop, undefined)\n}\narrayTraps.set = function(state, prop, value) {\n\tif (\n\t\tprocess.env.NODE_ENV !== \"production\" &&\n\t\tprop !== \"length\" &&\n\t\tisNaN(parseInt(prop as any))\n\t)\n\t\tdie(14)\n\treturn objectTraps.set!.call(this, state[0], prop, value, state[0])\n}\n\n// Access a property without creating an Immer draft.\nfunction peek(draft: Drafted, prop: PropertyKey) {\n\tconst state = draft[DRAFT_STATE]\n\tconst source = state ? latest(state) : draft\n\treturn source[prop]\n}\n\nfunction readPropFromProto(state: ImmerState, source: any, prop: PropertyKey) {\n\tconst desc = getDescriptorFromProto(source, prop)\n\treturn desc\n\t\t? `value` in desc\n\t\t\t? desc.value\n\t\t\t: // This is a very special case, if the prop is a getter defined by the\n\t\t\t // prototype, we should invoke it with the draft as context!\n\t\t\t desc.get?.call(state.draft_)\n\t\t: undefined\n}\n\nfunction getDescriptorFromProto(\n\tsource: any,\n\tprop: PropertyKey\n): PropertyDescriptor | undefined {\n\t// 'in' checks proto!\n\tif (!(prop in source)) return undefined\n\tlet proto = getPrototypeOf(source)\n\twhile (proto) {\n\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop)\n\t\tif (desc) return desc\n\t\tproto = getPrototypeOf(proto)\n\t}\n\treturn undefined\n}\n\nexport function markChanged(state: ImmerState) {\n\tif (!state.modified_) {\n\t\tstate.modified_ = true\n\t\tif (state.parent_) {\n\t\t\tmarkChanged(state.parent_)\n\t\t}\n\t}\n}\n\nexport function prepareCopy(state: {\n\tbase_: any\n\tcopy_: any\n\tscope_: ImmerScope\n}) {\n\tif (!state.copy_) {\n\t\tstate.copy_ = shallowCopy(\n\t\t\tstate.base_,\n\t\t\tstate.scope_.immer_.useStrictShallowCopy_\n\t\t)\n\t}\n}\n","import {\n\tIProduceWithPatches,\n\tIProduce,\n\tImmerState,\n\tDrafted,\n\tisDraftable,\n\tprocessResult,\n\tPatch,\n\tObjectish,\n\tDRAFT_STATE,\n\tDraft,\n\tPatchListener,\n\tisDraft,\n\tisMap,\n\tisSet,\n\tcreateProxyProxy,\n\tgetPlugin,\n\tdie,\n\tenterScope,\n\trevokeScope,\n\tleaveScope,\n\tusePatchesInScope,\n\tgetCurrentScope,\n\tNOTHING,\n\tfreeze,\n\tcurrent\n} from \"../internal\"\n\ninterface ProducersFns {\n\tproduce: IProduce\n\tproduceWithPatches: IProduceWithPatches\n}\n\nexport type StrictMode = boolean | \"class_only\";\n\nexport class Immer implements ProducersFns {\n\tautoFreeze_: boolean = true\n\tuseStrictShallowCopy_: StrictMode = false\n\n\tconstructor(config?: {\n\t\tautoFreeze?: boolean\n\t\tuseStrictShallowCopy?: StrictMode\n\t}) {\n\t\tif (typeof config?.autoFreeze === \"boolean\")\n\t\t\tthis.setAutoFreeze(config!.autoFreeze)\n\t\tif (typeof config?.useStrictShallowCopy === \"boolean\")\n\t\t\tthis.setUseStrictShallowCopy(config!.useStrictShallowCopy)\n\t}\n\n\t/**\n\t * The `produce` function takes a value and a \"recipe function\" (whose\n\t * return value often depends on the base state). The recipe function is\n\t * free to mutate its first argument however it wants. All mutations are\n\t * only ever applied to a __copy__ of the base state.\n\t *\n\t * Pass only a function to create a \"curried producer\" which relieves you\n\t * from passing the recipe function every time.\n\t *\n\t * Only plain objects and arrays are made mutable. All other objects are\n\t * considered uncopyable.\n\t *\n\t * Note: This function is __bound__ to its `Immer` instance.\n\t *\n\t * @param {any} base - the initial state\n\t * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified\n\t * @param {Function} patchListener - optional function that will be called with all the patches produced here\n\t * @returns {any} a new state, or the initial state if nothing was modified\n\t */\n\tproduce: IProduce = (base: any, recipe?: any, patchListener?: any) => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\" && typeof recipe !== \"function\") {\n\t\t\tconst defaultBase = recipe\n\t\t\trecipe = base\n\n\t\t\tconst self = this\n\t\t\treturn function curriedProduce(\n\t\t\t\tthis: any,\n\t\t\t\tbase = defaultBase,\n\t\t\t\t...args: any[]\n\t\t\t) {\n\t\t\t\treturn self.produce(base, (draft: Drafted) => recipe.call(this, draft, ...args)) // prettier-ignore\n\t\t\t}\n\t\t}\n\n\t\tif (typeof recipe !== \"function\") die(6)\n\t\tif (patchListener !== undefined && typeof patchListener !== \"function\")\n\t\t\tdie(7)\n\n\t\tlet result\n\n\t\t// Only plain objects, arrays, and \"immerable classes\" are drafted.\n\t\tif (isDraftable(base)) {\n\t\t\tconst scope = enterScope(this)\n\t\t\tconst proxy = createProxy(base, undefined)\n\t\t\tlet hasError = true\n\t\t\ttry {\n\t\t\t\tresult = recipe(proxy)\n\t\t\t\thasError = false\n\t\t\t} finally {\n\t\t\t\t// finally instead of catch + rethrow better preserves original stack\n\t\t\t\tif (hasError) revokeScope(scope)\n\t\t\t\telse leaveScope(scope)\n\t\t\t}\n\t\t\tusePatchesInScope(scope, patchListener)\n\t\t\treturn processResult(result, scope)\n\t\t} else if (!base || typeof base !== \"object\") {\n\t\t\tresult = recipe(base)\n\t\t\tif (result === undefined) result = base\n\t\t\tif (result === NOTHING) result = undefined\n\t\t\tif (this.autoFreeze_) freeze(result, true)\n\t\t\tif (patchListener) {\n\t\t\t\tconst p: Patch[] = []\n\t\t\t\tconst ip: Patch[] = []\n\t\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(base, result, p, ip)\n\t\t\t\tpatchListener(p, ip)\n\t\t\t}\n\t\t\treturn result\n\t\t} else die(1, base)\n\t}\n\n\tproduceWithPatches: IProduceWithPatches = (base: any, recipe?: any): any => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\") {\n\t\t\treturn (state: any, ...args: any[]) =>\n\t\t\t\tthis.produceWithPatches(state, (draft: any) => base(draft, ...args))\n\t\t}\n\n\t\tlet patches: Patch[], inversePatches: Patch[]\n\t\tconst result = this.produce(base, recipe, (p: Patch[], ip: Patch[]) => {\n\t\t\tpatches = p\n\t\t\tinversePatches = ip\n\t\t})\n\t\treturn [result, patches!, inversePatches!]\n\t}\n\n\tcreateDraft(base: T): Draft {\n\t\tif (!isDraftable(base)) die(8)\n\t\tif (isDraft(base)) base = current(base)\n\t\tconst scope = enterScope(this)\n\t\tconst proxy = createProxy(base, undefined)\n\t\tproxy[DRAFT_STATE].isManual_ = true\n\t\tleaveScope(scope)\n\t\treturn proxy as any\n\t}\n\n\tfinishDraft>(\n\t\tdraft: D,\n\t\tpatchListener?: PatchListener\n\t): D extends Draft ? T : never {\n\t\tconst state: ImmerState = draft && (draft as any)[DRAFT_STATE]\n\t\tif (!state || !state.isManual_) die(9)\n\t\tconst {scope_: scope} = state\n\t\tusePatchesInScope(scope, patchListener)\n\t\treturn processResult(undefined, scope)\n\t}\n\n\t/**\n\t * Pass true to automatically freeze all copies created by Immer.\n\t *\n\t * By default, auto-freezing is enabled.\n\t */\n\tsetAutoFreeze(value: boolean) {\n\t\tthis.autoFreeze_ = value\n\t}\n\n\t/**\n\t * Pass true to enable strict shallow copy.\n\t *\n\t * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n\t */\n\tsetUseStrictShallowCopy(value: StrictMode) {\n\t\tthis.useStrictShallowCopy_ = value\n\t}\n\n\tapplyPatches(base: T, patches: readonly Patch[]): T {\n\t\t// If a patch replaces the entire state, take that replacement as base\n\t\t// before applying patches\n\t\tlet i: number\n\t\tfor (i = patches.length - 1; i >= 0; i--) {\n\t\t\tconst patch = patches[i]\n\t\t\tif (patch.path.length === 0 && patch.op === \"replace\") {\n\t\t\t\tbase = patch.value\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// If there was a patch that replaced the entire state, start from the\n\t\t// patch after that.\n\t\tif (i > -1) {\n\t\t\tpatches = patches.slice(i + 1)\n\t\t}\n\n\t\tconst applyPatchesImpl = getPlugin(\"Patches\").applyPatches_\n\t\tif (isDraft(base)) {\n\t\t\t// N.B: never hits if some patch a replacement, patches are never drafts\n\t\t\treturn applyPatchesImpl(base, patches)\n\t\t}\n\t\t// Otherwise, produce a copy of the base state.\n\t\treturn this.produce(base, (draft: Drafted) =>\n\t\t\tapplyPatchesImpl(draft, patches)\n\t\t)\n\t}\n}\n\nexport function createProxy(\n\tvalue: T,\n\tparent?: ImmerState\n): Drafted {\n\t// precondition: createProxy should be guarded by isDraftable, so we know we can safely draft\n\tconst draft: Drafted = isMap(value)\n\t\t? getPlugin(\"MapSet\").proxyMap_(value, parent)\n\t\t: isSet(value)\n\t\t? getPlugin(\"MapSet\").proxySet_(value, parent)\n\t\t: createProxyProxy(value, parent)\n\n\tconst scope = parent ? parent.scope_ : getCurrentScope()\n\tscope.drafts_.push(draft)\n\treturn draft\n}\n","import {\n\tdie,\n\tisDraft,\n\tshallowCopy,\n\teach,\n\tDRAFT_STATE,\n\tset,\n\tImmerState,\n\tisDraftable,\n\tisFrozen\n} from \"../internal\"\n\n/** Takes a snapshot of the current state of a draft and finalizes it (but without freezing). This is a great utility to print the current state during debugging (no Proxies in the way). The output of current can also be safely leaked outside the producer. */\nexport function current(value: T): T\nexport function current(value: any): any {\n\tif (!isDraft(value)) die(10, value)\n\treturn currentImpl(value)\n}\n\nfunction currentImpl(value: any): any {\n\tif (!isDraftable(value) || isFrozen(value)) return value\n\tconst state: ImmerState | undefined = value[DRAFT_STATE]\n\tlet copy: any\n\tif (state) {\n\t\tif (!state.modified_) return state.base_\n\t\t// Optimization: avoid generating new drafts during copying\n\t\tstate.finalized_ = true\n\t\tcopy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_)\n\t} else {\n\t\tcopy = shallowCopy(value, true)\n\t}\n\t// recurse\n\teach(copy, (key, childValue) => {\n\t\tset(copy, key, currentImpl(childValue))\n\t})\n\tif (state) {\n\t\tstate.finalized_ = false\n\t}\n\treturn copy\n}\n","import {immerable} from \"../immer\"\nimport {\n\tImmerState,\n\tPatch,\n\tSetState,\n\tProxyArrayState,\n\tMapState,\n\tProxyObjectState,\n\tPatchPath,\n\tget,\n\teach,\n\thas,\n\tgetArchtype,\n\tgetPrototypeOf,\n\tisSet,\n\tisMap,\n\tloadPlugin,\n\tArchType,\n\tdie,\n\tisDraft,\n\tisDraftable,\n\tNOTHING,\n\terrors\n} from \"../internal\"\n\nexport function enablePatches() {\n\tconst errorOffset = 16\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\terrors.push(\n\t\t\t'Sets cannot have \"replace\" patches.',\n\t\t\tfunction(op: string) {\n\t\t\t\treturn \"Unsupported patch operation: \" + op\n\t\t\t},\n\t\t\tfunction(path: string) {\n\t\t\t\treturn \"Cannot apply patch, path doesn't resolve: \" + path\n\t\t\t},\n\t\t\t\"Patching reserved attributes like __proto__, prototype and constructor is not allowed\"\n\t\t)\n\t}\n\n\tconst REPLACE = \"replace\"\n\tconst ADD = \"add\"\n\tconst REMOVE = \"remove\"\n\n\tfunction generatePatches_(\n\t\tstate: ImmerState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t): void {\n\t\tswitch (state.type_) {\n\t\t\tcase ArchType.Object:\n\t\t\tcase ArchType.Map:\n\t\t\t\treturn generatePatchesFromAssigned(\n\t\t\t\t\tstate,\n\t\t\t\t\tbasePath,\n\t\t\t\t\tpatches,\n\t\t\t\t\tinversePatches\n\t\t\t\t)\n\t\t\tcase ArchType.Array:\n\t\t\t\treturn generateArrayPatches(state, basePath, patches, inversePatches)\n\t\t\tcase ArchType.Set:\n\t\t\t\treturn generateSetPatches(\n\t\t\t\t\t(state as any) as SetState,\n\t\t\t\t\tbasePath,\n\t\t\t\t\tpatches,\n\t\t\t\t\tinversePatches\n\t\t\t\t)\n\t\t}\n\t}\n\n\tfunction generateArrayPatches(\n\t\tstate: ProxyArrayState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tlet {base_, assigned_} = state\n\t\tlet copy_ = state.copy_!\n\n\t\t// Reduce complexity by ensuring `base` is never longer.\n\t\tif (copy_.length < base_.length) {\n\t\t\t// @ts-ignore\n\t\t\t;[base_, copy_] = [copy_, base_]\n\t\t\t;[patches, inversePatches] = [inversePatches, patches]\n\t\t}\n\n\t\t// Process replaced indices.\n\t\tfor (let i = 0; i < base_.length; i++) {\n\t\t\tif (assigned_[i] && copy_[i] !== base_[i]) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: REPLACE,\n\t\t\t\t\tpath,\n\t\t\t\t\t// Need to maybe clone it, as it can in fact be the original value\n\t\t\t\t\t// due to the base/copy inversion at the start of this function\n\t\t\t\t\tvalue: clonePatchValueIfNeeded(copy_[i])\n\t\t\t\t})\n\t\t\t\tinversePatches.push({\n\t\t\t\t\top: REPLACE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue: clonePatchValueIfNeeded(base_[i])\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// Process added indices.\n\t\tfor (let i = base_.length; i < copy_.length; i++) {\n\t\t\tconst path = basePath.concat([i])\n\t\t\tpatches.push({\n\t\t\t\top: ADD,\n\t\t\t\tpath,\n\t\t\t\t// Need to maybe clone it, as it can in fact be the original value\n\t\t\t\t// due to the base/copy inversion at the start of this function\n\t\t\t\tvalue: clonePatchValueIfNeeded(copy_[i])\n\t\t\t})\n\t\t}\n\t\tfor (let i = copy_.length - 1; base_.length <= i; --i) {\n\t\t\tconst path = basePath.concat([i])\n\t\t\tinversePatches.push({\n\t\t\t\top: REMOVE,\n\t\t\t\tpath\n\t\t\t})\n\t\t}\n\t}\n\n\t// This is used for both Map objects and normal objects.\n\tfunction generatePatchesFromAssigned(\n\t\tstate: MapState | ProxyObjectState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tconst {base_, copy_} = state\n\t\teach(state.assigned_!, (key, assignedValue) => {\n\t\t\tconst origValue = get(base_, key)\n\t\t\tconst value = get(copy_!, key)\n\t\t\tconst op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD\n\t\t\tif (origValue === value && op === REPLACE) return\n\t\t\tconst path = basePath.concat(key as any)\n\t\t\tpatches.push(op === REMOVE ? {op, path} : {op, path, value})\n\t\t\tinversePatches.push(\n\t\t\t\top === ADD\n\t\t\t\t\t? {op: REMOVE, path}\n\t\t\t\t\t: op === REMOVE\n\t\t\t\t\t? {op: ADD, path, value: clonePatchValueIfNeeded(origValue)}\n\t\t\t\t\t: {op: REPLACE, path, value: clonePatchValueIfNeeded(origValue)}\n\t\t\t)\n\t\t})\n\t}\n\n\tfunction generateSetPatches(\n\t\tstate: SetState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tlet {base_, copy_} = state\n\n\t\tlet i = 0\n\t\tbase_.forEach((value: any) => {\n\t\t\tif (!copy_!.has(value)) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: REMOVE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t\tinversePatches.unshift({\n\t\t\t\t\top: ADD,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t}\n\t\t\ti++\n\t\t})\n\t\ti = 0\n\t\tcopy_!.forEach((value: any) => {\n\t\t\tif (!base_.has(value)) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: ADD,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t\tinversePatches.unshift({\n\t\t\t\t\top: REMOVE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t}\n\t\t\ti++\n\t\t})\n\t}\n\n\tfunction generateReplacementPatches_(\n\t\tbaseValue: any,\n\t\treplacement: any,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t): void {\n\t\tpatches.push({\n\t\t\top: REPLACE,\n\t\t\tpath: [],\n\t\t\tvalue: replacement === NOTHING ? undefined : replacement\n\t\t})\n\t\tinversePatches.push({\n\t\t\top: REPLACE,\n\t\t\tpath: [],\n\t\t\tvalue: baseValue\n\t\t})\n\t}\n\n\tfunction applyPatches_(draft: T, patches: readonly Patch[]): T {\n\t\tpatches.forEach(patch => {\n\t\t\tconst {path, op} = patch\n\n\t\t\tlet base: any = draft\n\t\t\tfor (let i = 0; i < path.length - 1; i++) {\n\t\t\t\tconst parentType = getArchtype(base)\n\t\t\t\tlet p = path[i]\n\t\t\t\tif (typeof p !== \"string\" && typeof p !== \"number\") {\n\t\t\t\t\tp = \"\" + p\n\t\t\t\t}\n\n\t\t\t\t// See #738, avoid prototype pollution\n\t\t\t\tif (\n\t\t\t\t\t(parentType === ArchType.Object || parentType === ArchType.Array) &&\n\t\t\t\t\t(p === \"__proto__\" || p === \"constructor\")\n\t\t\t\t)\n\t\t\t\t\tdie(errorOffset + 3)\n\t\t\t\tif (typeof base === \"function\" && p === \"prototype\")\n\t\t\t\t\tdie(errorOffset + 3)\n\t\t\t\tbase = get(base, p)\n\t\t\t\tif (typeof base !== \"object\") die(errorOffset + 2, path.join(\"/\"))\n\t\t\t}\n\n\t\t\tconst type = getArchtype(base)\n\t\t\tconst value = deepClonePatchValue(patch.value) // used to clone patch to ensure original patch is not modified, see #411\n\t\t\tconst key = path[path.length - 1]\n\t\t\tswitch (op) {\n\t\t\t\tcase REPLACE:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase ArchType.Map:\n\t\t\t\t\t\t\treturn base.set(key, value)\n\t\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\t\tcase ArchType.Set:\n\t\t\t\t\t\t\tdie(errorOffset)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t// if value is an object, then it's assigned by reference\n\t\t\t\t\t\t\t// in the following add or remove ops, the value field inside the patch will also be modifyed\n\t\t\t\t\t\t\t// so we use value from the cloned patch\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\treturn (base[key] = value)\n\t\t\t\t\t}\n\t\t\t\tcase ADD:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase ArchType.Array:\n\t\t\t\t\t\t\treturn key === \"-\"\n\t\t\t\t\t\t\t\t? base.push(value)\n\t\t\t\t\t\t\t\t: base.splice(key as any, 0, value)\n\t\t\t\t\t\tcase ArchType.Map:\n\t\t\t\t\t\t\treturn base.set(key, value)\n\t\t\t\t\t\tcase ArchType.Set:\n\t\t\t\t\t\t\treturn base.add(value)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn (base[key] = value)\n\t\t\t\t\t}\n\t\t\t\tcase REMOVE:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase ArchType.Array:\n\t\t\t\t\t\t\treturn base.splice(key as any, 1)\n\t\t\t\t\t\tcase ArchType.Map:\n\t\t\t\t\t\t\treturn base.delete(key)\n\t\t\t\t\t\tcase ArchType.Set:\n\t\t\t\t\t\t\treturn base.delete(patch.value)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn delete base[key]\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tdie(errorOffset + 1, op)\n\t\t\t}\n\t\t})\n\n\t\treturn draft\n\t}\n\n\t// optimize: this is quite a performance hit, can we detect intelligently when it is needed?\n\t// E.g. auto-draft when new objects from outside are assigned and modified?\n\t// (See failing test when deepClone just returns obj)\n\tfunction deepClonePatchValue(obj: T): T\n\tfunction deepClonePatchValue(obj: any) {\n\t\tif (!isDraftable(obj)) return obj\n\t\tif (Array.isArray(obj)) return obj.map(deepClonePatchValue)\n\t\tif (isMap(obj))\n\t\t\treturn new Map(\n\t\t\t\tArray.from(obj.entries()).map(([k, v]) => [k, deepClonePatchValue(v)])\n\t\t\t)\n\t\tif (isSet(obj)) return new Set(Array.from(obj).map(deepClonePatchValue))\n\t\tconst cloned = Object.create(getPrototypeOf(obj))\n\t\tfor (const key in obj) cloned[key] = deepClonePatchValue(obj[key])\n\t\tif (has(obj, immerable)) cloned[immerable] = obj[immerable]\n\t\treturn cloned\n\t}\n\n\tfunction clonePatchValueIfNeeded(obj: T): T {\n\t\tif (isDraft(obj)) {\n\t\t\treturn deepClonePatchValue(obj)\n\t\t} else return obj\n\t}\n\n\tloadPlugin(\"Patches\", {\n\t\tapplyPatches_,\n\t\tgeneratePatches_,\n\t\tgenerateReplacementPatches_\n\t})\n}\n","// types only!\nimport {\n\tImmerState,\n\tAnyMap,\n\tAnySet,\n\tMapState,\n\tSetState,\n\tDRAFT_STATE,\n\tgetCurrentScope,\n\tlatest,\n\tisDraftable,\n\tcreateProxy,\n\tloadPlugin,\n\tmarkChanged,\n\tdie,\n\tArchType,\n\teach\n} from \"../internal\"\n\nexport function enableMapSet() {\n\tclass DraftMap extends Map {\n\t\t[DRAFT_STATE]: MapState\n\n\t\tconstructor(target: AnyMap, parent?: ImmerState) {\n\t\t\tsuper()\n\t\t\tthis[DRAFT_STATE] = {\n\t\t\t\ttype_: ArchType.Map,\n\t\t\t\tparent_: parent,\n\t\t\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t\t\tmodified_: false,\n\t\t\t\tfinalized_: false,\n\t\t\t\tcopy_: undefined,\n\t\t\t\tassigned_: undefined,\n\t\t\t\tbase_: target,\n\t\t\t\tdraft_: this as any,\n\t\t\t\tisManual_: false,\n\t\t\t\trevoked_: false\n\t\t\t}\n\t\t}\n\n\t\tget size(): number {\n\t\t\treturn latest(this[DRAFT_STATE]).size\n\t\t}\n\n\t\thas(key: any): boolean {\n\t\t\treturn latest(this[DRAFT_STATE]).has(key)\n\t\t}\n\n\t\tset(key: any, value: any) {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (!latest(state).has(key) || latest(state).get(key) !== value) {\n\t\t\t\tprepareMapCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.assigned_!.set(key, true)\n\t\t\t\tstate.copy_!.set(key, value)\n\t\t\t\tstate.assigned_!.set(key, true)\n\t\t\t}\n\t\t\treturn this\n\t\t}\n\n\t\tdelete(key: any): boolean {\n\t\t\tif (!this.has(key)) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareMapCopy(state)\n\t\t\tmarkChanged(state)\n\t\t\tif (state.base_.has(key)) {\n\t\t\t\tstate.assigned_!.set(key, false)\n\t\t\t} else {\n\t\t\t\tstate.assigned_!.delete(key)\n\t\t\t}\n\t\t\tstate.copy_!.delete(key)\n\t\t\treturn true\n\t\t}\n\n\t\tclear() {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (latest(state).size) {\n\t\t\t\tprepareMapCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.assigned_ = new Map()\n\t\t\t\teach(state.base_, key => {\n\t\t\t\t\tstate.assigned_!.set(key, false)\n\t\t\t\t})\n\t\t\t\tstate.copy_!.clear()\n\t\t\t}\n\t\t}\n\n\t\tforEach(cb: (value: any, key: any, self: any) => void, thisArg?: any) {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tlatest(state).forEach((_value: any, key: any, _map: any) => {\n\t\t\t\tcb.call(thisArg, this.get(key), key, this)\n\t\t\t})\n\t\t}\n\n\t\tget(key: any): any {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tconst value = latest(state).get(key)\n\t\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\t\treturn value\n\t\t\t}\n\t\t\tif (value !== state.base_.get(key)) {\n\t\t\t\treturn value // either already drafted or reassigned\n\t\t\t}\n\t\t\t// despite what it looks, this creates a draft only once, see above condition\n\t\t\tconst draft = createProxy(value, state)\n\t\t\tprepareMapCopy(state)\n\t\t\tstate.copy_!.set(key, draft)\n\t\t\treturn draft\n\t\t}\n\n\t\tkeys(): IterableIterator {\n\t\t\treturn latest(this[DRAFT_STATE]).keys()\n\t\t}\n\n\t\tvalues(): IterableIterator {\n\t\t\tconst iterator = this.keys()\n\t\t\treturn {\n\t\t\t\t[Symbol.iterator]: () => this.values(),\n\t\t\t\tnext: () => {\n\t\t\t\t\tconst r = iterator.next()\n\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\tif (r.done) return r\n\t\t\t\t\tconst value = this.get(r.value)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\tvalue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} as any\n\t\t}\n\n\t\tentries(): IterableIterator<[any, any]> {\n\t\t\tconst iterator = this.keys()\n\t\t\treturn {\n\t\t\t\t[Symbol.iterator]: () => this.entries(),\n\t\t\t\tnext: () => {\n\t\t\t\t\tconst r = iterator.next()\n\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\tif (r.done) return r\n\t\t\t\t\tconst value = this.get(r.value)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\tvalue: [r.value, value]\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} as any\n\t\t}\n\n\t\t[Symbol.iterator]() {\n\t\t\treturn this.entries()\n\t\t}\n\t}\n\n\tfunction proxyMap_(target: T, parent?: ImmerState): T {\n\t\t// @ts-ignore\n\t\treturn new DraftMap(target, parent)\n\t}\n\n\tfunction prepareMapCopy(state: MapState) {\n\t\tif (!state.copy_) {\n\t\t\tstate.assigned_ = new Map()\n\t\t\tstate.copy_ = new Map(state.base_)\n\t\t}\n\t}\n\n\tclass DraftSet extends Set {\n\t\t[DRAFT_STATE]: SetState\n\t\tconstructor(target: AnySet, parent?: ImmerState) {\n\t\t\tsuper()\n\t\t\tthis[DRAFT_STATE] = {\n\t\t\t\ttype_: ArchType.Set,\n\t\t\t\tparent_: parent,\n\t\t\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t\t\tmodified_: false,\n\t\t\t\tfinalized_: false,\n\t\t\t\tcopy_: undefined,\n\t\t\t\tbase_: target,\n\t\t\t\tdraft_: this,\n\t\t\t\tdrafts_: new Map(),\n\t\t\t\trevoked_: false,\n\t\t\t\tisManual_: false\n\t\t\t}\n\t\t}\n\n\t\tget size(): number {\n\t\t\treturn latest(this[DRAFT_STATE]).size\n\t\t}\n\n\t\thas(value: any): boolean {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\t// bit of trickery here, to be able to recognize both the value, and the draft of its value\n\t\t\tif (!state.copy_) {\n\t\t\t\treturn state.base_.has(value)\n\t\t\t}\n\t\t\tif (state.copy_.has(value)) return true\n\t\t\tif (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value)))\n\t\t\t\treturn true\n\t\t\treturn false\n\t\t}\n\n\t\tadd(value: any): any {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (!this.has(value)) {\n\t\t\t\tprepareSetCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.copy_!.add(value)\n\t\t\t}\n\t\t\treturn this\n\t\t}\n\n\t\tdelete(value: any): any {\n\t\t\tif (!this.has(value)) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\tmarkChanged(state)\n\t\t\treturn (\n\t\t\t\tstate.copy_!.delete(value) ||\n\t\t\t\t(state.drafts_.has(value)\n\t\t\t\t\t? state.copy_!.delete(state.drafts_.get(value))\n\t\t\t\t\t: /* istanbul ignore next */ false)\n\t\t\t)\n\t\t}\n\n\t\tclear() {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (latest(state).size) {\n\t\t\t\tprepareSetCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.copy_!.clear()\n\t\t\t}\n\t\t}\n\n\t\tvalues(): IterableIterator {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\treturn state.copy_!.values()\n\t\t}\n\n\t\tentries(): IterableIterator<[any, any]> {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\treturn state.copy_!.entries()\n\t\t}\n\n\t\tkeys(): IterableIterator {\n\t\t\treturn this.values()\n\t\t}\n\n\t\t[Symbol.iterator]() {\n\t\t\treturn this.values()\n\t\t}\n\n\t\tforEach(cb: any, thisArg?: any) {\n\t\t\tconst iterator = this.values()\n\t\t\tlet result = iterator.next()\n\t\t\twhile (!result.done) {\n\t\t\t\tcb.call(thisArg, result.value, result.value, this)\n\t\t\t\tresult = iterator.next()\n\t\t\t}\n\t\t}\n\t}\n\tfunction proxySet_(target: T, parent?: ImmerState): T {\n\t\t// @ts-ignore\n\t\treturn new DraftSet(target, parent)\n\t}\n\n\tfunction prepareSetCopy(state: SetState) {\n\t\tif (!state.copy_) {\n\t\t\t// create drafts for all entries to preserve insertion order\n\t\t\tstate.copy_ = new Set()\n\t\t\tstate.base_.forEach(value => {\n\t\t\t\tif (isDraftable(value)) {\n\t\t\t\t\tconst draft = createProxy(value, state)\n\t\t\t\t\tstate.drafts_.set(value, draft)\n\t\t\t\t\tstate.copy_!.add(draft)\n\t\t\t\t} else {\n\t\t\t\t\tstate.copy_!.add(value)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n\n\tfunction assertUnrevoked(state: any /*ES5State | MapState | SetState*/) {\n\t\tif (state.revoked_) die(3, JSON.stringify(latest(state)))\n\t}\n\n\tloadPlugin(\"MapSet\", {proxyMap_, proxySet_})\n}\n","import {\n\tIProduce,\n\tIProduceWithPatches,\n\tImmer,\n\tDraft,\n\tImmutable\n} from \"./internal\"\n\nexport {\n\tDraft,\n\tWritableDraft,\n\tImmutable,\n\tPatch,\n\tPatchListener,\n\tProducer,\n\toriginal,\n\tcurrent,\n\tisDraft,\n\tisDraftable,\n\tNOTHING as nothing,\n\tDRAFTABLE as immerable,\n\tfreeze,\n\tObjectish,\n\tStrictMode\n} from \"./internal\"\n\nconst immer = new Immer()\n\n/**\n * The `produce` function takes a value and a \"recipe function\" (whose\n * return value often depends on the base state). The recipe function is\n * free to mutate its first argument however it wants. All mutations are\n * only ever applied to a __copy__ of the base state.\n *\n * Pass only a function to create a \"curried producer\" which relieves you\n * from passing the recipe function every time.\n *\n * Only plain objects and arrays are made mutable. All other objects are\n * considered uncopyable.\n *\n * Note: This function is __bound__ to its `Immer` instance.\n *\n * @param {any} base - the initial state\n * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified\n * @param {Function} patchListener - optional function that will be called with all the patches produced here\n * @returns {any} a new state, or the initial state if nothing was modified\n */\nexport const produce: IProduce = immer.produce\n\n/**\n * Like `produce`, but `produceWithPatches` always returns a tuple\n * [nextState, patches, inversePatches] (instead of just the next state)\n */\nexport const produceWithPatches: IProduceWithPatches = immer.produceWithPatches.bind(\n\timmer\n)\n\n/**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * Always freeze by default, even in production mode\n */\nexport const setAutoFreeze = immer.setAutoFreeze.bind(immer)\n\n/**\n * Pass true to enable strict shallow copy.\n *\n * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n */\nexport const setUseStrictShallowCopy = immer.setUseStrictShallowCopy.bind(immer)\n\n/**\n * Apply an array of Immer patches to the first argument.\n *\n * This function is a producer, which means copy-on-write is in effect.\n */\nexport const applyPatches = immer.applyPatches.bind(immer)\n\n/**\n * Create an Immer draft from the given base state, which may be a draft itself.\n * The draft can be modified until you finalize it with the `finishDraft` function.\n */\nexport const createDraft = immer.createDraft.bind(immer)\n\n/**\n * Finalize an Immer draft from a `createDraft` call, returning the base state\n * (if no changes were made) or a modified copy. The draft must *not* be\n * mutated afterwards.\n *\n * Pass a function as the 2nd argument to generate Immer patches based on the\n * changes that were made.\n */\nexport const finishDraft = immer.finishDraft.bind(immer)\n\n/**\n * This function is actually a no-op, but can be used to cast an immutable type\n * to an draft type and make TypeScript happy\n *\n * @param value\n */\nexport function castDraft(value: T): Draft {\n\treturn value as any\n}\n\n/**\n * This function is actually a no-op, but can be used to cast a mutable type\n * to an immutable type and make TypeScript happy\n * @param value\n */\nexport function castImmutable(value: T): Immutable {\n\treturn value as any\n}\n\nexport {Immer}\n\nexport {enablePatches} from \"./plugins/patches\"\nexport {enableMapSet} from \"./plugins/mapset\"\n"],"mappings":";AAKO,IAAM,UAAyB,OAAO,IAAI,eAAe;AAUzD,IAAM,YAA2B,OAAO,IAAI,iBAAiB;AAE7D,IAAM,cAA6B,OAAO,IAAI,aAAa;;;ACjB3D,IAAM,SACZ,QAAQ,IAAI,aAAa,eACtB;AAAA;AAAA,EAEA,SAAS,QAAgB;AACxB,WAAO,mBAAmB,yFAAyF;AAAA,EACpH;AAAA,EACA,SAAS,OAAe;AACvB,WAAO,sJAAsJ;AAAA,EAC9J;AAAA,EACA;AAAA,EACA,SAAS,MAAW;AACnB,WACC,yHACA;AAAA,EAEF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,OAAe;AACvB,WAAO,mCAAmC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA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AAgB,OAA+C;AACvE,QAAI,MAAM;AAAU,UAAI,GAAG,KAAK,UAAU,OAAO,KAAK,CAAC,CAAC;AAAA,EACzD;AAEA,aAAW,UAAU,EAAC,WAAW,UAAS,CAAC;AAC5C;;;ACrRA,IAAM,QAAQ,IAAIC,OAAM;AAqBjB,IAAM,UAAoB,MAAM;AAMhC,IAAM,qBAA0C,MAAM,mBAAmB;AAAA,EAC/E;AACD;AAOO,IAAM,gBAAgB,MAAM,cAAc,KAAK,KAAK;AAOpD,IAAM,0BAA0B,MAAM,wBAAwB,KAAK,KAAK;AAOxE,IAAM,eAAe,MAAM,aAAa,KAAK,KAAK;AAMlD,IAAM,cAAc,MAAM,YAAY,KAAK,KAAK;AAUhD,IAAM,cAAc,MAAM,YAAY,KAAK,KAAK;AAQhD,SAAS,UAAa,OAAoB;AAChD,SAAO;AACR;AAOO,SAAS,cAAiB,OAAwB;AACxD,SAAO;AACR;","names":["immer","isSet","current","Immer","base","Immer"]} \ No newline at end of file diff --git a/node_modules/immer/dist/immer.production.mjs b/node_modules/immer/dist/immer.production.mjs new file mode 100644 index 00000000..bc06411d --- /dev/null +++ b/node_modules/immer/dist/immer.production.mjs @@ -0,0 +1,2 @@ +var R=Symbol.for("immer-nothing"),z=Symbol.for("immer-draftable"),u=Symbol.for("immer-state");function h(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var N=Object.getPrototypeOf;function O(e){return!!e&&!!e[u]}function I(e){return e?ue(e)||Array.isArray(e)||!!e[z]||!!e.constructor?.[z]||v(e)||k(e):!1}var me=Object.prototype.constructor.toString();function ue(e){if(!e||typeof e!="object")return!1;let t=N(e);if(t===null)return!0;let r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object?!0:typeof r=="function"&&Function.toString.call(r)===me}function Se(e){return O(e)||h(15,e),e[u].t}function _(e,t){j(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,n)=>t(n,r,e))}function j(e){let t=e[u];return t?t.o:Array.isArray(e)?1:v(e)?2:k(e)?3:0}function C(e,t){return j(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function J(e,t){return j(e)===2?e.get(t):e[t]}function X(e,t,r){let n=j(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function ye(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function v(e){return e instanceof Map}function k(e){return e instanceof Set}function T(e){return e.e||e.t}function L(e,t){if(v(e))return new Map(e);if(k(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=ue(e);if(t===!0||t==="class_only"&&!r){let n=Object.getOwnPropertyDescriptors(e);delete n[u];let i=Reflect.ownKeys(n);for(let f=0;f1&&(e.set=e.add=e.clear=e.delete=Pe),Object.freeze(e),t&&Object.entries(e).forEach(([r,n])=>H(n,!0))),e}function Pe(){h(2)}function $(e){return Object.isFrozen(e)}var re={};function w(e){let t=re[e];return t||h(0,e),t}function Q(e,t){re[e]||(re[e]=t)}var U;function K(){return U}function xe(e,t){return{a:[],i:e,p:t,P:!0,d:0}}function ne(e,t){t&&(w("Patches"),e.f=[],e.h=[],e.b=t)}function V(e){Y(e),e.a.forEach(ge),e.a=null}function Y(e){e===U&&(U=e.i)}function ae(e){return U=xe(U,e)}function ge(e){let t=e[u];t.o===0||t.o===1?t.x():t.m=!0}function oe(e,t){t.d=t.a.length;let r=t.a[0];return e!==void 0&&e!==r?(r[u].s&&(V(t),h(4)),I(e)&&(e=Z(t,e),t.i||ee(t,e)),t.f&&w("Patches").T(r[u].t,e,t.f,t.h)):e=Z(t,r,[]),V(t),t.f&&t.b(t.f,t.h),e!==R?e:void 0}function Z(e,t,r){if($(t))return t;let n=t[u];if(!n)return _(t,(i,f)=>le(e,n,t,i,f,r)),t;if(n.n!==e)return t;if(!n.s)return ee(e,n.t,!0),n.t;if(!n.c){n.c=!0,n.n.d--;let i=n.e,f=i,l=!1;n.o===3&&(f=new Set(i),i.clear(),l=!0),_(f,(c,b)=>le(e,n,i,c,b,r,l)),ee(e,i,!1),r&&e.f&&w("Patches").g(n,r,e.f,e.h)}return n.e}function le(e,t,r,n,i,f,l){if(O(i)){let c=f&&t&&t.o!==3&&!C(t.r,n)?f.concat(n):void 0,b=Z(e,i,c);if(X(r,n,b),O(b))e.P=!1;else return}else l&&r.add(i);if(I(i)&&!$(i)){if(!e.p.y&&e.d<1)return;Z(e,i),(!t||!t.n.i)&&typeof n!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,n)&&ee(e,i)}}function ee(e,t,r=!1){!e.i&&e.p.y&&e.P&&H(t,r)}function pe(e,t){let r=Array.isArray(e),n={o:r?1:0,n:t?t.n:K(),s:!1,c:!1,r:{},i:t,t:e,u:null,e:null,x:null,l:!1},i=n,f=ce;r&&(i=[n],f=q);let{revoke:l,proxy:c}=Proxy.revocable(i,f);return n.u=c,n.x=l,c}var ce={get(e,t){if(t===u)return e;let r=T(e);if(!C(r,t))return be(e,r,t);let n=r[t];return e.c||!I(n)?n:n===ie(e.t,t)?(se(e),e.e[t]=B(n,e)):n},has(e,t){return t in T(e)},ownKeys(e){return Reflect.ownKeys(T(e))},set(e,t,r){let n=de(T(e),t);if(n?.set)return n.set.call(e.u,r),!0;if(!e.s){let i=ie(T(e),t),f=i?.[u];if(f&&f.t===r)return e.e[t]=r,e.r[t]=!1,!0;if(ye(r,i)&&(r!==void 0||C(e.t,t)))return!0;se(e),E(e)}return e.e[t]===r&&(r!==void 0||t in e.e)||Number.isNaN(r)&&Number.isNaN(e.e[t])||(e.e[t]=r,e.r[t]=!0),!0},deleteProperty(e,t){return ie(e.t,t)!==void 0||t in e.t?(e.r[t]=!1,se(e),E(e)):delete e.r[t],e.e&&delete e.e[t],!0},getOwnPropertyDescriptor(e,t){let r=T(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.o!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){h(11)},getPrototypeOf(e){return N(e.t)},setPrototypeOf(){h(12)}},q={};_(ce,(e,t)=>{q[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});q.deleteProperty=function(e,t){return q.set.call(this,e,t,void 0)};q.set=function(e,t,r){return ce.set.call(this,e[0],t,r,e[0])};function ie(e,t){let r=e[u];return(r?T(r):e)[t]}function be(e,t,r){let n=de(t,r);return n?"value"in n?n.value:n.get?.call(e.u):void 0}function de(e,t){if(!(t in e))return;let r=N(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=N(r)}}function E(e){e.s||(e.s=!0,e.i&&E(e.i))}function se(e){e.e||(e.e=L(e.t,e.n.p.S))}var te=class{constructor(t){this.y=!0;this.S=!1;this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){let f=r;r=t;let l=this;return function(b=f,...a){return l.produce(b,o=>r.call(this,o,...a))}}typeof r!="function"&&h(6),n!==void 0&&typeof n!="function"&&h(7);let i;if(I(t)){let f=ae(this),l=B(t,void 0),c=!0;try{i=r(l),c=!1}finally{c?V(f):Y(f)}return ne(f,n),oe(i,f)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===R&&(i=void 0),this.y&&H(i,!0),n){let f=[],l=[];w("Patches").T(t,i,f,l),n(f,l)}return i}else h(1,t)};this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(l,...c)=>this.produceWithPatches(l,b=>t(b,...c));let n,i;return[this.produce(t,r,(l,c)=>{n=l,i=c}),n,i]};typeof t?.autoFreeze=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof t?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){I(t)||h(8),O(t)&&(t=fe(t));let r=ae(this),n=B(t,void 0);return n[u].l=!0,Y(r),n}finishDraft(t,r){let n=t&&t[u];(!n||!n.l)&&h(9);let{n:i}=n;return ne(i,r),oe(void 0,i)}setAutoFreeze(t){this.y=t}setUseStrictShallowCopy(t){this.S=t}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){let f=r[n];if(f.path.length===0&&f.op==="replace"){t=f.value;break}}n>-1&&(r=r.slice(n+1));let i=w("Patches").A;return O(t)?i(t,r):this.produce(t,f=>i(f,r))}};function B(e,t){let r=v(e)?w("MapSet").I(e,t):k(e)?w("MapSet").D(e,t):pe(e,t);return(t?t.n:K()).a.push(r),r}function fe(e){return O(e)||h(10,e),he(e)}function he(e){if(!I(e)||$(e))return e;let t=e[u],r;if(t){if(!t.s)return t.t;t.c=!0,r=L(e,t.n.p.S)}else r=L(e,!0);return _(r,(n,i)=>{X(r,n,he(i))}),t&&(t.c=!1),r}function Te(){let t="replace",r="add",n="remove";function i(s,S,m,x){switch(s.o){case 0:case 2:return l(s,S,m,x);case 1:return f(s,S,m,x);case 3:return c(s,S,m,x)}}function f(s,S,m,x){let{t:A,r:P}=s,g=s.e;g.length{let d=J(A,g),W=J(P,g),F=y?C(A,g)?t:r:n;if(d===W&&F===t)return;let D=S.concat(g);m.push(F===n?{op:F,path:D}:{op:F,path:D,value:W}),x.push(F===r?{op:n,path:D}:F===n?{op:r,path:D,value:p(d)}:{op:t,path:D,value:p(d)})})}function c(s,S,m,x){let{t:A,e:P}=s,g=0;A.forEach(y=>{if(!P.has(y)){let d=S.concat([g]);m.push({op:n,path:d,value:y}),x.unshift({op:r,path:d,value:y})}g++}),g=0,P.forEach(y=>{if(!A.has(y)){let d=S.concat([g]);m.push({op:r,path:d,value:y}),x.unshift({op:n,path:d,value:y})}g++})}function b(s,S,m,x){m.push({op:t,path:[],value:S===R?void 0:S}),x.push({op:t,path:[],value:s})}function a(s,S){return S.forEach(m=>{let{path:x,op:A}=m,P=s;for(let W=0;W[m,o(x)]));if(k(s))return new Set(Array.from(s).map(o));let S=Object.create(N(s));for(let m in s)S[m]=o(s[m]);return C(s,z)&&(S[z]=s[z]),S}function p(s){return O(s)?o(s):s}Q("Patches",{A:a,g:i,T:b})}function Ae(){class e extends Map{constructor(a,o){super();this[u]={o:2,i:o,n:o?o.n:K(),s:!1,c:!1,e:void 0,r:void 0,t:a,u:this,l:!1,m:!1}}get size(){return T(this[u]).size}has(a){return T(this[u]).has(a)}set(a,o){let p=this[u];return l(p),(!T(p).has(a)||T(p).get(a)!==o)&&(r(p),E(p),p.r.set(a,!0),p.e.set(a,o),p.r.set(a,!0)),this}delete(a){if(!this.has(a))return!1;let o=this[u];return l(o),r(o),E(o),o.t.has(a)?o.r.set(a,!1):o.r.delete(a),o.e.delete(a),!0}clear(){let a=this[u];l(a),T(a).size&&(r(a),E(a),a.r=new Map,_(a.t,o=>{a.r.set(o,!1)}),a.e.clear())}forEach(a,o){let p=this[u];T(p).forEach((s,S,m)=>{a.call(o,this.get(S),S,this)})}get(a){let o=this[u];l(o);let p=T(o).get(a);if(o.c||!I(p)||p!==o.t.get(a))return p;let s=B(p,o);return r(o),o.e.set(a,s),s}keys(){return T(this[u]).keys()}values(){let a=this.keys();return{[Symbol.iterator]:()=>this.values(),next:()=>{let o=a.next();return o.done?o:{done:!1,value:this.get(o.value)}}}}entries(){let a=this.keys();return{[Symbol.iterator]:()=>this.entries(),next:()=>{let o=a.next();if(o.done)return o;let p=this.get(o.value);return{done:!1,value:[o.value,p]}}}}[(u,Symbol.iterator)](){return this.entries()}}function t(c,b){return new e(c,b)}function r(c){c.e||(c.r=new Map,c.e=new Map(c.t))}class n extends Set{constructor(a,o){super();this[u]={o:3,i:o,n:o?o.n:K(),s:!1,c:!1,e:void 0,t:a,u:this,a:new Map,m:!1,l:!1}}get size(){return T(this[u]).size}has(a){let o=this[u];return l(o),o.e?!!(o.e.has(a)||o.a.has(a)&&o.e.has(o.a.get(a))):o.t.has(a)}add(a){let o=this[u];return l(o),this.has(a)||(f(o),E(o),o.e.add(a)),this}delete(a){if(!this.has(a))return!1;let o=this[u];return l(o),f(o),E(o),o.e.delete(a)||(o.a.has(a)?o.e.delete(o.a.get(a)):!1)}clear(){let a=this[u];l(a),T(a).size&&(f(a),E(a),a.e.clear())}values(){let a=this[u];return l(a),f(a),a.e.values()}entries(){let a=this[u];return l(a),f(a),a.e.entries()}keys(){return this.values()}[(u,Symbol.iterator)](){return this.values()}forEach(a,o){let p=this.values(),s=p.next();for(;!s.done;)a.call(o,s.value,s.value,this),s=p.next()}}function i(c,b){return new n(c,b)}function f(c){c.e||(c.e=new Set,c.t.forEach(b=>{if(I(b)){let a=B(b,c);c.a.set(b,a),c.e.add(a)}else c.e.add(b)}))}function l(c){c.m&&h(3,JSON.stringify(T(c)))}Q("MapSet",{I:t,D:i})}var M=new te,qt=M.produce,Jt=M.produceWithPatches.bind(M),Xt=M.setAutoFreeze.bind(M),Qt=M.setUseStrictShallowCopy.bind(M),Yt=M.applyPatches.bind(M),Zt=M.createDraft.bind(M),er=M.finishDraft.bind(M);function tr(e){return e}function rr(e){return e}export{te as Immer,Yt as applyPatches,tr as castDraft,rr as castImmutable,Zt as createDraft,fe as current,Ae as enableMapSet,Te as enablePatches,er as finishDraft,H as freeze,z as immerable,O as isDraft,I as isDraftable,R as nothing,Se as original,qt as produce,Jt as produceWithPatches,Xt as setAutoFreeze,Qt as setUseStrictShallowCopy}; +//# sourceMappingURL=immer.production.mjs.map \ No newline at end of file diff --git a/node_modules/immer/dist/immer.production.mjs.map b/node_modules/immer/dist/immer.production.mjs.map new file mode 100644 index 00000000..2c914746 --- /dev/null +++ b/node_modules/immer/dist/immer.production.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/utils/env.ts","../src/utils/errors.ts","../src/utils/common.ts","../src/utils/plugins.ts","../src/core/scope.ts","../src/core/finalize.ts","../src/core/proxy.ts","../src/core/immerClass.ts","../src/core/current.ts","../src/plugins/patches.ts","../src/plugins/mapset.ts","../src/immer.ts"],"sourcesContent":["// Should be no imports here!\n\n/**\n * The sentinel value returned by producers to replace the draft with undefined.\n */\nexport const NOTHING: unique symbol = Symbol.for(\"immer-nothing\")\n\n/**\n * To let Immer treat your class instances as plain immutable objects\n * (albeit with a custom prototype), you must define either an instance property\n * or a static property on each of your custom classes.\n *\n * Otherwise, your class instance will never be drafted, which means it won't be\n * safe to mutate in a produce callback.\n */\nexport const DRAFTABLE: unique symbol = Symbol.for(\"immer-draftable\")\n\nexport const DRAFT_STATE: unique symbol = Symbol.for(\"immer-state\")\n","export const errors =\n\tprocess.env.NODE_ENV !== \"production\"\n\t\t? [\n\t\t\t\t// All error codes, starting by 0:\n\t\t\t\tfunction(plugin: string) {\n\t\t\t\t\treturn `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \\`enable${plugin}()\\` when initializing your application.`\n\t\t\t\t},\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`\n\t\t\t\t},\n\t\t\t\t\"This object has been frozen and should not be mutated\",\n\t\t\t\tfunction(data: any) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t\"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? \" +\n\t\t\t\t\t\tdata\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t\t\"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.\",\n\t\t\t\t\"Immer forbids circular references\",\n\t\t\t\t\"The first or second argument to `produce` must be a function\",\n\t\t\t\t\"The third argument to `produce` must be a function or undefined\",\n\t\t\t\t\"First argument to `createDraft` must be a plain object, an array, or an immerable object\",\n\t\t\t\t\"First argument to `finishDraft` must be a draft returned by `createDraft`\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'current' expects a draft, got: ${thing}`\n\t\t\t\t},\n\t\t\t\t\"Object.defineProperty() cannot be used on an Immer draft\",\n\t\t\t\t\"Object.setPrototypeOf() cannot be used on an Immer draft\",\n\t\t\t\t\"Immer only supports deleting array indices\",\n\t\t\t\t\"Immer only supports setting array indices and the 'length' property\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'original' expects a draft, got: ${thing}`\n\t\t\t\t}\n\t\t\t\t// Note: if more errors are added, the errorOffset in Patches.ts should be increased\n\t\t\t\t// See Patches.ts for additional errors\n\t\t ]\n\t\t: []\n\nexport function die(error: number, ...args: any[]): never {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tconst e = errors[error]\n\t\tconst msg = typeof e === \"function\" ? e.apply(null, args as any) : e\n\t\tthrow new Error(`[Immer] ${msg}`)\n\t}\n\tthrow new Error(\n\t\t`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`\n\t)\n}\n","import {\n\tDRAFT_STATE,\n\tDRAFTABLE,\n\tObjectish,\n\tDrafted,\n\tAnyObject,\n\tAnyMap,\n\tAnySet,\n\tImmerState,\n\tArchType,\n\tdie,\n\tStrictMode\n} from \"../internal\"\n\nexport const getPrototypeOf = Object.getPrototypeOf\n\n/** Returns true if the given value is an Immer draft */\n/*#__PURE__*/\nexport function isDraft(value: any): boolean {\n\treturn !!value && !!value[DRAFT_STATE]\n}\n\n/** Returns true if the given value can be drafted by Immer */\n/*#__PURE__*/\nexport function isDraftable(value: any): boolean {\n\tif (!value) return false\n\treturn (\n\t\tisPlainObject(value) ||\n\t\tArray.isArray(value) ||\n\t\t!!value[DRAFTABLE] ||\n\t\t!!value.constructor?.[DRAFTABLE] ||\n\t\tisMap(value) ||\n\t\tisSet(value)\n\t)\n}\n\nconst objectCtorString = Object.prototype.constructor.toString()\n/*#__PURE__*/\nexport function isPlainObject(value: any): boolean {\n\tif (!value || typeof value !== \"object\") return false\n\tconst proto = getPrototypeOf(value)\n\tif (proto === null) {\n\t\treturn true\n\t}\n\tconst Ctor =\n\t\tObject.hasOwnProperty.call(proto, \"constructor\") && proto.constructor\n\n\tif (Ctor === Object) return true\n\n\treturn (\n\t\ttypeof Ctor == \"function\" &&\n\t\tFunction.toString.call(Ctor) === objectCtorString\n\t)\n}\n\n/** Get the underlying object that is represented by the given draft */\n/*#__PURE__*/\nexport function original(value: T): T | undefined\nexport function original(value: Drafted): any {\n\tif (!isDraft(value)) die(15, value)\n\treturn value[DRAFT_STATE].base_\n}\n\n/**\n * Each iterates a map, set or array.\n * Or, if any other kind of object, all of its own properties.\n * Regardless whether they are enumerable or symbols\n */\nexport function each(\n\tobj: T,\n\titer: (key: string | number, value: any, source: T) => void\n): void\nexport function each(obj: any, iter: any) {\n\tif (getArchtype(obj) === ArchType.Object) {\n\t\tReflect.ownKeys(obj).forEach(key => {\n\t\t\titer(key, obj[key], obj)\n\t\t})\n\t} else {\n\t\tobj.forEach((entry: any, index: any) => iter(index, entry, obj))\n\t}\n}\n\n/*#__PURE__*/\nexport function getArchtype(thing: any): ArchType {\n\tconst state: undefined | ImmerState = thing[DRAFT_STATE]\n\treturn state\n\t\t? state.type_\n\t\t: Array.isArray(thing)\n\t\t? ArchType.Array\n\t\t: isMap(thing)\n\t\t? ArchType.Map\n\t\t: isSet(thing)\n\t\t? ArchType.Set\n\t\t: ArchType.Object\n}\n\n/*#__PURE__*/\nexport function has(thing: any, prop: PropertyKey): boolean {\n\treturn getArchtype(thing) === ArchType.Map\n\t\t? thing.has(prop)\n\t\t: Object.prototype.hasOwnProperty.call(thing, prop)\n}\n\n/*#__PURE__*/\nexport function get(thing: AnyMap | AnyObject, prop: PropertyKey): any {\n\t// @ts-ignore\n\treturn getArchtype(thing) === ArchType.Map ? thing.get(prop) : thing[prop]\n}\n\n/*#__PURE__*/\nexport function set(thing: any, propOrOldValue: PropertyKey, value: any) {\n\tconst t = getArchtype(thing)\n\tif (t === ArchType.Map) thing.set(propOrOldValue, value)\n\telse if (t === ArchType.Set) {\n\t\tthing.add(value)\n\t} else thing[propOrOldValue] = value\n}\n\n/*#__PURE__*/\nexport function is(x: any, y: any): boolean {\n\t// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n\tif (x === y) {\n\t\treturn x !== 0 || 1 / x === 1 / y\n\t} else {\n\t\treturn x !== x && y !== y\n\t}\n}\n\n/*#__PURE__*/\nexport function isMap(target: any): target is AnyMap {\n\treturn target instanceof Map\n}\n\n/*#__PURE__*/\nexport function isSet(target: any): target is AnySet {\n\treturn target instanceof Set\n}\n/*#__PURE__*/\nexport function latest(state: ImmerState): any {\n\treturn state.copy_ || state.base_\n}\n\n/*#__PURE__*/\nexport function shallowCopy(base: any, strict: StrictMode) {\n\tif (isMap(base)) {\n\t\treturn new Map(base)\n\t}\n\tif (isSet(base)) {\n\t\treturn new Set(base)\n\t}\n\tif (Array.isArray(base)) return Array.prototype.slice.call(base)\n\n\tconst isPlain = isPlainObject(base)\n\n\tif (strict === true || (strict === \"class_only\" && !isPlain)) {\n\t\t// Perform a strict copy\n\t\tconst descriptors = Object.getOwnPropertyDescriptors(base)\n\t\tdelete descriptors[DRAFT_STATE as any]\n\t\tlet keys = Reflect.ownKeys(descriptors)\n\t\tfor (let i = 0; i < keys.length; i++) {\n\t\t\tconst key: any = keys[i]\n\t\t\tconst desc = descriptors[key]\n\t\t\tif (desc.writable === false) {\n\t\t\t\tdesc.writable = true\n\t\t\t\tdesc.configurable = true\n\t\t\t}\n\t\t\t// like object.assign, we will read any _own_, get/set accessors. This helps in dealing\n\t\t\t// with libraries that trap values, like mobx or vue\n\t\t\t// unlike object.assign, non-enumerables will be copied as well\n\t\t\tif (desc.get || desc.set)\n\t\t\t\tdescriptors[key] = {\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\twritable: true, // could live with !!desc.set as well here...\n\t\t\t\t\tenumerable: desc.enumerable,\n\t\t\t\t\tvalue: base[key]\n\t\t\t\t}\n\t\t}\n\t\treturn Object.create(getPrototypeOf(base), descriptors)\n\t} else {\n\t\t// perform a sloppy copy\n\t\tconst proto = getPrototypeOf(base)\n\t\tif (proto !== null && isPlain) {\n\t\t\treturn {...base} // assumption: better inner class optimization than the assign below\n\t\t}\n\t\tconst obj = Object.create(proto)\n\t\treturn Object.assign(obj, base)\n\t}\n}\n\n/**\n * Freezes draftable objects. Returns the original object.\n * By default freezes shallowly, but if the second argument is `true` it will freeze recursively.\n *\n * @param obj\n * @param deep\n */\nexport function freeze(obj: T, deep?: boolean): T\nexport function freeze(obj: any, deep: boolean = false): T {\n\tif (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj\n\tif (getArchtype(obj) > 1 /* Map or Set */) {\n\t\tobj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections as any\n\t}\n\tObject.freeze(obj)\n\tif (deep)\n\t\t// See #590, don't recurse into non-enumerable / Symbol properties when freezing\n\t\t// So use Object.entries (only string-like, enumerables) instead of each()\n\t\tObject.entries(obj).forEach(([key, value]) => freeze(value, true))\n\treturn obj\n}\n\nfunction dontMutateFrozenCollections() {\n\tdie(2)\n}\n\nexport function isFrozen(obj: any): boolean {\n\treturn Object.isFrozen(obj)\n}\n","import {\n\tImmerState,\n\tPatch,\n\tDrafted,\n\tImmerBaseState,\n\tAnyMap,\n\tAnySet,\n\tArchType,\n\tdie\n} from \"../internal\"\n\n/** Plugin utilities */\nconst plugins: {\n\tPatches?: {\n\t\tgeneratePatches_(\n\t\t\tstate: ImmerState,\n\t\t\tbasePath: PatchPath,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tgenerateReplacementPatches_(\n\t\t\tbase: any,\n\t\t\treplacement: any,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tapplyPatches_(draft: T, patches: readonly Patch[]): T\n\t}\n\tMapSet?: {\n\t\tproxyMap_(target: T, parent?: ImmerState): T\n\t\tproxySet_(target: T, parent?: ImmerState): T\n\t}\n} = {}\n\ntype Plugins = typeof plugins\n\nexport function getPlugin(\n\tpluginKey: K\n): Exclude {\n\tconst plugin = plugins[pluginKey]\n\tif (!plugin) {\n\t\tdie(0, pluginKey)\n\t}\n\t// @ts-ignore\n\treturn plugin\n}\n\nexport function loadPlugin(\n\tpluginKey: K,\n\timplementation: Plugins[K]\n): void {\n\tif (!plugins[pluginKey]) plugins[pluginKey] = implementation\n}\n/** Map / Set plugin */\n\nexport interface MapState extends ImmerBaseState {\n\ttype_: ArchType.Map\n\tcopy_: AnyMap | undefined\n\tassigned_: Map | undefined\n\tbase_: AnyMap\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\nexport interface SetState extends ImmerBaseState {\n\ttype_: ArchType.Set\n\tcopy_: AnySet | undefined\n\tbase_: AnySet\n\tdrafts_: Map // maps the original value to the draft value in the new set\n\trevoked_: boolean\n\tdraft_: Drafted\n}\n\n/** Patches plugin */\n\nexport type PatchPath = (string | number)[]\n","import {\n\tPatch,\n\tPatchListener,\n\tDrafted,\n\tImmer,\n\tDRAFT_STATE,\n\tImmerState,\n\tArchType,\n\tgetPlugin\n} from \"../internal\"\n\n/** Each scope represents a `produce` call. */\n\nexport interface ImmerScope {\n\tpatches_?: Patch[]\n\tinversePatches_?: Patch[]\n\tcanAutoFreeze_: boolean\n\tdrafts_: any[]\n\tparent_?: ImmerScope\n\tpatchListener_?: PatchListener\n\timmer_: Immer\n\tunfinalizedDrafts_: number\n}\n\nlet currentScope: ImmerScope | undefined\n\nexport function getCurrentScope() {\n\treturn currentScope!\n}\n\nfunction createScope(\n\tparent_: ImmerScope | undefined,\n\timmer_: Immer\n): ImmerScope {\n\treturn {\n\t\tdrafts_: [],\n\t\tparent_,\n\t\timmer_,\n\t\t// Whenever the modified draft contains a draft from another scope, we\n\t\t// need to prevent auto-freezing so the unowned draft can be finalized.\n\t\tcanAutoFreeze_: true,\n\t\tunfinalizedDrafts_: 0\n\t}\n}\n\nexport function usePatchesInScope(\n\tscope: ImmerScope,\n\tpatchListener?: PatchListener\n) {\n\tif (patchListener) {\n\t\tgetPlugin(\"Patches\") // assert we have the plugin\n\t\tscope.patches_ = []\n\t\tscope.inversePatches_ = []\n\t\tscope.patchListener_ = patchListener\n\t}\n}\n\nexport function revokeScope(scope: ImmerScope) {\n\tleaveScope(scope)\n\tscope.drafts_.forEach(revokeDraft)\n\t// @ts-ignore\n\tscope.drafts_ = null\n}\n\nexport function leaveScope(scope: ImmerScope) {\n\tif (scope === currentScope) {\n\t\tcurrentScope = scope.parent_\n\t}\n}\n\nexport function enterScope(immer: Immer) {\n\treturn (currentScope = createScope(currentScope, immer))\n}\n\nfunction revokeDraft(draft: Drafted) {\n\tconst state: ImmerState = draft[DRAFT_STATE]\n\tif (state.type_ === ArchType.Object || state.type_ === ArchType.Array)\n\t\tstate.revoke_()\n\telse state.revoked_ = true\n}\n","import {\n\tImmerScope,\n\tDRAFT_STATE,\n\tisDraftable,\n\tNOTHING,\n\tPatchPath,\n\teach,\n\thas,\n\tfreeze,\n\tImmerState,\n\tisDraft,\n\tSetState,\n\tset,\n\tArchType,\n\tgetPlugin,\n\tdie,\n\trevokeScope,\n\tisFrozen\n} from \"../internal\"\n\nexport function processResult(result: any, scope: ImmerScope) {\n\tscope.unfinalizedDrafts_ = scope.drafts_.length\n\tconst baseDraft = scope.drafts_![0]\n\tconst isReplaced = result !== undefined && result !== baseDraft\n\tif (isReplaced) {\n\t\tif (baseDraft[DRAFT_STATE].modified_) {\n\t\t\trevokeScope(scope)\n\t\t\tdie(4)\n\t\t}\n\t\tif (isDraftable(result)) {\n\t\t\t// Finalize the result in case it contains (or is) a subset of the draft.\n\t\t\tresult = finalize(scope, result)\n\t\t\tif (!scope.parent_) maybeFreeze(scope, result)\n\t\t}\n\t\tif (scope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(\n\t\t\t\tbaseDraft[DRAFT_STATE].base_,\n\t\t\t\tresult,\n\t\t\t\tscope.patches_,\n\t\t\t\tscope.inversePatches_!\n\t\t\t)\n\t\t}\n\t} else {\n\t\t// Finalize the base draft.\n\t\tresult = finalize(scope, baseDraft, [])\n\t}\n\trevokeScope(scope)\n\tif (scope.patches_) {\n\t\tscope.patchListener_!(scope.patches_, scope.inversePatches_!)\n\t}\n\treturn result !== NOTHING ? result : undefined\n}\n\nfunction finalize(rootScope: ImmerScope, value: any, path?: PatchPath) {\n\t// Don't recurse in tho recursive data structures\n\tif (isFrozen(value)) return value\n\n\tconst state: ImmerState = value[DRAFT_STATE]\n\t// A plain object, might need freezing, might contain drafts\n\tif (!state) {\n\t\teach(value, (key, childValue) =>\n\t\t\tfinalizeProperty(rootScope, state, value, key, childValue, path)\n\t\t)\n\t\treturn value\n\t}\n\t// Never finalize drafts owned by another scope.\n\tif (state.scope_ !== rootScope) return value\n\t// Unmodified draft, return the (frozen) original\n\tif (!state.modified_) {\n\t\tmaybeFreeze(rootScope, state.base_, true)\n\t\treturn state.base_\n\t}\n\t// Not finalized yet, let's do that now\n\tif (!state.finalized_) {\n\t\tstate.finalized_ = true\n\t\tstate.scope_.unfinalizedDrafts_--\n\t\tconst result = state.copy_\n\t\t// Finalize all children of the copy\n\t\t// For sets we clone before iterating, otherwise we can get in endless loop due to modifying during iteration, see #628\n\t\t// To preserve insertion order in all cases we then clear the set\n\t\t// And we let finalizeProperty know it needs to re-add non-draft children back to the target\n\t\tlet resultEach = result\n\t\tlet isSet = false\n\t\tif (state.type_ === ArchType.Set) {\n\t\t\tresultEach = new Set(result)\n\t\t\tresult.clear()\n\t\t\tisSet = true\n\t\t}\n\t\teach(resultEach, (key, childValue) =>\n\t\t\tfinalizeProperty(rootScope, state, result, key, childValue, path, isSet)\n\t\t)\n\t\t// everything inside is frozen, we can freeze here\n\t\tmaybeFreeze(rootScope, result, false)\n\t\t// first time finalizing, let's create those patches\n\t\tif (path && rootScope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generatePatches_(\n\t\t\t\tstate,\n\t\t\t\tpath,\n\t\t\t\trootScope.patches_,\n\t\t\t\trootScope.inversePatches_!\n\t\t\t)\n\t\t}\n\t}\n\treturn state.copy_\n}\n\nfunction finalizeProperty(\n\trootScope: ImmerScope,\n\tparentState: undefined | ImmerState,\n\ttargetObject: any,\n\tprop: string | number,\n\tchildValue: any,\n\trootPath?: PatchPath,\n\ttargetIsSet?: boolean\n) {\n\tif (process.env.NODE_ENV !== \"production\" && childValue === targetObject)\n\t\tdie(5)\n\tif (isDraft(childValue)) {\n\t\tconst path =\n\t\t\trootPath &&\n\t\t\tparentState &&\n\t\t\tparentState!.type_ !== ArchType.Set && // Set objects are atomic since they have no keys.\n\t\t\t!has((parentState as Exclude).assigned_!, prop) // Skip deep patches for assigned keys.\n\t\t\t\t? rootPath!.concat(prop)\n\t\t\t\t: undefined\n\t\t// Drafts owned by `scope` are finalized here.\n\t\tconst res = finalize(rootScope, childValue, path)\n\t\tset(targetObject, prop, res)\n\t\t// Drafts from another scope must prevented to be frozen\n\t\t// if we got a draft back from finalize, we're in a nested produce and shouldn't freeze\n\t\tif (isDraft(res)) {\n\t\t\trootScope.canAutoFreeze_ = false\n\t\t} else return\n\t} else if (targetIsSet) {\n\t\ttargetObject.add(childValue)\n\t}\n\t// Search new objects for unfinalized drafts. Frozen objects should never contain drafts.\n\tif (isDraftable(childValue) && !isFrozen(childValue)) {\n\t\tif (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {\n\t\t\t// optimization: if an object is not a draft, and we don't have to\n\t\t\t// deepfreeze everything, and we are sure that no drafts are left in the remaining object\n\t\t\t// cause we saw and finalized all drafts already; we can stop visiting the rest of the tree.\n\t\t\t// This benefits especially adding large data tree's without further processing.\n\t\t\t// See add-data.js perf test\n\t\t\treturn\n\t\t}\n\t\tfinalize(rootScope, childValue)\n\t\t// Immer deep freezes plain objects, so if there is no parent state, we freeze as well\n\t\t// Per #590, we never freeze symbolic properties. Just to make sure don't accidentally interfere\n\t\t// with other frameworks.\n\t\tif (\n\t\t\t(!parentState || !parentState.scope_.parent_) &&\n\t\t\ttypeof prop !== \"symbol\" &&\n\t\t\tObject.prototype.propertyIsEnumerable.call(targetObject, prop)\n\t\t)\n\t\t\tmaybeFreeze(rootScope, childValue)\n\t}\n}\n\nfunction maybeFreeze(scope: ImmerScope, value: any, deep = false) {\n\t// we never freeze for a non-root scope; as it would prevent pruning for drafts inside wrapping objects\n\tif (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {\n\t\tfreeze(value, deep)\n\t}\n}\n","import {\n\teach,\n\thas,\n\tis,\n\tisDraftable,\n\tshallowCopy,\n\tlatest,\n\tImmerBaseState,\n\tImmerState,\n\tDrafted,\n\tAnyObject,\n\tAnyArray,\n\tObjectish,\n\tgetCurrentScope,\n\tgetPrototypeOf,\n\tDRAFT_STATE,\n\tdie,\n\tcreateProxy,\n\tArchType,\n\tImmerScope\n} from \"../internal\"\n\ninterface ProxyBaseState extends ImmerBaseState {\n\tassigned_: {\n\t\t[property: string]: boolean\n\t}\n\tparent_?: ImmerState\n\trevoke_(): void\n}\n\nexport interface ProxyObjectState extends ProxyBaseState {\n\ttype_: ArchType.Object\n\tbase_: any\n\tcopy_: any\n\tdraft_: Drafted\n}\n\nexport interface ProxyArrayState extends ProxyBaseState {\n\ttype_: ArchType.Array\n\tbase_: AnyArray\n\tcopy_: AnyArray | null\n\tdraft_: Drafted\n}\n\ntype ProxyState = ProxyObjectState | ProxyArrayState\n\n/**\n * Returns a new draft of the `base` object.\n *\n * The second argument is the parent draft-state (used internally).\n */\nexport function createProxyProxy(\n\tbase: T,\n\tparent?: ImmerState\n): Drafted {\n\tconst isArray = Array.isArray(base)\n\tconst state: ProxyState = {\n\t\ttype_: isArray ? ArchType.Array : (ArchType.Object as any),\n\t\t// Track which produce call this is associated with.\n\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t// True for both shallow and deep changes.\n\t\tmodified_: false,\n\t\t// Used during finalization.\n\t\tfinalized_: false,\n\t\t// Track which properties have been assigned (true) or deleted (false).\n\t\tassigned_: {},\n\t\t// The parent draft state.\n\t\tparent_: parent,\n\t\t// The base state.\n\t\tbase_: base,\n\t\t// The base proxy.\n\t\tdraft_: null as any, // set below\n\t\t// The base copy with any updated values.\n\t\tcopy_: null,\n\t\t// Called by the `produce` function.\n\t\trevoke_: null as any,\n\t\tisManual_: false\n\t}\n\n\t// the traps must target something, a bit like the 'real' base.\n\t// but also, we need to be able to determine from the target what the relevant state is\n\t// (to avoid creating traps per instance to capture the state in closure,\n\t// and to avoid creating weird hidden properties as well)\n\t// So the trick is to use 'state' as the actual 'target'! (and make sure we intercept everything)\n\t// Note that in the case of an array, we put the state in an array to have better Reflect defaults ootb\n\tlet target: T = state as any\n\tlet traps: ProxyHandler> = objectTraps\n\tif (isArray) {\n\t\ttarget = [state] as any\n\t\ttraps = arrayTraps\n\t}\n\n\tconst {revoke, proxy} = Proxy.revocable(target, traps)\n\tstate.draft_ = proxy as any\n\tstate.revoke_ = revoke\n\treturn proxy as any\n}\n\n/**\n * Object drafts\n */\nexport const objectTraps: ProxyHandler = {\n\tget(state, prop) {\n\t\tif (prop === DRAFT_STATE) return state\n\n\t\tconst source = latest(state)\n\t\tif (!has(source, prop)) {\n\t\t\t// non-existing or non-own property...\n\t\t\treturn readPropFromProto(state, source, prop)\n\t\t}\n\t\tconst value = source[prop]\n\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\treturn value\n\t\t}\n\t\t// Check for existing draft in modified state.\n\t\t// Assigned values are never drafted. This catches any drafts we created, too.\n\t\tif (value === peek(state.base_, prop)) {\n\t\t\tprepareCopy(state)\n\t\t\treturn (state.copy_![prop as any] = createProxy(value, state))\n\t\t}\n\t\treturn value\n\t},\n\thas(state, prop) {\n\t\treturn prop in latest(state)\n\t},\n\townKeys(state) {\n\t\treturn Reflect.ownKeys(latest(state))\n\t},\n\tset(\n\t\tstate: ProxyObjectState,\n\t\tprop: string /* strictly not, but helps TS */,\n\t\tvalue\n\t) {\n\t\tconst desc = getDescriptorFromProto(latest(state), prop)\n\t\tif (desc?.set) {\n\t\t\t// special case: if this write is captured by a setter, we have\n\t\t\t// to trigger it with the correct context\n\t\t\tdesc.set.call(state.draft_, value)\n\t\t\treturn true\n\t\t}\n\t\tif (!state.modified_) {\n\t\t\t// the last check is because we need to be able to distinguish setting a non-existing to undefined (which is a change)\n\t\t\t// from setting an existing property with value undefined to undefined (which is not a change)\n\t\t\tconst current = peek(latest(state), prop)\n\t\t\t// special case, if we assigning the original value to a draft, we can ignore the assignment\n\t\t\tconst currentState: ProxyObjectState = current?.[DRAFT_STATE]\n\t\t\tif (currentState && currentState.base_ === value) {\n\t\t\t\tstate.copy_![prop] = value\n\t\t\t\tstate.assigned_[prop] = false\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (is(value, current) && (value !== undefined || has(state.base_, prop)))\n\t\t\t\treturn true\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t}\n\n\t\tif (\n\t\t\t(state.copy_![prop] === value &&\n\t\t\t\t// special case: handle new props with value 'undefined'\n\t\t\t\t(value !== undefined || prop in state.copy_)) ||\n\t\t\t// special case: NaN\n\t\t\t(Number.isNaN(value) && Number.isNaN(state.copy_![prop]))\n\t\t)\n\t\t\treturn true\n\n\t\t// @ts-ignore\n\t\tstate.copy_![prop] = value\n\t\tstate.assigned_[prop] = true\n\t\treturn true\n\t},\n\tdeleteProperty(state, prop: string) {\n\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\tif (peek(state.base_, prop) !== undefined || prop in state.base_) {\n\t\t\tstate.assigned_[prop] = false\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t} else {\n\t\t\t// if an originally not assigned property was deleted\n\t\t\tdelete state.assigned_[prop]\n\t\t}\n\t\tif (state.copy_) {\n\t\t\tdelete state.copy_[prop]\n\t\t}\n\t\treturn true\n\t},\n\t// Note: We never coerce `desc.value` into an Immer draft, because we can't make\n\t// the same guarantee in ES5 mode.\n\tgetOwnPropertyDescriptor(state, prop) {\n\t\tconst owner = latest(state)\n\t\tconst desc = Reflect.getOwnPropertyDescriptor(owner, prop)\n\t\tif (!desc) return desc\n\t\treturn {\n\t\t\twritable: true,\n\t\t\tconfigurable: state.type_ !== ArchType.Array || prop !== \"length\",\n\t\t\tenumerable: desc.enumerable,\n\t\t\tvalue: owner[prop]\n\t\t}\n\t},\n\tdefineProperty() {\n\t\tdie(11)\n\t},\n\tgetPrototypeOf(state) {\n\t\treturn getPrototypeOf(state.base_)\n\t},\n\tsetPrototypeOf() {\n\t\tdie(12)\n\t}\n}\n\n/**\n * Array drafts\n */\n\nconst arrayTraps: ProxyHandler<[ProxyArrayState]> = {}\neach(objectTraps, (key, fn) => {\n\t// @ts-ignore\n\tarrayTraps[key] = function() {\n\t\targuments[0] = arguments[0][0]\n\t\treturn fn.apply(this, arguments)\n\t}\n})\narrayTraps.deleteProperty = function(state, prop) {\n\tif (process.env.NODE_ENV !== \"production\" && isNaN(parseInt(prop as any)))\n\t\tdie(13)\n\t// @ts-ignore\n\treturn arrayTraps.set!.call(this, state, prop, undefined)\n}\narrayTraps.set = function(state, prop, value) {\n\tif (\n\t\tprocess.env.NODE_ENV !== \"production\" &&\n\t\tprop !== \"length\" &&\n\t\tisNaN(parseInt(prop as any))\n\t)\n\t\tdie(14)\n\treturn objectTraps.set!.call(this, state[0], prop, value, state[0])\n}\n\n// Access a property without creating an Immer draft.\nfunction peek(draft: Drafted, prop: PropertyKey) {\n\tconst state = draft[DRAFT_STATE]\n\tconst source = state ? latest(state) : draft\n\treturn source[prop]\n}\n\nfunction readPropFromProto(state: ImmerState, source: any, prop: PropertyKey) {\n\tconst desc = getDescriptorFromProto(source, prop)\n\treturn desc\n\t\t? `value` in desc\n\t\t\t? desc.value\n\t\t\t: // This is a very special case, if the prop is a getter defined by the\n\t\t\t // prototype, we should invoke it with the draft as context!\n\t\t\t desc.get?.call(state.draft_)\n\t\t: undefined\n}\n\nfunction getDescriptorFromProto(\n\tsource: any,\n\tprop: PropertyKey\n): PropertyDescriptor | undefined {\n\t// 'in' checks proto!\n\tif (!(prop in source)) return undefined\n\tlet proto = getPrototypeOf(source)\n\twhile (proto) {\n\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop)\n\t\tif (desc) return desc\n\t\tproto = getPrototypeOf(proto)\n\t}\n\treturn undefined\n}\n\nexport function markChanged(state: ImmerState) {\n\tif (!state.modified_) {\n\t\tstate.modified_ = true\n\t\tif (state.parent_) {\n\t\t\tmarkChanged(state.parent_)\n\t\t}\n\t}\n}\n\nexport function prepareCopy(state: {\n\tbase_: any\n\tcopy_: any\n\tscope_: ImmerScope\n}) {\n\tif (!state.copy_) {\n\t\tstate.copy_ = shallowCopy(\n\t\t\tstate.base_,\n\t\t\tstate.scope_.immer_.useStrictShallowCopy_\n\t\t)\n\t}\n}\n","import {\n\tIProduceWithPatches,\n\tIProduce,\n\tImmerState,\n\tDrafted,\n\tisDraftable,\n\tprocessResult,\n\tPatch,\n\tObjectish,\n\tDRAFT_STATE,\n\tDraft,\n\tPatchListener,\n\tisDraft,\n\tisMap,\n\tisSet,\n\tcreateProxyProxy,\n\tgetPlugin,\n\tdie,\n\tenterScope,\n\trevokeScope,\n\tleaveScope,\n\tusePatchesInScope,\n\tgetCurrentScope,\n\tNOTHING,\n\tfreeze,\n\tcurrent\n} from \"../internal\"\n\ninterface ProducersFns {\n\tproduce: IProduce\n\tproduceWithPatches: IProduceWithPatches\n}\n\nexport type StrictMode = boolean | \"class_only\";\n\nexport class Immer implements ProducersFns {\n\tautoFreeze_: boolean = true\n\tuseStrictShallowCopy_: StrictMode = false\n\n\tconstructor(config?: {\n\t\tautoFreeze?: boolean\n\t\tuseStrictShallowCopy?: StrictMode\n\t}) {\n\t\tif (typeof config?.autoFreeze === \"boolean\")\n\t\t\tthis.setAutoFreeze(config!.autoFreeze)\n\t\tif (typeof config?.useStrictShallowCopy === \"boolean\")\n\t\t\tthis.setUseStrictShallowCopy(config!.useStrictShallowCopy)\n\t}\n\n\t/**\n\t * The `produce` function takes a value and a \"recipe function\" (whose\n\t * return value often depends on the base state). The recipe function is\n\t * free to mutate its first argument however it wants. All mutations are\n\t * only ever applied to a __copy__ of the base state.\n\t *\n\t * Pass only a function to create a \"curried producer\" which relieves you\n\t * from passing the recipe function every time.\n\t *\n\t * Only plain objects and arrays are made mutable. All other objects are\n\t * considered uncopyable.\n\t *\n\t * Note: This function is __bound__ to its `Immer` instance.\n\t *\n\t * @param {any} base - the initial state\n\t * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified\n\t * @param {Function} patchListener - optional function that will be called with all the patches produced here\n\t * @returns {any} a new state, or the initial state if nothing was modified\n\t */\n\tproduce: IProduce = (base: any, recipe?: any, patchListener?: any) => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\" && typeof recipe !== \"function\") {\n\t\t\tconst defaultBase = recipe\n\t\t\trecipe = base\n\n\t\t\tconst self = this\n\t\t\treturn function curriedProduce(\n\t\t\t\tthis: any,\n\t\t\t\tbase = defaultBase,\n\t\t\t\t...args: any[]\n\t\t\t) {\n\t\t\t\treturn self.produce(base, (draft: Drafted) => recipe.call(this, draft, ...args)) // prettier-ignore\n\t\t\t}\n\t\t}\n\n\t\tif (typeof recipe !== \"function\") die(6)\n\t\tif (patchListener !== undefined && typeof patchListener !== \"function\")\n\t\t\tdie(7)\n\n\t\tlet result\n\n\t\t// Only plain objects, arrays, and \"immerable classes\" are drafted.\n\t\tif (isDraftable(base)) {\n\t\t\tconst scope = enterScope(this)\n\t\t\tconst proxy = createProxy(base, undefined)\n\t\t\tlet hasError = true\n\t\t\ttry {\n\t\t\t\tresult = recipe(proxy)\n\t\t\t\thasError = false\n\t\t\t} finally {\n\t\t\t\t// finally instead of catch + rethrow better preserves original stack\n\t\t\t\tif (hasError) revokeScope(scope)\n\t\t\t\telse leaveScope(scope)\n\t\t\t}\n\t\t\tusePatchesInScope(scope, patchListener)\n\t\t\treturn processResult(result, scope)\n\t\t} else if (!base || typeof base !== \"object\") {\n\t\t\tresult = recipe(base)\n\t\t\tif (result === undefined) result = base\n\t\t\tif (result === NOTHING) result = undefined\n\t\t\tif (this.autoFreeze_) freeze(result, true)\n\t\t\tif (patchListener) {\n\t\t\t\tconst p: Patch[] = []\n\t\t\t\tconst ip: Patch[] = []\n\t\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(base, result, p, ip)\n\t\t\t\tpatchListener(p, ip)\n\t\t\t}\n\t\t\treturn result\n\t\t} else die(1, base)\n\t}\n\n\tproduceWithPatches: IProduceWithPatches = (base: any, recipe?: any): any => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\") {\n\t\t\treturn (state: any, ...args: any[]) =>\n\t\t\t\tthis.produceWithPatches(state, (draft: any) => base(draft, ...args))\n\t\t}\n\n\t\tlet patches: Patch[], inversePatches: Patch[]\n\t\tconst result = this.produce(base, recipe, (p: Patch[], ip: Patch[]) => {\n\t\t\tpatches = p\n\t\t\tinversePatches = ip\n\t\t})\n\t\treturn [result, patches!, inversePatches!]\n\t}\n\n\tcreateDraft(base: T): Draft {\n\t\tif (!isDraftable(base)) die(8)\n\t\tif (isDraft(base)) base = current(base)\n\t\tconst scope = enterScope(this)\n\t\tconst proxy = createProxy(base, undefined)\n\t\tproxy[DRAFT_STATE].isManual_ = true\n\t\tleaveScope(scope)\n\t\treturn proxy as any\n\t}\n\n\tfinishDraft>(\n\t\tdraft: D,\n\t\tpatchListener?: PatchListener\n\t): D extends Draft ? T : never {\n\t\tconst state: ImmerState = draft && (draft as any)[DRAFT_STATE]\n\t\tif (!state || !state.isManual_) die(9)\n\t\tconst {scope_: scope} = state\n\t\tusePatchesInScope(scope, patchListener)\n\t\treturn processResult(undefined, scope)\n\t}\n\n\t/**\n\t * Pass true to automatically freeze all copies created by Immer.\n\t *\n\t * By default, auto-freezing is enabled.\n\t */\n\tsetAutoFreeze(value: boolean) {\n\t\tthis.autoFreeze_ = value\n\t}\n\n\t/**\n\t * Pass true to enable strict shallow copy.\n\t *\n\t * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n\t */\n\tsetUseStrictShallowCopy(value: StrictMode) {\n\t\tthis.useStrictShallowCopy_ = value\n\t}\n\n\tapplyPatches(base: T, patches: readonly Patch[]): T {\n\t\t// If a patch replaces the entire state, take that replacement as base\n\t\t// before applying patches\n\t\tlet i: number\n\t\tfor (i = patches.length - 1; i >= 0; i--) {\n\t\t\tconst patch = patches[i]\n\t\t\tif (patch.path.length === 0 && patch.op === \"replace\") {\n\t\t\t\tbase = patch.value\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// If there was a patch that replaced the entire state, start from the\n\t\t// patch after that.\n\t\tif (i > -1) {\n\t\t\tpatches = patches.slice(i + 1)\n\t\t}\n\n\t\tconst applyPatchesImpl = getPlugin(\"Patches\").applyPatches_\n\t\tif (isDraft(base)) {\n\t\t\t// N.B: never hits if some patch a replacement, patches are never drafts\n\t\t\treturn applyPatchesImpl(base, patches)\n\t\t}\n\t\t// Otherwise, produce a copy of the base state.\n\t\treturn this.produce(base, (draft: Drafted) =>\n\t\t\tapplyPatchesImpl(draft, patches)\n\t\t)\n\t}\n}\n\nexport function createProxy(\n\tvalue: T,\n\tparent?: ImmerState\n): Drafted {\n\t// precondition: createProxy should be guarded by isDraftable, so we know we can safely draft\n\tconst draft: Drafted = isMap(value)\n\t\t? getPlugin(\"MapSet\").proxyMap_(value, parent)\n\t\t: isSet(value)\n\t\t? getPlugin(\"MapSet\").proxySet_(value, parent)\n\t\t: createProxyProxy(value, parent)\n\n\tconst scope = parent ? parent.scope_ : getCurrentScope()\n\tscope.drafts_.push(draft)\n\treturn draft\n}\n","import {\n\tdie,\n\tisDraft,\n\tshallowCopy,\n\teach,\n\tDRAFT_STATE,\n\tset,\n\tImmerState,\n\tisDraftable,\n\tisFrozen\n} from \"../internal\"\n\n/** Takes a snapshot of the current state of a draft and finalizes it (but without freezing). This is a great utility to print the current state during debugging (no Proxies in the way). The output of current can also be safely leaked outside the producer. */\nexport function current(value: T): T\nexport function current(value: any): any {\n\tif (!isDraft(value)) die(10, value)\n\treturn currentImpl(value)\n}\n\nfunction currentImpl(value: any): any {\n\tif (!isDraftable(value) || isFrozen(value)) return value\n\tconst state: ImmerState | undefined = value[DRAFT_STATE]\n\tlet copy: any\n\tif (state) {\n\t\tif (!state.modified_) return state.base_\n\t\t// Optimization: avoid generating new drafts during copying\n\t\tstate.finalized_ = true\n\t\tcopy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_)\n\t} else {\n\t\tcopy = shallowCopy(value, true)\n\t}\n\t// recurse\n\teach(copy, (key, childValue) => {\n\t\tset(copy, key, currentImpl(childValue))\n\t})\n\tif (state) {\n\t\tstate.finalized_ = false\n\t}\n\treturn copy\n}\n","import {immerable} from \"../immer\"\nimport {\n\tImmerState,\n\tPatch,\n\tSetState,\n\tProxyArrayState,\n\tMapState,\n\tProxyObjectState,\n\tPatchPath,\n\tget,\n\teach,\n\thas,\n\tgetArchtype,\n\tgetPrototypeOf,\n\tisSet,\n\tisMap,\n\tloadPlugin,\n\tArchType,\n\tdie,\n\tisDraft,\n\tisDraftable,\n\tNOTHING,\n\terrors\n} from \"../internal\"\n\nexport function enablePatches() {\n\tconst errorOffset = 16\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\terrors.push(\n\t\t\t'Sets cannot have \"replace\" patches.',\n\t\t\tfunction(op: string) {\n\t\t\t\treturn \"Unsupported patch operation: \" + op\n\t\t\t},\n\t\t\tfunction(path: string) {\n\t\t\t\treturn \"Cannot apply patch, path doesn't resolve: \" + path\n\t\t\t},\n\t\t\t\"Patching reserved attributes like __proto__, prototype and constructor is not allowed\"\n\t\t)\n\t}\n\n\tconst REPLACE = \"replace\"\n\tconst ADD = \"add\"\n\tconst REMOVE = \"remove\"\n\n\tfunction generatePatches_(\n\t\tstate: ImmerState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t): void {\n\t\tswitch (state.type_) {\n\t\t\tcase ArchType.Object:\n\t\t\tcase ArchType.Map:\n\t\t\t\treturn generatePatchesFromAssigned(\n\t\t\t\t\tstate,\n\t\t\t\t\tbasePath,\n\t\t\t\t\tpatches,\n\t\t\t\t\tinversePatches\n\t\t\t\t)\n\t\t\tcase ArchType.Array:\n\t\t\t\treturn generateArrayPatches(state, basePath, patches, inversePatches)\n\t\t\tcase ArchType.Set:\n\t\t\t\treturn generateSetPatches(\n\t\t\t\t\t(state as any) as SetState,\n\t\t\t\t\tbasePath,\n\t\t\t\t\tpatches,\n\t\t\t\t\tinversePatches\n\t\t\t\t)\n\t\t}\n\t}\n\n\tfunction generateArrayPatches(\n\t\tstate: ProxyArrayState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tlet {base_, assigned_} = state\n\t\tlet copy_ = state.copy_!\n\n\t\t// Reduce complexity by ensuring `base` is never longer.\n\t\tif (copy_.length < base_.length) {\n\t\t\t// @ts-ignore\n\t\t\t;[base_, copy_] = [copy_, base_]\n\t\t\t;[patches, inversePatches] = [inversePatches, patches]\n\t\t}\n\n\t\t// Process replaced indices.\n\t\tfor (let i = 0; i < base_.length; i++) {\n\t\t\tif (assigned_[i] && copy_[i] !== base_[i]) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: REPLACE,\n\t\t\t\t\tpath,\n\t\t\t\t\t// Need to maybe clone it, as it can in fact be the original value\n\t\t\t\t\t// due to the base/copy inversion at the start of this function\n\t\t\t\t\tvalue: clonePatchValueIfNeeded(copy_[i])\n\t\t\t\t})\n\t\t\t\tinversePatches.push({\n\t\t\t\t\top: REPLACE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue: clonePatchValueIfNeeded(base_[i])\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// Process added indices.\n\t\tfor (let i = base_.length; i < copy_.length; i++) {\n\t\t\tconst path = basePath.concat([i])\n\t\t\tpatches.push({\n\t\t\t\top: ADD,\n\t\t\t\tpath,\n\t\t\t\t// Need to maybe clone it, as it can in fact be the original value\n\t\t\t\t// due to the base/copy inversion at the start of this function\n\t\t\t\tvalue: clonePatchValueIfNeeded(copy_[i])\n\t\t\t})\n\t\t}\n\t\tfor (let i = copy_.length - 1; base_.length <= i; --i) {\n\t\t\tconst path = basePath.concat([i])\n\t\t\tinversePatches.push({\n\t\t\t\top: REMOVE,\n\t\t\t\tpath\n\t\t\t})\n\t\t}\n\t}\n\n\t// This is used for both Map objects and normal objects.\n\tfunction generatePatchesFromAssigned(\n\t\tstate: MapState | ProxyObjectState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tconst {base_, copy_} = state\n\t\teach(state.assigned_!, (key, assignedValue) => {\n\t\t\tconst origValue = get(base_, key)\n\t\t\tconst value = get(copy_!, key)\n\t\t\tconst op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD\n\t\t\tif (origValue === value && op === REPLACE) return\n\t\t\tconst path = basePath.concat(key as any)\n\t\t\tpatches.push(op === REMOVE ? {op, path} : {op, path, value})\n\t\t\tinversePatches.push(\n\t\t\t\top === ADD\n\t\t\t\t\t? {op: REMOVE, path}\n\t\t\t\t\t: op === REMOVE\n\t\t\t\t\t? {op: ADD, path, value: clonePatchValueIfNeeded(origValue)}\n\t\t\t\t\t: {op: REPLACE, path, value: clonePatchValueIfNeeded(origValue)}\n\t\t\t)\n\t\t})\n\t}\n\n\tfunction generateSetPatches(\n\t\tstate: SetState,\n\t\tbasePath: PatchPath,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t) {\n\t\tlet {base_, copy_} = state\n\n\t\tlet i = 0\n\t\tbase_.forEach((value: any) => {\n\t\t\tif (!copy_!.has(value)) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: REMOVE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t\tinversePatches.unshift({\n\t\t\t\t\top: ADD,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t}\n\t\t\ti++\n\t\t})\n\t\ti = 0\n\t\tcopy_!.forEach((value: any) => {\n\t\t\tif (!base_.has(value)) {\n\t\t\t\tconst path = basePath.concat([i])\n\t\t\t\tpatches.push({\n\t\t\t\t\top: ADD,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t\tinversePatches.unshift({\n\t\t\t\t\top: REMOVE,\n\t\t\t\t\tpath,\n\t\t\t\t\tvalue\n\t\t\t\t})\n\t\t\t}\n\t\t\ti++\n\t\t})\n\t}\n\n\tfunction generateReplacementPatches_(\n\t\tbaseValue: any,\n\t\treplacement: any,\n\t\tpatches: Patch[],\n\t\tinversePatches: Patch[]\n\t): void {\n\t\tpatches.push({\n\t\t\top: REPLACE,\n\t\t\tpath: [],\n\t\t\tvalue: replacement === NOTHING ? undefined : replacement\n\t\t})\n\t\tinversePatches.push({\n\t\t\top: REPLACE,\n\t\t\tpath: [],\n\t\t\tvalue: baseValue\n\t\t})\n\t}\n\n\tfunction applyPatches_(draft: T, patches: readonly Patch[]): T {\n\t\tpatches.forEach(patch => {\n\t\t\tconst {path, op} = patch\n\n\t\t\tlet base: any = draft\n\t\t\tfor (let i = 0; i < path.length - 1; i++) {\n\t\t\t\tconst parentType = getArchtype(base)\n\t\t\t\tlet p = path[i]\n\t\t\t\tif (typeof p !== \"string\" && typeof p !== \"number\") {\n\t\t\t\t\tp = \"\" + p\n\t\t\t\t}\n\n\t\t\t\t// See #738, avoid prototype pollution\n\t\t\t\tif (\n\t\t\t\t\t(parentType === ArchType.Object || parentType === ArchType.Array) &&\n\t\t\t\t\t(p === \"__proto__\" || p === \"constructor\")\n\t\t\t\t)\n\t\t\t\t\tdie(errorOffset + 3)\n\t\t\t\tif (typeof base === \"function\" && p === \"prototype\")\n\t\t\t\t\tdie(errorOffset + 3)\n\t\t\t\tbase = get(base, p)\n\t\t\t\tif (typeof base !== \"object\") die(errorOffset + 2, path.join(\"/\"))\n\t\t\t}\n\n\t\t\tconst type = getArchtype(base)\n\t\t\tconst value = deepClonePatchValue(patch.value) // used to clone patch to ensure original patch is not modified, see #411\n\t\t\tconst key = path[path.length - 1]\n\t\t\tswitch (op) {\n\t\t\t\tcase REPLACE:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase ArchType.Map:\n\t\t\t\t\t\t\treturn base.set(key, value)\n\t\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\t\tcase ArchType.Set:\n\t\t\t\t\t\t\tdie(errorOffset)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t// if value is an object, then it's assigned by reference\n\t\t\t\t\t\t\t// in the following add or remove ops, the value field inside the patch will also be modifyed\n\t\t\t\t\t\t\t// so we use value from the cloned patch\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\treturn (base[key] = value)\n\t\t\t\t\t}\n\t\t\t\tcase ADD:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase ArchType.Array:\n\t\t\t\t\t\t\treturn key === \"-\"\n\t\t\t\t\t\t\t\t? base.push(value)\n\t\t\t\t\t\t\t\t: base.splice(key as any, 0, value)\n\t\t\t\t\t\tcase ArchType.Map:\n\t\t\t\t\t\t\treturn base.set(key, value)\n\t\t\t\t\t\tcase ArchType.Set:\n\t\t\t\t\t\t\treturn base.add(value)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn (base[key] = value)\n\t\t\t\t\t}\n\t\t\t\tcase REMOVE:\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase ArchType.Array:\n\t\t\t\t\t\t\treturn base.splice(key as any, 1)\n\t\t\t\t\t\tcase ArchType.Map:\n\t\t\t\t\t\t\treturn base.delete(key)\n\t\t\t\t\t\tcase ArchType.Set:\n\t\t\t\t\t\t\treturn base.delete(patch.value)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn delete base[key]\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tdie(errorOffset + 1, op)\n\t\t\t}\n\t\t})\n\n\t\treturn draft\n\t}\n\n\t// optimize: this is quite a performance hit, can we detect intelligently when it is needed?\n\t// E.g. auto-draft when new objects from outside are assigned and modified?\n\t// (See failing test when deepClone just returns obj)\n\tfunction deepClonePatchValue(obj: T): T\n\tfunction deepClonePatchValue(obj: any) {\n\t\tif (!isDraftable(obj)) return obj\n\t\tif (Array.isArray(obj)) return obj.map(deepClonePatchValue)\n\t\tif (isMap(obj))\n\t\t\treturn new Map(\n\t\t\t\tArray.from(obj.entries()).map(([k, v]) => [k, deepClonePatchValue(v)])\n\t\t\t)\n\t\tif (isSet(obj)) return new Set(Array.from(obj).map(deepClonePatchValue))\n\t\tconst cloned = Object.create(getPrototypeOf(obj))\n\t\tfor (const key in obj) cloned[key] = deepClonePatchValue(obj[key])\n\t\tif (has(obj, immerable)) cloned[immerable] = obj[immerable]\n\t\treturn cloned\n\t}\n\n\tfunction clonePatchValueIfNeeded(obj: T): T {\n\t\tif (isDraft(obj)) {\n\t\t\treturn deepClonePatchValue(obj)\n\t\t} else return obj\n\t}\n\n\tloadPlugin(\"Patches\", {\n\t\tapplyPatches_,\n\t\tgeneratePatches_,\n\t\tgenerateReplacementPatches_\n\t})\n}\n","// types only!\nimport {\n\tImmerState,\n\tAnyMap,\n\tAnySet,\n\tMapState,\n\tSetState,\n\tDRAFT_STATE,\n\tgetCurrentScope,\n\tlatest,\n\tisDraftable,\n\tcreateProxy,\n\tloadPlugin,\n\tmarkChanged,\n\tdie,\n\tArchType,\n\teach\n} from \"../internal\"\n\nexport function enableMapSet() {\n\tclass DraftMap extends Map {\n\t\t[DRAFT_STATE]: MapState\n\n\t\tconstructor(target: AnyMap, parent?: ImmerState) {\n\t\t\tsuper()\n\t\t\tthis[DRAFT_STATE] = {\n\t\t\t\ttype_: ArchType.Map,\n\t\t\t\tparent_: parent,\n\t\t\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t\t\tmodified_: false,\n\t\t\t\tfinalized_: false,\n\t\t\t\tcopy_: undefined,\n\t\t\t\tassigned_: undefined,\n\t\t\t\tbase_: target,\n\t\t\t\tdraft_: this as any,\n\t\t\t\tisManual_: false,\n\t\t\t\trevoked_: false\n\t\t\t}\n\t\t}\n\n\t\tget size(): number {\n\t\t\treturn latest(this[DRAFT_STATE]).size\n\t\t}\n\n\t\thas(key: any): boolean {\n\t\t\treturn latest(this[DRAFT_STATE]).has(key)\n\t\t}\n\n\t\tset(key: any, value: any) {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (!latest(state).has(key) || latest(state).get(key) !== value) {\n\t\t\t\tprepareMapCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.assigned_!.set(key, true)\n\t\t\t\tstate.copy_!.set(key, value)\n\t\t\t\tstate.assigned_!.set(key, true)\n\t\t\t}\n\t\t\treturn this\n\t\t}\n\n\t\tdelete(key: any): boolean {\n\t\t\tif (!this.has(key)) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareMapCopy(state)\n\t\t\tmarkChanged(state)\n\t\t\tif (state.base_.has(key)) {\n\t\t\t\tstate.assigned_!.set(key, false)\n\t\t\t} else {\n\t\t\t\tstate.assigned_!.delete(key)\n\t\t\t}\n\t\t\tstate.copy_!.delete(key)\n\t\t\treturn true\n\t\t}\n\n\t\tclear() {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (latest(state).size) {\n\t\t\t\tprepareMapCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.assigned_ = new Map()\n\t\t\t\teach(state.base_, key => {\n\t\t\t\t\tstate.assigned_!.set(key, false)\n\t\t\t\t})\n\t\t\t\tstate.copy_!.clear()\n\t\t\t}\n\t\t}\n\n\t\tforEach(cb: (value: any, key: any, self: any) => void, thisArg?: any) {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tlatest(state).forEach((_value: any, key: any, _map: any) => {\n\t\t\t\tcb.call(thisArg, this.get(key), key, this)\n\t\t\t})\n\t\t}\n\n\t\tget(key: any): any {\n\t\t\tconst state: MapState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tconst value = latest(state).get(key)\n\t\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\t\treturn value\n\t\t\t}\n\t\t\tif (value !== state.base_.get(key)) {\n\t\t\t\treturn value // either already drafted or reassigned\n\t\t\t}\n\t\t\t// despite what it looks, this creates a draft only once, see above condition\n\t\t\tconst draft = createProxy(value, state)\n\t\t\tprepareMapCopy(state)\n\t\t\tstate.copy_!.set(key, draft)\n\t\t\treturn draft\n\t\t}\n\n\t\tkeys(): IterableIterator {\n\t\t\treturn latest(this[DRAFT_STATE]).keys()\n\t\t}\n\n\t\tvalues(): IterableIterator {\n\t\t\tconst iterator = this.keys()\n\t\t\treturn {\n\t\t\t\t[Symbol.iterator]: () => this.values(),\n\t\t\t\tnext: () => {\n\t\t\t\t\tconst r = iterator.next()\n\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\tif (r.done) return r\n\t\t\t\t\tconst value = this.get(r.value)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\tvalue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} as any\n\t\t}\n\n\t\tentries(): IterableIterator<[any, any]> {\n\t\t\tconst iterator = this.keys()\n\t\t\treturn {\n\t\t\t\t[Symbol.iterator]: () => this.entries(),\n\t\t\t\tnext: () => {\n\t\t\t\t\tconst r = iterator.next()\n\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\tif (r.done) return r\n\t\t\t\t\tconst value = this.get(r.value)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\tvalue: [r.value, value]\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} as any\n\t\t}\n\n\t\t[Symbol.iterator]() {\n\t\t\treturn this.entries()\n\t\t}\n\t}\n\n\tfunction proxyMap_(target: T, parent?: ImmerState): T {\n\t\t// @ts-ignore\n\t\treturn new DraftMap(target, parent)\n\t}\n\n\tfunction prepareMapCopy(state: MapState) {\n\t\tif (!state.copy_) {\n\t\t\tstate.assigned_ = new Map()\n\t\t\tstate.copy_ = new Map(state.base_)\n\t\t}\n\t}\n\n\tclass DraftSet extends Set {\n\t\t[DRAFT_STATE]: SetState\n\t\tconstructor(target: AnySet, parent?: ImmerState) {\n\t\t\tsuper()\n\t\t\tthis[DRAFT_STATE] = {\n\t\t\t\ttype_: ArchType.Set,\n\t\t\t\tparent_: parent,\n\t\t\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t\t\tmodified_: false,\n\t\t\t\tfinalized_: false,\n\t\t\t\tcopy_: undefined,\n\t\t\t\tbase_: target,\n\t\t\t\tdraft_: this,\n\t\t\t\tdrafts_: new Map(),\n\t\t\t\trevoked_: false,\n\t\t\t\tisManual_: false\n\t\t\t}\n\t\t}\n\n\t\tget size(): number {\n\t\t\treturn latest(this[DRAFT_STATE]).size\n\t\t}\n\n\t\thas(value: any): boolean {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\t// bit of trickery here, to be able to recognize both the value, and the draft of its value\n\t\t\tif (!state.copy_) {\n\t\t\t\treturn state.base_.has(value)\n\t\t\t}\n\t\t\tif (state.copy_.has(value)) return true\n\t\t\tif (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value)))\n\t\t\t\treturn true\n\t\t\treturn false\n\t\t}\n\n\t\tadd(value: any): any {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (!this.has(value)) {\n\t\t\t\tprepareSetCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.copy_!.add(value)\n\t\t\t}\n\t\t\treturn this\n\t\t}\n\n\t\tdelete(value: any): any {\n\t\t\tif (!this.has(value)) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\tmarkChanged(state)\n\t\t\treturn (\n\t\t\t\tstate.copy_!.delete(value) ||\n\t\t\t\t(state.drafts_.has(value)\n\t\t\t\t\t? state.copy_!.delete(state.drafts_.get(value))\n\t\t\t\t\t: /* istanbul ignore next */ false)\n\t\t\t)\n\t\t}\n\n\t\tclear() {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tif (latest(state).size) {\n\t\t\t\tprepareSetCopy(state)\n\t\t\t\tmarkChanged(state)\n\t\t\t\tstate.copy_!.clear()\n\t\t\t}\n\t\t}\n\n\t\tvalues(): IterableIterator {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\treturn state.copy_!.values()\n\t\t}\n\n\t\tentries(): IterableIterator<[any, any]> {\n\t\t\tconst state: SetState = this[DRAFT_STATE]\n\t\t\tassertUnrevoked(state)\n\t\t\tprepareSetCopy(state)\n\t\t\treturn state.copy_!.entries()\n\t\t}\n\n\t\tkeys(): IterableIterator {\n\t\t\treturn this.values()\n\t\t}\n\n\t\t[Symbol.iterator]() {\n\t\t\treturn this.values()\n\t\t}\n\n\t\tforEach(cb: any, thisArg?: any) {\n\t\t\tconst iterator = this.values()\n\t\t\tlet result = iterator.next()\n\t\t\twhile (!result.done) {\n\t\t\t\tcb.call(thisArg, result.value, result.value, this)\n\t\t\t\tresult = iterator.next()\n\t\t\t}\n\t\t}\n\t}\n\tfunction proxySet_(target: T, parent?: ImmerState): T {\n\t\t// @ts-ignore\n\t\treturn new DraftSet(target, parent)\n\t}\n\n\tfunction prepareSetCopy(state: SetState) {\n\t\tif (!state.copy_) {\n\t\t\t// create drafts for all entries to preserve insertion order\n\t\t\tstate.copy_ = new Set()\n\t\t\tstate.base_.forEach(value => {\n\t\t\t\tif (isDraftable(value)) {\n\t\t\t\t\tconst draft = createProxy(value, state)\n\t\t\t\t\tstate.drafts_.set(value, draft)\n\t\t\t\t\tstate.copy_!.add(draft)\n\t\t\t\t} else {\n\t\t\t\t\tstate.copy_!.add(value)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n\n\tfunction assertUnrevoked(state: any /*ES5State | MapState | SetState*/) {\n\t\tif (state.revoked_) die(3, JSON.stringify(latest(state)))\n\t}\n\n\tloadPlugin(\"MapSet\", {proxyMap_, proxySet_})\n}\n","import {\n\tIProduce,\n\tIProduceWithPatches,\n\tImmer,\n\tDraft,\n\tImmutable\n} from \"./internal\"\n\nexport {\n\tDraft,\n\tWritableDraft,\n\tImmutable,\n\tPatch,\n\tPatchListener,\n\tProducer,\n\toriginal,\n\tcurrent,\n\tisDraft,\n\tisDraftable,\n\tNOTHING as nothing,\n\tDRAFTABLE as immerable,\n\tfreeze,\n\tObjectish,\n\tStrictMode\n} from \"./internal\"\n\nconst immer = new Immer()\n\n/**\n * The `produce` function takes a value and a \"recipe function\" (whose\n * return value often depends on the base state). The recipe function is\n * free to mutate its first argument however it wants. All mutations are\n * only ever applied to a __copy__ of the base state.\n *\n * Pass only a function to create a \"curried producer\" which relieves you\n * from passing the recipe function every time.\n *\n * Only plain objects and arrays are made mutable. All other objects are\n * considered uncopyable.\n *\n * Note: This function is __bound__ to its `Immer` instance.\n *\n * @param {any} base - the initial state\n * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified\n * @param {Function} patchListener - optional function that will be called with all the patches produced here\n * @returns {any} a new state, or the initial state if nothing was modified\n */\nexport const produce: IProduce = immer.produce\n\n/**\n * Like `produce`, but `produceWithPatches` always returns a tuple\n * [nextState, patches, inversePatches] (instead of just the next state)\n */\nexport const produceWithPatches: IProduceWithPatches = immer.produceWithPatches.bind(\n\timmer\n)\n\n/**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * Always freeze by default, even in production mode\n */\nexport const setAutoFreeze = immer.setAutoFreeze.bind(immer)\n\n/**\n * Pass true to enable strict shallow copy.\n *\n * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n */\nexport const setUseStrictShallowCopy = immer.setUseStrictShallowCopy.bind(immer)\n\n/**\n * Apply an array of Immer patches to the first argument.\n *\n * This function is a producer, which means copy-on-write is in effect.\n */\nexport const applyPatches = immer.applyPatches.bind(immer)\n\n/**\n * Create an Immer draft from the given base state, which may be a draft itself.\n * The draft can be modified until you finalize it with the `finishDraft` function.\n */\nexport const createDraft = immer.createDraft.bind(immer)\n\n/**\n * Finalize an Immer draft from a `createDraft` call, returning the base state\n * (if no changes were made) or a modified copy. The draft must *not* be\n * mutated afterwards.\n *\n * Pass a function as the 2nd argument to generate Immer patches based on the\n * changes that were made.\n */\nexport const finishDraft = immer.finishDraft.bind(immer)\n\n/**\n * This function is actually a no-op, but can be used to cast an immutable type\n * to an draft type and make TypeScript happy\n *\n * @param value\n */\nexport function castDraft(value: T): Draft {\n\treturn value as any\n}\n\n/**\n * This function is actually a no-op, but can be used to cast a mutable type\n * to an immutable type and make TypeScript happy\n * @param value\n */\nexport function castImmutable(value: T): Immutable {\n\treturn value as any\n}\n\nexport {Immer}\n\nexport {enablePatches} from \"./plugins/patches\"\nexport {enableMapSet} from \"./plugins/mapset\"\n"],"mappings":"AAKO,IAAMA,EAAyB,OAAO,IAAI,eAAe,EAUnDC,EAA2B,OAAO,IAAI,iBAAiB,EAEvDC,EAA6B,OAAO,IAAI,aAAa,ECqB3D,SAASC,EAAIC,KAAkBC,EAAoB,CAMzD,MAAM,IAAI,MACT,8BAA8BD,0CAC/B,CACD,CCjCO,IAAME,EAAiB,OAAO,eAI9B,SAASC,EAAQC,EAAqB,CAC5C,MAAO,CAAC,CAACA,GAAS,CAAC,CAACA,EAAMC,CAAW,CACtC,CAIO,SAASC,EAAYF,EAAqB,CAChD,OAAKA,EAEJG,GAAcH,CAAK,GACnB,MAAM,QAAQA,CAAK,GACnB,CAAC,CAACA,EAAMI,CAAS,GACjB,CAAC,CAACJ,EAAM,cAAcI,CAAS,GAC/BC,EAAML,CAAK,GACXM,EAAMN,CAAK,EAPO,EASp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ACA,SAASO,EAA4BrC,EAAWC,EAAwB,CAEvE,OAAO,IAAIgC,EAASjC,EAAQC,CAAM,CACnC,CAEA,SAASkC,EAAejB,EAAiB,CACnCA,EAAMT,IAEVS,EAAMT,EAAQ,IAAI,IAClBS,EAAMP,EAAM,QAAQM,GAAS,CAC5B,GAAIU,EAAYV,CAAK,EAAG,CACvB,IAAMW,EAAQC,EAAYZ,EAAOC,CAAK,EACtCA,EAAMgB,EAAQ,IAAIjB,EAAOW,CAAK,EAC9BV,EAAMT,EAAO,IAAImB,CAAK,OAEtBV,EAAMT,EAAO,IAAIQ,CAAK,CAExB,CAAC,EAEH,CAEA,SAASE,EAAgBD,EAA+C,CACnEA,EAAMJ,GAAUwB,EAAI,EAAG,KAAK,UAAUvB,EAAOG,CAAK,CAAC,CAAC,CACzD,CAEAqB,EAAW,SAAU,CAACP,IAAWK,GAAS,CAAC,CAC5C,CCrRA,IAAMG,EAAQ,IAAIC,GAqBLC,GAAoBF,EAAM,QAM1BG,GAA0CH,EAAM,mBAAmB,KAC/EA,CACD,EAOaI,GAAgBJ,EAAM,cAAc,KAAKA,CAAK,EAO9CK,GAA0BL,EAAM,wBAAwB,KAAKA,CAAK,EAOlEM,GAAeN,EAAM,aAAa,KAAKA,CAAK,EAM5CO,GAAcP,EAAM,YAAY,KAAKA,CAAK,EAU1CQ,GAAcR,EAAM,YAAY,KAAKA,CAAK,EAQhD,SAASS,GAAaC,EAAoB,CAChD,OAAOA,CACR,CAOO,SAASC,GAAiBD,EAAwB,CACxD,OAAOA,CACR","names":["NOTHING","DRAFTABLE","DRAFT_STATE","die","error","args","getPrototypeOf","isDraft","value","DRAFT_STATE","isDraftable","isPlainObject","DRAFTABLE","isMap","isSet","objectCtorString","proto","Ctor","original","die","base_","each","obj","iter","getArchtype","key","entry","index","thing","state","type_","has","prop","get","set","propOrOldValue","t","is","x","y","target","latest","copy_","shallowCopy","base","strict","isPlain","descriptors","keys","i","desc","freeze","deep","isFrozen","dontMutateFrozenCollections","plugins","getPlugin","pluginKey","plugin","die","loadPlugin","implementation","currentScope","getCurrentScope","createScope","parent_","immer_","drafts_","canAutoFreeze_","unfinalizedDrafts_","usePatchesInScope","scope","patchListener","getPlugin","patches_","inversePatches_","patchListener_","revokeScope","leaveScope","revokeDraft","enterScope","immer","draft","state","DRAFT_STATE","type_","revoke_","revoked_","processResult","result","scope","unfinalizedDrafts_","drafts_","baseDraft","DRAFT_STATE","modified_","revokeScope","die","isDraftable","finalize","parent_","maybeFreeze","patches_","getPlugin","generateReplacementPatches_","base_","inversePatches_","patchListener_","NOTHING","rootScope","value","path","isFrozen","state","each","key","childValue","finalizeProperty","scope_","finalized_","copy_","resultEach","isSet","type_","generatePatches_","parentState","targetObject","prop","rootPath","targetIsSet","isDraft","has","assigned_","res","set","canAutoFreeze_","immer_","autoFreeze_","deep","freeze","createProxyProxy","base","parent","isArray","state","type_","scope_","getCurrentScope","modified_","finalized_","assigned_","parent_","base_","draft_","copy_","revoke_","isManual_","target","traps","objectTraps","arrayTraps","revoke","proxy","prop","DRAFT_STATE","source","latest","has","readPropFromProto","value","isDraftable","peek","prepareCopy","createProxy","desc","getDescriptorFromProto","current","currentState","is","markChanged","owner","die","getPrototypeOf","each","key","fn","draft","proto","shallowCopy","immer_","useStrictShallowCopy_","Immer","config","autoFreeze_","useStrictShallowCopy_","base","recipe","patchListener","defaultBase","self","args","draft","die","result","isDraftable","scope","enterScope","proxy","createProxy","hasError","revokeScope","leaveScope","usePatchesInScope","processResult","NOTHING","freeze","p","ip","getPlugin","generateReplacementPatches_","state","patches","inversePatches","isDraft","current","DRAFT_STATE","isManual_","scope_","value","i","patch","applyPatchesImpl","applyPatches_","parent","isMap","proxyMap_","isSet","proxySet_","createProxyProxy","getCurrentScope","drafts_","current","value","isDraft","die","currentImpl","isDraftable","isFrozen","state","DRAFT_STATE","copy","modified_","base_","finalized_","shallowCopy","scope_","immer_","useStrictShallowCopy_","each","key","childValue","set","enablePatches","REPLACE","ADD","REMOVE","generatePatches_","state","basePath","patches","inversePatches","type_","generatePatchesFromAssigned","generateArrayPatches","generateSetPatches","base_","assigned_","copy_","i","path","clonePatchValueIfNeeded","each","key","assignedValue","origValue","get","value","op","has","generateReplacementPatches_","baseValue","replacement","NOTHING","applyPatches_","draft","patch","base","parentType","getArchtype","p","die","type","deepClonePatchValue","obj","isDraftable","isMap","k","v","isSet","cloned","getPrototypeOf","DRAFTABLE","isDraft","loadPlugin","enableMapSet","DraftMap","target","parent","DRAFT_STATE","type_","parent_","scope_","getCurrentScope","modified_","finalized_","copy_","assigned_","base_","draft_","isManual_","revoked_","latest","key","value","state","assertUnrevoked","prepareMapCopy","markChanged","each","cb","thisArg","_value","_map","isDraftable","draft","createProxy","iterator","r","proxyMap_","DraftSet","drafts_","prepareSetCopy","result","proxySet_","die","loadPlugin","immer","Immer","produce","produceWithPatches","setAutoFreeze","setUseStrictShallowCopy","applyPatches","createDraft","finishDraft","castDraft","value","castImmutable"]} \ No newline at end of file diff --git a/node_modules/immer/package.json b/node_modules/immer/package.json new file mode 100644 index 00000000..40823a8a --- /dev/null +++ b/node_modules/immer/package.json @@ -0,0 +1,87 @@ +{ + "name": "immer", + "version": "10.1.1", + "description": "Create your next immutable state by mutating the current one", + "main": "./dist/cjs/index.js", + "module": "./dist/immer.legacy-esm.js", + "exports": { + "./package.json": "./package.json", + ".": { + "types": "./dist/immer.d.ts", + "import": "./dist/immer.mjs", + "require": "./dist/cjs/index.js" + } + }, + "jsnext:main": "dist/immer.mjs", + "react-native": "./dist/immer.legacy-esm.js", + "source": "src/immer.ts", + "types": "./dist/immer.d.ts", + "sideEffects": false, + "scripts": { + "pretest": "yarn build", + "test": "jest && yarn test:build && yarn test:flow", + "test:perf": "cd __performance_tests__ && node add-data.mjs && node todo.mjs && node incremental.mjs && node large-obj.mjs", + "test:flow": "yarn flow check __tests__/flow", + "test:build": "NODE_ENV='production' yarn jest --config jest.config.build.js", + "watch": "jest --watch", + "coverage": "jest --coverage", + "coveralls": "jest --coverage && cat ./coverage/lcov.info | ./node_modules/.bin/coveralls && rm -rf ./coverage", + "build": "tsup", + "publish-docs": "cd website && GIT_USER=mweststrate USE_SSH=true yarn docusaurus deploy", + "start": "cd website && yarn start", + "test:size": "yarn build && yarn import-size --report . produce enableMapSet enablePatches", + "test:sizequick": "yarn build && yarn import-size . produce" + }, + "husky": { + "hooks": { + "pre-commit": "pretty-quick --staged" + } + }, + "repository": { + "type": "git", + "url": "https://github.com/immerjs/immer.git" + }, + "keywords": [ + "immutable", + "mutable", + "copy-on-write" + ], + "author": "Michel Weststrate ", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + }, + "bugs": { + "url": "https://github.com/immerjs/immer/issues" + }, + "homepage": "https://github.com/immerjs/immer#readme", + "files": [ + "dist", + "compat", + "src" + ], + "devDependencies": { + "@babel/core": "^7.21.3", + "@types/jest": "^25.1.2", + "coveralls": "^3.0.0", + "cpx2": "^3.0.0", + "deep-freeze": "^0.0.1", + "flow-bin": "^0.123.0", + "husky": "^1.2.0", + "immutable": "^3.8.2", + "import-size": "^1.0.2", + "jest": "^29.5.0", + "lodash": "^4.17.4", + "lodash.clonedeep": "^4.5.0", + "prettier": "1.19.1", + "pretty-quick": "^1.8.0", + "redux": "^4.0.5", + "rimraf": "^2.6.2", + "seamless-immutable": "^7.1.3", + "semantic-release": "^17.0.2", + "ts-jest": "^29.0.0", + "tsup": "^6.7.0", + "typescript": "^5.0.2" + } +} diff --git a/node_modules/immer/readme.md b/node_modules/immer/readme.md new file mode 100644 index 00000000..41ca194f --- /dev/null +++ b/node_modules/immer/readme.md @@ -0,0 +1,33 @@ + + +# Immer + +[![npm](https://img.shields.io/npm/v/immer.svg)](https://www.npmjs.com/package/immer) [![Build Status](https://github.com/immerjs/immer/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/immerjs/immer/actions?query=branch%3Amain) [![Coverage Status](https://coveralls.io/repos/github/immerjs/immer/badge.svg?branch=main)](https://coveralls.io/github/immerjs/immer?branch=main) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![OpenCollective](https://opencollective.com/immer/backers/badge.svg)](#backers) [![OpenCollective](https://opencollective.com/immer/sponsors/badge.svg)](#sponsors) [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/immerjs/immer) + +_Create the next immutable state tree by simply modifying the current tree_ + +Winner of the "Breakthrough of the year" [React open source award](https://osawards.com/react/) and "Most impactful contribution" [JavaScript open source award](https://osawards.com/javascript/) in 2019 + +## Contribute using one-click online setup + +You can use Gitpod (a free online VS Code like IDE) for contributing online. With a single click it will launch a workspace and automatically: + +- clone the immer repo. +- install the dependencies. +- run `yarn run start`. + +so that you can start coding straight away. + +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/from-referrer/) + +## Documentation + +The documentation of this package is hosted at https://immerjs.github.io/immer/ + +## Support + +Did Immer make a difference to your project? Join the open collective at https://opencollective.com/immer! + +## Release notes + +https://github.com/immerjs/immer/releases diff --git a/node_modules/immer/src/core/current.ts b/node_modules/immer/src/core/current.ts new file mode 100644 index 00000000..6346e14f --- /dev/null +++ b/node_modules/immer/src/core/current.ts @@ -0,0 +1,40 @@ +import { + die, + isDraft, + shallowCopy, + each, + DRAFT_STATE, + set, + ImmerState, + isDraftable, + isFrozen +} from "../internal" + +/** Takes a snapshot of the current state of a draft and finalizes it (but without freezing). This is a great utility to print the current state during debugging (no Proxies in the way). The output of current can also be safely leaked outside the producer. */ +export function current(value: T): T +export function current(value: any): any { + if (!isDraft(value)) die(10, value) + return currentImpl(value) +} + +function currentImpl(value: any): any { + if (!isDraftable(value) || isFrozen(value)) return value + const state: ImmerState | undefined = value[DRAFT_STATE] + let copy: any + if (state) { + if (!state.modified_) return state.base_ + // Optimization: avoid generating new drafts during copying + state.finalized_ = true + copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_) + } else { + copy = shallowCopy(value, true) + } + // recurse + each(copy, (key, childValue) => { + set(copy, key, currentImpl(childValue)) + }) + if (state) { + state.finalized_ = false + } + return copy +} diff --git a/node_modules/immer/src/core/finalize.ts b/node_modules/immer/src/core/finalize.ts new file mode 100644 index 00000000..6ee69ce6 --- /dev/null +++ b/node_modules/immer/src/core/finalize.ts @@ -0,0 +1,165 @@ +import { + ImmerScope, + DRAFT_STATE, + isDraftable, + NOTHING, + PatchPath, + each, + has, + freeze, + ImmerState, + isDraft, + SetState, + set, + ArchType, + getPlugin, + die, + revokeScope, + isFrozen +} from "../internal" + +export function processResult(result: any, scope: ImmerScope) { + scope.unfinalizedDrafts_ = scope.drafts_.length + const baseDraft = scope.drafts_![0] + const isReplaced = result !== undefined && result !== baseDraft + if (isReplaced) { + if (baseDraft[DRAFT_STATE].modified_) { + revokeScope(scope) + die(4) + } + if (isDraftable(result)) { + // Finalize the result in case it contains (or is) a subset of the draft. + result = finalize(scope, result) + if (!scope.parent_) maybeFreeze(scope, result) + } + if (scope.patches_) { + getPlugin("Patches").generateReplacementPatches_( + baseDraft[DRAFT_STATE].base_, + result, + scope.patches_, + scope.inversePatches_! + ) + } + } else { + // Finalize the base draft. + result = finalize(scope, baseDraft, []) + } + revokeScope(scope) + if (scope.patches_) { + scope.patchListener_!(scope.patches_, scope.inversePatches_!) + } + return result !== NOTHING ? result : undefined +} + +function finalize(rootScope: ImmerScope, value: any, path?: PatchPath) { + // Don't recurse in tho recursive data structures + if (isFrozen(value)) return value + + const state: ImmerState = value[DRAFT_STATE] + // A plain object, might need freezing, might contain drafts + if (!state) { + each(value, (key, childValue) => + finalizeProperty(rootScope, state, value, key, childValue, path) + ) + return value + } + // Never finalize drafts owned by another scope. + if (state.scope_ !== rootScope) return value + // Unmodified draft, return the (frozen) original + if (!state.modified_) { + maybeFreeze(rootScope, state.base_, true) + return state.base_ + } + // Not finalized yet, let's do that now + if (!state.finalized_) { + state.finalized_ = true + state.scope_.unfinalizedDrafts_-- + const result = state.copy_ + // Finalize all children of the copy + // For sets we clone before iterating, otherwise we can get in endless loop due to modifying during iteration, see #628 + // To preserve insertion order in all cases we then clear the set + // And we let finalizeProperty know it needs to re-add non-draft children back to the target + let resultEach = result + let isSet = false + if (state.type_ === ArchType.Set) { + resultEach = new Set(result) + result.clear() + isSet = true + } + each(resultEach, (key, childValue) => + finalizeProperty(rootScope, state, result, key, childValue, path, isSet) + ) + // everything inside is frozen, we can freeze here + maybeFreeze(rootScope, result, false) + // first time finalizing, let's create those patches + if (path && rootScope.patches_) { + getPlugin("Patches").generatePatches_( + state, + path, + rootScope.patches_, + rootScope.inversePatches_! + ) + } + } + return state.copy_ +} + +function finalizeProperty( + rootScope: ImmerScope, + parentState: undefined | ImmerState, + targetObject: any, + prop: string | number, + childValue: any, + rootPath?: PatchPath, + targetIsSet?: boolean +) { + if (process.env.NODE_ENV !== "production" && childValue === targetObject) + die(5) + if (isDraft(childValue)) { + const path = + rootPath && + parentState && + parentState!.type_ !== ArchType.Set && // Set objects are atomic since they have no keys. + !has((parentState as Exclude).assigned_!, prop) // Skip deep patches for assigned keys. + ? rootPath!.concat(prop) + : undefined + // Drafts owned by `scope` are finalized here. + const res = finalize(rootScope, childValue, path) + set(targetObject, prop, res) + // Drafts from another scope must prevented to be frozen + // if we got a draft back from finalize, we're in a nested produce and shouldn't freeze + if (isDraft(res)) { + rootScope.canAutoFreeze_ = false + } else return + } else if (targetIsSet) { + targetObject.add(childValue) + } + // Search new objects for unfinalized drafts. Frozen objects should never contain drafts. + if (isDraftable(childValue) && !isFrozen(childValue)) { + if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) { + // optimization: if an object is not a draft, and we don't have to + // deepfreeze everything, and we are sure that no drafts are left in the remaining object + // cause we saw and finalized all drafts already; we can stop visiting the rest of the tree. + // This benefits especially adding large data tree's without further processing. + // See add-data.js perf test + return + } + finalize(rootScope, childValue) + // Immer deep freezes plain objects, so if there is no parent state, we freeze as well + // Per #590, we never freeze symbolic properties. Just to make sure don't accidentally interfere + // with other frameworks. + if ( + (!parentState || !parentState.scope_.parent_) && + typeof prop !== "symbol" && + Object.prototype.propertyIsEnumerable.call(targetObject, prop) + ) + maybeFreeze(rootScope, childValue) + } +} + +function maybeFreeze(scope: ImmerScope, value: any, deep = false) { + // we never freeze for a non-root scope; as it would prevent pruning for drafts inside wrapping objects + if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) { + freeze(value, deep) + } +} diff --git a/node_modules/immer/src/core/immerClass.ts b/node_modules/immer/src/core/immerClass.ts new file mode 100644 index 00000000..f827361c --- /dev/null +++ b/node_modules/immer/src/core/immerClass.ts @@ -0,0 +1,218 @@ +import { + IProduceWithPatches, + IProduce, + ImmerState, + Drafted, + isDraftable, + processResult, + Patch, + Objectish, + DRAFT_STATE, + Draft, + PatchListener, + isDraft, + isMap, + isSet, + createProxyProxy, + getPlugin, + die, + enterScope, + revokeScope, + leaveScope, + usePatchesInScope, + getCurrentScope, + NOTHING, + freeze, + current +} from "../internal" + +interface ProducersFns { + produce: IProduce + produceWithPatches: IProduceWithPatches +} + +export type StrictMode = boolean | "class_only"; + +export class Immer implements ProducersFns { + autoFreeze_: boolean = true + useStrictShallowCopy_: StrictMode = false + + constructor(config?: { + autoFreeze?: boolean + useStrictShallowCopy?: StrictMode + }) { + if (typeof config?.autoFreeze === "boolean") + this.setAutoFreeze(config!.autoFreeze) + if (typeof config?.useStrictShallowCopy === "boolean") + this.setUseStrictShallowCopy(config!.useStrictShallowCopy) + } + + /** + * The `produce` function takes a value and a "recipe function" (whose + * return value often depends on the base state). The recipe function is + * free to mutate its first argument however it wants. All mutations are + * only ever applied to a __copy__ of the base state. + * + * Pass only a function to create a "curried producer" which relieves you + * from passing the recipe function every time. + * + * Only plain objects and arrays are made mutable. All other objects are + * considered uncopyable. + * + * Note: This function is __bound__ to its `Immer` instance. + * + * @param {any} base - the initial state + * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified + * @param {Function} patchListener - optional function that will be called with all the patches produced here + * @returns {any} a new state, or the initial state if nothing was modified + */ + produce: IProduce = (base: any, recipe?: any, patchListener?: any) => { + // curried invocation + if (typeof base === "function" && typeof recipe !== "function") { + const defaultBase = recipe + recipe = base + + const self = this + return function curriedProduce( + this: any, + base = defaultBase, + ...args: any[] + ) { + return self.produce(base, (draft: Drafted) => recipe.call(this, draft, ...args)) // prettier-ignore + } + } + + if (typeof recipe !== "function") die(6) + if (patchListener !== undefined && typeof patchListener !== "function") + die(7) + + let result + + // Only plain objects, arrays, and "immerable classes" are drafted. + if (isDraftable(base)) { + const scope = enterScope(this) + const proxy = createProxy(base, undefined) + let hasError = true + try { + result = recipe(proxy) + hasError = false + } finally { + // finally instead of catch + rethrow better preserves original stack + if (hasError) revokeScope(scope) + else leaveScope(scope) + } + usePatchesInScope(scope, patchListener) + return processResult(result, scope) + } else if (!base || typeof base !== "object") { + result = recipe(base) + if (result === undefined) result = base + if (result === NOTHING) result = undefined + if (this.autoFreeze_) freeze(result, true) + if (patchListener) { + const p: Patch[] = [] + const ip: Patch[] = [] + getPlugin("Patches").generateReplacementPatches_(base, result, p, ip) + patchListener(p, ip) + } + return result + } else die(1, base) + } + + produceWithPatches: IProduceWithPatches = (base: any, recipe?: any): any => { + // curried invocation + if (typeof base === "function") { + return (state: any, ...args: any[]) => + this.produceWithPatches(state, (draft: any) => base(draft, ...args)) + } + + let patches: Patch[], inversePatches: Patch[] + const result = this.produce(base, recipe, (p: Patch[], ip: Patch[]) => { + patches = p + inversePatches = ip + }) + return [result, patches!, inversePatches!] + } + + createDraft(base: T): Draft { + if (!isDraftable(base)) die(8) + if (isDraft(base)) base = current(base) + const scope = enterScope(this) + const proxy = createProxy(base, undefined) + proxy[DRAFT_STATE].isManual_ = true + leaveScope(scope) + return proxy as any + } + + finishDraft>( + draft: D, + patchListener?: PatchListener + ): D extends Draft ? T : never { + const state: ImmerState = draft && (draft as any)[DRAFT_STATE] + if (!state || !state.isManual_) die(9) + const {scope_: scope} = state + usePatchesInScope(scope, patchListener) + return processResult(undefined, scope) + } + + /** + * Pass true to automatically freeze all copies created by Immer. + * + * By default, auto-freezing is enabled. + */ + setAutoFreeze(value: boolean) { + this.autoFreeze_ = value + } + + /** + * Pass true to enable strict shallow copy. + * + * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties. + */ + setUseStrictShallowCopy(value: StrictMode) { + this.useStrictShallowCopy_ = value + } + + applyPatches(base: T, patches: readonly Patch[]): T { + // If a patch replaces the entire state, take that replacement as base + // before applying patches + let i: number + for (i = patches.length - 1; i >= 0; i--) { + const patch = patches[i] + if (patch.path.length === 0 && patch.op === "replace") { + base = patch.value + break + } + } + // If there was a patch that replaced the entire state, start from the + // patch after that. + if (i > -1) { + patches = patches.slice(i + 1) + } + + const applyPatchesImpl = getPlugin("Patches").applyPatches_ + if (isDraft(base)) { + // N.B: never hits if some patch a replacement, patches are never drafts + return applyPatchesImpl(base, patches) + } + // Otherwise, produce a copy of the base state. + return this.produce(base, (draft: Drafted) => + applyPatchesImpl(draft, patches) + ) + } +} + +export function createProxy( + value: T, + parent?: ImmerState +): Drafted { + // precondition: createProxy should be guarded by isDraftable, so we know we can safely draft + const draft: Drafted = isMap(value) + ? getPlugin("MapSet").proxyMap_(value, parent) + : isSet(value) + ? getPlugin("MapSet").proxySet_(value, parent) + : createProxyProxy(value, parent) + + const scope = parent ? parent.scope_ : getCurrentScope() + scope.drafts_.push(draft) + return draft +} diff --git a/node_modules/immer/src/core/proxy.ts b/node_modules/immer/src/core/proxy.ts new file mode 100644 index 00000000..3ce06aa8 --- /dev/null +++ b/node_modules/immer/src/core/proxy.ts @@ -0,0 +1,292 @@ +import { + each, + has, + is, + isDraftable, + shallowCopy, + latest, + ImmerBaseState, + ImmerState, + Drafted, + AnyObject, + AnyArray, + Objectish, + getCurrentScope, + getPrototypeOf, + DRAFT_STATE, + die, + createProxy, + ArchType, + ImmerScope +} from "../internal" + +interface ProxyBaseState extends ImmerBaseState { + assigned_: { + [property: string]: boolean + } + parent_?: ImmerState + revoke_(): void +} + +export interface ProxyObjectState extends ProxyBaseState { + type_: ArchType.Object + base_: any + copy_: any + draft_: Drafted +} + +export interface ProxyArrayState extends ProxyBaseState { + type_: ArchType.Array + base_: AnyArray + copy_: AnyArray | null + draft_: Drafted +} + +type ProxyState = ProxyObjectState | ProxyArrayState + +/** + * Returns a new draft of the `base` object. + * + * The second argument is the parent draft-state (used internally). + */ +export function createProxyProxy( + base: T, + parent?: ImmerState +): Drafted { + const isArray = Array.isArray(base) + const state: ProxyState = { + type_: isArray ? ArchType.Array : (ArchType.Object as any), + // Track which produce call this is associated with. + scope_: parent ? parent.scope_ : getCurrentScope()!, + // True for both shallow and deep changes. + modified_: false, + // Used during finalization. + finalized_: false, + // Track which properties have been assigned (true) or deleted (false). + assigned_: {}, + // The parent draft state. + parent_: parent, + // The base state. + base_: base, + // The base proxy. + draft_: null as any, // set below + // The base copy with any updated values. + copy_: null, + // Called by the `produce` function. + revoke_: null as any, + isManual_: false + } + + // the traps must target something, a bit like the 'real' base. + // but also, we need to be able to determine from the target what the relevant state is + // (to avoid creating traps per instance to capture the state in closure, + // and to avoid creating weird hidden properties as well) + // So the trick is to use 'state' as the actual 'target'! (and make sure we intercept everything) + // Note that in the case of an array, we put the state in an array to have better Reflect defaults ootb + let target: T = state as any + let traps: ProxyHandler> = objectTraps + if (isArray) { + target = [state] as any + traps = arrayTraps + } + + const {revoke, proxy} = Proxy.revocable(target, traps) + state.draft_ = proxy as any + state.revoke_ = revoke + return proxy as any +} + +/** + * Object drafts + */ +export const objectTraps: ProxyHandler = { + get(state, prop) { + if (prop === DRAFT_STATE) return state + + const source = latest(state) + if (!has(source, prop)) { + // non-existing or non-own property... + return readPropFromProto(state, source, prop) + } + const value = source[prop] + if (state.finalized_ || !isDraftable(value)) { + return value + } + // Check for existing draft in modified state. + // Assigned values are never drafted. This catches any drafts we created, too. + if (value === peek(state.base_, prop)) { + prepareCopy(state) + return (state.copy_![prop as any] = createProxy(value, state)) + } + return value + }, + has(state, prop) { + return prop in latest(state) + }, + ownKeys(state) { + return Reflect.ownKeys(latest(state)) + }, + set( + state: ProxyObjectState, + prop: string /* strictly not, but helps TS */, + value + ) { + const desc = getDescriptorFromProto(latest(state), prop) + if (desc?.set) { + // special case: if this write is captured by a setter, we have + // to trigger it with the correct context + desc.set.call(state.draft_, value) + return true + } + if (!state.modified_) { + // the last check is because we need to be able to distinguish setting a non-existing to undefined (which is a change) + // from setting an existing property with value undefined to undefined (which is not a change) + const current = peek(latest(state), prop) + // special case, if we assigning the original value to a draft, we can ignore the assignment + const currentState: ProxyObjectState = current?.[DRAFT_STATE] + if (currentState && currentState.base_ === value) { + state.copy_![prop] = value + state.assigned_[prop] = false + return true + } + if (is(value, current) && (value !== undefined || has(state.base_, prop))) + return true + prepareCopy(state) + markChanged(state) + } + + if ( + (state.copy_![prop] === value && + // special case: handle new props with value 'undefined' + (value !== undefined || prop in state.copy_)) || + // special case: NaN + (Number.isNaN(value) && Number.isNaN(state.copy_![prop])) + ) + return true + + // @ts-ignore + state.copy_![prop] = value + state.assigned_[prop] = true + return true + }, + deleteProperty(state, prop: string) { + // The `undefined` check is a fast path for pre-existing keys. + if (peek(state.base_, prop) !== undefined || prop in state.base_) { + state.assigned_[prop] = false + prepareCopy(state) + markChanged(state) + } else { + // if an originally not assigned property was deleted + delete state.assigned_[prop] + } + if (state.copy_) { + delete state.copy_[prop] + } + return true + }, + // Note: We never coerce `desc.value` into an Immer draft, because we can't make + // the same guarantee in ES5 mode. + getOwnPropertyDescriptor(state, prop) { + const owner = latest(state) + const desc = Reflect.getOwnPropertyDescriptor(owner, prop) + if (!desc) return desc + return { + writable: true, + configurable: state.type_ !== ArchType.Array || prop !== "length", + enumerable: desc.enumerable, + value: owner[prop] + } + }, + defineProperty() { + die(11) + }, + getPrototypeOf(state) { + return getPrototypeOf(state.base_) + }, + setPrototypeOf() { + die(12) + } +} + +/** + * Array drafts + */ + +const arrayTraps: ProxyHandler<[ProxyArrayState]> = {} +each(objectTraps, (key, fn) => { + // @ts-ignore + arrayTraps[key] = function() { + arguments[0] = arguments[0][0] + return fn.apply(this, arguments) + } +}) +arrayTraps.deleteProperty = function(state, prop) { + if (process.env.NODE_ENV !== "production" && isNaN(parseInt(prop as any))) + die(13) + // @ts-ignore + return arrayTraps.set!.call(this, state, prop, undefined) +} +arrayTraps.set = function(state, prop, value) { + if ( + process.env.NODE_ENV !== "production" && + prop !== "length" && + isNaN(parseInt(prop as any)) + ) + die(14) + return objectTraps.set!.call(this, state[0], prop, value, state[0]) +} + +// Access a property without creating an Immer draft. +function peek(draft: Drafted, prop: PropertyKey) { + const state = draft[DRAFT_STATE] + const source = state ? latest(state) : draft + return source[prop] +} + +function readPropFromProto(state: ImmerState, source: any, prop: PropertyKey) { + const desc = getDescriptorFromProto(source, prop) + return desc + ? `value` in desc + ? desc.value + : // This is a very special case, if the prop is a getter defined by the + // prototype, we should invoke it with the draft as context! + desc.get?.call(state.draft_) + : undefined +} + +function getDescriptorFromProto( + source: any, + prop: PropertyKey +): PropertyDescriptor | undefined { + // 'in' checks proto! + if (!(prop in source)) return undefined + let proto = getPrototypeOf(source) + while (proto) { + const desc = Object.getOwnPropertyDescriptor(proto, prop) + if (desc) return desc + proto = getPrototypeOf(proto) + } + return undefined +} + +export function markChanged(state: ImmerState) { + if (!state.modified_) { + state.modified_ = true + if (state.parent_) { + markChanged(state.parent_) + } + } +} + +export function prepareCopy(state: { + base_: any + copy_: any + scope_: ImmerScope +}) { + if (!state.copy_) { + state.copy_ = shallowCopy( + state.base_, + state.scope_.immer_.useStrictShallowCopy_ + ) + } +} diff --git a/node_modules/immer/src/core/scope.ts b/node_modules/immer/src/core/scope.ts new file mode 100644 index 00000000..65eb5eed --- /dev/null +++ b/node_modules/immer/src/core/scope.ts @@ -0,0 +1,80 @@ +import { + Patch, + PatchListener, + Drafted, + Immer, + DRAFT_STATE, + ImmerState, + ArchType, + getPlugin +} from "../internal" + +/** Each scope represents a `produce` call. */ + +export interface ImmerScope { + patches_?: Patch[] + inversePatches_?: Patch[] + canAutoFreeze_: boolean + drafts_: any[] + parent_?: ImmerScope + patchListener_?: PatchListener + immer_: Immer + unfinalizedDrafts_: number +} + +let currentScope: ImmerScope | undefined + +export function getCurrentScope() { + return currentScope! +} + +function createScope( + parent_: ImmerScope | undefined, + immer_: Immer +): ImmerScope { + return { + drafts_: [], + parent_, + immer_, + // Whenever the modified draft contains a draft from another scope, we + // need to prevent auto-freezing so the unowned draft can be finalized. + canAutoFreeze_: true, + unfinalizedDrafts_: 0 + } +} + +export function usePatchesInScope( + scope: ImmerScope, + patchListener?: PatchListener +) { + if (patchListener) { + getPlugin("Patches") // assert we have the plugin + scope.patches_ = [] + scope.inversePatches_ = [] + scope.patchListener_ = patchListener + } +} + +export function revokeScope(scope: ImmerScope) { + leaveScope(scope) + scope.drafts_.forEach(revokeDraft) + // @ts-ignore + scope.drafts_ = null +} + +export function leaveScope(scope: ImmerScope) { + if (scope === currentScope) { + currentScope = scope.parent_ + } +} + +export function enterScope(immer: Immer) { + return (currentScope = createScope(currentScope, immer)) +} + +function revokeDraft(draft: Drafted) { + const state: ImmerState = draft[DRAFT_STATE] + if (state.type_ === ArchType.Object || state.type_ === ArchType.Array) + state.revoke_() + else state.revoked_ = true +} diff --git a/node_modules/immer/src/immer.ts b/node_modules/immer/src/immer.ts new file mode 100644 index 00000000..01998487 --- /dev/null +++ b/node_modules/immer/src/immer.ts @@ -0,0 +1,117 @@ +import { + IProduce, + IProduceWithPatches, + Immer, + Draft, + Immutable +} from "./internal" + +export { + Draft, + WritableDraft, + Immutable, + Patch, + PatchListener, + Producer, + original, + current, + isDraft, + isDraftable, + NOTHING as nothing, + DRAFTABLE as immerable, + freeze, + Objectish, + StrictMode +} from "./internal" + +const immer = new Immer() + +/** + * The `produce` function takes a value and a "recipe function" (whose + * return value often depends on the base state). The recipe function is + * free to mutate its first argument however it wants. All mutations are + * only ever applied to a __copy__ of the base state. + * + * Pass only a function to create a "curried producer" which relieves you + * from passing the recipe function every time. + * + * Only plain objects and arrays are made mutable. All other objects are + * considered uncopyable. + * + * Note: This function is __bound__ to its `Immer` instance. + * + * @param {any} base - the initial state + * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified + * @param {Function} patchListener - optional function that will be called with all the patches produced here + * @returns {any} a new state, or the initial state if nothing was modified + */ +export const produce: IProduce = immer.produce + +/** + * Like `produce`, but `produceWithPatches` always returns a tuple + * [nextState, patches, inversePatches] (instead of just the next state) + */ +export const produceWithPatches: IProduceWithPatches = immer.produceWithPatches.bind( + immer +) + +/** + * Pass true to automatically freeze all copies created by Immer. + * + * Always freeze by default, even in production mode + */ +export const setAutoFreeze = immer.setAutoFreeze.bind(immer) + +/** + * Pass true to enable strict shallow copy. + * + * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties. + */ +export const setUseStrictShallowCopy = immer.setUseStrictShallowCopy.bind(immer) + +/** + * Apply an array of Immer patches to the first argument. + * + * This function is a producer, which means copy-on-write is in effect. + */ +export const applyPatches = immer.applyPatches.bind(immer) + +/** + * Create an Immer draft from the given base state, which may be a draft itself. + * The draft can be modified until you finalize it with the `finishDraft` function. + */ +export const createDraft = immer.createDraft.bind(immer) + +/** + * Finalize an Immer draft from a `createDraft` call, returning the base state + * (if no changes were made) or a modified copy. The draft must *not* be + * mutated afterwards. + * + * Pass a function as the 2nd argument to generate Immer patches based on the + * changes that were made. + */ +export const finishDraft = immer.finishDraft.bind(immer) + +/** + * This function is actually a no-op, but can be used to cast an immutable type + * to an draft type and make TypeScript happy + * + * @param value + */ +export function castDraft(value: T): Draft { + return value as any +} + +/** + * This function is actually a no-op, but can be used to cast a mutable type + * to an immutable type and make TypeScript happy + * @param value + */ +export function castImmutable(value: T): Immutable { + return value as any +} + +export {Immer} + +export {enablePatches} from "./plugins/patches" +export {enableMapSet} from "./plugins/mapset" diff --git a/node_modules/immer/src/internal.ts b/node_modules/immer/src/internal.ts new file mode 100644 index 00000000..de7236a6 --- /dev/null +++ b/node_modules/immer/src/internal.ts @@ -0,0 +1,11 @@ +export * from "./utils/env" +export * from "./utils/errors" +export * from "./types/types-external" +export * from "./types/types-internal" +export * from "./utils/common" +export * from "./utils/plugins" +export * from "./core/scope" +export * from "./core/finalize" +export * from "./core/proxy" +export * from "./core/immerClass" +export * from "./core/current" diff --git a/node_modules/immer/src/plugins/mapset.ts b/node_modules/immer/src/plugins/mapset.ts new file mode 100644 index 00000000..edc628a7 --- /dev/null +++ b/node_modules/immer/src/plugins/mapset.ts @@ -0,0 +1,304 @@ +// types only! +import { + ImmerState, + AnyMap, + AnySet, + MapState, + SetState, + DRAFT_STATE, + getCurrentScope, + latest, + isDraftable, + createProxy, + loadPlugin, + markChanged, + die, + ArchType, + each +} from "../internal" + +export function enableMapSet() { + class DraftMap extends Map { + [DRAFT_STATE]: MapState + + constructor(target: AnyMap, parent?: ImmerState) { + super() + this[DRAFT_STATE] = { + type_: ArchType.Map, + parent_: parent, + scope_: parent ? parent.scope_ : getCurrentScope()!, + modified_: false, + finalized_: false, + copy_: undefined, + assigned_: undefined, + base_: target, + draft_: this as any, + isManual_: false, + revoked_: false + } + } + + get size(): number { + return latest(this[DRAFT_STATE]).size + } + + has(key: any): boolean { + return latest(this[DRAFT_STATE]).has(key) + } + + set(key: any, value: any) { + const state: MapState = this[DRAFT_STATE] + assertUnrevoked(state) + if (!latest(state).has(key) || latest(state).get(key) !== value) { + prepareMapCopy(state) + markChanged(state) + state.assigned_!.set(key, true) + state.copy_!.set(key, value) + state.assigned_!.set(key, true) + } + return this + } + + delete(key: any): boolean { + if (!this.has(key)) { + return false + } + + const state: MapState = this[DRAFT_STATE] + assertUnrevoked(state) + prepareMapCopy(state) + markChanged(state) + if (state.base_.has(key)) { + state.assigned_!.set(key, false) + } else { + state.assigned_!.delete(key) + } + state.copy_!.delete(key) + return true + } + + clear() { + const state: MapState = this[DRAFT_STATE] + assertUnrevoked(state) + if (latest(state).size) { + prepareMapCopy(state) + markChanged(state) + state.assigned_ = new Map() + each(state.base_, key => { + state.assigned_!.set(key, false) + }) + state.copy_!.clear() + } + } + + forEach(cb: (value: any, key: any, self: any) => void, thisArg?: any) { + const state: MapState = this[DRAFT_STATE] + latest(state).forEach((_value: any, key: any, _map: any) => { + cb.call(thisArg, this.get(key), key, this) + }) + } + + get(key: any): any { + const state: MapState = this[DRAFT_STATE] + assertUnrevoked(state) + const value = latest(state).get(key) + if (state.finalized_ || !isDraftable(value)) { + return value + } + if (value !== state.base_.get(key)) { + return value // either already drafted or reassigned + } + // despite what it looks, this creates a draft only once, see above condition + const draft = createProxy(value, state) + prepareMapCopy(state) + state.copy_!.set(key, draft) + return draft + } + + keys(): IterableIterator { + return latest(this[DRAFT_STATE]).keys() + } + + values(): IterableIterator { + const iterator = this.keys() + return { + [Symbol.iterator]: () => this.values(), + next: () => { + const r = iterator.next() + /* istanbul ignore next */ + if (r.done) return r + const value = this.get(r.value) + return { + done: false, + value + } + } + } as any + } + + entries(): IterableIterator<[any, any]> { + const iterator = this.keys() + return { + [Symbol.iterator]: () => this.entries(), + next: () => { + const r = iterator.next() + /* istanbul ignore next */ + if (r.done) return r + const value = this.get(r.value) + return { + done: false, + value: [r.value, value] + } + } + } as any + } + + [Symbol.iterator]() { + return this.entries() + } + } + + function proxyMap_(target: T, parent?: ImmerState): T { + // @ts-ignore + return new DraftMap(target, parent) + } + + function prepareMapCopy(state: MapState) { + if (!state.copy_) { + state.assigned_ = new Map() + state.copy_ = new Map(state.base_) + } + } + + class DraftSet extends Set { + [DRAFT_STATE]: SetState + constructor(target: AnySet, parent?: ImmerState) { + super() + this[DRAFT_STATE] = { + type_: ArchType.Set, + parent_: parent, + scope_: parent ? parent.scope_ : getCurrentScope()!, + modified_: false, + finalized_: false, + copy_: undefined, + base_: target, + draft_: this, + drafts_: new Map(), + revoked_: false, + isManual_: false + } + } + + get size(): number { + return latest(this[DRAFT_STATE]).size + } + + has(value: any): boolean { + const state: SetState = this[DRAFT_STATE] + assertUnrevoked(state) + // bit of trickery here, to be able to recognize both the value, and the draft of its value + if (!state.copy_) { + return state.base_.has(value) + } + if (state.copy_.has(value)) return true + if (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value))) + return true + return false + } + + add(value: any): any { + const state: SetState = this[DRAFT_STATE] + assertUnrevoked(state) + if (!this.has(value)) { + prepareSetCopy(state) + markChanged(state) + state.copy_!.add(value) + } + return this + } + + delete(value: any): any { + if (!this.has(value)) { + return false + } + + const state: SetState = this[DRAFT_STATE] + assertUnrevoked(state) + prepareSetCopy(state) + markChanged(state) + return ( + state.copy_!.delete(value) || + (state.drafts_.has(value) + ? state.copy_!.delete(state.drafts_.get(value)) + : /* istanbul ignore next */ false) + ) + } + + clear() { + const state: SetState = this[DRAFT_STATE] + assertUnrevoked(state) + if (latest(state).size) { + prepareSetCopy(state) + markChanged(state) + state.copy_!.clear() + } + } + + values(): IterableIterator { + const state: SetState = this[DRAFT_STATE] + assertUnrevoked(state) + prepareSetCopy(state) + return state.copy_!.values() + } + + entries(): IterableIterator<[any, any]> { + const state: SetState = this[DRAFT_STATE] + assertUnrevoked(state) + prepareSetCopy(state) + return state.copy_!.entries() + } + + keys(): IterableIterator { + return this.values() + } + + [Symbol.iterator]() { + return this.values() + } + + forEach(cb: any, thisArg?: any) { + const iterator = this.values() + let result = iterator.next() + while (!result.done) { + cb.call(thisArg, result.value, result.value, this) + result = iterator.next() + } + } + } + function proxySet_(target: T, parent?: ImmerState): T { + // @ts-ignore + return new DraftSet(target, parent) + } + + function prepareSetCopy(state: SetState) { + if (!state.copy_) { + // create drafts for all entries to preserve insertion order + state.copy_ = new Set() + state.base_.forEach(value => { + if (isDraftable(value)) { + const draft = createProxy(value, state) + state.drafts_.set(value, draft) + state.copy_!.add(draft) + } else { + state.copy_!.add(value) + } + }) + } + } + + function assertUnrevoked(state: any /*ES5State | MapState | SetState*/) { + if (state.revoked_) die(3, JSON.stringify(latest(state))) + } + + loadPlugin("MapSet", {proxyMap_, proxySet_}) +} diff --git a/node_modules/immer/src/plugins/patches.ts b/node_modules/immer/src/plugins/patches.ts new file mode 100644 index 00000000..934e0b96 --- /dev/null +++ b/node_modules/immer/src/plugins/patches.ts @@ -0,0 +1,317 @@ +import {immerable} from "../immer" +import { + ImmerState, + Patch, + SetState, + ProxyArrayState, + MapState, + ProxyObjectState, + PatchPath, + get, + each, + has, + getArchtype, + getPrototypeOf, + isSet, + isMap, + loadPlugin, + ArchType, + die, + isDraft, + isDraftable, + NOTHING, + errors +} from "../internal" + +export function enablePatches() { + const errorOffset = 16 + if (process.env.NODE_ENV !== "production") { + errors.push( + 'Sets cannot have "replace" patches.', + function(op: string) { + return "Unsupported patch operation: " + op + }, + function(path: string) { + return "Cannot apply patch, path doesn't resolve: " + path + }, + "Patching reserved attributes like __proto__, prototype and constructor is not allowed" + ) + } + + const REPLACE = "replace" + const ADD = "add" + const REMOVE = "remove" + + function generatePatches_( + state: ImmerState, + basePath: PatchPath, + patches: Patch[], + inversePatches: Patch[] + ): void { + switch (state.type_) { + case ArchType.Object: + case ArchType.Map: + return generatePatchesFromAssigned( + state, + basePath, + patches, + inversePatches + ) + case ArchType.Array: + return generateArrayPatches(state, basePath, patches, inversePatches) + case ArchType.Set: + return generateSetPatches( + (state as any) as SetState, + basePath, + patches, + inversePatches + ) + } + } + + function generateArrayPatches( + state: ProxyArrayState, + basePath: PatchPath, + patches: Patch[], + inversePatches: Patch[] + ) { + let {base_, assigned_} = state + let copy_ = state.copy_! + + // Reduce complexity by ensuring `base` is never longer. + if (copy_.length < base_.length) { + // @ts-ignore + ;[base_, copy_] = [copy_, base_] + ;[patches, inversePatches] = [inversePatches, patches] + } + + // Process replaced indices. + for (let i = 0; i < base_.length; i++) { + if (assigned_[i] && copy_[i] !== base_[i]) { + const path = basePath.concat([i]) + patches.push({ + op: REPLACE, + path, + // Need to maybe clone it, as it can in fact be the original value + // due to the base/copy inversion at the start of this function + value: clonePatchValueIfNeeded(copy_[i]) + }) + inversePatches.push({ + op: REPLACE, + path, + value: clonePatchValueIfNeeded(base_[i]) + }) + } + } + + // Process added indices. + for (let i = base_.length; i < copy_.length; i++) { + const path = basePath.concat([i]) + patches.push({ + op: ADD, + path, + // Need to maybe clone it, as it can in fact be the original value + // due to the base/copy inversion at the start of this function + value: clonePatchValueIfNeeded(copy_[i]) + }) + } + for (let i = copy_.length - 1; base_.length <= i; --i) { + const path = basePath.concat([i]) + inversePatches.push({ + op: REMOVE, + path + }) + } + } + + // This is used for both Map objects and normal objects. + function generatePatchesFromAssigned( + state: MapState | ProxyObjectState, + basePath: PatchPath, + patches: Patch[], + inversePatches: Patch[] + ) { + const {base_, copy_} = state + each(state.assigned_!, (key, assignedValue) => { + const origValue = get(base_, key) + const value = get(copy_!, key) + const op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD + if (origValue === value && op === REPLACE) return + const path = basePath.concat(key as any) + patches.push(op === REMOVE ? {op, path} : {op, path, value}) + inversePatches.push( + op === ADD + ? {op: REMOVE, path} + : op === REMOVE + ? {op: ADD, path, value: clonePatchValueIfNeeded(origValue)} + : {op: REPLACE, path, value: clonePatchValueIfNeeded(origValue)} + ) + }) + } + + function generateSetPatches( + state: SetState, + basePath: PatchPath, + patches: Patch[], + inversePatches: Patch[] + ) { + let {base_, copy_} = state + + let i = 0 + base_.forEach((value: any) => { + if (!copy_!.has(value)) { + const path = basePath.concat([i]) + patches.push({ + op: REMOVE, + path, + value + }) + inversePatches.unshift({ + op: ADD, + path, + value + }) + } + i++ + }) + i = 0 + copy_!.forEach((value: any) => { + if (!base_.has(value)) { + const path = basePath.concat([i]) + patches.push({ + op: ADD, + path, + value + }) + inversePatches.unshift({ + op: REMOVE, + path, + value + }) + } + i++ + }) + } + + function generateReplacementPatches_( + baseValue: any, + replacement: any, + patches: Patch[], + inversePatches: Patch[] + ): void { + patches.push({ + op: REPLACE, + path: [], + value: replacement === NOTHING ? undefined : replacement + }) + inversePatches.push({ + op: REPLACE, + path: [], + value: baseValue + }) + } + + function applyPatches_(draft: T, patches: readonly Patch[]): T { + patches.forEach(patch => { + const {path, op} = patch + + let base: any = draft + for (let i = 0; i < path.length - 1; i++) { + const parentType = getArchtype(base) + let p = path[i] + if (typeof p !== "string" && typeof p !== "number") { + p = "" + p + } + + // See #738, avoid prototype pollution + if ( + (parentType === ArchType.Object || parentType === ArchType.Array) && + (p === "__proto__" || p === "constructor") + ) + die(errorOffset + 3) + if (typeof base === "function" && p === "prototype") + die(errorOffset + 3) + base = get(base, p) + if (typeof base !== "object") die(errorOffset + 2, path.join("/")) + } + + const type = getArchtype(base) + const value = deepClonePatchValue(patch.value) // used to clone patch to ensure original patch is not modified, see #411 + const key = path[path.length - 1] + switch (op) { + case REPLACE: + switch (type) { + case ArchType.Map: + return base.set(key, value) + /* istanbul ignore next */ + case ArchType.Set: + die(errorOffset) + default: + // if value is an object, then it's assigned by reference + // in the following add or remove ops, the value field inside the patch will also be modifyed + // so we use value from the cloned patch + // @ts-ignore + return (base[key] = value) + } + case ADD: + switch (type) { + case ArchType.Array: + return key === "-" + ? base.push(value) + : base.splice(key as any, 0, value) + case ArchType.Map: + return base.set(key, value) + case ArchType.Set: + return base.add(value) + default: + return (base[key] = value) + } + case REMOVE: + switch (type) { + case ArchType.Array: + return base.splice(key as any, 1) + case ArchType.Map: + return base.delete(key) + case ArchType.Set: + return base.delete(patch.value) + default: + return delete base[key] + } + default: + die(errorOffset + 1, op) + } + }) + + return draft + } + + // optimize: this is quite a performance hit, can we detect intelligently when it is needed? + // E.g. auto-draft when new objects from outside are assigned and modified? + // (See failing test when deepClone just returns obj) + function deepClonePatchValue(obj: T): T + function deepClonePatchValue(obj: any) { + if (!isDraftable(obj)) return obj + if (Array.isArray(obj)) return obj.map(deepClonePatchValue) + if (isMap(obj)) + return new Map( + Array.from(obj.entries()).map(([k, v]) => [k, deepClonePatchValue(v)]) + ) + if (isSet(obj)) return new Set(Array.from(obj).map(deepClonePatchValue)) + const cloned = Object.create(getPrototypeOf(obj)) + for (const key in obj) cloned[key] = deepClonePatchValue(obj[key]) + if (has(obj, immerable)) cloned[immerable] = obj[immerable] + return cloned + } + + function clonePatchValueIfNeeded(obj: T): T { + if (isDraft(obj)) { + return deepClonePatchValue(obj) + } else return obj + } + + loadPlugin("Patches", { + applyPatches_, + generatePatches_, + generateReplacementPatches_ + }) +} diff --git a/node_modules/immer/src/types/globals.d.ts b/node_modules/immer/src/types/globals.d.ts new file mode 100644 index 00000000..404c55f1 --- /dev/null +++ b/node_modules/immer/src/types/globals.d.ts @@ -0,0 +1 @@ +declare const __DEV__: boolean diff --git a/node_modules/immer/src/types/index.js.flow b/node_modules/immer/src/types/index.js.flow new file mode 100644 index 00000000..6f14c85a --- /dev/null +++ b/node_modules/immer/src/types/index.js.flow @@ -0,0 +1,111 @@ +// @flow + +export interface Patch { + op: "replace" | "remove" | "add"; + path: (string | number)[]; + value?: any; +} + +export type PatchListener = (patches: Patch[], inversePatches: Patch[]) => void + +type Base = {...} | Array +interface IProduce { + /** + * Immer takes a state, and runs a function against it. + * That function can freely mutate the state, as it will create copies-on-write. + * This means that the original state will stay unchanged, and once the function finishes, the modified state is returned. + * + * If the first argument is a function, this is interpreted as the recipe, and will create a curried function that will execute the recipe + * any time it is called with the current state. + * + * @param currentState - the state to start with + * @param recipe - function that receives a proxy of the current state as first argument and which can be freely modified + * @param initialState - if a curried function is created and this argument was given, it will be used as fallback if the curried function is called with a state of undefined + * @returns The next state: a new state, or the current state if nothing was modified + */ + ( + currentState: S, + recipe: (draftState: S) => S | void, + patchListener?: PatchListener + ): S; + // curried invocations with initial state + ( + recipe: (draftState: S, a: A, b: B, c: C, ...extraArgs: any[]) => S | void, + initialState: S + ): (currentState: S | void, a: A, b: B, c: C, ...extraArgs: any[]) => S; + // curried invocations without initial state + ( + recipe: (draftState: S, a: A, b: B, c: C, ...extraArgs: any[]) => S | void + ): (currentState: S, a: A, b: B, c: C, ...extraArgs: any[]) => S; +} + +interface IProduceWithPatches { + /** + * Like `produce`, but instead of just returning the new state, + * a tuple is returned with [nextState, patches, inversePatches] + * + * Like produce, this function supports currying + */ + ( + currentState: S, + recipe: (draftState: S) => S | void + ): [S, Patch[], Patch[]]; + // curried invocations with initial state + ( + recipe: (draftState: S, a: A, b: B, c: C, ...extraArgs: any[]) => S | void, + initialState: S + ): (currentState: S | void, a: A, b: B, c: C, ...extraArgs: any[]) => [S, Patch[], Patch[]]; + // curried invocations without initial state + ( + recipe: (draftState: S, a: A, b: B, c: C, ...extraArgs: any[]) => S | void + ): (currentState: S, a: A, b: B, c: C, ...extraArgs: any[]) => [S, Patch[], Patch[]]; +} + +declare export var produce: IProduce + +declare export var produceWithPatches: IProduceWithPatches + +declare export var nothing: typeof undefined + +declare export var immerable: Symbol + +/** + * Automatically freezes any state trees generated by immer. + * This protects against accidental modifications of the state tree outside of an immer function. + * This comes with a performance impact, so it is recommended to disable this option in production. + * By default it is turned on during local development, and turned off in production. + */ +declare export function setAutoFreeze(autoFreeze: boolean): void + +/** + * Pass false to disable strict shallow copy. + * + * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties. + */ +declare export function setUseStrictShallowCopy(useStrictShallowCopy: boolean): void + +declare export function applyPatches(state: S, patches: Patch[]): S + +declare export function original(value: S): S + +declare export function current(value: S): S + +declare export function isDraft(value: any): boolean + +/** + * Creates a mutable draft from an (immutable) object / array. + * The draft can be modified until `finishDraft` is called + */ +declare export function createDraft(base: T): T + +/** + * Given a draft that was created using `createDraft`, + * finalizes the draft into a new immutable object. + * Optionally a patch-listener can be provided to gather the patches that are needed to construct the object. + */ +declare export function finishDraft(base: T, listener?: PatchListener): T + +declare export function enableMapSet(): void +declare export function enablePatches(): void + +declare export function freeze(obj: T, freeze?: boolean): T diff --git a/node_modules/immer/src/types/types-external.ts b/node_modules/immer/src/types/types-external.ts new file mode 100644 index 00000000..8bb44aba --- /dev/null +++ b/node_modules/immer/src/types/types-external.ts @@ -0,0 +1,239 @@ +import {NOTHING} from "../internal" + +type AnyFunc = (...args: any[]) => any + +type PrimitiveType = number | string | boolean + +/** Object types that should never be mapped */ +type AtomicObject = Function | Promise | Date | RegExp + +/** + * If the lib "ES2015.Collection" is not included in tsconfig.json, + * types like ReadonlyArray, WeakMap etc. fall back to `any` (specified nowhere) + * or `{}` (from the node types), in both cases entering an infinite recursion in + * pattern matching type mappings + * This type can be used to cast these types to `void` in these cases. + */ +export type IfAvailable = + // fallback if any + true | false extends (T extends never + ? true + : false) + ? Fallback // fallback if empty type + : keyof T extends never + ? Fallback // original type + : T + +/** + * These should also never be mapped but must be tested after regular Map and + * Set + */ +type WeakReferences = IfAvailable> | IfAvailable> + +export type WritableDraft = {-readonly [K in keyof T]: Draft} + +/** Convert a readonly type into a mutable type, if possible */ +export type Draft = T extends PrimitiveType + ? T + : T extends AtomicObject + ? T + : T extends ReadonlyMap // Map extends ReadonlyMap + ? Map, Draft> + : T extends ReadonlySet // Set extends ReadonlySet + ? Set> + : T extends WeakReferences + ? T + : T extends object + ? WritableDraft + : T + +/** Convert a mutable type into a readonly type */ +export type Immutable = T extends PrimitiveType + ? T + : T extends AtomicObject + ? T + : T extends ReadonlyMap // Map extends ReadonlyMap + ? ReadonlyMap, Immutable> + : T extends ReadonlySet // Set extends ReadonlySet + ? ReadonlySet> + : T extends WeakReferences + ? T + : T extends object + ? {readonly [K in keyof T]: Immutable} + : T + +export interface Patch { + op: "replace" | "remove" | "add" + path: (string | number)[] + value?: any +} + +export type PatchListener = (patches: Patch[], inversePatches: Patch[]) => void + +/** Converts `nothing` into `undefined` */ +type FromNothing = T extends typeof NOTHING ? undefined : T + +/** The inferred return type of `produce` */ +export type Produced = Return extends void + ? Base + : FromNothing + +/** + * Utility types + */ +type PatchesTuple = readonly [T, Patch[], Patch[]] + +type ValidRecipeReturnType = + | State + | void + | undefined + | (State extends undefined ? typeof NOTHING : never) + +type ReturnTypeWithPatchesIfNeeded< + State, + UsePatches extends boolean +> = UsePatches extends true ? PatchesTuple : State + +/** + * Core Producer inference + */ +type InferRecipeFromCurried = Curried extends ( + base: infer State, + ...rest: infer Args +) => any // extra assertion to make sure this is a proper curried function (state, args) => state + ? ReturnType extends State + ? ( + draft: Draft, + ...rest: Args + ) => ValidRecipeReturnType> + : never + : never + +type InferInitialStateFromCurried = Curried extends ( + base: infer State, + ...rest: any[] +) => any // extra assertion to make sure this is a proper curried function (state, args) => state + ? State + : never + +type InferCurriedFromRecipe< + Recipe, + UsePatches extends boolean +> = Recipe extends (draft: infer DraftState, ...args: infer RestArgs) => any // verify return type + ? ReturnType extends ValidRecipeReturnType + ? ( + base: Immutable, + ...args: RestArgs + ) => ReturnTypeWithPatchesIfNeeded // N.b. we return mutable draftstate, in case the recipe's first arg isn't read only, and that isn't expected as output either + : never // incorrect return type + : never // not a function + +type InferCurriedFromInitialStateAndRecipe< + State, + Recipe, + UsePatches extends boolean +> = Recipe extends ( + draft: Draft, + ...rest: infer RestArgs +) => ValidRecipeReturnType + ? ( + base?: State | undefined, + ...args: RestArgs + ) => ReturnTypeWithPatchesIfNeeded + : never // recipe doesn't match initial state + +/** + * The `produce` function takes a value and a "recipe function" (whose + * return value often depends on the base state). The recipe function is + * free to mutate its first argument however it wants. All mutations are + * only ever applied to a __copy__ of the base state. + * + * Pass only a function to create a "curried producer" which relieves you + * from passing the recipe function every time. + * + * Only plain objects and arrays are made mutable. All other objects are + * considered uncopyable. + * + * Note: This function is __bound__ to its `Immer` instance. + * + * @param {any} base - the initial state + * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified + * @param {Function} patchListener - optional function that will be called with all the patches produced here + * @returns {any} a new state, or the initial state if nothing was modified + */ +export interface IProduce { + /** Curried producer that infers the recipe from the curried output function (e.g. when passing to setState) */ + ( + recipe: InferRecipeFromCurried, + initialState?: InferInitialStateFromCurried + ): Curried + + /** Curried producer that infers curried from the recipe */ + (recipe: Recipe): InferCurriedFromRecipe< + Recipe, + false + > + + /** Curried producer that infers curried from the State generic, which is explicitly passed in. */ + ( + recipe: ( + state: Draft, + initialState: State + ) => ValidRecipeReturnType + ): (state?: State) => State + ( + recipe: ( + state: Draft, + ...args: Args + ) => ValidRecipeReturnType, + initialState: State + ): (state?: State, ...args: Args) => State + (recipe: (state: Draft) => ValidRecipeReturnType): ( + state: State + ) => State + ( + recipe: (state: Draft, ...args: Args) => ValidRecipeReturnType + ): (state: State, ...args: Args) => State + + /** Curried producer with initial state, infers recipe from initial state */ + ( + recipe: Recipe, + initialState: State + ): InferCurriedFromInitialStateAndRecipe + + /** Normal producer */ + >( // By using a default inferred D, rather than Draft in the recipe, we can override it. + base: Base, + recipe: (draft: D) => ValidRecipeReturnType, + listener?: PatchListener + ): Base +} + +/** + * Like `produce`, but instead of just returning the new state, + * a tuple is returned with [nextState, patches, inversePatches] + * + * Like produce, this function supports currying + */ +export interface IProduceWithPatches { + // Types copied from IProduce, wrapped with PatchesTuple + (recipe: Recipe): InferCurriedFromRecipe + ( + recipe: Recipe, + initialState: State + ): InferCurriedFromInitialStateAndRecipe + >( + base: Base, + recipe: (draft: D) => ValidRecipeReturnType, + listener?: PatchListener + ): PatchesTuple +} + +/** + * The type for `recipe function` + */ +export type Producer = (draft: Draft) => ValidRecipeReturnType> + +// Fixes #507: bili doesn't export the types of this file if there is no actual source in it.. +// hopefully it get's tree-shaken away for everyone :) +export function never_used() {} diff --git a/node_modules/immer/src/types/types-internal.ts b/node_modules/immer/src/types/types-internal.ts new file mode 100644 index 00000000..5c506252 --- /dev/null +++ b/node_modules/immer/src/types/types-internal.ts @@ -0,0 +1,42 @@ +import { + SetState, + ImmerScope, + ProxyObjectState, + ProxyArrayState, + MapState, + DRAFT_STATE +} from "../internal" + +export type Objectish = AnyObject | AnyArray | AnyMap | AnySet +export type ObjectishNoSet = AnyObject | AnyArray | AnyMap + +export type AnyObject = {[key: string]: any} +export type AnyArray = Array +export type AnySet = Set +export type AnyMap = Map + +export const enum ArchType { + Object, + Array, + Map, + Set +} + +export interface ImmerBaseState { + parent_?: ImmerState + scope_: ImmerScope + modified_: boolean + finalized_: boolean + isManual_: boolean +} + +export type ImmerState = + | ProxyObjectState + | ProxyArrayState + | MapState + | SetState + +// The _internal_ type used for drafts (not to be confused with Draft, which is public facing) +export type Drafted = { + [DRAFT_STATE]: T +} & Base diff --git a/node_modules/immer/src/utils/common.ts b/node_modules/immer/src/utils/common.ts new file mode 100644 index 00000000..692157b7 --- /dev/null +++ b/node_modules/immer/src/utils/common.ts @@ -0,0 +1,217 @@ +import { + DRAFT_STATE, + DRAFTABLE, + Objectish, + Drafted, + AnyObject, + AnyMap, + AnySet, + ImmerState, + ArchType, + die, + StrictMode +} from "../internal" + +export const getPrototypeOf = Object.getPrototypeOf + +/** Returns true if the given value is an Immer draft */ +/*#__PURE__*/ +export function isDraft(value: any): boolean { + return !!value && !!value[DRAFT_STATE] +} + +/** Returns true if the given value can be drafted by Immer */ +/*#__PURE__*/ +export function isDraftable(value: any): boolean { + if (!value) return false + return ( + isPlainObject(value) || + Array.isArray(value) || + !!value[DRAFTABLE] || + !!value.constructor?.[DRAFTABLE] || + isMap(value) || + isSet(value) + ) +} + +const objectCtorString = Object.prototype.constructor.toString() +/*#__PURE__*/ +export function isPlainObject(value: any): boolean { + if (!value || typeof value !== "object") return false + const proto = getPrototypeOf(value) + if (proto === null) { + return true + } + const Ctor = + Object.hasOwnProperty.call(proto, "constructor") && proto.constructor + + if (Ctor === Object) return true + + return ( + typeof Ctor == "function" && + Function.toString.call(Ctor) === objectCtorString + ) +} + +/** Get the underlying object that is represented by the given draft */ +/*#__PURE__*/ +export function original(value: T): T | undefined +export function original(value: Drafted): any { + if (!isDraft(value)) die(15, value) + return value[DRAFT_STATE].base_ +} + +/** + * Each iterates a map, set or array. + * Or, if any other kind of object, all of its own properties. + * Regardless whether they are enumerable or symbols + */ +export function each( + obj: T, + iter: (key: string | number, value: any, source: T) => void +): void +export function each(obj: any, iter: any) { + if (getArchtype(obj) === ArchType.Object) { + Reflect.ownKeys(obj).forEach(key => { + iter(key, obj[key], obj) + }) + } else { + obj.forEach((entry: any, index: any) => iter(index, entry, obj)) + } +} + +/*#__PURE__*/ +export function getArchtype(thing: any): ArchType { + const state: undefined | ImmerState = thing[DRAFT_STATE] + return state + ? state.type_ + : Array.isArray(thing) + ? ArchType.Array + : isMap(thing) + ? ArchType.Map + : isSet(thing) + ? ArchType.Set + : ArchType.Object +} + +/*#__PURE__*/ +export function has(thing: any, prop: PropertyKey): boolean { + return getArchtype(thing) === ArchType.Map + ? thing.has(prop) + : Object.prototype.hasOwnProperty.call(thing, prop) +} + +/*#__PURE__*/ +export function get(thing: AnyMap | AnyObject, prop: PropertyKey): any { + // @ts-ignore + return getArchtype(thing) === ArchType.Map ? thing.get(prop) : thing[prop] +} + +/*#__PURE__*/ +export function set(thing: any, propOrOldValue: PropertyKey, value: any) { + const t = getArchtype(thing) + if (t === ArchType.Map) thing.set(propOrOldValue, value) + else if (t === ArchType.Set) { + thing.add(value) + } else thing[propOrOldValue] = value +} + +/*#__PURE__*/ +export function is(x: any, y: any): boolean { + // From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js + if (x === y) { + return x !== 0 || 1 / x === 1 / y + } else { + return x !== x && y !== y + } +} + +/*#__PURE__*/ +export function isMap(target: any): target is AnyMap { + return target instanceof Map +} + +/*#__PURE__*/ +export function isSet(target: any): target is AnySet { + return target instanceof Set +} +/*#__PURE__*/ +export function latest(state: ImmerState): any { + return state.copy_ || state.base_ +} + +/*#__PURE__*/ +export function shallowCopy(base: any, strict: StrictMode) { + if (isMap(base)) { + return new Map(base) + } + if (isSet(base)) { + return new Set(base) + } + if (Array.isArray(base)) return Array.prototype.slice.call(base) + + const isPlain = isPlainObject(base) + + if (strict === true || (strict === "class_only" && !isPlain)) { + // Perform a strict copy + const descriptors = Object.getOwnPropertyDescriptors(base) + delete descriptors[DRAFT_STATE as any] + let keys = Reflect.ownKeys(descriptors) + for (let i = 0; i < keys.length; i++) { + const key: any = keys[i] + const desc = descriptors[key] + if (desc.writable === false) { + desc.writable = true + desc.configurable = true + } + // like object.assign, we will read any _own_, get/set accessors. This helps in dealing + // with libraries that trap values, like mobx or vue + // unlike object.assign, non-enumerables will be copied as well + if (desc.get || desc.set) + descriptors[key] = { + configurable: true, + writable: true, // could live with !!desc.set as well here... + enumerable: desc.enumerable, + value: base[key] + } + } + return Object.create(getPrototypeOf(base), descriptors) + } else { + // perform a sloppy copy + const proto = getPrototypeOf(base) + if (proto !== null && isPlain) { + return {...base} // assumption: better inner class optimization than the assign below + } + const obj = Object.create(proto) + return Object.assign(obj, base) + } +} + +/** + * Freezes draftable objects. Returns the original object. + * By default freezes shallowly, but if the second argument is `true` it will freeze recursively. + * + * @param obj + * @param deep + */ +export function freeze(obj: T, deep?: boolean): T +export function freeze(obj: any, deep: boolean = false): T { + if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj + if (getArchtype(obj) > 1 /* Map or Set */) { + obj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections as any + } + Object.freeze(obj) + if (deep) + // See #590, don't recurse into non-enumerable / Symbol properties when freezing + // So use Object.entries (only string-like, enumerables) instead of each() + Object.entries(obj).forEach(([key, value]) => freeze(value, true)) + return obj +} + +function dontMutateFrozenCollections() { + die(2) +} + +export function isFrozen(obj: any): boolean { + return Object.isFrozen(obj) +} diff --git a/node_modules/immer/src/utils/env.ts b/node_modules/immer/src/utils/env.ts new file mode 100644 index 00000000..dee4b06a --- /dev/null +++ b/node_modules/immer/src/utils/env.ts @@ -0,0 +1,18 @@ +// Should be no imports here! + +/** + * The sentinel value returned by producers to replace the draft with undefined. + */ +export const NOTHING: unique symbol = Symbol.for("immer-nothing") + +/** + * To let Immer treat your class instances as plain immutable objects + * (albeit with a custom prototype), you must define either an instance property + * or a static property on each of your custom classes. + * + * Otherwise, your class instance will never be drafted, which means it won't be + * safe to mutate in a produce callback. + */ +export const DRAFTABLE: unique symbol = Symbol.for("immer-draftable") + +export const DRAFT_STATE: unique symbol = Symbol.for("immer-state") diff --git a/node_modules/immer/src/utils/errors.ts b/node_modules/immer/src/utils/errors.ts new file mode 100644 index 00000000..f74d1bd9 --- /dev/null +++ b/node_modules/immer/src/utils/errors.ts @@ -0,0 +1,48 @@ +export const errors = + process.env.NODE_ENV !== "production" + ? [ + // All error codes, starting by 0: + function(plugin: string) { + return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.` + }, + function(thing: string) { + return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'` + }, + "This object has been frozen and should not be mutated", + function(data: any) { + return ( + "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + + data + ) + }, + "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.", + "Immer forbids circular references", + "The first or second argument to `produce` must be a function", + "The third argument to `produce` must be a function or undefined", + "First argument to `createDraft` must be a plain object, an array, or an immerable object", + "First argument to `finishDraft` must be a draft returned by `createDraft`", + function(thing: string) { + return `'current' expects a draft, got: ${thing}` + }, + "Object.defineProperty() cannot be used on an Immer draft", + "Object.setPrototypeOf() cannot be used on an Immer draft", + "Immer only supports deleting array indices", + "Immer only supports setting array indices and the 'length' property", + function(thing: string) { + return `'original' expects a draft, got: ${thing}` + } + // Note: if more errors are added, the errorOffset in Patches.ts should be increased + // See Patches.ts for additional errors + ] + : [] + +export function die(error: number, ...args: any[]): never { + if (process.env.NODE_ENV !== "production") { + const e = errors[error] + const msg = typeof e === "function" ? e.apply(null, args as any) : e + throw new Error(`[Immer] ${msg}`) + } + throw new Error( + `[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf` + ) +} diff --git a/node_modules/immer/src/utils/plugins.ts b/node_modules/immer/src/utils/plugins.ts new file mode 100644 index 00000000..fede08f5 --- /dev/null +++ b/node_modules/immer/src/utils/plugins.ts @@ -0,0 +1,76 @@ +import { + ImmerState, + Patch, + Drafted, + ImmerBaseState, + AnyMap, + AnySet, + ArchType, + die +} from "../internal" + +/** Plugin utilities */ +const plugins: { + Patches?: { + generatePatches_( + state: ImmerState, + basePath: PatchPath, + patches: Patch[], + inversePatches: Patch[] + ): void + generateReplacementPatches_( + base: any, + replacement: any, + patches: Patch[], + inversePatches: Patch[] + ): void + applyPatches_(draft: T, patches: readonly Patch[]): T + } + MapSet?: { + proxyMap_(target: T, parent?: ImmerState): T + proxySet_(target: T, parent?: ImmerState): T + } +} = {} + +type Plugins = typeof plugins + +export function getPlugin( + pluginKey: K +): Exclude { + const plugin = plugins[pluginKey] + if (!plugin) { + die(0, pluginKey) + } + // @ts-ignore + return plugin +} + +export function loadPlugin( + pluginKey: K, + implementation: Plugins[K] +): void { + if (!plugins[pluginKey]) plugins[pluginKey] = implementation +} +/** Map / Set plugin */ + +export interface MapState extends ImmerBaseState { + type_: ArchType.Map + copy_: AnyMap | undefined + assigned_: Map | undefined + base_: AnyMap + revoked_: boolean + draft_: Drafted +} + +export interface SetState extends ImmerBaseState { + type_: ArchType.Set + copy_: AnySet | undefined + base_: AnySet + drafts_: Map // maps the original value to the draft value in the new set + revoked_: boolean + draft_: Drafted +} + +/** Patches plugin */ + +export type PatchPath = (string | number)[] diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..0db7bd8c --- /dev/null +++ b/package-lock.json @@ -0,0 +1,21 @@ +{ + "name": "certimate", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "immer": "^10.1.1" + } + }, + "node_modules/immer": { + "version": "10.1.1", + "resolved": "https://registry.npmmirror.com/immer/-/immer-10.1.1.tgz", + "integrity": "sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..d3f94b6f --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "immer": "^10.1.1" + } +} diff --git a/ui/dist/assets/index-CWUb5Xuf.css b/ui/dist/assets/index-CWUb5Xuf.css new file mode 100644 index 00000000..510dce1d --- /dev/null +++ b/ui/dist/assets/index-CWUb5Xuf.css @@ -0,0 +1 @@ +*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}:root{--background: 0 0% 100%;--foreground: 20 14.3% 4.1%;--card: 0 0% 100%;--card-foreground: 20 14.3% 4.1%;--popover: 0 0% 100%;--popover-foreground: 20 14.3% 4.1%;--primary: 24.6 95% 53.1%;--primary-foreground: 60 9.1% 97.8%;--secondary: 60 4.8% 95.9%;--secondary-foreground: 24 9.8% 10%;--muted: 60 4.8% 95.9%;--muted-foreground: 25 5.3% 44.7%;--accent: 60 4.8% 95.9%;--accent-foreground: 24 9.8% 10%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 60 9.1% 97.8%;--border: 20 5.9% 90%;--input: 20 5.9% 90%;--ring: 24.6 95% 53.1%;--radius: .5rem;--chart-1: 12 76% 61%;--chart-2: 173 58% 39%;--chart-3: 197 37% 24%;--chart-4: 43 74% 66%;--chart-5: 27 87% 67%}.dark{--background: 20 14.3% 4.1%;--foreground: 60 9.1% 97.8%;--card: 20 14.3% 4.1%;--card-foreground: 60 9.1% 97.8%;--popover: 20 14.3% 4.1%;--popover-foreground: 60 9.1% 97.8%;--primary: 20.5 90.2% 48.2%;--primary-foreground: 60 9.1% 97.8%;--secondary: 12 6.5% 15.1%;--secondary-foreground: 60 9.1% 97.8%;--muted: 12 6.5% 15.1%;--muted-foreground: 24 5.4% 63.9%;--accent: 12 6.5% 15.1%;--accent-foreground: 60 9.1% 97.8%;--destructive: 0 72.2% 50.6%;--destructive-foreground: 60 9.1% 97.8%;--border: 12 6.5% 15.1%;--input: 12 6.5% 15.1%;--ring: 20.5 90.2% 48.2%;--chart-1: 220 70% 50%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media (min-width: 1400px){.container{max-width:1400px}}@media (min-width: 1920px){.container{max-width:1920px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.left-0{left:0}.left-2{left:.5rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-2{top:.5rem}.top-4{top:1rem}.top-\[1px\]{top:1px}.top-\[50\%\]{top:50%}.top-\[60\%\]{top:60%}.top-full{top:100%}.z-10{z-index:10}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[1\]{z-index:1}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-\[-0\.65rem\]{margin-left:-.65rem;margin-right:-.65rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mb-1{margin-bottom:.25rem}.mb-10{margin-bottom:2.5rem}.mb-3{margin-bottom:.75rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-auto{margin-left:auto}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-10{margin-top:2.5rem}.mt-2{margin-top:.5rem}.mt-20{margin-top:5rem}.mt-24{margin-top:6rem}.mt-3{margin-top:.75rem}.mt-32{margin-top:8rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-7{margin-top:1.75rem}.mt-auto{margin-top:auto}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1\.2rem\]{height:1.2rem}.h-\[1px\]{height:1px}.h-\[36px\]{height:36px}.h-\[75vh\]{height:75vh}.h-\[80dvh\]{height:80dvh}.h-\[80vh\]{height:80vh}.h-\[var\(--radix-navigation-menu-viewport-height\)\]{height:var(--radix-navigation-menu-viewport-height)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.max-h-96{max-height:24rem}.max-h-\[80vh\]{max-height:80vh}.max-h-screen{max-height:100vh}.min-h-\[180px\]{min-height:180px}.min-h-\[80px\]{min-height:80px}.min-h-screen{min-height:100vh}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-60{width:15rem}.w-64{width:16rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[1\.2rem\]{width:1.2rem}.w-\[100px\]{width:100px}.w-\[1px\]{width:1px}.w-\[36px\]{width:36px}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-\[35em\]{max-width:35em}.max-w-\[40em\]{max-width:40em}.max-w-\[60px\]{max-width:60px}.max-w-lg{max-width:32rem}.max-w-max{max-width:-moz-max-content;max-width:max-content}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-0{--tw-rotate: 0deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-0{--tw-scale-x: 0;--tw-scale-y: 0;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.list-none{list-style-type:none}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-5>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1.25rem * var(--tw-space-x-reverse));margin-left:calc(1.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.text-nowrap{text-wrap:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-t-\[10px\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-destructive{border-color:hsl(var(--destructive))}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.border-transparent{border-color:transparent}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-background{background-color:hsl(var(--background))}.bg-black\/80{background-color:#000c}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-gray-950{--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/40{background-color:hsl(var(--muted) / .4)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-orange-100{--tw-bg-opacity: 1;background-color:rgb(255 237 213 / var(--tw-bg-opacity))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:transparent}.fill-current{fill:currentColor}.p-0{padding:0}.p-1{padding:.25rem}.p-10{padding:2.5rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.pb-4{padding-bottom:1rem}.pl-2\.5{padding-left:.625rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-5{padding-top:1.25rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.leading-none{line-height:1}.tracking-tight{letter-spacing:-.025em}.tracking-widest{letter-spacing:.1em}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-stone-100{--tw-text-opacity: 1;color:rgb(245 245 244 / var(--tw-text-opacity))}.text-stone-600{--tw-text-opacity: 1;color:rgb(87 83 78 / var(--tw-text-opacity))}.text-stone-700{--tw-text-opacity: 1;color:rgb(68 64 60 / var(--tw-text-opacity))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.duration-200{animation-duration:.2s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-stone-900:hover{--tw-text-opacity: 1;color:rgb(28 25 23 / var(--tw-text-opacity))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity))}.group.destructive .group-\[\.destructive\]\:hover\:border-destructive\/30:hover{border-color:hsl(var(--destructive) / .3)}.group.destructive .group-\[\.destructive\]\:hover\:bg-destructive:hover{background-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:hover\:text-destructive-foreground:hover{color:hsl(var(--destructive-foreground))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity))}.group.destructive .group-\[\.destructive\]\:focus\:ring-destructive:focus{--tw-ring-color: hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\[state\=closed\]\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\[state\=open\]\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\[active\]\:bg-accent\/50[data-active]{background-color:hsl(var(--accent) / .5)}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:bg-accent\/50[data-state=open]{background-color:hsl(var(--accent) / .5)}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=closed\]\:duration-300[data-state=closed]{transition-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{transition-duration:.5s}.data-\[motion\^\=from-\]\:animate-in[data-motion^=from-],.data-\[state\=open\]\:animate-in[data-state=open],.data-\[state\=visible\]\:animate-in[data-state=visible]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[motion\^\=to-\]\:animate-out[data-motion^=to-],.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[state\=hidden\]\:animate-out[data-state=hidden],.data-\[swipe\=end\]\:animate-out[data-swipe=end]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[motion\^\=from-\]\:fade-in[data-motion^=from-]{--tw-enter-opacity: 0}.data-\[motion\^\=to-\]\:fade-out[data-motion^=to-],.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\[state\=closed\]\:fade-out-80[data-state=closed]{--tw-exit-opacity: .8}.data-\[state\=hidden\]\:fade-out[data-state=hidden]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open],.data-\[state\=visible\]\:fade-in[data-state=visible]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-90[data-state=open]{--tw-enter-scale: .9}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[motion\=from-end\]\:slide-in-from-right-52[data-motion=from-end]{--tw-enter-translate-x: 13rem}.data-\[motion\=from-start\]\:slide-in-from-left-52[data-motion=from-start]{--tw-enter-translate-x: -13rem}.data-\[motion\=to-end\]\:slide-out-to-right-52[data-motion=to-end]{--tw-exit-translate-x: 13rem}.data-\[motion\=to-start\]\:slide-out-to-left-52[data-motion=to-start]{--tw-exit-translate-x: -13rem}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed],.data-\[state\=closed\]\:slide-out-to-right-full[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-top-full[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=closed\]\:duration-300[data-state=closed]{animation-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{animation-duration:.5s}.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dark\:-rotate-90:is(.dark *){--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dark\:rotate-0:is(.dark *){--tw-rotate: 0deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dark\:scale-0:is(.dark *){--tw-scale-x: 0;--tw-scale-y: 0;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dark\:scale-100:is(.dark *){--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dark\:border-destructive:is(.dark *){border-color:hsl(var(--destructive))}.dark\:border-stone-200:is(.dark *){--tw-border-opacity: 1;border-color:rgb(231 229 228 / var(--tw-border-opacity))}.dark\:border-stone-400:is(.dark *){--tw-border-opacity: 1;border-color:rgb(168 162 158 / var(--tw-border-opacity))}.dark\:border-stone-500:is(.dark *){--tw-border-opacity: 1;border-color:rgb(120 113 108 / var(--tw-border-opacity))}.dark\:border-stone-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(68 64 60 / var(--tw-border-opacity))}.dark\:bg-stone-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(12 10 9 / var(--tw-bg-opacity))}.dark\:text-gray-200:is(.dark *){--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity))}.dark\:text-stone-200:is(.dark *){--tw-text-opacity: 1;color:rgb(231 229 228 / var(--tw-text-opacity))}.dark\:text-white:is(.dark *){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.dark\:hover\:text-stone-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(231 229 228 / var(--tw-text-opacity))}@media (min-width: 640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:top-auto{top:auto}.sm\:ml-2{margin-left:.5rem}.sm\:mt-0{margin-top:0}.sm\:flex{display:flex}.sm\:hidden{display:none}.sm\:w-24{width:6rem}.sm\:w-32{width:8rem}.sm\:w-36{width:9rem}.sm\:w-40{width:10rem}.sm\:w-48{width:12rem}.sm\:w-56{width:14rem}.sm\:w-60{width:15rem}.sm\:w-64{width:16rem}.sm\:max-w-5xl{max-width:64rem}.sm\:max-w-\[600px\]{max-width:600px}.sm\:max-w-sm{max-width:24rem}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:justify-end{justify-content:flex-end}.sm\:justify-center{justify-content:center}.sm\:gap-2\.5{gap:.625rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-2{padding:.5rem}.sm\:pt-0{padding-top:0}.sm\:text-left{text-align:left}.data-\[state\=open\]\:sm\:slide-in-from-bottom-full[data-state=open]{--tw-enter-translate-y: 100%}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\:mt-0{margin-top:0}.md\:mt-5{margin-top:1.25rem}.md\:block{display:block}.md\:hidden{display:none}.md\:w-\[200px\]{width:200px}.md\:w-\[250px\]{width:250px}.md\:w-\[350px\]{width:350px}.md\:w-\[35em\]{width:35em}.md\:w-\[45em\]{width:45em}.md\:w-\[var\(--radix-navigation-menu-viewport-width\)\]{width:var(--radix-navigation-menu-viewport-width)}.md\:w-auto{width:auto}.md\:max-w-\[35em\]{max-width:35em}.md\:max-w-\[420px\]{max-width:420px}.md\:grid-cols-\[180px_1fr\]{grid-template-columns:180px 1fr}.md\:flex-row{flex-direction:row}.md\:flex-col{flex-direction:column}.md\:space-x-10>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(2.5rem * var(--tw-space-x-reverse));margin-left:calc(2.5rem * calc(1 - var(--tw-space-x-reverse)))}.md\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.md\:p-3{padding:.75rem}}@media (min-width: 1024px){.lg\:h-\[60px\]{height:60px}.lg\:grid-cols-\[200px_1fr\]{grid-template-columns:200px 1fr}.lg\:gap-6{gap:1.5rem}.lg\:p-6{padding:1.5rem}.lg\:px-4{padding-left:1rem;padding-right:1rem}.lg\:px-6{padding-left:1.5rem;padding-right:1.5rem}}@media (min-width: 1536px){@media (min-width: 768px){.\32xl\:md\:grid-cols-\[280px_1fr\]{grid-template-columns:280px 1fr}}}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:text-destructive>svg{color:hsl(var(--destructive))}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px} diff --git a/ui/dist/assets/index-DOft-CKV.css b/ui/dist/assets/index-DOft-CKV.css deleted file mode 100644 index 1e08162c..00000000 --- a/ui/dist/assets/index-DOft-CKV.css +++ /dev/null @@ -1 +0,0 @@ -*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}:root{--background: 0 0% 100%;--foreground: 20 14.3% 4.1%;--card: 0 0% 100%;--card-foreground: 20 14.3% 4.1%;--popover: 0 0% 100%;--popover-foreground: 20 14.3% 4.1%;--primary: 24.6 95% 53.1%;--primary-foreground: 60 9.1% 97.8%;--secondary: 60 4.8% 95.9%;--secondary-foreground: 24 9.8% 10%;--muted: 60 4.8% 95.9%;--muted-foreground: 25 5.3% 44.7%;--accent: 60 4.8% 95.9%;--accent-foreground: 24 9.8% 10%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 60 9.1% 97.8%;--border: 20 5.9% 90%;--input: 20 5.9% 90%;--ring: 24.6 95% 53.1%;--radius: .5rem;--chart-1: 12 76% 61%;--chart-2: 173 58% 39%;--chart-3: 197 37% 24%;--chart-4: 43 74% 66%;--chart-5: 27 87% 67%}.dark{--background: 20 14.3% 4.1%;--foreground: 60 9.1% 97.8%;--card: 20 14.3% 4.1%;--card-foreground: 60 9.1% 97.8%;--popover: 20 14.3% 4.1%;--popover-foreground: 60 9.1% 97.8%;--primary: 20.5 90.2% 48.2%;--primary-foreground: 60 9.1% 97.8%;--secondary: 12 6.5% 15.1%;--secondary-foreground: 60 9.1% 97.8%;--muted: 12 6.5% 15.1%;--muted-foreground: 24 5.4% 63.9%;--accent: 12 6.5% 15.1%;--accent-foreground: 60 9.1% 97.8%;--destructive: 0 72.2% 50.6%;--destructive-foreground: 60 9.1% 97.8%;--border: 12 6.5% 15.1%;--input: 12 6.5% 15.1%;--ring: 20.5 90.2% 48.2%;--chart-1: 220 70% 50%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media (min-width: 1400px){.container{max-width:1400px}}@media (min-width: 1920px){.container{max-width:1920px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.left-0{left:0}.left-2{left:.5rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-2{top:.5rem}.top-4{top:1rem}.top-\[1px\]{top:1px}.top-\[50\%\]{top:50%}.top-\[60\%\]{top:60%}.top-full{top:100%}.z-10{z-index:10}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[1\]{z-index:1}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-\[-0\.65rem\]{margin-left:-.65rem;margin-right:-.65rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mb-1{margin-bottom:.25rem}.mb-10{margin-bottom:2.5rem}.mb-3{margin-bottom:.75rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-auto{margin-left:auto}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-10{margin-top:2.5rem}.mt-2{margin-top:.5rem}.mt-20{margin-top:5rem}.mt-24{margin-top:6rem}.mt-3{margin-top:.75rem}.mt-32{margin-top:8rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-7{margin-top:1.75rem}.mt-auto{margin-top:auto}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1\.2rem\]{height:1.2rem}.h-\[1px\]{height:1px}.h-\[36px\]{height:36px}.h-\[75vh\]{height:75vh}.h-\[80dvh\]{height:80dvh}.h-\[80vh\]{height:80vh}.h-\[var\(--radix-navigation-menu-viewport-height\)\]{height:var(--radix-navigation-menu-viewport-height)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.max-h-96{max-height:24rem}.max-h-\[80vh\]{max-height:80vh}.max-h-screen{max-height:100vh}.min-h-\[180px\]{min-height:180px}.min-h-\[80px\]{min-height:80px}.min-h-screen{min-height:100vh}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-60{width:15rem}.w-64{width:16rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[1\.2rem\]{width:1.2rem}.w-\[100px\]{width:100px}.w-\[1px\]{width:1px}.w-\[36px\]{width:36px}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-\[35em\]{max-width:35em}.max-w-\[40em\]{max-width:40em}.max-w-\[60px\]{max-width:60px}.max-w-lg{max-width:32rem}.max-w-max{max-width:-moz-max-content;max-width:max-content}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-0{--tw-rotate: 0deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-0{--tw-scale-x: 0;--tw-scale-y: 0;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.list-none{list-style-type:none}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-5>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1.25rem * var(--tw-space-x-reverse));margin-left:calc(1.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.text-nowrap{text-wrap:nowrap}.rounded{border-radius:.25rem}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-t-\[10px\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-destructive{border-color:hsl(var(--destructive))}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.border-transparent{border-color:transparent}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-background{background-color:hsl(var(--background))}.bg-black\/80{background-color:#000c}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.bg-gray-950{--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/40{background-color:hsl(var(--muted) / .4)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-orange-100{--tw-bg-opacity: 1;background-color:rgb(255 237 213 / var(--tw-bg-opacity))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:transparent}.fill-current{fill:currentColor}.p-0{padding:0}.p-1{padding:.25rem}.p-10{padding:2.5rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.pb-4{padding-bottom:1rem}.pl-2\.5{padding-left:.625rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.leading-none{line-height:1}.tracking-tight{letter-spacing:-.025em}.tracking-widest{letter-spacing:.1em}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-stone-100{--tw-text-opacity: 1;color:rgb(245 245 244 / var(--tw-text-opacity))}.text-stone-700{--tw-text-opacity: 1;color:rgb(68 64 60 / var(--tw-text-opacity))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.duration-200{animation-duration:.2s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.placeholder\:whitespace-pre-wrap::-moz-placeholder{white-space:pre-wrap}.placeholder\:whitespace-pre-wrap::placeholder{white-space:pre-wrap}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-stone-900:hover{--tw-text-opacity: 1;color:rgb(28 25 23 / var(--tw-text-opacity))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity))}.group.destructive .group-\[\.destructive\]\:hover\:border-destructive\/30:hover{border-color:hsl(var(--destructive) / .3)}.group.destructive .group-\[\.destructive\]\:hover\:bg-destructive:hover{background-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:hover\:text-destructive-foreground:hover{color:hsl(var(--destructive-foreground))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity))}.group.destructive .group-\[\.destructive\]\:focus\:ring-destructive:focus{--tw-ring-color: hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\[state\=closed\]\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\[state\=open\]\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\[active\]\:bg-accent\/50[data-active]{background-color:hsl(var(--accent) / .5)}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:bg-accent\/50[data-state=open]{background-color:hsl(var(--accent) / .5)}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=closed\]\:duration-300[data-state=closed]{transition-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{transition-duration:.5s}.data-\[motion\^\=from-\]\:animate-in[data-motion^=from-],.data-\[state\=open\]\:animate-in[data-state=open],.data-\[state\=visible\]\:animate-in[data-state=visible]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[motion\^\=to-\]\:animate-out[data-motion^=to-],.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[state\=hidden\]\:animate-out[data-state=hidden],.data-\[swipe\=end\]\:animate-out[data-swipe=end]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[motion\^\=from-\]\:fade-in[data-motion^=from-]{--tw-enter-opacity: 0}.data-\[motion\^\=to-\]\:fade-out[data-motion^=to-],.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\[state\=closed\]\:fade-out-80[data-state=closed]{--tw-exit-opacity: .8}.data-\[state\=hidden\]\:fade-out[data-state=hidden]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open],.data-\[state\=visible\]\:fade-in[data-state=visible]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-90[data-state=open]{--tw-enter-scale: .9}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[motion\=from-end\]\:slide-in-from-right-52[data-motion=from-end]{--tw-enter-translate-x: 13rem}.data-\[motion\=from-start\]\:slide-in-from-left-52[data-motion=from-start]{--tw-enter-translate-x: -13rem}.data-\[motion\=to-end\]\:slide-out-to-right-52[data-motion=to-end]{--tw-exit-translate-x: 13rem}.data-\[motion\=to-start\]\:slide-out-to-left-52[data-motion=to-start]{--tw-exit-translate-x: -13rem}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed],.data-\[state\=closed\]\:slide-out-to-right-full[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-top-full[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=closed\]\:duration-300[data-state=closed]{animation-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{animation-duration:.5s}.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dark\:-rotate-90:is(.dark *){--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dark\:rotate-0:is(.dark *){--tw-rotate: 0deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dark\:scale-0:is(.dark *){--tw-scale-x: 0;--tw-scale-y: 0;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dark\:scale-100:is(.dark *){--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dark\:border-destructive:is(.dark *){border-color:hsl(var(--destructive))}.dark\:border-stone-200:is(.dark *){--tw-border-opacity: 1;border-color:rgb(231 229 228 / var(--tw-border-opacity))}.dark\:border-stone-500:is(.dark *){--tw-border-opacity: 1;border-color:rgb(120 113 108 / var(--tw-border-opacity))}.dark\:border-stone-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(68 64 60 / var(--tw-border-opacity))}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity))}.dark\:bg-stone-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(12 10 9 / var(--tw-bg-opacity))}.dark\:text-gray-200:is(.dark *){--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity))}.dark\:text-stone-200:is(.dark *){--tw-text-opacity: 1;color:rgb(231 229 228 / var(--tw-text-opacity))}.dark\:text-white:is(.dark *){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.dark\:hover\:text-stone-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(231 229 228 / var(--tw-text-opacity))}@media (min-width: 640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:top-auto{top:auto}.sm\:ml-2{margin-left:.5rem}.sm\:mt-0{margin-top:0}.sm\:flex{display:flex}.sm\:hidden{display:none}.sm\:w-24{width:6rem}.sm\:w-32{width:8rem}.sm\:w-36{width:9rem}.sm\:w-40{width:10rem}.sm\:w-48{width:12rem}.sm\:w-56{width:14rem}.sm\:w-60{width:15rem}.sm\:w-64{width:16rem}.sm\:max-w-5xl{max-width:64rem}.sm\:max-w-\[600px\]{max-width:600px}.sm\:max-w-sm{max-width:24rem}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:justify-end{justify-content:flex-end}.sm\:justify-center{justify-content:center}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-2{padding:.5rem}.sm\:pt-0{padding-top:0}.sm\:text-left{text-align:left}.data-\[state\=open\]\:sm\:slide-in-from-bottom-full[data-state=open]{--tw-enter-translate-y: 100%}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\:mt-0{margin-top:0}.md\:block{display:block}.md\:hidden{display:none}.md\:w-\[200px\]{width:200px}.md\:w-\[250px\]{width:250px}.md\:w-\[350px\]{width:350px}.md\:w-\[35em\]{width:35em}.md\:w-\[45em\]{width:45em}.md\:w-\[var\(--radix-navigation-menu-viewport-width\)\]{width:var(--radix-navigation-menu-viewport-width)}.md\:w-auto{width:auto}.md\:max-w-\[35em\]{max-width:35em}.md\:max-w-\[420px\]{max-width:420px}.md\:grid-cols-\[180px_1fr\]{grid-template-columns:180px 1fr}.md\:flex-row{flex-direction:row}.md\:flex-col{flex-direction:column}.md\:space-x-10>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(2.5rem * var(--tw-space-x-reverse));margin-left:calc(2.5rem * calc(1 - var(--tw-space-x-reverse)))}.md\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.md\:p-3{padding:.75rem}}@media (min-width: 1024px){.lg\:h-\[60px\]{height:60px}.lg\:grid-cols-\[200px_1fr\]{grid-template-columns:200px 1fr}.lg\:gap-6{gap:1.5rem}.lg\:p-6{padding:1.5rem}.lg\:px-4{padding-left:1rem;padding-right:1rem}.lg\:px-6{padding-left:1.5rem;padding-right:1.5rem}}@media (min-width: 1536px){@media (min-width: 768px){.\32xl\:md\:grid-cols-\[280px_1fr\]{grid-template-columns:280px 1fr}}}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:text-destructive>svg{color:hsl(var(--destructive))}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px} diff --git a/ui/dist/assets/index-DbwFzZm1.js b/ui/dist/assets/index-DbwFzZm1.js new file mode 100644 index 00000000..b4503f7f --- /dev/null +++ b/ui/dist/assets/index-DbwFzZm1.js @@ -0,0 +1,332 @@ +var vP=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var eY=vP((pY,Td)=>{function yb(e,t){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var ju=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vb={exports:{}},Wf={},xb={exports:{}},nt={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Zc=Symbol.for("react.element"),xP=Symbol.for("react.portal"),wP=Symbol.for("react.fragment"),bP=Symbol.for("react.strict_mode"),_P=Symbol.for("react.profiler"),SP=Symbol.for("react.provider"),kP=Symbol.for("react.context"),CP=Symbol.for("react.forward_ref"),jP=Symbol.for("react.suspense"),EP=Symbol.for("react.memo"),NP=Symbol.for("react.lazy"),c0=Symbol.iterator;function TP(e){return e===null||typeof e!="object"?null:(e=c0&&e[c0]||e["@@iterator"],typeof e=="function"?e:null)}var wb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},bb=Object.assign,_b={};function Ya(e,t,n){this.props=e,this.context=t,this.refs=_b,this.updater=n||wb}Ya.prototype.isReactComponent={};Ya.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ya.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Sb(){}Sb.prototype=Ya.prototype;function sy(e,t,n){this.props=e,this.context=t,this.refs=_b,this.updater=n||wb}var iy=sy.prototype=new Sb;iy.constructor=sy;bb(iy,Ya.prototype);iy.isPureReactComponent=!0;var u0=Array.isArray,kb=Object.prototype.hasOwnProperty,oy={current:null},Cb={key:!0,ref:!0,__self:!0,__source:!0};function jb(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)kb.call(t,r)&&!Cb.hasOwnProperty(r)&&(s[r]=t[r]);var a=arguments.length-2;if(a===1)s.children=n;else if(1>>1,B=W[$];if(0>>1;$s(ie,X))Des(pe,ie)?(W[$]=pe,W[De]=X,$=De):(W[$]=ie,W[se]=X,$=se);else if(Des(pe,X))W[$]=pe,W[De]=X,$=De;else break e}}return I}function s(W,I){var X=W.sortIndex-I.sortIndex;return X!==0?X:W.id-I.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var c=[],u=[],d=1,f=null,h=3,p=!1,x=!1,m=!1,w=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(W){for(var I=n(u);I!==null;){if(I.callback===null)r(u);else if(I.startTime<=W)r(u),I.sortIndex=I.expirationTime,t(c,I);else break;I=n(u)}}function _(W){if(m=!1,b(W),!x)if(n(c)!==null)x=!0,J(C);else{var I=n(u);I!==null&&z(_,I.startTime-W)}}function C(W,I){x=!1,m&&(m=!1,y(R),R=-1),p=!0;var X=h;try{for(b(I),f=n(c);f!==null&&(!(f.expirationTime>I)||W&&!G());){var $=f.callback;if(typeof $=="function"){f.callback=null,h=f.priorityLevel;var B=$(f.expirationTime<=I);I=e.unstable_now(),typeof B=="function"?f.callback=B:f===n(c)&&r(c),b(I)}else r(c);f=n(c)}if(f!==null)var he=!0;else{var se=n(u);se!==null&&z(_,se.startTime-I),he=!1}return he}finally{f=null,h=X,p=!1}}var j=!1,T=null,R=-1,A=5,D=-1;function G(){return!(e.unstable_now()-DW||125$?(W.sortIndex=X,t(u,W),n(c)===null&&W===n(u)&&(m?(y(R),R=-1):m=!0,z(_,X-$))):(W.sortIndex=B,t(c,W),x||p||(x=!0,J(C))),W},e.unstable_shouldYield=G,e.unstable_wrapCallback=function(W){var I=h;return function(){var X=h;h=I;try{return W.apply(this,arguments)}finally{h=X}}}})(Ab);Rb.exports=Ab;var $P=Rb.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var UP=g,Gn=$P;function oe(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xm=Object.prototype.hasOwnProperty,VP=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f0={},h0={};function BP(e){return xm.call(h0,e)?!0:xm.call(f0,e)?!1:VP.test(e)?h0[e]=!0:(f0[e]=!0,!1)}function WP(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function HP(e,t,n,r){if(t===null||typeof t>"u"||WP(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function En(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var on={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){on[e]=new En(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];on[t]=new En(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){on[e]=new En(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){on[e]=new En(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){on[e]=new En(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){on[e]=new En(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){on[e]=new En(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){on[e]=new En(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){on[e]=new En(e,5,!1,e.toLowerCase(),null,!1,!1)});var ly=/[\-:]([a-z])/g;function cy(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ly,cy);on[t]=new En(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ly,cy);on[t]=new En(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ly,cy);on[t]=new En(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){on[e]=new En(e,1,!1,e.toLowerCase(),null,!1,!1)});on.xlinkHref=new En("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){on[e]=new En(e,1,!1,e.toLowerCase(),null,!0,!0)});function uy(e,t,n,r){var s=on.hasOwnProperty(t)?on[t]:null;(s!==null?s.type!==0:r||!(2a||s[o]!==i[a]){var c=` +`+s[o].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=o&&0<=a);break}}}finally{gp=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Pl(e):""}function YP(e){switch(e.tag){case 5:return Pl(e.type);case 16:return Pl("Lazy");case 13:return Pl("Suspense");case 19:return Pl("SuspenseList");case 0:case 2:case 15:return e=yp(e.type,!1),e;case 11:return e=yp(e.type.render,!1),e;case 1:return e=yp(e.type,!0),e;default:return""}}function Sm(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Zo:return"Fragment";case Go:return"Portal";case wm:return"Profiler";case dy:return"StrictMode";case bm:return"Suspense";case _m:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ib:return(e.displayName||"Context")+".Consumer";case Db:return(e._context.displayName||"Context")+".Provider";case fy:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case hy:return t=e.displayName||null,t!==null?t:Sm(e.type)||"Memo";case ri:t=e._payload,e=e._init;try{return Sm(e(t))}catch{}}return null}function KP(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Sm(t);case 8:return t===dy?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function _i(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Lb(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function GP(e){var t=Lb(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Tu(e){e._valueTracker||(e._valueTracker=GP(e))}function Fb(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Lb(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Pd(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function km(e,t){var n=t.checked;return Lt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function m0(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=_i(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function zb(e,t){t=t.checked,t!=null&&uy(e,"checked",t,!1)}function Cm(e,t){zb(e,t);var n=_i(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?jm(e,t.type,n):t.hasOwnProperty("defaultValue")&&jm(e,t.type,_i(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function g0(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function jm(e,t,n){(t!=="number"||Pd(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Rl=Array.isArray;function ha(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=Pu.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function rc(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Vl={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ZP=["Webkit","ms","Moz","O"];Object.keys(Vl).forEach(function(e){ZP.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Vl[t]=Vl[e]})});function Bb(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Vl.hasOwnProperty(e)&&Vl[e]?(""+t).trim():t+"px"}function Wb(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Bb(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var qP=Lt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Tm(e,t){if(t){if(qP[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(oe(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(oe(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(oe(61))}if(t.style!=null&&typeof t.style!="object")throw Error(oe(62))}}function Pm(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Rm=null;function py(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Am=null,pa=null,ma=null;function x0(e){if(e=Qc(e)){if(typeof Am!="function")throw Error(oe(280));var t=e.stateNode;t&&(t=Zf(t),Am(e.stateNode,e.type,t))}}function Hb(e){pa?ma?ma.push(e):ma=[e]:pa=e}function Yb(){if(pa){var e=pa,t=ma;if(ma=pa=null,x0(e),t)for(e=0;e>>=0,e===0?32:31-(aR(e)/lR|0)|0}var Ru=64,Au=4194304;function Al(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Dd(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~s;a!==0?r=Al(a):(i&=o,i!==0&&(r=Al(i)))}else o=n&~s,o!==0?r=Al(o):i!==0&&(r=Al(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function qc(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Er(t),e[t]=n}function fR(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Wl),N0=" ",T0=!1;function f_(e,t){switch(e){case"keyup":return $R.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function h_(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var qo=!1;function VR(e,t){switch(e){case"compositionend":return h_(t);case"keypress":return t.which!==32?null:(T0=!0,N0);case"textInput":return e=t.data,e===N0&&T0?null:e;default:return null}}function BR(e,t){if(qo)return e==="compositionend"||!_y&&f_(e,t)?(e=u_(),cd=xy=li=null,qo=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=O0(n)}}function y_(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?y_(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function v_(){for(var e=window,t=Pd();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Pd(e.document)}return t}function Sy(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function QR(e){var t=v_(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&y_(n.ownerDocument.documentElement,n)){if(r!==null&&Sy(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=D0(n,i);var o=D0(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Xo=null,Fm=null,Yl=null,zm=!1;function I0(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;zm||Xo==null||Xo!==Pd(r)||(r=Xo,"selectionStart"in r&&Sy(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Yl&&cc(Yl,r)||(Yl=r,r=Ld(Fm,"onSelect"),0ea||(e.current=Hm[ea],Hm[ea]=null,ea--)}function bt(e,t){ea++,Hm[ea]=e.current,e.current=t}var Si={},yn=Oi(Si),On=Oi(!1),so=Si;function Na(e,t){var n=e.type.contextTypes;if(!n)return Si;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Dn(e){return e=e.childContextTypes,e!=null}function zd(){kt(On),kt(yn)}function V0(e,t,n){if(yn.current!==Si)throw Error(oe(168));bt(yn,t),bt(On,n)}function E_(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(oe(108,KP(e)||"Unknown",s));return Lt({},n,r)}function $d(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Si,so=yn.current,bt(yn,e),bt(On,On.current),!0}function B0(e,t,n){var r=e.stateNode;if(!r)throw Error(oe(169));n?(e=E_(e,t,so),r.__reactInternalMemoizedMergedChildContext=e,kt(On),kt(yn),bt(yn,e)):kt(On),bt(On,n)}var _s=null,qf=!1,Rp=!1;function N_(e){_s===null?_s=[e]:_s.push(e)}function uA(e){qf=!0,N_(e)}function Di(){if(!Rp&&_s!==null){Rp=!0;var e=0,t=gt;try{var n=_s;for(gt=1;e>=o,s-=o,Ss=1<<32-Er(t)+s|n<R?(A=T,T=null):A=T.sibling;var D=h(y,T,b[R],_);if(D===null){T===null&&(T=A);break}e&&T&&D.alternate===null&&t(y,T),v=i(D,v,R),j===null?C=D:j.sibling=D,j=D,T=A}if(R===b.length)return n(y,T),Pt&&zi(y,R),C;if(T===null){for(;RR?(A=T,T=null):A=T.sibling;var G=h(y,T,D.value,_);if(G===null){T===null&&(T=A);break}e&&T&&G.alternate===null&&t(y,T),v=i(G,v,R),j===null?C=G:j.sibling=G,j=G,T=A}if(D.done)return n(y,T),Pt&&zi(y,R),C;if(T===null){for(;!D.done;R++,D=b.next())D=f(y,D.value,_),D!==null&&(v=i(D,v,R),j===null?C=D:j.sibling=D,j=D);return Pt&&zi(y,R),C}for(T=r(y,T);!D.done;R++,D=b.next())D=p(T,y,R,D.value,_),D!==null&&(e&&D.alternate!==null&&T.delete(D.key===null?R:D.key),v=i(D,v,R),j===null?C=D:j.sibling=D,j=D);return e&&T.forEach(function(N){return t(y,N)}),Pt&&zi(y,R),C}function w(y,v,b,_){if(typeof b=="object"&&b!==null&&b.type===Zo&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Nu:e:{for(var C=b.key,j=v;j!==null;){if(j.key===C){if(C=b.type,C===Zo){if(j.tag===7){n(y,j.sibling),v=s(j,b.props.children),v.return=y,y=v;break e}}else if(j.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===ri&&Y0(C)===j.type){n(y,j.sibling),v=s(j,b.props),v.ref=gl(y,j,b),v.return=y,y=v;break e}n(y,j);break}else t(y,j);j=j.sibling}b.type===Zo?(v=eo(b.props.children,y.mode,_,b.key),v.return=y,y=v):(_=yd(b.type,b.key,b.props,null,y.mode,_),_.ref=gl(y,v,b),_.return=y,y=_)}return o(y);case Go:e:{for(j=b.key;v!==null;){if(v.key===j)if(v.tag===4&&v.stateNode.containerInfo===b.containerInfo&&v.stateNode.implementation===b.implementation){n(y,v.sibling),v=s(v,b.children||[]),v.return=y,y=v;break e}else{n(y,v);break}else t(y,v);v=v.sibling}v=zp(b,y.mode,_),v.return=y,y=v}return o(y);case ri:return j=b._init,w(y,v,j(b._payload),_)}if(Rl(b))return x(y,v,b,_);if(dl(b))return m(y,v,b,_);zu(y,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,v!==null&&v.tag===6?(n(y,v.sibling),v=s(v,b),v.return=y,y=v):(n(y,v),v=Fp(b,y.mode,_),v.return=y,y=v),o(y)):n(y,v)}return w}var Pa=A_(!0),O_=A_(!1),Bd=Oi(null),Wd=null,ra=null,Ey=null;function Ny(){Ey=ra=Wd=null}function Ty(e){var t=Bd.current;kt(Bd),e._currentValue=t}function Gm(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function ya(e,t){Wd=e,Ey=ra=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(An=!0),e.firstContext=null)}function fr(e){var t=e._currentValue;if(Ey!==e)if(e={context:e,memoizedValue:t,next:null},ra===null){if(Wd===null)throw Error(oe(308));ra=e,Wd.dependencies={lanes:0,firstContext:e}}else ra=ra.next=e;return t}var Wi=null;function Py(e){Wi===null?Wi=[e]:Wi.push(e)}function D_(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Py(t)):(n.next=s.next,s.next=n),t.interleaved=n,Ds(e,r)}function Ds(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var si=!1;function Ry(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function I_(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Es(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function yi(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ct&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Ds(e,n)}return s=r.interleaved,s===null?(t.next=t,Py(r)):(t.next=s.next,s.next=t),r.interleaved=t,Ds(e,n)}function dd(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,gy(e,n)}}function K0(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Hd(e,t,n,r){var s=e.updateQueue;si=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var c=a,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;o=0,d=u=c=null,a=i;do{var h=a.lane,p=a.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var x=e,m=a;switch(h=t,p=n,m.tag){case 1:if(x=m.payload,typeof x=="function"){f=x.call(p,f,h);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=m.payload,h=typeof x=="function"?x.call(p,f,h):x,h==null)break e;f=Lt({},f,h);break e;case 2:si=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[a]:h.push(a))}else p={eventTime:p,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,o|=h;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;h=a,a=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);ao|=o,e.lanes=o,e.memoizedState=f}}function G0(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Op.transition;Op.transition={};try{e(!1),t()}finally{gt=n,Op.transition=r}}function Q_(){return hr().memoizedState}function pA(e,t,n){var r=xi(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},J_(e))eS(t,n);else if(n=D_(e,t,n,r),n!==null){var s=kn();Nr(n,e,r,s),tS(n,t,r)}}function mA(e,t,n){var r=xi(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(J_(e))eS(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,Pr(a,o)){var c=t.interleaved;c===null?(s.next=s,Py(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=D_(e,t,s,r),n!==null&&(s=kn(),Nr(n,e,r,s),tS(n,t,r))}}function J_(e){var t=e.alternate;return e===Mt||t!==null&&t===Mt}function eS(e,t){Kl=Kd=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function tS(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,gy(e,n)}}var Gd={readContext:fr,useCallback:hn,useContext:hn,useEffect:hn,useImperativeHandle:hn,useInsertionEffect:hn,useLayoutEffect:hn,useMemo:hn,useReducer:hn,useRef:hn,useState:hn,useDebugValue:hn,useDeferredValue:hn,useTransition:hn,useMutableSource:hn,useSyncExternalStore:hn,useId:hn,unstable_isNewReconciler:!1},gA={readContext:fr,useCallback:function(e,t){return Br().memoizedState=[e,t===void 0?null:t],e},useContext:fr,useEffect:q0,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,hd(4194308,4,K_.bind(null,t,e),n)},useLayoutEffect:function(e,t){return hd(4194308,4,e,t)},useInsertionEffect:function(e,t){return hd(4,2,e,t)},useMemo:function(e,t){var n=Br();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Br();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=pA.bind(null,Mt,e),[r.memoizedState,e]},useRef:function(e){var t=Br();return e={current:e},t.memoizedState=e},useState:Z0,useDebugValue:zy,useDeferredValue:function(e){return Br().memoizedState=e},useTransition:function(){var e=Z0(!1),t=e[0];return e=hA.bind(null,e[1]),Br().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Mt,s=Br();if(Pt){if(n===void 0)throw Error(oe(407));n=n()}else{if(n=t(),en===null)throw Error(oe(349));oo&30||z_(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,q0(U_.bind(null,r,i,e),[e]),r.flags|=2048,yc(9,$_.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Br(),t=en.identifierPrefix;if(Pt){var n=ks,r=Ss;n=(r&~(1<<32-Er(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=mc++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Wr]=t,e[fc]=r,dS(e,t,!1,!1),t.stateNode=e;e:{switch(o=Pm(n,r),n){case"dialog":St("cancel",e),St("close",e),s=r;break;case"iframe":case"object":case"embed":St("load",e),s=r;break;case"video":case"audio":for(s=0;sOa&&(t.flags|=128,r=!0,yl(i,!1),t.lanes=4194304)}else{if(!r)if(e=Yd(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),yl(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Pt)return pn(t),null}else 2*Vt()-i.renderingStartTime>Oa&&n!==1073741824&&(t.flags|=128,r=!0,yl(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Vt(),t.sibling=null,n=Dt.current,bt(Dt,r?n&1|2:n&1),t):(pn(t),null);case 22:case 23:return Hy(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?zn&1073741824&&(pn(t),t.subtreeFlags&6&&(t.flags|=8192)):pn(t),null;case 24:return null;case 25:return null}throw Error(oe(156,t.tag))}function kA(e,t){switch(Cy(t),t.tag){case 1:return Dn(t.type)&&zd(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ra(),kt(On),kt(yn),Dy(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Oy(t),null;case 13:if(kt(Dt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(oe(340));Ta()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return kt(Dt),null;case 4:return Ra(),null;case 10:return Ty(t.type._context),null;case 22:case 23:return Hy(),null;case 24:return null;default:return null}}var Uu=!1,mn=!1,CA=typeof WeakSet=="function"?WeakSet:Set,Ne=null;function sa(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){zt(e,t,r)}else n.current=null}function rg(e,t,n){try{n()}catch(r){zt(e,t,r)}}var aw=!1;function jA(e,t){if($m=Id,e=v_(),Sy(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(a=o+s),f!==i||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===s&&(a=o),h===i&&++d===r&&(c=o),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=a===-1||c===-1?null:{start:a,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Um={focusedElem:e,selectionRange:n},Id=!1,Ne=t;Ne!==null;)if(t=Ne,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ne=e;else for(;Ne!==null;){t=Ne;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var m=x.memoizedProps,w=x.memoizedState,y=t.stateNode,v=y.getSnapshotBeforeUpdate(t.elementType===t.type?m:vr(t.type,m),w);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(oe(163))}}catch(_){zt(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,Ne=e;break}Ne=t.return}return x=aw,aw=!1,x}function Gl(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&rg(t,n,i)}s=s.next}while(s!==r)}}function Jf(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function sg(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function pS(e){var t=e.alternate;t!==null&&(e.alternate=null,pS(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Wr],delete t[fc],delete t[Wm],delete t[lA],delete t[cA])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function mS(e){return e.tag===5||e.tag===3||e.tag===4}function lw(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||mS(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ig(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Fd));else if(r!==4&&(e=e.child,e!==null))for(ig(e,t,n),e=e.sibling;e!==null;)ig(e,t,n),e=e.sibling}function og(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(og(e,t,n),e=e.sibling;e!==null;)og(e,t,n),e=e.sibling}var rn=null,xr=!1;function Qs(e,t,n){for(n=n.child;n!==null;)gS(e,t,n),n=n.sibling}function gS(e,t,n){if(Xr&&typeof Xr.onCommitFiberUnmount=="function")try{Xr.onCommitFiberUnmount(Hf,n)}catch{}switch(n.tag){case 5:mn||sa(n,t);case 6:var r=rn,s=xr;rn=null,Qs(e,t,n),rn=r,xr=s,rn!==null&&(xr?(e=rn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):rn.removeChild(n.stateNode));break;case 18:rn!==null&&(xr?(e=rn,n=n.stateNode,e.nodeType===8?Pp(e.parentNode,n):e.nodeType===1&&Pp(e,n),ac(e)):Pp(rn,n.stateNode));break;case 4:r=rn,s=xr,rn=n.stateNode.containerInfo,xr=!0,Qs(e,t,n),rn=r,xr=s;break;case 0:case 11:case 14:case 15:if(!mn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&rg(n,t,o),s=s.next}while(s!==r)}Qs(e,t,n);break;case 1:if(!mn&&(sa(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){zt(n,t,a)}Qs(e,t,n);break;case 21:Qs(e,t,n);break;case 22:n.mode&1?(mn=(r=mn)||n.memoizedState!==null,Qs(e,t,n),mn=r):Qs(e,t,n);break;default:Qs(e,t,n)}}function cw(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new CA),t.forEach(function(r){var s=IA.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function yr(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=o),r&=~i}if(r=s,r=Vt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*NA(r/1960))-r,10e?16:e,ci===null)var r=!1;else{if(e=ci,ci=null,Xd=0,ct&6)throw Error(oe(331));var s=ct;for(ct|=4,Ne=e.current;Ne!==null;){var i=Ne,o=i.child;if(Ne.flags&16){var a=i.deletions;if(a!==null){for(var c=0;cVt()-By?Ji(e,0):Vy|=n),In(e,t)}function kS(e,t){t===0&&(e.mode&1?(t=Au,Au<<=1,!(Au&130023424)&&(Au=4194304)):t=1);var n=kn();e=Ds(e,t),e!==null&&(qc(e,t,n),In(e,n))}function DA(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),kS(e,n)}function IA(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(oe(314))}r!==null&&r.delete(t),kS(e,n)}var CS;CS=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||On.current)An=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return An=!1,_A(e,t,n);An=!!(e.flags&131072)}else An=!1,Pt&&t.flags&1048576&&T_(t,Vd,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;pd(e,t),e=t.pendingProps;var s=Na(t,yn.current);ya(t,n),s=My(null,t,r,e,s,n);var i=Ly();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Dn(r)?(i=!0,$d(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Ry(t),s.updater=Qf,t.stateNode=s,s._reactInternals=t,qm(t,r,e,n),t=Jm(null,t,r,!0,i,n)):(t.tag=0,Pt&&i&&ky(t),_n(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(pd(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=LA(r),e=vr(r,e),s){case 0:t=Qm(null,t,r,e,n);break e;case 1:t=sw(null,t,r,e,n);break e;case 11:t=nw(null,t,r,e,n);break e;case 14:t=rw(null,t,r,vr(r.type,e),n);break e}throw Error(oe(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:vr(r,s),Qm(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:vr(r,s),sw(e,t,r,s,n);case 3:e:{if(lS(t),e===null)throw Error(oe(387));r=t.pendingProps,i=t.memoizedState,s=i.element,I_(e,t),Hd(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Aa(Error(oe(423)),t),t=iw(e,t,r,n,s);break e}else if(r!==s){s=Aa(Error(oe(424)),t),t=iw(e,t,r,n,s);break e}else for(Vn=gi(t.stateNode.containerInfo.firstChild),Bn=t,Pt=!0,br=null,n=O_(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ta(),r===s){t=Is(e,t,n);break e}_n(e,t,r,n)}t=t.child}return t;case 5:return M_(t),e===null&&Km(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,Vm(r,s)?o=null:i!==null&&Vm(r,i)&&(t.flags|=32),aS(e,t),_n(e,t,o,n),t.child;case 6:return e===null&&Km(t),null;case 13:return cS(e,t,n);case 4:return Ay(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Pa(t,null,r,n):_n(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:vr(r,s),nw(e,t,r,s,n);case 7:return _n(e,t,t.pendingProps,n),t.child;case 8:return _n(e,t,t.pendingProps.children,n),t.child;case 12:return _n(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,bt(Bd,r._currentValue),r._currentValue=o,i!==null)if(Pr(i.value,o)){if(i.children===s.children&&!On.current){t=Is(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var c=a.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=Es(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Gm(i.return,n,t),a.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(oe(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Gm(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}_n(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,ya(t,n),s=fr(s),r=r(s),t.flags|=1,_n(e,t,r,n),t.child;case 14:return r=t.type,s=vr(r,t.pendingProps),s=vr(r.type,s),rw(e,t,r,s,n);case 15:return iS(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:vr(r,s),pd(e,t),t.tag=1,Dn(r)?(e=!0,$d(t)):e=!1,ya(t,n),nS(t,r,s),qm(t,r,s,n),Jm(null,t,r,!0,e,n);case 19:return uS(e,t,n);case 22:return oS(e,t,n)}throw Error(oe(156,t.tag))};function jS(e,t){return Jb(e,t)}function MA(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ar(e,t,n,r){return new MA(e,t,n,r)}function Ky(e){return e=e.prototype,!(!e||!e.isReactComponent)}function LA(e){if(typeof e=="function")return Ky(e)?1:0;if(e!=null){if(e=e.$$typeof,e===fy)return 11;if(e===hy)return 14}return 2}function wi(e,t){var n=e.alternate;return n===null?(n=ar(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function yd(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")Ky(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Zo:return eo(n.children,s,i,t);case dy:o=8,s|=8;break;case wm:return e=ar(12,n,t,s|2),e.elementType=wm,e.lanes=i,e;case bm:return e=ar(13,n,t,s),e.elementType=bm,e.lanes=i,e;case _m:return e=ar(19,n,t,s),e.elementType=_m,e.lanes=i,e;case Mb:return th(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Db:o=10;break e;case Ib:o=9;break e;case fy:o=11;break e;case hy:o=14;break e;case ri:o=16,r=null;break e}throw Error(oe(130,e==null?e:typeof e,""))}return t=ar(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function eo(e,t,n,r){return e=ar(7,e,r,t),e.lanes=n,e}function th(e,t,n,r){return e=ar(22,e,r,t),e.elementType=Mb,e.lanes=n,e.stateNode={isHidden:!1},e}function Fp(e,t,n){return e=ar(6,e,null,t),e.lanes=n,e}function zp(e,t,n){return t=ar(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function FA(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=xp(0),this.expirationTimes=xp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xp(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Gy(e,t,n,r,s,i,o,a,c){return e=new FA(e,t,n,a,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=ar(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ry(i),e}function zA(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(PS)}catch(e){console.error(e)}}PS(),Pb.exports=Qn;var Vs=Pb.exports;const RS=Bf(Vs),WA=yb({__proto__:null,default:RS},[Vs]);var yw=Vs;vm.createRoot=yw.createRoot,vm.hydrateRoot=yw.hydrateRoot;/** + * @remix-run/router v1.18.0 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Ot(){return Ot=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function co(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function YA(){return Math.random().toString(36).substr(2,8)}function xw(e,t){return{usr:e.state,key:e.key,idx:t}}function xc(e,t,n,r){return n===void 0&&(n=null),Ot({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Bs(t):t,{state:n,key:t&&t.key||r||YA()})}function uo(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Bs(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function KA(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,a=Wt.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(Ot({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){a=Wt.Pop;let w=d(),y=w==null?null:w-u;u=w,c&&c({action:a,location:m.location,delta:y})}function h(w,y){a=Wt.Push;let v=xc(m.location,w,y);n&&n(v,w),u=d()+1;let b=xw(v,u),_=m.createHref(v);try{o.pushState(b,"",_)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;s.location.assign(_)}i&&c&&c({action:a,location:m.location,delta:1})}function p(w,y){a=Wt.Replace;let v=xc(m.location,w,y);n&&n(v,w),u=d();let b=xw(v,u),_=m.createHref(v);o.replaceState(b,"",_),i&&c&&c({action:a,location:m.location,delta:0})}function x(w){let y=s.location.origin!=="null"?s.location.origin:s.location.href,v=typeof w=="string"?w:uo(w);return v=v.replace(/ $/,"%20"),tt(y,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,y)}let m={get action(){return a},get location(){return e(s,o)},listen(w){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(vw,f),c=w,()=>{s.removeEventListener(vw,f),c=null}},createHref(w){return t(s,w)},createURL:x,encodeLocation(w){let y=x(w);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:h,replace:p,go(w){return o.go(w)}};return m}var wt;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(wt||(wt={}));const GA=new Set(["lazy","caseSensitive","path","id","index","children"]);function ZA(e){return e.index===!0}function wc(e,t,n,r){return n===void 0&&(n=[]),r===void 0&&(r={}),e.map((s,i)=>{let o=[...n,String(i)],a=typeof s.id=="string"?s.id:o.join("-");if(tt(s.index!==!0||!s.children,"Cannot specify children on an index route"),tt(!r[a],'Found a route id collision on id "'+a+`". Route id's must be globally unique within Data Router usages`),ZA(s)){let c=Ot({},s,t(s),{id:a});return r[a]=c,c}else{let c=Ot({},s,t(s),{id:a,children:void 0});return r[a]=c,s.children&&(c.children=wc(s.children,t,o,r)),c}})}function Vi(e,t,n){return n===void 0&&(n="/"),vd(e,t,n,!1)}function vd(e,t,n,r){let s=typeof t=="string"?Bs(t):t,i=Za(s.pathname||"/",n);if(i==null)return null;let o=AS(e);XA(o);let a=null;for(let c=0;a==null&&c{let c={relativePath:a===void 0?i.path||"":a,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};c.relativePath.startsWith("/")&&(tt(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=Ns([r,c.relativePath]),d=n.concat(c);i.children&&i.children.length>0&&(tt(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),AS(i.children,t,d,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:sO(u,i.index),routesMeta:d})};return e.forEach((i,o)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))s(i,o);else for(let c of OS(i.path))s(i,o,c)}),t}function OS(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=OS(r.join("/")),a=[];return a.push(...o.map(c=>c===""?i:[i,c].join("/"))),s&&a.push(...o),a.map(c=>e.startsWith("/")&&c===""?"/":c)}function XA(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:iO(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const QA=/^:[\w-]+$/,JA=3,eO=2,tO=1,nO=10,rO=-2,ww=e=>e==="*";function sO(e,t){let n=e.split("/"),r=n.length;return n.some(ww)&&(r+=rO),t&&(r+=eO),n.filter(s=>!ww(s)).reduce((s,i)=>s+(QA.test(i)?JA:i===""?tO:nO),r)}function iO(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function oO(e,t,n){n===void 0&&(n=!1);let{routesMeta:r}=e,s={},i="/",o=[];for(let a=0;a{let{paramName:h,isOptional:p}=d;if(h==="*"){let m=a[f]||"";o=i.slice(0,i.length-m.length).replace(/(.)\/+$/,"$1")}const x=a[f];return p&&!x?u[h]=void 0:u[h]=(x||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function aO(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),co(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,c)=>(r.push({paramName:a,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function lO(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return co(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Za(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function cO(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?Bs(e):e;return{pathname:n?n.startsWith("/")?n:uO(n,t):t,search:fO(r),hash:hO(s)}}function uO(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function $p(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function DS(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function oh(e,t){let n=DS(e);return t?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function ah(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=Bs(e):(s=Ot({},e),tt(!s.pathname||!s.pathname.includes("?"),$p("?","pathname","search",s)),tt(!s.pathname||!s.pathname.includes("#"),$p("#","pathname","hash",s)),tt(!s.search||!s.search.includes("#"),$p("#","search","hash",s)));let i=e===""||s.pathname==="",o=i?"/":s.pathname,a;if(o==null)a=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),f-=1;s.pathname=h.join("/")}a=f>=0?t[f]:"/"}let c=cO(s,a),u=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const Ns=e=>e.join("/").replace(/\/\/+/g,"/"),dO=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),fO=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,hO=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class Qy{constructor(t,n,r,s){s===void 0&&(s=!1),this.status=t,this.statusText=n||"",this.internal=s,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function lh(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const IS=["post","put","patch","delete"],pO=new Set(IS),mO=["get",...IS],gO=new Set(mO),yO=new Set([301,302,303,307,308]),vO=new Set([307,308]),Up={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},xO={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},xl={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Jy=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,wO=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),MS="remix-router-transitions";function bO(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",r=!n;tt(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let s;if(e.mapRouteProperties)s=e.mapRouteProperties;else if(e.detectErrorBoundary){let V=e.detectErrorBoundary;s=H=>({hasErrorBoundary:V(H)})}else s=wO;let i={},o=wc(e.routes,s,void 0,i),a,c=e.basename||"/",u=e.unstable_dataStrategy||jO,d=e.unstable_patchRoutesOnMiss,f=Ot({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),h=null,p=new Set,x=null,m=null,w=null,y=e.hydrationData!=null,v=Vi(o,e.history.location,c),b=null;if(v==null&&!d){let V=wn(404,{pathname:e.history.location.pathname}),{matches:H,route:q}=Rw(o);v=H,b={[q.id]:V}}v&&d&&!e.hydrationData&&hp(v,o,e.history.location.pathname).active&&(v=null);let _;if(!v)_=!1,v=[];else if(v.some(V=>V.route.lazy))_=!1;else if(!v.some(V=>V.route.loader))_=!0;else if(f.v7_partialHydration){let V=e.hydrationData?e.hydrationData.loaderData:null,H=e.hydrationData?e.hydrationData.errors:null,q=ne=>ne.route.loader?typeof ne.route.loader=="function"&&ne.route.loader.hydrate===!0?!1:V&&V[ne.route.id]!==void 0||H&&H[ne.route.id]!==void 0:!0;if(H){let ne=v.findIndex(be=>H[be.route.id]!==void 0);_=v.slice(0,ne+1).every(q)}else _=v.every(q)}else _=e.hydrationData!=null;let C,j={historyAction:e.history.action,location:e.history.location,matches:v,initialized:_,navigation:Up,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||b,fetchers:new Map,blockers:new Map},T=Wt.Pop,R=!1,A,D=!1,G=new Map,N=null,F=!1,S=!1,U=[],J=[],z=new Map,W=0,I=-1,X=new Map,$=new Set,B=new Map,he=new Map,se=new Set,ie=new Map,De=new Map,pe=new Map,we=!1;function Te(){if(h=e.history.listen(V=>{let{action:H,location:q,delta:ne}=V;if(we){we=!1;return}co(De.size===0||ne!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let be=bu({currentLocation:j.location,nextLocation:q,historyAction:H});if(be&&ne!=null){we=!0,e.history.go(ne*-1),Ao(be,{state:"blocked",location:q,proceed(){Ao(be,{state:"proceeding",proceed:void 0,reset:void 0,location:q}),e.history.go(ne)},reset(){let Ae=new Map(j.blockers);Ae.set(be,xl),Re({blockers:Ae})}});return}return Z(H,q)}),n){zO(t,G);let V=()=>$O(t,G);t.addEventListener("pagehide",V),N=()=>t.removeEventListener("pagehide",V)}return j.initialized||Z(Wt.Pop,j.location,{initialHydration:!0}),C}function ze(){h&&h(),N&&N(),p.clear(),A&&A.abort(),j.fetchers.forEach((V,H)=>Yt(H)),j.blockers.forEach((V,H)=>wu(H))}function Ie(V){return p.add(V),()=>p.delete(V)}function Re(V,H){H===void 0&&(H={}),j=Ot({},j,V);let q=[],ne=[];f.v7_fetcherPersist&&j.fetchers.forEach((be,Ae)=>{be.state==="idle"&&(se.has(Ae)?ne.push(Ae):q.push(Ae))}),[...p].forEach(be=>be(j,{deletedFetchers:ne,unstable_viewTransitionOpts:H.viewTransitionOpts,unstable_flushSync:H.flushSync===!0})),f.v7_fetcherPersist&&(q.forEach(be=>j.fetchers.delete(be)),ne.forEach(be=>Yt(be)))}function st(V,H,q){var ne,be;let{flushSync:Ae}=q===void 0?{}:q,Be=j.actionData!=null&&j.navigation.formMethod!=null&&wr(j.navigation.formMethod)&&j.navigation.state==="loading"&&((ne=V.state)==null?void 0:ne._isRedirect)!==!0,fe;H.actionData?Object.keys(H.actionData).length>0?fe=H.actionData:fe=null:Be?fe=j.actionData:fe=null;let qe=H.loaderData?Tw(j.loaderData,H.loaderData,H.matches||[],H.errors):j.loaderData,Fe=j.blockers;Fe.size>0&&(Fe=new Map(Fe),Fe.forEach((mt,xt)=>Fe.set(xt,xl)));let $e=R===!0||j.navigation.formMethod!=null&&wr(j.navigation.formMethod)&&((be=V.state)==null?void 0:be._isRedirect)!==!0;a&&(o=a,a=void 0),F||T===Wt.Pop||(T===Wt.Push?e.history.push(V,V.state):T===Wt.Replace&&e.history.replace(V,V.state));let yt;if(T===Wt.Pop){let mt=G.get(j.location.pathname);mt&&mt.has(V.pathname)?yt={currentLocation:j.location,nextLocation:V}:G.has(V.pathname)&&(yt={currentLocation:V,nextLocation:j.location})}else if(D){let mt=G.get(j.location.pathname);mt?mt.add(V.pathname):(mt=new Set([V.pathname]),G.set(j.location.pathname,mt)),yt={currentLocation:j.location,nextLocation:V}}Re(Ot({},H,{actionData:fe,loaderData:qe,historyAction:T,location:V,initialized:!0,navigation:Up,revalidation:"idle",restoreScrollPosition:a0(V,H.matches||j.matches),preventScrollReset:$e,blockers:Fe}),{viewTransitionOpts:yt,flushSync:Ae===!0}),T=Wt.Pop,R=!1,D=!1,F=!1,S=!1,U=[],J=[]}async function E(V,H){if(typeof V=="number"){e.history.go(V);return}let q=dg(j.location,j.matches,c,f.v7_prependBasename,V,f.v7_relativeSplatPath,H==null?void 0:H.fromRouteId,H==null?void 0:H.relative),{path:ne,submission:be,error:Ae}=_w(f.v7_normalizeFormMethod,!1,q,H),Be=j.location,fe=xc(j.location,ne,H&&H.state);fe=Ot({},fe,e.history.encodeLocation(fe));let qe=H&&H.replace!=null?H.replace:void 0,Fe=Wt.Push;qe===!0?Fe=Wt.Replace:qe===!1||be!=null&&wr(be.formMethod)&&be.formAction===j.location.pathname+j.location.search&&(Fe=Wt.Replace);let $e=H&&"preventScrollReset"in H?H.preventScrollReset===!0:void 0,yt=(H&&H.unstable_flushSync)===!0,mt=bu({currentLocation:Be,nextLocation:fe,historyAction:Fe});if(mt){Ao(mt,{state:"blocked",location:fe,proceed(){Ao(mt,{state:"proceeding",proceed:void 0,reset:void 0,location:fe}),E(V,H)},reset(){let xt=new Map(j.blockers);xt.set(mt,xl),Re({blockers:xt})}});return}return await Z(Fe,fe,{submission:be,pendingError:Ae,preventScrollReset:$e,replace:H&&H.replace,enableViewTransition:H&&H.unstable_viewTransition,flushSync:yt})}function ee(){if(Ye(),Re({revalidation:"loading"}),j.navigation.state!=="submitting"){if(j.navigation.state==="idle"){Z(j.historyAction,j.location,{startUninterruptedRevalidation:!0});return}Z(T||j.historyAction,j.navigation.location,{overrideNavigation:j.navigation})}}async function Z(V,H,q){A&&A.abort(),A=null,T=V,F=(q&&q.startUninterruptedRevalidation)===!0,pP(j.location,j.matches),R=(q&&q.preventScrollReset)===!0,D=(q&&q.enableViewTransition)===!0;let ne=a||o,be=q&&q.overrideNavigation,Ae=Vi(ne,H,c),Be=(q&&q.flushSync)===!0,fe=hp(Ae,ne,H.pathname);if(fe.active&&fe.matches&&(Ae=fe.matches),!Ae){let{error:ht,notFoundMatches:nn,route:Bt}=Oo(H.pathname);st(H,{matches:nn,loaderData:{},errors:{[Bt.id]:ht}},{flushSync:Be});return}if(j.initialized&&!S&&AO(j.location,H)&&!(q&&q.submission&&wr(q.submission.formMethod))){st(H,{matches:Ae},{flushSync:Be});return}A=new AbortController;let qe=Fo(e.history,H,A.signal,q&&q.submission),Fe;if(q&&q.pendingError)Fe=[oa(Ae).route.id,{type:wt.error,error:q.pendingError}];else if(q&&q.submission&&wr(q.submission.formMethod)){let ht=await O(qe,H,q.submission,Ae,fe.active,{replace:q.replace,flushSync:Be});if(ht.shortCircuited)return;if(ht.pendingActionResult){let[nn,Bt]=ht.pendingActionResult;if($n(Bt)&&lh(Bt.error)&&Bt.error.status===404){A=null,st(H,{matches:ht.matches,loaderData:{},errors:{[nn]:Bt.error}});return}}Ae=ht.matches||Ae,Fe=ht.pendingActionResult,be=Vp(H,q.submission),Be=!1,fe.active=!1,qe=Fo(e.history,qe.url,qe.signal)}let{shortCircuited:$e,matches:yt,loaderData:mt,errors:xt}=await k(qe,H,Ae,fe.active,be,q&&q.submission,q&&q.fetcherSubmission,q&&q.replace,q&&q.initialHydration===!0,Be,Fe);$e||(A=null,st(H,Ot({matches:yt||Ae},Pw(Fe),{loaderData:mt,errors:xt})))}async function O(V,H,q,ne,be,Ae){Ae===void 0&&(Ae={}),Ye();let Be=LO(H,q);if(Re({navigation:Be},{flushSync:Ae.flushSync===!0}),be){let Fe=await _u(ne,H.pathname,V.signal);if(Fe.type==="aborted")return{shortCircuited:!0};if(Fe.type==="error"){let{boundaryId:$e,error:yt}=$r(H.pathname,Fe);return{matches:Fe.partialMatches,pendingActionResult:[$e,{type:wt.error,error:yt}]}}else if(Fe.matches)ne=Fe.matches;else{let{notFoundMatches:$e,error:yt,route:mt}=Oo(H.pathname);return{matches:$e,pendingActionResult:[mt.id,{type:wt.error,error:yt}]}}}let fe,qe=Dl(ne,H);if(!qe.route.action&&!qe.route.lazy)fe={type:wt.error,error:wn(405,{method:V.method,pathname:H.pathname,routeId:qe.route.id})};else if(fe=(await te("action",V,[qe],ne))[0],V.signal.aborted)return{shortCircuited:!0};if(Ki(fe)){let Fe;return Ae&&Ae.replace!=null?Fe=Ae.replace:Fe=jw(fe.response.headers.get("Location"),new URL(V.url),c)===j.location.pathname+j.location.search,await Q(V,fe,{submission:q,replace:Fe}),{shortCircuited:!0}}if(Yi(fe))throw wn(400,{type:"defer-action"});if($n(fe)){let Fe=oa(ne,qe.route.id);return(Ae&&Ae.replace)!==!0&&(T=Wt.Push),{matches:ne,pendingActionResult:[Fe.route.id,fe]}}return{matches:ne,pendingActionResult:[qe.route.id,fe]}}async function k(V,H,q,ne,be,Ae,Be,fe,qe,Fe,$e){let yt=be||Vp(H,Ae),mt=Ae||Be||Dw(yt),xt=!F&&(!f.v7_partialHydration||!qe);if(ne){if(xt){let Ft=P($e);Re(Ot({navigation:yt},Ft!==void 0?{actionData:Ft}:{}),{flushSync:Fe})}let Je=await _u(q,H.pathname,V.signal);if(Je.type==="aborted")return{shortCircuited:!0};if(Je.type==="error"){let{boundaryId:Ft,error:Mn}=$r(H.pathname,Je);return{matches:Je.partialMatches,loaderData:{},errors:{[Ft]:Mn}}}else if(Je.matches)q=Je.matches;else{let{error:Ft,notFoundMatches:Mn,route:Nt}=Oo(H.pathname);return{matches:Mn,loaderData:{},errors:{[Nt.id]:Ft}}}}let ht=a||o,[nn,Bt]=Sw(e.history,j,q,mt,H,f.v7_partialHydration&&qe===!0,f.v7_skipActionErrorRevalidation,S,U,J,se,B,$,ht,c,$e);if(qs(Je=>!(q&&q.some(Ft=>Ft.route.id===Je))||nn&&nn.some(Ft=>Ft.route.id===Je)),I=++W,nn.length===0&&Bt.length===0){let Je=hs();return st(H,Ot({matches:q,loaderData:{},errors:$e&&$n($e[1])?{[$e[0]]:$e[1].error}:null},Pw($e),Je?{fetchers:new Map(j.fetchers)}:{}),{flushSync:Fe}),{shortCircuited:!0}}if(xt){let Je={};if(!ne){Je.navigation=yt;let Ft=P($e);Ft!==void 0&&(Je.actionData=Ft)}Bt.length>0&&(Je.fetchers=M(Bt)),Re(Je,{flushSync:Fe})}Bt.forEach(Je=>{z.has(Je.key)&<(Je.key),Je.controller&&z.set(Je.key,Je.controller)});let ul=()=>Bt.forEach(Je=>lt(Je.key));A&&A.signal.addEventListener("abort",ul);let{loaderResults:Xs,fetcherResults:Do}=await me(j.matches,q,nn,Bt,V);if(V.signal.aborted)return{shortCircuited:!0};A&&A.signal.removeEventListener("abort",ul),Bt.forEach(Je=>z.delete(Je.key));let Io=Aw([...Xs,...Do]);if(Io){if(Io.idx>=nn.length){let Je=Bt[Io.idx-nn.length].key;$.add(Je)}return await Q(V,Io.result,{replace:fe}),{shortCircuited:!0}}let{loaderData:Mo,errors:Ur}=Nw(j,q,nn,Xs,$e,Bt,Do,ie);ie.forEach((Je,Ft)=>{Je.subscribe(Mn=>{(Mn||Je.done)&&ie.delete(Ft)})}),f.v7_partialHydration&&qe&&j.errors&&Object.entries(j.errors).filter(Je=>{let[Ft]=Je;return!nn.some(Mn=>Mn.route.id===Ft)}).forEach(Je=>{let[Ft,Mn]=Je;Ur=Object.assign(Ur||{},{[Ft]:Mn})});let Su=hs(),ku=rr(I),Cu=Su||ku||Bt.length>0;return Ot({matches:q,loaderData:Mo,errors:Ur},Cu?{fetchers:new Map(j.fetchers)}:{})}function P(V){if(V&&!$n(V[1]))return{[V[0]]:V[1].data};if(j.actionData)return Object.keys(j.actionData).length===0?null:j.actionData}function M(V){return V.forEach(H=>{let q=j.fetchers.get(H.key),ne=wl(void 0,q?q.data:void 0);j.fetchers.set(H.key,ne)}),new Map(j.fetchers)}function K(V,H,q,ne){if(r)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");z.has(V)&<(V);let be=(ne&&ne.unstable_flushSync)===!0,Ae=a||o,Be=dg(j.location,j.matches,c,f.v7_prependBasename,q,f.v7_relativeSplatPath,H,ne==null?void 0:ne.relative),fe=Vi(Ae,Be,c),qe=hp(fe,Ae,Be);if(qe.active&&qe.matches&&(fe=qe.matches),!fe){Et(V,H,wn(404,{pathname:Be}),{flushSync:be});return}let{path:Fe,submission:$e,error:yt}=_w(f.v7_normalizeFormMethod,!0,Be,ne);if(yt){Et(V,H,yt,{flushSync:be});return}let mt=Dl(fe,Fe);if(R=(ne&&ne.preventScrollReset)===!0,$e&&wr($e.formMethod)){L(V,H,Fe,mt,fe,qe.active,be,$e);return}B.set(V,{routeId:H,path:Fe}),Y(V,H,Fe,mt,fe,qe.active,be,$e)}async function L(V,H,q,ne,be,Ae,Be,fe){Ye(),B.delete(V);function qe(Nt){if(!Nt.route.action&&!Nt.route.lazy){let ps=wn(405,{method:fe.formMethod,pathname:q,routeId:H});return Et(V,H,ps,{flushSync:Be}),!0}return!1}if(!Ae&&qe(ne))return;let Fe=j.fetchers.get(V);Ue(V,FO(fe,Fe),{flushSync:Be});let $e=new AbortController,yt=Fo(e.history,q,$e.signal,fe);if(Ae){let Nt=await _u(be,q,yt.signal);if(Nt.type==="aborted")return;if(Nt.type==="error"){let{error:ps}=$r(q,Nt);Et(V,H,ps,{flushSync:Be});return}else if(Nt.matches){if(be=Nt.matches,ne=Dl(be,q),qe(ne))return}else{Et(V,H,wn(404,{pathname:q}),{flushSync:Be});return}}z.set(V,$e);let mt=W,ht=(await te("action",yt,[ne],be))[0];if(yt.signal.aborted){z.get(V)===$e&&z.delete(V);return}if(f.v7_fetcherPersist&&se.has(V)){if(Ki(ht)||$n(ht)){Ue(V,ti(void 0));return}}else{if(Ki(ht))if(z.delete(V),I>mt){Ue(V,ti(void 0));return}else return $.add(V),Ue(V,wl(fe)),Q(yt,ht,{fetcherSubmission:fe});if($n(ht)){Et(V,H,ht.error);return}}if(Yi(ht))throw wn(400,{type:"defer-action"});let nn=j.navigation.location||j.location,Bt=Fo(e.history,nn,$e.signal),ul=a||o,Xs=j.navigation.state!=="idle"?Vi(ul,j.navigation.location,c):j.matches;tt(Xs,"Didn't find any matches after fetcher action");let Do=++W;X.set(V,Do);let Io=wl(fe,ht.data);j.fetchers.set(V,Io);let[Mo,Ur]=Sw(e.history,j,Xs,fe,nn,!1,f.v7_skipActionErrorRevalidation,S,U,J,se,B,$,ul,c,[ne.route.id,ht]);Ur.filter(Nt=>Nt.key!==V).forEach(Nt=>{let ps=Nt.key,l0=j.fetchers.get(ps),yP=wl(void 0,l0?l0.data:void 0);j.fetchers.set(ps,yP),z.has(ps)&<(ps),Nt.controller&&z.set(ps,Nt.controller)}),Re({fetchers:new Map(j.fetchers)});let Su=()=>Ur.forEach(Nt=>lt(Nt.key));$e.signal.addEventListener("abort",Su);let{loaderResults:ku,fetcherResults:Cu}=await me(j.matches,Xs,Mo,Ur,Bt);if($e.signal.aborted)return;$e.signal.removeEventListener("abort",Su),X.delete(V),z.delete(V),Ur.forEach(Nt=>z.delete(Nt.key));let Je=Aw([...ku,...Cu]);if(Je){if(Je.idx>=Mo.length){let Nt=Ur[Je.idx-Mo.length].key;$.add(Nt)}return Q(Bt,Je.result)}let{loaderData:Ft,errors:Mn}=Nw(j,j.matches,Mo,ku,void 0,Ur,Cu,ie);if(j.fetchers.has(V)){let Nt=ti(ht.data);j.fetchers.set(V,Nt)}rr(Do),j.navigation.state==="loading"&&Do>I?(tt(T,"Expected pending action"),A&&A.abort(),st(j.navigation.location,{matches:Xs,loaderData:Ft,errors:Mn,fetchers:new Map(j.fetchers)})):(Re({errors:Mn,loaderData:Tw(j.loaderData,Ft,Xs,Mn),fetchers:new Map(j.fetchers)}),S=!1)}async function Y(V,H,q,ne,be,Ae,Be,fe){let qe=j.fetchers.get(V);Ue(V,wl(fe,qe?qe.data:void 0),{flushSync:Be});let Fe=new AbortController,$e=Fo(e.history,q,Fe.signal);if(Ae){let ht=await _u(be,q,$e.signal);if(ht.type==="aborted")return;if(ht.type==="error"){let{error:nn}=$r(q,ht);Et(V,H,nn,{flushSync:Be});return}else if(ht.matches)be=ht.matches,ne=Dl(be,q);else{Et(V,H,wn(404,{pathname:q}),{flushSync:Be});return}}z.set(V,Fe);let yt=W,xt=(await te("loader",$e,[ne],be))[0];if(Yi(xt)&&(xt=await US(xt,$e.signal,!0)||xt),z.get(V)===Fe&&z.delete(V),!$e.signal.aborted){if(se.has(V)){Ue(V,ti(void 0));return}if(Ki(xt))if(I>yt){Ue(V,ti(void 0));return}else{$.add(V),await Q($e,xt);return}if($n(xt)){Et(V,H,xt.error);return}tt(!Yi(xt),"Unhandled fetcher deferred data"),Ue(V,ti(xt.data))}}async function Q(V,H,q){let{submission:ne,fetcherSubmission:be,replace:Ae}=q===void 0?{}:q;H.response.headers.has("X-Remix-Revalidate")&&(S=!0);let Be=H.response.headers.get("Location");tt(Be,"Expected a Location header on the redirect Response"),Be=jw(Be,new URL(V.url),c);let fe=xc(j.location,Be,{_isRedirect:!0});if(n){let xt=!1;if(H.response.headers.has("X-Remix-Reload-Document"))xt=!0;else if(Jy.test(Be)){const ht=e.history.createURL(Be);xt=ht.origin!==t.location.origin||Za(ht.pathname,c)==null}if(xt){Ae?t.location.replace(Be):t.location.assign(Be);return}}A=null;let qe=Ae===!0?Wt.Replace:Wt.Push,{formMethod:Fe,formAction:$e,formEncType:yt}=j.navigation;!ne&&!be&&Fe&&$e&&yt&&(ne=Dw(j.navigation));let mt=ne||be;if(vO.has(H.response.status)&&mt&&wr(mt.formMethod))await Z(qe,fe,{submission:Ot({},mt,{formAction:Be}),preventScrollReset:R});else{let xt=Vp(fe,ne);await Z(qe,fe,{overrideNavigation:xt,fetcherSubmission:be,preventScrollReset:R})}}async function te(V,H,q,ne){try{let be=await EO(u,V,H,q,ne,i,s);return await Promise.all(be.map((Ae,Be)=>{if(DO(Ae)){let fe=Ae.result;return{type:wt.redirect,response:PO(fe,H,q[Be].route.id,ne,c,f.v7_relativeSplatPath)}}return TO(Ae)}))}catch(be){return q.map(()=>({type:wt.error,error:be}))}}async function me(V,H,q,ne,be){let[Ae,...Be]=await Promise.all([q.length?te("loader",be,q,H):[],...ne.map(fe=>{if(fe.matches&&fe.match&&fe.controller){let qe=Fo(e.history,fe.path,fe.controller.signal);return te("loader",qe,[fe.match],fe.matches).then(Fe=>Fe[0])}else return Promise.resolve({type:wt.error,error:wn(404,{pathname:fe.path})})})]);return await Promise.all([Ow(V,q,Ae,Ae.map(()=>be.signal),!1,j.loaderData),Ow(V,ne.map(fe=>fe.match),Be,ne.map(fe=>fe.controller?fe.controller.signal:null),!0)]),{loaderResults:Ae,fetcherResults:Be}}function Ye(){S=!0,U.push(...qs()),B.forEach((V,H)=>{z.has(H)&&(J.push(H),lt(H))})}function Ue(V,H,q){q===void 0&&(q={}),j.fetchers.set(V,H),Re({fetchers:new Map(j.fetchers)},{flushSync:(q&&q.flushSync)===!0})}function Et(V,H,q,ne){ne===void 0&&(ne={});let be=oa(j.matches,H);Yt(V),Re({errors:{[be.route.id]:q},fetchers:new Map(j.fetchers)},{flushSync:(ne&&ne.flushSync)===!0})}function nr(V){return f.v7_fetcherPersist&&(he.set(V,(he.get(V)||0)+1),se.has(V)&&se.delete(V)),j.fetchers.get(V)||xO}function Yt(V){let H=j.fetchers.get(V);z.has(V)&&!(H&&H.state==="loading"&&X.has(V))&<(V),B.delete(V),X.delete(V),$.delete(V),se.delete(V),j.fetchers.delete(V)}function ds(V){if(f.v7_fetcherPersist){let H=(he.get(V)||0)-1;H<=0?(he.delete(V),se.add(V)):he.set(V,H)}else Yt(V);Re({fetchers:new Map(j.fetchers)})}function lt(V){let H=z.get(V);tt(H,"Expected fetch controller: "+V),H.abort(),z.delete(V)}function fs(V){for(let H of V){let q=nr(H),ne=ti(q.data);j.fetchers.set(H,ne)}}function hs(){let V=[],H=!1;for(let q of $){let ne=j.fetchers.get(q);tt(ne,"Expected fetcher: "+q),ne.state==="loading"&&($.delete(q),V.push(q),H=!0)}return fs(V),H}function rr(V){let H=[];for(let[q,ne]of X)if(ne0}function xu(V,H){let q=j.blockers.get(V)||xl;return De.get(V)!==H&&De.set(V,H),q}function wu(V){j.blockers.delete(V),De.delete(V)}function Ao(V,H){let q=j.blockers.get(V)||xl;tt(q.state==="unblocked"&&H.state==="blocked"||q.state==="blocked"&&H.state==="blocked"||q.state==="blocked"&&H.state==="proceeding"||q.state==="blocked"&&H.state==="unblocked"||q.state==="proceeding"&&H.state==="unblocked","Invalid blocker state transition: "+q.state+" -> "+H.state);let ne=new Map(j.blockers);ne.set(V,H),Re({blockers:ne})}function bu(V){let{currentLocation:H,nextLocation:q,historyAction:ne}=V;if(De.size===0)return;De.size>1&&co(!1,"A router only supports one blocker at a time");let be=Array.from(De.entries()),[Ae,Be]=be[be.length-1],fe=j.blockers.get(Ae);if(!(fe&&fe.state==="proceeding")&&Be({currentLocation:H,nextLocation:q,historyAction:ne}))return Ae}function Oo(V){let H=wn(404,{pathname:V}),q=a||o,{matches:ne,route:be}=Rw(q);return qs(),{notFoundMatches:ne,route:be,error:H}}function $r(V,H){return{boundaryId:oa(H.partialMatches).route.id,error:wn(400,{type:"route-discovery",pathname:V,message:H.error!=null&&"message"in H.error?H.error:String(H.error)})}}function qs(V){let H=[];return ie.forEach((q,ne)=>{(!V||V(ne))&&(q.cancel(),H.push(ne),ie.delete(ne))}),H}function hP(V,H,q){if(x=V,w=H,m=q||null,!y&&j.navigation===Up){y=!0;let ne=a0(j.location,j.matches);ne!=null&&Re({restoreScrollPosition:ne})}return()=>{x=null,w=null,m=null}}function o0(V,H){return m&&m(V,H.map(ne=>qA(ne,j.loaderData)))||V.key}function pP(V,H){if(x&&w){let q=o0(V,H);x[q]=w()}}function a0(V,H){if(x){let q=o0(V,H),ne=x[q];if(typeof ne=="number")return ne}return null}function hp(V,H,q){if(d)if(V){let ne=V[V.length-1].route;if(ne.path&&(ne.path==="*"||ne.path.endsWith("/*")))return{active:!0,matches:vd(H,q,c,!0)}}else return{active:!0,matches:vd(H,q,c,!0)||[]};return{active:!1,matches:null}}async function _u(V,H,q){let ne=V,be=ne.length>0?ne[ne.length-1].route:null;for(;;){let Ae=a==null,Be=a||o;try{await CO(d,H,ne,Be,i,s,pe,q)}catch($e){return{type:"error",error:$e,partialMatches:ne}}finally{Ae&&(o=[...o])}if(q.aborted)return{type:"aborted"};let fe=Vi(Be,H,c),qe=!1;if(fe){let $e=fe[fe.length-1].route;if($e.index)return{type:"success",matches:fe};if($e.path&&$e.path.length>0)if($e.path==="*")qe=!0;else return{type:"success",matches:fe}}let Fe=vd(Be,H,c,!0);if(!Fe||ne.map($e=>$e.route.id).join("-")===Fe.map($e=>$e.route.id).join("-"))return{type:"success",matches:qe?fe:null};if(ne=Fe,be=ne[ne.length-1].route,be.path==="*")return{type:"success",matches:ne}}}function mP(V){i={},a=wc(V,s,void 0,i)}function gP(V,H){let q=a==null;FS(V,H,a||o,i,s),q&&(o=[...o],Re({}))}return C={get basename(){return c},get future(){return f},get state(){return j},get routes(){return o},get window(){return t},initialize:Te,subscribe:Ie,enableScrollRestoration:hP,navigate:E,fetch:K,revalidate:ee,createHref:V=>e.history.createHref(V),encodeLocation:V=>e.history.encodeLocation(V),getFetcher:nr,deleteFetcher:ds,dispose:ze,getBlocker:xu,deleteBlocker:wu,patchRoutes:gP,_internalFetchControllers:z,_internalActiveDeferreds:ie,_internalSetRoutes:mP},C}function _O(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function dg(e,t,n,r,s,i,o,a){let c,u;if(o){c=[];for(let f of t)if(c.push(f),f.route.id===o){u=f;break}}else c=t,u=t[t.length-1];let d=ah(s||".",oh(c,i),Za(e.pathname,n)||e.pathname,a==="path");return s==null&&(d.search=e.search,d.hash=e.hash),(s==null||s===""||s===".")&&u&&u.route.index&&!ev(d.search)&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),r&&n!=="/"&&(d.pathname=d.pathname==="/"?n:Ns([n,d.pathname])),uo(d)}function _w(e,t,n,r){if(!r||!_O(r))return{path:n};if(r.formMethod&&!MO(r.formMethod))return{path:n,error:wn(405,{method:r.formMethod})};let s=()=>({path:n,error:wn(400,{type:"invalid-body"})}),i=r.formMethod||"get",o=e?i.toUpperCase():i.toLowerCase(),a=zS(n);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!wr(o))return s();let h=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((p,x)=>{let[m,w]=x;return""+p+m+"="+w+` +`},""):String(r.body);return{path:n,submission:{formMethod:o,formAction:a,formEncType:r.formEncType,formData:void 0,json:void 0,text:h}}}else if(r.formEncType==="application/json"){if(!wr(o))return s();try{let h=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:o,formAction:a,formEncType:r.formEncType,formData:void 0,json:h,text:void 0}}}catch{return s()}}}tt(typeof FormData=="function","FormData is not available in this environment");let c,u;if(r.formData)c=fg(r.formData),u=r.formData;else if(r.body instanceof FormData)c=fg(r.body),u=r.body;else if(r.body instanceof URLSearchParams)c=r.body,u=Ew(c);else if(r.body==null)c=new URLSearchParams,u=new FormData;else try{c=new URLSearchParams(r.body),u=Ew(c)}catch{return s()}let d={formMethod:o,formAction:a,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:u,json:void 0,text:void 0};if(wr(d.formMethod))return{path:n,submission:d};let f=Bs(n);return t&&f.search&&ev(f.search)&&c.append("index",""),f.search="?"+c,{path:uo(f),submission:d}}function SO(e,t){let n=e;if(t){let r=e.findIndex(s=>s.route.id===t);r>=0&&(n=e.slice(0,r))}return n}function Sw(e,t,n,r,s,i,o,a,c,u,d,f,h,p,x,m){let w=m?$n(m[1])?m[1].error:m[1].data:void 0,y=e.createURL(t.location),v=e.createURL(s),b=m&&$n(m[1])?m[0]:void 0,_=b?SO(n,b):n,C=m?m[1].statusCode:void 0,j=o&&C&&C>=400,T=_.filter((A,D)=>{let{route:G}=A;if(G.lazy)return!0;if(G.loader==null)return!1;if(i)return typeof G.loader!="function"||G.loader.hydrate?!0:t.loaderData[G.id]===void 0&&(!t.errors||t.errors[G.id]===void 0);if(kO(t.loaderData,t.matches[D],A)||c.some(S=>S===A.route.id))return!0;let N=t.matches[D],F=A;return kw(A,Ot({currentUrl:y,currentParams:N.params,nextUrl:v,nextParams:F.params},r,{actionResult:w,actionStatus:C,defaultShouldRevalidate:j?!1:a||y.pathname+y.search===v.pathname+v.search||y.search!==v.search||LS(N,F)}))}),R=[];return f.forEach((A,D)=>{if(i||!n.some(U=>U.route.id===A.routeId)||d.has(D))return;let G=Vi(p,A.path,x);if(!G){R.push({key:D,routeId:A.routeId,path:A.path,matches:null,match:null,controller:null});return}let N=t.fetchers.get(D),F=Dl(G,A.path),S=!1;h.has(D)?S=!1:u.includes(D)?S=!0:N&&N.state!=="idle"&&N.data===void 0?S=a:S=kw(F,Ot({currentUrl:y,currentParams:t.matches[t.matches.length-1].params,nextUrl:v,nextParams:n[n.length-1].params},r,{actionResult:w,actionStatus:C,defaultShouldRevalidate:j?!1:a})),S&&R.push({key:D,routeId:A.routeId,path:A.path,matches:G,match:F,controller:new AbortController})}),[T,R]}function kO(e,t,n){let r=!t||n.route.id!==t.route.id,s=e[n.route.id]===void 0;return r||s}function LS(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function kw(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}async function CO(e,t,n,r,s,i,o,a){let c=[t,...n.map(u=>u.route.id)].join("-");try{let u=o.get(c);u||(u=e({path:t,matches:n,patch:(d,f)=>{a.aborted||FS(d,f,r,s,i)}}),o.set(c,u)),u&&OO(u)&&await u}finally{o.delete(c)}}function FS(e,t,n,r,s){if(e){var i;let o=r[e];tt(o,"No route found to patch children into: routeId = "+e);let a=wc(t,s,[e,"patch",String(((i=o.children)==null?void 0:i.length)||"0")],r);o.children?o.children.push(...a):o.children=a}else{let o=wc(t,s,["patch",String(n.length||"0")],r);n.push(...o)}}async function Cw(e,t,n){if(!e.lazy)return;let r=await e.lazy();if(!e.lazy)return;let s=n[e.id];tt(s,"No route found in manifest");let i={};for(let o in r){let c=s[o]!==void 0&&o!=="hasErrorBoundary";co(!c,'Route "'+s.id+'" has a static property "'+o+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+o+'" will be ignored.')),!c&&!GA.has(o)&&(i[o]=r[o])}Object.assign(s,i),Object.assign(s,Ot({},t(s),{lazy:void 0}))}function jO(e){return Promise.all(e.matches.map(t=>t.resolve()))}async function EO(e,t,n,r,s,i,o,a){let c=r.reduce((f,h)=>f.add(h.route.id),new Set),u=new Set,d=await e({matches:s.map(f=>{let h=c.has(f.route.id);return Ot({},f,{shouldLoad:h,resolve:x=>(u.add(f.route.id),h?NO(t,n,f,i,o,x,a):Promise.resolve({type:wt.data,result:void 0}))})}),request:n,params:s[0].params,context:a});return s.forEach(f=>tt(u.has(f.route.id),'`match.resolve()` was not called for route id "'+f.route.id+'". You must call `match.resolve()` on every match passed to `dataStrategy` to ensure all routes are properly loaded.')),d.filter((f,h)=>c.has(s[h].route.id))}async function NO(e,t,n,r,s,i,o){let a,c,u=d=>{let f,h=new Promise((m,w)=>f=w);c=()=>f(),t.signal.addEventListener("abort",c);let p=m=>typeof d!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+n.route.id+"]"))):d({request:t,params:n.params,context:o},...m!==void 0?[m]:[]),x;return i?x=i(m=>p(m)):x=(async()=>{try{return{type:"data",result:await p()}}catch(m){return{type:"error",result:m}}})(),Promise.race([x,h])};try{let d=n.route[e];if(n.route.lazy)if(d){let f,[h]=await Promise.all([u(d).catch(p=>{f=p}),Cw(n.route,s,r)]);if(f!==void 0)throw f;a=h}else if(await Cw(n.route,s,r),d=n.route[e],d)a=await u(d);else if(e==="action"){let f=new URL(t.url),h=f.pathname+f.search;throw wn(405,{method:t.method,pathname:h,routeId:n.route.id})}else return{type:wt.data,result:void 0};else if(d)a=await u(d);else{let f=new URL(t.url),h=f.pathname+f.search;throw wn(404,{pathname:h})}tt(a.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+n.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(d){return{type:wt.error,result:d}}finally{c&&t.signal.removeEventListener("abort",c)}return a}async function TO(e){let{result:t,type:n,status:r}=e;if($S(t)){let o;try{let a=t.headers.get("Content-Type");a&&/\bapplication\/json\b/.test(a)?t.body==null?o=null:o=await t.json():o=await t.text()}catch(a){return{type:wt.error,error:a}}return n===wt.error?{type:wt.error,error:new Qy(t.status,t.statusText,o),statusCode:t.status,headers:t.headers}:{type:wt.data,data:o,statusCode:t.status,headers:t.headers}}if(n===wt.error)return{type:wt.error,error:t,statusCode:lh(t)?t.status:r};if(IO(t)){var s,i;return{type:wt.deferred,deferredData:t,statusCode:(s=t.init)==null?void 0:s.status,headers:((i=t.init)==null?void 0:i.headers)&&new Headers(t.init.headers)}}return{type:wt.data,data:t,statusCode:r}}function PO(e,t,n,r,s,i){let o=e.headers.get("Location");if(tt(o,"Redirects returned/thrown from loaders/actions must have a Location header"),!Jy.test(o)){let a=r.slice(0,r.findIndex(c=>c.route.id===n)+1);o=dg(new URL(t.url),a,s,!0,o,i),e.headers.set("Location",o)}return e}function jw(e,t,n){if(Jy.test(e)){let r=e,s=r.startsWith("//")?new URL(t.protocol+r):new URL(r),i=Za(s.pathname,n)!=null;if(s.origin===t.origin&&i)return s.pathname+s.search+s.hash}return e}function Fo(e,t,n,r){let s=e.createURL(zS(t)).toString(),i={signal:n};if(r&&wr(r.formMethod)){let{formMethod:o,formEncType:a}=r;i.method=o.toUpperCase(),a==="application/json"?(i.headers=new Headers({"Content-Type":a}),i.body=JSON.stringify(r.json)):a==="text/plain"?i.body=r.text:a==="application/x-www-form-urlencoded"&&r.formData?i.body=fg(r.formData):i.body=r.formData}return new Request(s,i)}function fg(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function Ew(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function RO(e,t,n,r,s,i){let o={},a=null,c,u=!1,d={},f=r&&$n(r[1])?r[1].error:void 0;return n.forEach((h,p)=>{let x=t[p].route.id;if(tt(!Ki(h),"Cannot handle redirect results in processLoaderData"),$n(h)){let m=h.error;f!==void 0&&(m=f,f=void 0),a=a||{};{let w=oa(e,x);a[w.route.id]==null&&(a[w.route.id]=m)}o[x]=void 0,u||(u=!0,c=lh(h.error)?h.error.status:500),h.headers&&(d[x]=h.headers)}else Yi(h)?(s.set(x,h.deferredData),o[x]=h.deferredData.data,h.statusCode!=null&&h.statusCode!==200&&!u&&(c=h.statusCode),h.headers&&(d[x]=h.headers)):(o[x]=h.data,h.statusCode&&h.statusCode!==200&&!u&&(c=h.statusCode),h.headers&&(d[x]=h.headers))}),f!==void 0&&r&&(a={[r[0]]:f},o[r[0]]=void 0),{loaderData:o,errors:a,statusCode:c||200,loaderHeaders:d}}function Nw(e,t,n,r,s,i,o,a){let{loaderData:c,errors:u}=RO(t,n,r,s,a);for(let d=0;dr.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function Rw(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function wn(e,t){let{pathname:n,routeId:r,method:s,type:i,message:o}=t===void 0?{}:t,a="Unknown Server Error",c="Unknown @remix-run/router error";return e===400?(a="Bad Request",i==="route-discovery"?c='Unable to match URL "'+n+'" - the `unstable_patchRoutesOnMiss()` '+(`function threw the following error: +`+o):s&&n&&r?c="You made a "+s+' request to "'+n+'" but '+('did not provide a `loader` for route "'+r+'", ')+"so there is no way to handle the request.":i==="defer-action"?c="defer() is not supported in actions":i==="invalid-body"&&(c="Unable to encode submission body")):e===403?(a="Forbidden",c='Route "'+r+'" does not match URL "'+n+'"'):e===404?(a="Not Found",c='No route matches URL "'+n+'"'):e===405&&(a="Method Not Allowed",s&&n&&r?c="You made a "+s.toUpperCase()+' request to "'+n+'" but '+('did not provide an `action` for route "'+r+'", ')+"so there is no way to handle the request.":s&&(c='Invalid request method "'+s.toUpperCase()+'"')),new Qy(e||500,a,new Error(c),!0)}function Aw(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(Ki(n))return{result:n,idx:t}}}function zS(e){let t=typeof e=="string"?Bs(e):e;return uo(Ot({},t,{hash:""}))}function AO(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function OO(e){return typeof e=="object"&&e!=null&&"then"in e}function DO(e){return $S(e.result)&&yO.has(e.result.status)}function Yi(e){return e.type===wt.deferred}function $n(e){return e.type===wt.error}function Ki(e){return(e&&e.type)===wt.redirect}function IO(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function $S(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function MO(e){return gO.has(e.toLowerCase())}function wr(e){return pO.has(e.toLowerCase())}async function Ow(e,t,n,r,s,i){for(let o=0;of.route.id===c.route.id),d=u!=null&&!LS(u,c)&&(i&&i[c.route.id])!==void 0;if(Yi(a)&&(s||d)){let f=r[o];tt(f,"Expected an AbortSignal for revalidating fetcher deferred result"),await US(a,f,s).then(h=>{h&&(n[o]=h||n[o])})}}}async function US(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:wt.data,data:e.deferredData.unwrappedData}}catch(s){return{type:wt.error,error:s}}return{type:wt.data,data:e.deferredData.data}}}function ev(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Dl(e,t){let n=typeof t=="string"?Bs(t).search:t.search;if(e[e.length-1].route.index&&ev(n||""))return e[e.length-1];let r=DS(e);return r[r.length-1]}function Dw(e){let{formMethod:t,formAction:n,formEncType:r,text:s,formData:i,json:o}=e;if(!(!t||!n||!r)){if(s!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:s};if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:i,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function Vp(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function LO(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function wl(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function FO(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function ti(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function zO(e,t){try{let n=e.sessionStorage.getItem(MS);if(n){let r=JSON.parse(n);for(let[s,i]of Object.entries(r||{}))i&&Array.isArray(i)&&t.set(s,new Set(i||[]))}}catch{}}function $O(e,t){if(t.size>0){let n={};for(let[r,s]of t)n[r]=[...s];try{e.sessionStorage.setItem(MS,JSON.stringify(n))}catch(r){co(!1,"Failed to save applied view transitions in sessionStorage ("+r+").")}}}/** + * React Router v6.25.1 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function ef(){return ef=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),g.useCallback(function(u,d){if(d===void 0&&(d={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let f=ah(u,JSON.parse(o),i,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Ns([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,o,i,e])}const BO=g.createContext(null);function WO(e){let t=g.useContext(Ws).outlet;return t&&g.createElement(BO.Provider,{value:e},t)}function HS(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=g.useContext(Ii),{matches:s}=g.useContext(Ws),{pathname:i}=Mr(),o=JSON.stringify(oh(s,r.v7_relativeSplatPath));return g.useMemo(()=>ah(e,JSON.parse(o),i,n==="path"),[e,o,i,n])}function HO(e,t,n,r){qa()||tt(!1);let{navigator:s}=g.useContext(Ii),{matches:i}=g.useContext(Ws),o=i[i.length-1],a=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=Mr(),d;d=u;let f=d.pathname||"/",h=f;if(c!=="/"){let m=c.replace(/^\//,"").split("/");h="/"+f.replace(/^\//,"").split("/").slice(m.length).join("/")}let p=Vi(e,{pathname:h});return qO(p&&p.map(m=>Object.assign({},m,{params:Object.assign({},a,m.params),pathname:Ns([c,s.encodeLocation?s.encodeLocation(m.pathname).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?c:Ns([c,s.encodeLocation?s.encodeLocation(m.pathnameBase).pathname:m.pathnameBase])})),i,n,r)}function YO(){let e=eD(),t=lh(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),n?g.createElement("pre",{style:s},n):null,null)}const KO=g.createElement(YO,null);class GO extends g.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?g.createElement(Ws.Provider,{value:this.props.routeContext},g.createElement(BS.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function ZO(e){let{routeContext:t,match:n,children:r}=e,s=g.useContext(ch);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),g.createElement(Ws.Provider,{value:t},r)}function qO(e,t,n,r){var s;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if((i=n)!=null&&i.errors)e=n.matches;else return null}let o=e,a=(s=n)==null?void 0:s.errors;if(a!=null){let d=o.findIndex(f=>f.route.id&&(a==null?void 0:a[f.route.id])!==void 0);d>=0||tt(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,h)=>{let p,x=!1,m=null,w=null;n&&(p=a&&f.route.id?a[f.route.id]:void 0,m=f.route.errorElement||KO,c&&(u<0&&h===0?(nD("route-fallback"),x=!0,w=null):u===h&&(x=!0,w=f.route.hydrateFallbackElement||null)));let y=t.concat(o.slice(0,h+1)),v=()=>{let b;return p?b=m:x?b=w:f.route.Component?b=g.createElement(f.route.Component,null):f.route.element?b=f.route.element:b=d,g.createElement(ZO,{match:f,routeContext:{outlet:d,matches:y,isDataRoute:n!=null},children:b})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?g.createElement(GO,{location:n.location,revalidation:n.revalidation,component:m,error:p,children:v(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):v()},null)}var YS=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(YS||{}),tf=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(tf||{});function XO(e){let t=g.useContext(ch);return t||tt(!1),t}function QO(e){let t=g.useContext(VS);return t||tt(!1),t}function JO(e){let t=g.useContext(Ws);return t||tt(!1),t}function KS(e){let t=JO(),n=t.matches[t.matches.length-1];return n.route.id||tt(!1),n.route.id}function eD(){var e;let t=g.useContext(BS),n=QO(tf.UseRouteError),r=KS(tf.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function tD(){let{router:e}=XO(YS.UseNavigateStable),t=KS(tf.UseNavigateStable),n=g.useRef(!1);return WS(()=>{n.current=!0}),g.useCallback(function(s,i){i===void 0&&(i={}),n.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,ef({fromRouteId:t},i)))},[e,t])}const Iw={};function nD(e,t,n){Iw[e]||(Iw[e]=!0)}function GS(e){let{to:t,replace:n,state:r,relative:s}=e;qa()||tt(!1);let{future:i,static:o}=g.useContext(Ii),{matches:a}=g.useContext(Ws),{pathname:c}=Mr(),u=er(),d=ah(t,oh(a,i.v7_relativeSplatPath),c,s==="path"),f=JSON.stringify(d);return g.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:s}),[u,f,s,n,r]),null}function nv(e){return WO(e.context)}function rD(e){let{basename:t="/",children:n=null,location:r,navigationType:s=Wt.Pop,navigator:i,static:o=!1,future:a}=e;qa()&&tt(!1);let c=t.replace(/^\/*/,"/"),u=g.useMemo(()=>({basename:c,navigator:i,static:o,future:ef({v7_relativeSplatPath:!1},a)}),[c,a,i,o]);typeof r=="string"&&(r=Bs(r));let{pathname:d="/",search:f="",hash:h="",state:p=null,key:x="default"}=r,m=g.useMemo(()=>{let w=Za(d,c);return w==null?null:{location:{pathname:w,search:f,hash:h,state:p,key:x},navigationType:s}},[c,d,f,h,p,x,s]);return m==null?null:g.createElement(Ii.Provider,{value:u},g.createElement(tv.Provider,{children:n,value:m}))}new Promise(()=>{});function sD(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:g.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:g.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:g.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/** + * React Router DOM v6.25.1 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function bc(){return bc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[s]=e[s]);return n}function oD(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function aD(e,t){return e.button===0&&(!t||t==="_self")&&!oD(e)}function hg(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function lD(e,t){let n=hg(e);return t&&t.forEach((r,s)=>{n.has(s)||t.getAll(s).forEach(i=>{n.append(s,i)})}),n}const cD=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],uD="6";try{window.__reactRouterVersion=uD}catch{}function dD(e,t){return bO({basename:void 0,future:bc({},void 0,{v7_prependBasename:!0}),history:HA({window:void 0}),hydrationData:fD(),routes:e,mapRouteProperties:sD,unstable_dataStrategy:void 0,unstable_patchRoutesOnMiss:void 0,window:void 0}).initialize()}function fD(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=bc({},t,{errors:hD(t.errors)})),t}function hD(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,s]of t)if(s&&s.__type==="RouteErrorResponse")n[r]=new Qy(s.status,s.statusText,s.data,s.internal===!0);else if(s&&s.__type==="Error"){if(s.__subType){let i=window[s.__subType];if(typeof i=="function")try{let o=new i(s.message);o.stack="",n[r]=o}catch{}}if(n[r]==null){let i=new Error(s.message);i.stack="",n[r]=i}}else n[r]=s;return n}const pD=g.createContext({isTransitioning:!1}),mD=g.createContext(new Map),gD="startTransition",Mw=Nb[gD],yD="flushSync",Lw=WA[yD];function vD(e){Mw?Mw(e):e()}function bl(e){Lw?Lw(e):e()}class xD{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function wD(e){let{fallbackElement:t,router:n,future:r}=e,[s,i]=g.useState(n.state),[o,a]=g.useState(),[c,u]=g.useState({isTransitioning:!1}),[d,f]=g.useState(),[h,p]=g.useState(),[x,m]=g.useState(),w=g.useRef(new Map),{v7_startTransition:y}=r||{},v=g.useCallback(R=>{y?vD(R):R()},[y]),b=g.useCallback((R,A)=>{let{deletedFetchers:D,unstable_flushSync:G,unstable_viewTransitionOpts:N}=A;D.forEach(S=>w.current.delete(S)),R.fetchers.forEach((S,U)=>{S.data!==void 0&&w.current.set(U,S.data)});let F=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!N||F){G?bl(()=>i(R)):v(()=>i(R));return}if(G){bl(()=>{h&&(d&&d.resolve(),h.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:N.currentLocation,nextLocation:N.nextLocation})});let S=n.window.document.startViewTransition(()=>{bl(()=>i(R))});S.finished.finally(()=>{bl(()=>{f(void 0),p(void 0),a(void 0),u({isTransitioning:!1})})}),bl(()=>p(S));return}h?(d&&d.resolve(),h.skipTransition(),m({state:R,currentLocation:N.currentLocation,nextLocation:N.nextLocation})):(a(R),u({isTransitioning:!0,flushSync:!1,currentLocation:N.currentLocation,nextLocation:N.nextLocation}))},[n.window,h,d,w,v]);g.useLayoutEffect(()=>n.subscribe(b),[n,b]),g.useEffect(()=>{c.isTransitioning&&!c.flushSync&&f(new xD)},[c]),g.useEffect(()=>{if(d&&o&&n.window){let R=o,A=d.promise,D=n.window.document.startViewTransition(async()=>{v(()=>i(R)),await A});D.finished.finally(()=>{f(void 0),p(void 0),a(void 0),u({isTransitioning:!1})}),p(D)}},[v,o,d,n.window]),g.useEffect(()=>{d&&o&&s.location.key===o.location.key&&d.resolve()},[d,h,s.location,o]),g.useEffect(()=>{!c.isTransitioning&&x&&(a(x.state),u({isTransitioning:!0,flushSync:!1,currentLocation:x.currentLocation,nextLocation:x.nextLocation}),m(void 0))},[c.isTransitioning,x]),g.useEffect(()=>{},[]);let _=g.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:R=>n.navigate(R),push:(R,A,D)=>n.navigate(R,{state:A,preventScrollReset:D==null?void 0:D.preventScrollReset}),replace:(R,A,D)=>n.navigate(R,{replace:!0,state:A,preventScrollReset:D==null?void 0:D.preventScrollReset})}),[n]),C=n.basename||"/",j=g.useMemo(()=>({router:n,navigator:_,static:!1,basename:C}),[n,_,C]),T=g.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return g.createElement(g.Fragment,null,g.createElement(ch.Provider,{value:j},g.createElement(VS.Provider,{value:s},g.createElement(mD.Provider,{value:w.current},g.createElement(pD.Provider,{value:c},g.createElement(rD,{basename:C,location:s.location,navigationType:s.historyAction,navigator:_,future:T},s.initialized||n.future.v7_partialHydration?g.createElement(bD,{routes:n.routes,future:n.future,state:s}):t))))),null)}const bD=g.memo(_D);function _D(e){let{routes:t,future:n,state:r}=e;return HO(t,void 0,r,n)}const SD=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",kD=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,bn=g.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:i,replace:o,state:a,target:c,to:u,preventScrollReset:d,unstable_viewTransition:f}=t,h=iD(t,cD),{basename:p}=g.useContext(Ii),x,m=!1;if(typeof u=="string"&&kD.test(u)&&(x=u,SD))try{let b=new URL(window.location.href),_=u.startsWith("//")?new URL(b.protocol+u):new URL(u),C=Za(_.pathname,p);_.origin===b.origin&&C!=null?u=C+_.search+_.hash:m=!0}catch{}let w=UO(u,{relative:s}),y=CD(u,{replace:o,state:a,target:c,preventScrollReset:d,relative:s,unstable_viewTransition:f});function v(b){r&&r(b),b.defaultPrevented||y(b)}return g.createElement("a",bc({},h,{href:x||w,onClick:m||i?r:v,ref:n,target:c}))});var Fw;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Fw||(Fw={}));var zw;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(zw||(zw={}));function CD(e,t){let{target:n,replace:r,state:s,preventScrollReset:i,relative:o,unstable_viewTransition:a}=t===void 0?{}:t,c=er(),u=Mr(),d=HS(e,{relative:o});return g.useCallback(f=>{if(aD(f,n)){f.preventDefault();let h=r!==void 0?r:uo(u)===uo(d);c(e,{replace:h,state:s,preventScrollReset:i,relative:o,unstable_viewTransition:a})}},[u,c,d,r,s,n,e,i,o,a])}function jD(e){let t=g.useRef(hg(e)),n=g.useRef(!1),r=Mr(),s=g.useMemo(()=>lD(r.search,n.current?null:t.current),[r.search]),i=er(),o=g.useCallback((a,c)=>{const u=hg(typeof a=="function"?a(s):a);n.current=!0,i("?"+u,c)},[i,s]);return[s,o]}/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ED=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ZS=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var ND={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TD=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...a},c)=>g.createElement("svg",{ref:c,...ND,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:ZS("lucide",s),...a},[...o.map(([u,d])=>g.createElement(u,d)),...Array.isArray(i)?i:[i]]));/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ut=(e,t)=>{const n=g.forwardRef(({className:r,...s},i)=>g.createElement(TD,{ref:i,iconNode:t,className:ZS(`lucide-${ED(e)}`,r),...s}));return n.displayName=`${e}`,n};/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const PD=ut("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RD=ut("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AD=ut("CalendarX2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m17 22 5-5",key:"1k6ppv"}],["path",{d:"m17 17 5 5",key:"p7ous7"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qS=ut("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rv=ut("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const XS=ut("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OD=ut("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const DD=ut("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ID=ut("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $w=ut("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const QS=ut("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pg=ut("Earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const MD=ut("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Uw=ut("Group",[["path",{d:"M3 7V5c0-1.1.9-2 2-2h2",key:"adw53z"}],["path",{d:"M17 3h2c1.1 0 2 .9 2 2v2",key:"an4l38"}],["path",{d:"M21 17v2c0 1.1-.9 2-2 2h-2",key:"144t0e"}],["path",{d:"M7 21H5c-1.1 0-2-.9-2-2v-2",key:"rtnfgi"}],["rect",{width:"7",height:"5",x:"7",y:"7",rx:"1",key:"1eyiv7"}],["rect",{width:"7",height:"5",x:"10",y:"12",rx:"1",key:"1qlmkx"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Vw=ut("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Bw=ut("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const LD=ut("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const FD=ut("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zD=ut("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $D=ut("LoaderPinwheel",[["path",{d:"M2 12c0-2.8 2.2-5 5-5s5 2.2 5 5 2.2 5 5 5 5-2.2 5-5",key:"1cg5zf"}],["path",{d:"M7 20.7a1 1 0 1 1 5-8.7 1 1 0 1 0 5-8.6",key:"1gnrpi"}],["path",{d:"M7 3.3a1 1 0 1 1 5 8.6 1 1 0 1 0 5 8.6",key:"u9yy5q"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UD=ut("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VD=ut("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const BD=ut("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fo=ut("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ww=ut("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const WD=ut("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const JS=ut("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sv=ut("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const HD=ut("SquareSigma",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M16 8.9V7H8l4 5-4 5h8v-1.9",key:"9nih0i"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const YD=ut("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iv=ut("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const KD=ut("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);/** + * @license lucide-react v0.417.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ov=ut("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);var GD={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0};const ZD=Bf(GD);var qD=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function Hw(e){var t={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(ZD[n[1]]||e.charAt(e.length-2)==="/")&&(t.voidElement=!0),t.name.startsWith("!--"))){var r=e.indexOf("-->");return{type:"comment",comment:r!==-1?e.slice(4,r):""}}for(var s=new RegExp(qD),i=null;(i=s.exec(e))!==null;)if(i[0].trim())if(i[1]){var o=i[1].trim(),a=[o,""];o.indexOf("=")>-1&&(a=o.split("=")),t.attrs[a[0]]=a[1],s.lastIndex--}else i[2]&&(t.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return t}var XD=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,QD=/^\s*$/,JD=Object.create(null);function ek(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(n){var r=[];for(var s in n)r.push(s+'="'+n[s]+'"');return r.length?" "+r.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(ek,"")+"";case"comment":return e+""}}var eI={parse:function(e,t){t||(t={}),t.components||(t.components=JD);var n,r=[],s=[],i=-1,o=!1;if(e.indexOf("<")!==0){var a=e.indexOf("<");r.push({type:"text",content:a===-1?e:e.substring(0,a)})}return e.replace(XD,function(c,u){if(o){if(c!=="")return;o=!1}var d,f=c.charAt(1)!=="/",h=c.startsWith("");return{type:"comment",comment:r!==-1?e.slice(4,r):""}}for(var s=new RegExp(XO),i=null;(i=s.exec(e))!==null;)if(i[0].trim())if(i[1]){var o=i[1].trim(),a=[o,""];o.indexOf("=")>-1&&(a=o.split("=")),t.attrs[a[0]]=a[1],s.lastIndex--}else i[2]&&(t.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return t}var QO=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,JO=/^\s*$/,eD=Object.create(null);function uS(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(n){var r=[];for(var s in n)r.push(s+'="'+n[s]+'"');return r.length?" "+r.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(uS,"")+"";case"comment":return e+""}}var tD={parse:function(e,t){t||(t={}),t.components||(t.components=eD);var n,r=[],s=[],i=-1,o=!1;if(e.indexOf("<")!==0){var a=e.indexOf("<");r.push({type:"text",content:a===-1?e:e.substring(0,a)})}return e.replace(QO,function(c,u){if(o){if(c!=="")return;o=!1}var d,f=c.charAt(1)!=="/",h=c.startsWith("